AOM_QM: remove spurious dependence on inter/intra.
Inter/intra matrices are the same. Reduce the dimensions
of the various matrices.
Change-Id: Ie5049af9195d9c48b6928143ac04ac0a5058d0d8
diff --git a/av1/common/blockd.h b/av1/common/blockd.h
index 27c668b..1c50596 100644
--- a/av1/common/blockd.h
+++ b/av1/common/blockd.h
@@ -568,8 +568,8 @@
uint8_t width, height;
#if CONFIG_AOM_QM
- qm_val_t *seg_iqmatrix[MAX_SEGMENTS][2][TX_SIZES_ALL];
- qm_val_t *seg_qmatrix[MAX_SEGMENTS][2][TX_SIZES_ALL];
+ qm_val_t *seg_iqmatrix[MAX_SEGMENTS][TX_SIZES_ALL];
+ qm_val_t *seg_qmatrix[MAX_SEGMENTS][TX_SIZES_ALL];
#endif
// encoder
const int16_t *dequant;
diff --git a/av1/common/onyxc_int.h b/av1/common/onyxc_int.h
index 06007c5..15db2ab 100644
--- a/av1/common/onyxc_int.h
+++ b/av1/common/onyxc_int.h
@@ -299,15 +299,15 @@
#if CONFIG_AOM_QM
// Global quant matrix tables
- qm_val_t *giqmatrix[NUM_QM_LEVELS][2][2][TX_SIZES_ALL];
- qm_val_t *gqmatrix[NUM_QM_LEVELS][2][2][TX_SIZES_ALL];
+ qm_val_t *giqmatrix[NUM_QM_LEVELS][2][TX_SIZES_ALL];
+ qm_val_t *gqmatrix[NUM_QM_LEVELS][2][TX_SIZES_ALL];
// Local quant matrix tables for each frame
- qm_val_t *y_iqmatrix[MAX_SEGMENTS][2][TX_SIZES_ALL];
- qm_val_t *uv_iqmatrix[MAX_SEGMENTS][2][TX_SIZES_ALL];
+ qm_val_t *y_iqmatrix[MAX_SEGMENTS][TX_SIZES_ALL];
+ qm_val_t *uv_iqmatrix[MAX_SEGMENTS][TX_SIZES_ALL];
// Encoder
- qm_val_t *y_qmatrix[MAX_SEGMENTS][2][TX_SIZES_ALL];
- qm_val_t *uv_qmatrix[MAX_SEGMENTS][2][TX_SIZES_ALL];
+ qm_val_t *y_qmatrix[MAX_SEGMENTS][TX_SIZES_ALL];
+ qm_val_t *uv_qmatrix[MAX_SEGMENTS][TX_SIZES_ALL];
int using_qmatrix;
int min_qmlevel;
diff --git a/av1/common/quant_common.c b/av1/common/quant_common.c
index 1b0af4c..10dd88a 100644
--- a/av1/common/quant_common.c
+++ b/av1/common/quant_common.c
@@ -343,12 +343,12 @@
#if CONFIG_AOM_QM
qm_val_t *aom_iqmatrix(AV1_COMMON *cm, int qmlevel, int is_chroma,
- TX_SIZE tx_size, int is_intra) {
- return &cm->giqmatrix[qmlevel][!!is_chroma][!!is_intra][tx_size][0];
+ TX_SIZE tx_size) {
+ return &cm->giqmatrix[qmlevel][!!is_chroma][tx_size][0];
}
qm_val_t *aom_qmatrix(AV1_COMMON *cm, int qmlevel, int is_chroma,
- TX_SIZE tx_size, int is_intra) {
- return &cm->gqmatrix[qmlevel][!!is_chroma][!!is_intra][tx_size][0];
+ TX_SIZE tx_size) {
+ return &cm->gqmatrix[qmlevel][!!is_chroma][tx_size][0];
}
#define QM_TOTAL_SIZE 3344
@@ -356,28 +356,22 @@
static uint16_t iwt_matrix_ref[NUM_QM_LEVELS][2][QM_TOTAL_SIZE];
void aom_qm_init(AV1_COMMON *cm) {
- int q, c, f, t;
+ int q, c, t;
int current;
for (q = 0; q < NUM_QM_LEVELS; ++q) {
for (c = 0; c < 2; ++c) {
- for (f = 0; f < 2; ++f) {
- current = 0;
- for (t = 0; t < TX_SIZES_ALL; ++t) {
- const int size = tx_size_2d[t];
- // Don't use QM for sizes > 32x32
- if (q == NUM_QM_LEVELS - 1 || size > 1024) {
- cm->gqmatrix[q][c][f][t] = NULL;
- cm->giqmatrix[q][c][f][t] = NULL;
- } else {
- assert(current + size <= QM_TOTAL_SIZE);
- cm->gqmatrix[q][c][f][t] = &wt_matrix_ref[AOMMIN(
- NUM_QM_LEVELS - 1, f == 0 ? q + DEFAULT_QM_INTER_OFFSET : q)][c]
- [current];
- cm->giqmatrix[q][c][f][t] = &iwt_matrix_ref[AOMMIN(
- NUM_QM_LEVELS - 1, f == 0 ? q + DEFAULT_QM_INTER_OFFSET : q)][c]
- [current];
- current += size;
- }
+ current = 0;
+ for (t = 0; t < TX_SIZES_ALL; ++t) {
+ const int size = tx_size_2d[t];
+ // Don't use QM for sizes > 32x32
+ if (q == NUM_QM_LEVELS - 1 || size > 1024) {
+ cm->gqmatrix[q][c][t] = NULL;
+ cm->giqmatrix[q][c][t] = NULL;
+ } else {
+ assert(current + size <= QM_TOTAL_SIZE);
+ cm->gqmatrix[q][c][t] = &wt_matrix_ref[q][c][current];
+ cm->giqmatrix[q][c][t] = &iwt_matrix_ref[q][c][current];
+ current += size;
}
}
}
diff --git a/av1/common/quant_common.h b/av1/common/quant_common.h
index 3e2e9b3..516e325 100644
--- a/av1/common/quant_common.h
+++ b/av1/common/quant_common.h
@@ -33,7 +33,6 @@
* blocks*/
#define DEFAULT_QM_FIRST 5
#define DEFAULT_QM_LAST 9
-#define DEFAULT_QM_INTER_OFFSET 0
#endif
struct AV1Common;
@@ -52,9 +51,9 @@
}
void aom_qm_init(struct AV1Common *cm);
qm_val_t *aom_iqmatrix(struct AV1Common *cm, int qindex, int comp,
- TX_SIZE tx_size, int is_intra);
+ TX_SIZE tx_size);
qm_val_t *aom_qmatrix(struct AV1Common *cm, int qindex, int comp,
- TX_SIZE tx_size, int is_intra);
+ TX_SIZE tx_size);
#endif
#if CONFIG_NEW_QUANT