Mark AOM_QM matricies const. These large (200 KB) static stables are functionally read-only. Marking them const moves them to the read-only section of shared libraries, reducing memory footprint when multiple application processes are running simultaneously. Change-Id: I6b66ea8f512147f9762728ae01cea02a0fa71300
diff --git a/av1/common/onyxc_int.h b/av1/common/onyxc_int.h index 356d2ad..b02b275 100644 --- a/av1/common/onyxc_int.h +++ b/av1/common/onyxc_int.h
@@ -348,13 +348,13 @@ #if CONFIG_AOM_QM // Global quant matrix tables - qm_val_t *giqmatrix[NUM_QM_LEVELS][3][TX_SIZES_ALL]; - qm_val_t *gqmatrix[NUM_QM_LEVELS][3][TX_SIZES_ALL]; + const qm_val_t *giqmatrix[NUM_QM_LEVELS][3][TX_SIZES_ALL]; + const qm_val_t *gqmatrix[NUM_QM_LEVELS][3][TX_SIZES_ALL]; // Local quant matrix tables for each frame - qm_val_t *y_iqmatrix[MAX_SEGMENTS][TX_SIZES_ALL]; - qm_val_t *u_iqmatrix[MAX_SEGMENTS][TX_SIZES_ALL]; - qm_val_t *v_iqmatrix[MAX_SEGMENTS][TX_SIZES_ALL]; + const qm_val_t *y_iqmatrix[MAX_SEGMENTS][TX_SIZES_ALL]; + const qm_val_t *u_iqmatrix[MAX_SEGMENTS][TX_SIZES_ALL]; + const qm_val_t *v_iqmatrix[MAX_SEGMENTS][TX_SIZES_ALL]; // Encoder int using_qmatrix;
diff --git a/av1/common/quant_common.c b/av1/common/quant_common.c index 3a70753..3d357d6 100644 --- a/av1/common/quant_common.c +++ b/av1/common/quant_common.c
@@ -530,17 +530,18 @@ } #if CONFIG_AOM_QM -qm_val_t *aom_iqmatrix(AV1_COMMON *cm, int qmlevel, int plane, - TX_SIZE tx_size) { +const qm_val_t *aom_iqmatrix(AV1_COMMON *cm, int qmlevel, int plane, + TX_SIZE tx_size) { return &cm->giqmatrix[qmlevel][plane][tx_size][0]; } -qm_val_t *aom_qmatrix(AV1_COMMON *cm, int qmlevel, int plane, TX_SIZE tx_size) { +const qm_val_t *aom_qmatrix(AV1_COMMON *cm, int qmlevel, int plane, + TX_SIZE tx_size) { return &cm->gqmatrix[qmlevel][plane][tx_size][0]; } #define QM_TOTAL_SIZE 3344 -static uint16_t wt_matrix_ref[NUM_QM_LEVELS][2][QM_TOTAL_SIZE]; -static uint16_t iwt_matrix_ref[NUM_QM_LEVELS][2][QM_TOTAL_SIZE]; +static const uint16_t wt_matrix_ref[NUM_QM_LEVELS][2][QM_TOTAL_SIZE]; +static const uint16_t iwt_matrix_ref[NUM_QM_LEVELS][2][QM_TOTAL_SIZE]; void aom_qm_init(AV1_COMMON *cm) { int q, c, t; @@ -579,7 +580,7 @@ frequency domain according to different nominal viewing distances. */ -static uint16_t iwt_matrix_ref[NUM_QM_LEVELS][2][QM_TOTAL_SIZE] = { +static const uint16_t iwt_matrix_ref[NUM_QM_LEVELS][2][QM_TOTAL_SIZE] = { { { /* Luma */ /* Size 4x4 */ @@ -7347,7 +7348,7 @@ }, }; -static uint16_t wt_matrix_ref[NUM_QM_LEVELS][2][QM_TOTAL_SIZE] = { +static const uint16_t wt_matrix_ref[NUM_QM_LEVELS][2][QM_TOTAL_SIZE] = { { { /* Luma */ /* Size 4x4 */
diff --git a/av1/common/quant_common.h b/av1/common/quant_common.h index 398b23f..e09f5df 100644 --- a/av1/common/quant_common.h +++ b/av1/common/quant_common.h
@@ -52,10 +52,10 @@ return first + (qindex * (last + 1 - first)) / QINDEX_RANGE; } void aom_qm_init(struct AV1Common *cm); -qm_val_t *aom_iqmatrix(struct AV1Common *cm, int qindex, int comp, - TX_SIZE tx_size); -qm_val_t *aom_qmatrix(struct AV1Common *cm, int qindex, int comp, - TX_SIZE tx_size); +const qm_val_t *aom_iqmatrix(struct AV1Common *cm, int qindex, int comp, + TX_SIZE tx_size); +const qm_val_t *aom_qmatrix(struct AV1Common *cm, int qindex, int comp, + TX_SIZE tx_size); #endif // CONFIG_AOM_QM #if CONFIG_NEW_QUANT