Make lv-map work with 64x16/16x64 transforms
Some refactoring done to enable reuse of code.
Change-Id: I28cea413a1bf7e6b8ce82ee50c5b5603e8185a2a
diff --git a/av1/common/blockd.h b/av1/common/blockd.h
index 0354183..05673f1 100644
--- a/av1/common/blockd.h
+++ b/av1/common/blockd.h
@@ -1457,6 +1457,21 @@
return tx_size_2d[tx_size];
}
+static INLINE TX_SIZE av1_get_adjusted_tx_size(TX_SIZE tx_size) {
+#if CONFIG_TX64X64
+ if (tx_size == TX_64X64 || tx_size == TX_64X32 || tx_size == TX_32X64) {
+ return TX_32X32;
+ }
+ if (tx_size == TX_16X64) {
+ return TX_16X32;
+ }
+ if (tx_size == TX_64X16) {
+ return TX_32X16;
+ }
+#endif // CONFIG_TX64X64
+ return tx_size;
+}
+
#ifdef __cplusplus
} // extern "C"
#endif
diff --git a/av1/common/quant_common.c b/av1/common/quant_common.c
index f76ce81..0887cb8 100644
--- a/av1/common/quant_common.c
+++ b/av1/common/quant_common.c
@@ -467,7 +467,7 @@
current = 0;
for (t = 0; t < TX_SIZES_ALL; ++t) {
const int size = tx_size_2d[t];
- const int qm_tx_size = get_qm_tx_size(t);
+ const int qm_tx_size = av1_get_adjusted_tx_size(t);
if (q == NUM_QM_LEVELS - 1) {
cm->gqmatrix[q][c][t] = NULL;
cm->giqmatrix[q][c][t] = NULL;
diff --git a/av1/common/quant_common.h b/av1/common/quant_common.h
index e0e1ace..af43833 100644
--- a/av1/common/quant_common.h
+++ b/av1/common/quant_common.h
@@ -56,21 +56,6 @@
TX_SIZE tx_size);
qm_val_t *aom_qmatrix(struct AV1Common *cm, int qindex, int comp,
TX_SIZE tx_size);
-
-static inline TX_SIZE get_qm_tx_size(TX_SIZE tx_size) {
-#if CONFIG_TX64X64
- if (tx_size == TX_64X64 || tx_size == TX_64X32 || tx_size == TX_32X64) {
- return TX_32X32;
- }
- if (tx_size == TX_16X64) {
- return TX_16X32;
- }
- if (tx_size == TX_64X16) {
- return TX_32X16;
- }
-#endif // CONFIG_TX64X64
- return tx_size;
-}
#endif // CONFIG_AOM_QM
#if CONFIG_NEW_QUANT
diff --git a/av1/common/txb_common.h b/av1/common/txb_common.h
index 78094a8..03beed4 100644
--- a/av1/common/txb_common.h
+++ b/av1/common/txb_common.h
@@ -112,26 +112,17 @@
}
static INLINE int get_txb_bwl(TX_SIZE tx_size) {
-#if CONFIG_TX64X64
- if (tx_size == TX_64X64 || tx_size == TX_64X32 || tx_size == TX_32X64)
- tx_size = TX_32X32;
-#endif
+ tx_size = av1_get_adjusted_tx_size(tx_size);
return tx_size_wide_log2[tx_size];
}
static INLINE int get_txb_wide(TX_SIZE tx_size) {
-#if CONFIG_TX64X64
- if (tx_size == TX_64X64 || tx_size == TX_64X32 || tx_size == TX_32X64)
- tx_size = TX_32X32;
-#endif
+ tx_size = av1_get_adjusted_tx_size(tx_size);
return tx_size_wide[tx_size];
}
static INLINE int get_txb_high(TX_SIZE tx_size) {
-#if CONFIG_TX64X64
- if (tx_size == TX_64X64 || tx_size == TX_64X32 || tx_size == TX_32X64)
- tx_size = TX_32X32;
-#endif
+ tx_size = av1_get_adjusted_tx_size(tx_size);
return tx_size_high[tx_size];
}
diff --git a/av1/encoder/encodemb.c b/av1/encoder/encodemb.c
index f8057eb..bdad057 100644
--- a/av1/encoder/encodemb.c
+++ b/av1/encoder/encodemb.c
@@ -161,7 +161,7 @@
#endif
#if CONFIG_AOM_QM
int seg_id = xd->mi[0]->mbmi.segment_id;
- const TX_SIZE qm_tx_size = get_qm_tx_size(tx_size);
+ const TX_SIZE qm_tx_size = av1_get_adjusted_tx_size(tx_size);
// Use a flat matrix (i.e. no weighting) for 1D and Identity transforms
const qm_val_t *iqmatrix =
IS_2D_TRANSFORM(tx_type)
@@ -505,7 +505,7 @@
const int diff_stride = block_size_wide[plane_bsize];
#if CONFIG_AOM_QM
int seg_id = mbmi->segment_id;
- const TX_SIZE qm_tx_size = get_qm_tx_size(tx_size);
+ const TX_SIZE qm_tx_size = av1_get_adjusted_tx_size(tx_size);
// Use a flat matrix (i.e. no weighting) for 1D and Identity transforms
const qm_val_t *qmatrix =
IS_2D_TRANSFORM(tx_type) ? pd->seg_qmatrix[seg_id][qm_tx_size]