Commit 695abd72 authored by Debargha Mukherjee's avatar Debargha Mukherjee
Browse files

Make lv-map work with 64x16/16x64 transforms

Some refactoring done to enable reuse of code.

Change-Id: I28cea413a1bf7e6b8ce82ee50c5b5603e8185a2a
parent 4e16ea64
...@@ -1457,6 +1457,21 @@ static INLINE int av1_get_max_eob(TX_SIZE tx_size) { ...@@ -1457,6 +1457,21 @@ static INLINE int av1_get_max_eob(TX_SIZE tx_size) {
return tx_size_2d[tx_size]; 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 #ifdef __cplusplus
} // extern "C" } // extern "C"
#endif #endif
......
...@@ -467,7 +467,7 @@ void aom_qm_init(AV1_COMMON *cm) { ...@@ -467,7 +467,7 @@ void aom_qm_init(AV1_COMMON *cm) {
current = 0; current = 0;
for (t = 0; t < TX_SIZES_ALL; ++t) { for (t = 0; t < TX_SIZES_ALL; ++t) {
const int size = tx_size_2d[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) { if (q == NUM_QM_LEVELS - 1) {
cm->gqmatrix[q][c][t] = NULL; cm->gqmatrix[q][c][t] = NULL;
cm->giqmatrix[q][c][t] = NULL; cm->giqmatrix[q][c][t] = NULL;
......
...@@ -56,21 +56,6 @@ qm_val_t *aom_iqmatrix(struct AV1Common *cm, int qindex, int comp, ...@@ -56,21 +56,6 @@ qm_val_t *aom_iqmatrix(struct AV1Common *cm, int qindex, int comp,
TX_SIZE tx_size); TX_SIZE tx_size);
qm_val_t *aom_qmatrix(struct AV1Common *cm, int qindex, int comp, qm_val_t *aom_qmatrix(struct AV1Common *cm, int qindex, int comp,
TX_SIZE tx_size); 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 #endif // CONFIG_AOM_QM
#if CONFIG_NEW_QUANT #if CONFIG_NEW_QUANT
......
...@@ -112,26 +112,17 @@ static INLINE int av1_get_eob_pos_ctx(const TX_TYPE tx_type, ...@@ -112,26 +112,17 @@ static INLINE int av1_get_eob_pos_ctx(const TX_TYPE tx_type,
} }
static INLINE int get_txb_bwl(TX_SIZE tx_size) { static INLINE int get_txb_bwl(TX_SIZE tx_size) {
#if CONFIG_TX64X64 tx_size = av1_get_adjusted_tx_size(tx_size);
if (tx_size == TX_64X64 || tx_size == TX_64X32 || tx_size == TX_32X64)
tx_size = TX_32X32;
#endif
return tx_size_wide_log2[tx_size]; return tx_size_wide_log2[tx_size];
} }
static INLINE int get_txb_wide(TX_SIZE tx_size) { static INLINE int get_txb_wide(TX_SIZE tx_size) {
#if CONFIG_TX64X64 tx_size = av1_get_adjusted_tx_size(tx_size);
if (tx_size == TX_64X64 || tx_size == TX_64X32 || tx_size == TX_32X64)
tx_size = TX_32X32;
#endif
return tx_size_wide[tx_size]; return tx_size_wide[tx_size];
} }
static INLINE int get_txb_high(TX_SIZE tx_size) { static INLINE int get_txb_high(TX_SIZE tx_size) {
#if CONFIG_TX64X64 tx_size = av1_get_adjusted_tx_size(tx_size);
if (tx_size == TX_64X64 || tx_size == TX_64X32 || tx_size == TX_32X64)
tx_size = TX_32X32;
#endif
return tx_size_high[tx_size]; return tx_size_high[tx_size];
} }
......
...@@ -161,7 +161,7 @@ static int optimize_b_greedy(const AV1_COMMON *cm, MACROBLOCK *mb, int plane, ...@@ -161,7 +161,7 @@ static int optimize_b_greedy(const AV1_COMMON *cm, MACROBLOCK *mb, int plane,
#endif #endif
#if CONFIG_AOM_QM #if CONFIG_AOM_QM
int seg_id = xd->mi[0]->mbmi.segment_id; 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 // Use a flat matrix (i.e. no weighting) for 1D and Identity transforms
const qm_val_t *iqmatrix = const qm_val_t *iqmatrix =
IS_2D_TRANSFORM(tx_type) IS_2D_TRANSFORM(tx_type)
...@@ -505,7 +505,7 @@ void av1_xform_quant(const AV1_COMMON *cm, MACROBLOCK *x, int plane, int block, ...@@ -505,7 +505,7 @@ void av1_xform_quant(const AV1_COMMON *cm, MACROBLOCK *x, int plane, int block,
const int diff_stride = block_size_wide[plane_bsize]; const int diff_stride = block_size_wide[plane_bsize];
#if CONFIG_AOM_QM #if CONFIG_AOM_QM
int seg_id = mbmi->segment_id; 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 // Use a flat matrix (i.e. no weighting) for 1D and Identity transforms
const qm_val_t *qmatrix = const qm_val_t *qmatrix =
IS_2D_TRANSFORM(tx_type) ? pd->seg_qmatrix[seg_id][qm_tx_size] IS_2D_TRANSFORM(tx_type) ? pd->seg_qmatrix[seg_id][qm_tx_size]
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment