From 4afda450fdbb7dea724858a355b4ccd77b517815 Mon Sep 17 00:00:00 2001 From: Linfeng Zhang Date: Tue, 24 Oct 2017 10:34:04 -0700 Subject: [PATCH] Add 'const' to static tables to fix some warnings Change-Id: I8604a1f644302f5e6249b89c96550e1d5715188f warning: assignment from incompatible pointer type --- av1/common/txb_common.h | 10 +++++----- av1/encoder/encodetxb.c | 14 +++++++------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/av1/common/txb_common.h b/av1/common/txb_common.h index 9ec2ab872..5c3132f7b 100644 --- a/av1/common/txb_common.h +++ b/av1/common/txb_common.h @@ -320,15 +320,15 @@ static INLINE int get_br_ctx_coeff(const tran_low_t *const tcoeffs, #define SIG_REF_OFFSET_NUM 7 #if CONFIG_EOB_FIRST -static int sig_ref_offset[SIG_REF_OFFSET_NUM][2] = { +static const int sig_ref_offset[SIG_REF_OFFSET_NUM][2] = { { 2, 1 }, { 2, 0 }, { 1, 2 }, { 1, 1 }, { 1, 0 }, { 0, 2 }, { 0, 1 }, }; -static int sig_ref_offset_vert[SIG_REF_OFFSET_NUM][2] = { +static const int sig_ref_offset_vert[SIG_REF_OFFSET_NUM][2] = { { 2, 1 }, { 2, 0 }, { 3, 0 }, { 1, 1 }, { 1, 0 }, { 4, 0 }, { 0, 1 }, }; -static int sig_ref_offset_horiz[SIG_REF_OFFSET_NUM][2] = { +static const int sig_ref_offset_horiz[SIG_REF_OFFSET_NUM][2] = { { 0, 3 }, { 0, 4 }, { 1, 2 }, { 1, 1 }, { 1, 0 }, { 0, 2 }, { 0, 1 }, }; @@ -358,7 +358,7 @@ static INLINE int get_nz_count(const tran_low_t *tcoeffs, int bwl, int height, return count; } #else -static int sig_ref_offset[SIG_REF_OFFSET_NUM][2] = { +static const int sig_ref_offset[SIG_REF_OFFSET_NUM][2] = { { -2, -1 }, { -2, 0 }, { -1, -2 }, { -1, -1 }, { -1, 0 }, { 0, -2 }, { 0, -1 }, }; @@ -704,7 +704,7 @@ static INLINE int get_empty_line_ctx(int line_idx, int16_t *eob_ls) { } #define MAX_POS_CTX 8 -static int pos_ctx[MAX_HVTX_SIZE] = { +static const int pos_ctx[MAX_HVTX_SIZE] = { 0, 1, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, }; diff --git a/av1/encoder/encodetxb.c b/av1/encoder/encodetxb.c index aad203803..8175fa335 100644 --- a/av1/encoder/encodetxb.c +++ b/av1/encoder/encodetxb.c @@ -1513,11 +1513,11 @@ static INLINE int check_br_neighbor(tran_low_t qc) { #if FAST_OPTIMIZE_TXB #define ALNB_REF_OFFSET_NUM 2 -static int alnb_ref_offset[ALNB_REF_OFFSET_NUM][2] = { +static const int alnb_ref_offset[ALNB_REF_OFFSET_NUM][2] = { { -1, 0 }, { 0, -1 }, }; #define NB_REF_OFFSET_NUM 4 -static int nb_ref_offset[NB_REF_OFFSET_NUM][2] = { +static const int nb_ref_offset[NB_REF_OFFSET_NUM][2] = { { -1, 0 }, { 0, -1 }, { 1, 0 }, { 0, 1 }, }; #endif // FAST_OPTIMIZE_TXB @@ -1553,7 +1553,7 @@ int try_level_down(int coeff_idx, const TxbCache *txb_cache, const int col = coeff_idx - (row << txb_info->bwl); if (check_nz_neighbor(qc)) { #if FAST_OPTIMIZE_TXB - int(*ref_offset)[2]; + const int(*ref_offset)[2]; int ref_num; if (fast_mode) { ref_offset = alnb_ref_offset; @@ -1563,7 +1563,7 @@ int try_level_down(int coeff_idx, const TxbCache *txb_cache, ref_num = SIG_REF_OFFSET_NUM; } #else - int(*ref_offset)[2] = sig_ref_offset; + const int(*ref_offset)[2] = sig_ref_offset; const int ref_num = SIG_REF_OFFSET_NUM; #endif for (int i = 0; i < ref_num; ++i) { @@ -1589,7 +1589,7 @@ int try_level_down(int coeff_idx, const TxbCache *txb_cache, if (check_base_neighbor(qc)) { #if FAST_OPTIMIZE_TXB - int(*ref_offset)[2]; + const int(*ref_offset)[2]; int ref_num; if (fast_mode) { ref_offset = nb_ref_offset; @@ -1625,7 +1625,7 @@ int try_level_down(int coeff_idx, const TxbCache *txb_cache, if (check_br_neighbor(qc)) { #if FAST_OPTIMIZE_TXB - int(*ref_offset)[2]; + const int(*ref_offset)[2]; int ref_num; if (fast_mode) { ref_offset = nb_ref_offset; @@ -1934,7 +1934,7 @@ int get_coeff_cost(tran_low_t qc, int scan_idx, TxbInfo *txb_info, #if TEST_OPTIMIZE_TXB #define ALL_REF_OFFSET_NUM 17 -static int all_ref_offset[ALL_REF_OFFSET_NUM][2] = { +static const int all_ref_offset[ALL_REF_OFFSET_NUM][2] = { { 0, 0 }, { -2, -1 }, { -2, 0 }, { -2, 1 }, { -1, -2 }, { -1, -1 }, { -1, 0 }, { -1, 1 }, { 0, -2 }, { 0, -1 }, { 1, -2 }, { 1, -1 }, { 1, 0 }, { 2, 0 }, { 0, 1 }, { 0, 2 }, { 1, 1 }, -- GitLab