Commit 2b38deff authored by Angie Chiang's avatar Angie Chiang
Browse files

Use 7 neighbors for nz_map ctx

This will let coding performance drop slightly
lowres 0.093%

Increase encoder speed by 24%

Reduce nz_map's context size by 20%

Change-Id: I871c18a7e0341e066afc334556b9998194b3f8c9
parent cad9fb52
...@@ -61,13 +61,13 @@ extern "C" { ...@@ -61,13 +61,13 @@ extern "C" {
#if CONFIG_LV_MAP #if CONFIG_LV_MAP
#define TXB_SKIP_CONTEXTS 13 #define TXB_SKIP_CONTEXTS 13
#if CONFIG_EXT_TX #if CONFIG_EXT_TX
#define SIG_COEF_CONTEXTS_2D 20 #define SIG_COEF_CONTEXTS_2D 16
#define SIG_COEF_CONTEXTS_1D 20 #define SIG_COEF_CONTEXTS_1D 16
#define SIG_COEF_CONTEXTS \ #define SIG_COEF_CONTEXTS \
(SIG_COEF_CONTEXTS_2D + SIG_COEF_CONTEXTS_1D + SIG_COEF_CONTEXTS_1D) (SIG_COEF_CONTEXTS_2D + SIG_COEF_CONTEXTS_1D + SIG_COEF_CONTEXTS_1D)
#else #else
#define SIG_COEF_CONTEXTS_2D 20 #define SIG_COEF_CONTEXTS_2D 16
#define SIG_COEF_CONTEXTS 20 #define SIG_COEF_CONTEXTS 16
#endif #endif
#define EOB_COEF_CONTEXTS 25 #define EOB_COEF_CONTEXTS 25
#define COEFF_BASE_CONTEXTS 42 #define COEFF_BASE_CONTEXTS 42
......
...@@ -175,133 +175,178 @@ const aom_prob default_nz_map[TX_SIZES][PLANE_TYPES][SIG_COEF_CONTEXTS] = { ...@@ -175,133 +175,178 @@ const aom_prob default_nz_map[TX_SIZES][PLANE_TYPES][SIG_COEF_CONTEXTS] = {
#if CONFIG_EXT_TX #if CONFIG_EXT_TX
#if CONFIG_CHROMA_2X2 #if CONFIG_CHROMA_2X2
{ {
{ 34, 103, 61, 106, 62, 160, 112, 54, 173, 121, {
75, 157, 92, 75, 157, 129, 94, 65, 52, 37, 34, 103, 61, 106, 62, 160, 112, 54,
173, 121, 157, 92, 157, 129, 94, 65,
34, 103, 61, 106, 62, 160, 112, 54, 173, 121, 34, 103, 61, 106, 62, 160, 112, 54,
75, 157, 92, 75, 157, 129, 94, 65, 52, 37, 173, 121, 157, 92, 157, 129, 94, 65,
34, 103, 61, 106, 62, 160, 112, 54, 173, 121, 34, 103, 61, 106, 62, 160, 112, 54,
75, 157, 92, 75, 157, 129, 94, 65, 52, 37 }, 173, 121, 157, 92, 157, 129, 94, 65,
},
{ 52, 124, 84, 136, 107, 197, 161, 82, 183, 151, {
109, 153, 140, 103, 152, 134, 109, 81, 69, 50, 52, 124, 84, 136, 107, 197, 161, 82,
183, 151, 153, 140, 152, 134, 109, 81,
52, 124, 84, 136, 107, 197, 161, 82, 183, 151, 52, 124, 84, 136, 107, 197, 161, 82,
109, 153, 140, 103, 152, 134, 109, 81, 69, 50, 183, 151, 153, 140, 152, 134, 109, 81,
52, 124, 84, 136, 107, 197, 161, 82, 183, 151, 52, 124, 84, 136, 107, 197, 161, 82,
109, 153, 140, 103, 152, 134, 109, 81, 69, 50 }, 183, 151, 153, 140, 152, 134, 109, 81,
},
}, },
#endif #endif
{ {
{ 34, 103, 61, 106, 62, 160, 112, 54, 173, 121, {
75, 157, 92, 75, 157, 129, 94, 65, 52, 37, 34, 103, 61, 106, 62, 160, 112, 54,
173, 121, 157, 92, 157, 129, 94, 65,
34, 103, 61, 106, 62, 160, 112, 54, 173, 121, 34, 103, 61, 106, 62, 160, 112, 54,
75, 157, 92, 75, 157, 129, 94, 65, 52, 37, 173, 121, 157, 92, 157, 129, 94, 65,
34, 103, 61, 106, 62, 160, 112, 54, 173, 121, 34, 103, 61, 106, 62, 160, 112, 54,
75, 157, 92, 75, 157, 129, 94, 65, 52, 37 }, 173, 121, 157, 92, 157, 129, 94, 65,
},
{ 52, 124, 84, 136, 107, 197, 161, 82, 183, 151, {
109, 153, 140, 103, 152, 134, 109, 81, 69, 50, 52, 124, 84, 136, 107, 197, 161, 82,
183, 151, 153, 140, 152, 134, 109, 81,
52, 124, 84, 136, 107, 197, 161, 82, 183, 151, 52, 124, 84, 136, 107, 197, 161, 82,
109, 153, 140, 103, 152, 134, 109, 81, 69, 50, 183, 151, 153, 140, 152, 134, 109, 81,
52, 124, 84, 136, 107, 197, 161, 82, 183, 151, 52, 124, 84, 136, 107, 197, 161, 82,
109, 153, 140, 103, 152, 134, 109, 81, 69, 50 }, 183, 151, 153, 140, 152, 134, 109, 81,
},
}, },
{ {
{ 34, 127, 74, 124, 74, 204, 153, 76, 226, 162, {
92, 207, 126, 91, 227, 192, 149, 108, 85, 55, 34, 127, 74, 124, 74, 204, 153, 76,
226, 162, 207, 126, 227, 192, 149, 108,
34, 127, 74, 124, 74, 204, 153, 76, 226, 162, 34, 127, 74, 124, 74, 204, 153, 76,
92, 207, 126, 91, 227, 192, 149, 108, 85, 55, 226, 162, 207, 126, 227, 192, 149, 108,
34, 127, 74, 124, 74, 204, 153, 76, 226, 162, 34, 127, 74, 124, 74, 204, 153, 76,
92, 207, 126, 91, 227, 192, 149, 108, 85, 55 }, 226, 162, 207, 126, 227, 192, 149, 108,
},
{ 43, 136, 115, 158, 130, 212, 187, 112, 231, 180, {
130, 202, 164, 130, 236, 204, 168, 139, 112, 114, 43, 136, 115, 158, 130, 212, 187, 112,
231, 180, 202, 164, 236, 204, 168, 139,
43, 136, 115, 158, 130, 212, 187, 112, 231, 180, 43, 136, 115, 158, 130, 212, 187, 112,
130, 202, 164, 130, 236, 204, 168, 139, 112, 114, 231, 180, 202, 164, 236, 204, 168, 139,
43, 136, 115, 158, 130, 212, 187, 112, 231, 180, 43, 136, 115, 158, 130, 212, 187, 112,
130, 202, 164, 130, 236, 204, 168, 139, 112, 114 }, 231, 180, 202, 164, 236, 204, 168, 139,
},
}, },
{ {
{ 25, 117, 70, 120, 77, 215, 171, 102, 234, 156, {
105, 235, 155, 109, 247, 220, 176, 127, 92, 72, 25, 117, 70, 120, 77, 215, 171, 102,
234, 156, 235, 155, 247, 220, 176, 127,
25, 117, 70, 120, 77, 215, 171, 102, 234, 156, 25, 117, 70, 120, 77, 215, 171, 102,
105, 235, 155, 109, 247, 220, 176, 127, 92, 72, 234, 156, 235, 155, 247, 220, 176, 127,
25, 117, 70, 120, 77, 215, 171, 102, 234, 156, 25, 117, 70, 120, 77, 215, 171, 102,
105, 235, 155, 109, 247, 220, 176, 127, 92, 72 }, 234, 156, 235, 155, 247, 220, 176, 127,
},
{ 24, 88, 49, 100, 62, 202, 148, 62, 237, 178, {
102, 233, 168, 105, 244, 198, 162, 127, 103, 71, 24, 88, 49, 100, 62, 202, 148, 62,
237, 178, 233, 168, 244, 198, 162, 127,
24, 88, 49, 100, 62, 202, 148, 62, 237, 178, 24, 88, 49, 100, 62, 202, 148, 62,
102, 233, 168, 105, 244, 198, 162, 127, 103, 71, 237, 178, 233, 168, 244, 198, 162, 127,
24, 88, 49, 100, 62, 202, 148, 62, 237, 178, 24, 88, 49, 100, 62, 202, 148, 62,
102, 233, 168, 105, 244, 198, 162, 127, 103, 71 }, 237, 178, 233, 168, 244, 198, 162, 127,
},
}, },
{ {
{ 11, 54, 17, 69, 26, 128, 125, 56, 232, 130, {
60, 237, 121, 66, 250, 168, 134, 114, 93, 53, 11, 54, 17, 69, 26, 128, 125, 56,
232, 130, 237, 121, 250, 168, 134, 114,
11, 54, 17, 69, 26, 128, 125, 56, 232, 130, 11, 54, 17, 69, 26, 128, 125, 56,
60, 237, 121, 66, 250, 168, 134, 114, 93, 53, 232, 130, 237, 121, 250, 168, 134, 114,
11, 54, 17, 69, 26, 128, 125, 56, 232, 130, 11, 54, 17, 69, 26, 128, 125, 56,
60, 237, 121, 66, 250, 168, 134, 114, 93, 53 }, 232, 130, 237, 121, 250, 168, 134, 114,
},
{ 21, 52, 32, 95, 64, 171, 152, 70, 247, 159, {
81, 252, 177, 100, 252, 221, 192, 143, 195, 146, 21, 52, 32, 95, 64, 171, 152, 70,
247, 159, 252, 177, 252, 221, 192, 143,
21, 52, 32, 95, 64, 171, 152, 70, 247, 159, 21, 52, 32, 95, 64, 171, 152, 70,
81, 252, 177, 100, 252, 221, 192, 143, 195, 146, 247, 159, 252, 177, 252, 221, 192, 143,
21, 52, 32, 95, 64, 171, 152, 70, 247, 159, 21, 52, 32, 95, 64, 171, 152, 70,
81, 252, 177, 100, 252, 221, 192, 143, 195, 146 }, 247, 159, 252, 177, 252, 221, 192, 143,
},
}, },
#else // CONFIG_EXT_TX #else // CONFIG_EXT_TX
#if CONFIG_CHROMA_2X2 #if CONFIG_CHROMA_2X2
{ {
{ 34, 103, 61, 106, 62, 160, 112, 54, 173, 121, {
75, 157, 92, 75, 157, 129, 94, 65, 52, 37 }, 34, 103, 61, 106, 62, 160, 112, 54, 173, 121, 157, 92, 157, 129, 94,
{ 52, 124, 84, 136, 107, 197, 161, 82, 183, 151, 65,
109, 153, 140, 103, 152, 134, 109, 81, 69, 50 }, },
{
52, 124, 84, 136, 107, 197, 161, 82, 183, 151, 153, 140, 152, 134,
109, 81,
},
}, },
#endif #endif
{ {
{ 34, 103, 61, 106, 62, 160, 112, 54, 173, 121, {
75, 157, 92, 75, 157, 129, 94, 65, 52, 37 }, 34, 103, 61, 106, 62, 160, 112, 54, 173, 121, 157, 92, 157, 129, 94,
{ 52, 124, 84, 136, 107, 197, 161, 82, 183, 151, 65,
109, 153, 140, 103, 152, 134, 109, 81, 69, 50 }, },
{
52, 124, 84, 136, 107, 197, 161, 82, 183, 151, 153, 140, 152, 134,
109, 81,
},
}, },
{ {
{ 34, 127, 74, 124, 74, 204, 153, 76, 226, 162, {
92, 207, 126, 91, 227, 192, 149, 108, 85, 55 }, 34, 127, 74, 124, 74, 204, 153, 76, 226, 162, 207, 126, 227, 192, 149,
{ 43, 136, 115, 158, 130, 212, 187, 112, 231, 180, 108,
130, 202, 164, 130, 236, 204, 168, 139, 112, 114 }, },
{
43, 136, 115, 158, 130, 212, 187, 112, 231, 180, 202, 164, 236, 204,
168, 139,
},
}, },
{ {
{ 25, 117, 70, 120, 77, 215, 171, 102, 234, 156, {
105, 235, 155, 109, 247, 220, 176, 127, 92, 72 }, 25, 117, 70, 120, 77, 215, 171, 102, 234, 156, 235, 155, 247, 220,
{ 24, 88, 49, 100, 62, 202, 148, 62, 237, 178, 176, 127,
102, 233, 168, 105, 244, 198, 162, 127, 103, 71 }, },
{
24, 88, 49, 100, 62, 202, 148, 62, 237, 178, 233, 168, 244, 198, 162,
127,
},
}, },
{ {
{ 11, 54, 17, 69, 26, 128, 125, 56, 232, 130, {
60, 237, 121, 66, 250, 168, 134, 114, 93, 53 }, 11, 54, 17, 69, 26, 128, 125, 56, 232, 130, 237, 121, 250, 168, 134,
{ 21, 52, 32, 95, 64, 171, 152, 70, 247, 159, 114,
81, 252, 177, 100, 252, 221, 192, 143, 195, 146 }, },
{
21, 52, 32, 95, 64, 171, 152, 70, 247, 159, 252, 177, 252, 221, 192,
143,
},
}, },
#endif // CONFIG_EXT_TX #endif // CONFIG_EXT_TX
}; };
......
...@@ -249,16 +249,15 @@ static INLINE int get_br_ctx(const tran_low_t *tcoeffs, ...@@ -249,16 +249,15 @@ static INLINE int get_br_ctx(const tran_low_t *tcoeffs,
return ctx; return ctx;
} }
#define SIG_REF_OFFSET_NUM 11 #define SIG_REF_OFFSET_NUM 7
static int sig_ref_offset[SIG_REF_OFFSET_NUM][2] = { static int sig_ref_offset[SIG_REF_OFFSET_NUM][2] = {
{ -2, -1 }, { -2, 0 }, { -2, 1 }, { -1, -2 }, { -1, -1 }, { -1, 0 }, { -2, -1 }, { -2, 0 }, { -1, -2 }, { -1, -1 },
{ -1, 1 }, { 0, -2 }, { 0, -1 }, { 1, -2 }, { 1, -1 }, { -1, 0 }, { 0, -2 }, { 0, -1 },
}; };
static INLINE int get_nz_count(const tran_low_t *tcoeffs, int bwl, int height, static INLINE int get_nz_count(const tran_low_t *tcoeffs, int bwl, int height,
int row, int col, const int16_t *iscan) { int row, int col) {
int count = 0; int count = 0;
const int pos = (row << bwl) + col;
for (int idx = 0; idx < SIG_REF_OFFSET_NUM; ++idx) { for (int idx = 0; idx < SIG_REF_OFFSET_NUM; ++idx) {
const int ref_row = row + sig_ref_offset[idx][0]; const int ref_row = row + sig_ref_offset[idx][0];
const int ref_col = col + sig_ref_offset[idx][1]; const int ref_col = col + sig_ref_offset[idx][1];
...@@ -266,7 +265,7 @@ static INLINE int get_nz_count(const tran_low_t *tcoeffs, int bwl, int height, ...@@ -266,7 +265,7 @@ static INLINE int get_nz_count(const tran_low_t *tcoeffs, int bwl, int height,
ref_col >= (1 << bwl)) ref_col >= (1 << bwl))
continue; continue;
const int nb_pos = (ref_row << bwl) + ref_col; const int nb_pos = (ref_row << bwl) + ref_col;
if (iscan[nb_pos] < iscan[pos]) count += (tcoeffs[nb_pos] != 0); count += (tcoeffs[nb_pos] != 0);
} }
return count; return count;
} }
...@@ -288,10 +287,8 @@ static INLINE TX_CLASS get_tx_class(TX_TYPE tx_type) { ...@@ -288,10 +287,8 @@ static INLINE TX_CLASS get_tx_class(TX_TYPE tx_type) {
// TODO(angiebird): optimize this function by generate a table that maps from // TODO(angiebird): optimize this function by generate a table that maps from
// count to ctx // count to ctx
static INLINE int get_nz_map_ctx_from_count(int count, static INLINE int get_nz_map_ctx_from_count(int count,
const tran_low_t *tcoeffs,
int coeff_idx, // raster order int coeff_idx, // raster order
int bwl, const int16_t *iscan, int bwl, TX_TYPE tx_type) {
TX_TYPE tx_type) {
(void)tx_type; (void)tx_type;
const int row = coeff_idx >> bwl; const int row = coeff_idx >> bwl;
const int col = coeff_idx - (row << bwl); const int col = coeff_idx - (row << bwl);
...@@ -311,19 +308,12 @@ static INLINE int get_nz_map_ctx_from_count(int count, ...@@ -311,19 +308,12 @@ static INLINE int get_nz_map_ctx_from_count(int count,
if (row == 0 && col == 0) return offset + 0; if (row == 0 && col == 0) return offset + 0;
if (row == 0 && col == 1) return offset + 1 + (tcoeffs[0] != 0); if (row == 0 && col == 1) return offset + 1 + count;
if (row == 1 && col == 0) return offset + 3 + (tcoeffs[0] != 0); if (row == 1 && col == 0) return offset + 3 + count;
if (row == 1 && col == 1) { if (row == 1 && col == 1) {
int pos; ctx = (count + 1) >> 1;
ctx = (tcoeffs[0] != 0);
if (iscan[1] < iscan[coeff_idx]) ctx += (tcoeffs[1] != 0);
pos = 1 << bwl;
if (iscan[pos] < iscan[coeff_idx]) ctx += (tcoeffs[pos] != 0);
ctx = (ctx + 1) >> 1;
assert(5 + ctx <= 7); assert(5 + ctx <= 7);
...@@ -333,33 +323,32 @@ static INLINE int get_nz_map_ctx_from_count(int count, ...@@ -333,33 +323,32 @@ static INLINE int get_nz_map_ctx_from_count(int count,
if (row == 0) { if (row == 0) {
ctx = (count + 1) >> 1; ctx = (count + 1) >> 1;
assert(ctx < 3); assert(ctx < 2);
return offset + 8 + ctx; return offset + 8 + ctx;
} }
if (col == 0) { if (col == 0) {
ctx = (count + 1) >> 1; ctx = (count + 1) >> 1;
assert(ctx < 3); assert(ctx < 2);
return offset + 11 + ctx; return offset + 10 + ctx;
} }
ctx = count >> 1; ctx = count >> 1;
assert(14 + ctx < 20); assert(12 + ctx < 16);
return offset + 14 + ctx; return offset + 12 + ctx;
} }
static INLINE int get_nz_map_ctx(const tran_low_t *tcoeffs, static INLINE int get_nz_map_ctx(const tran_low_t *tcoeffs,
const int coeff_idx, // raster order const int coeff_idx, // raster order
const int bwl, const int height, const int bwl, const int height,
const int16_t *iscan, TX_TYPE tx_type) { TX_TYPE tx_type) {
const int row = coeff_idx >> bwl; const int row = coeff_idx >> bwl;
const int col = coeff_idx - (row << bwl); const int col = coeff_idx - (row << bwl);
int count = get_nz_count(tcoeffs, bwl, height, row, col, iscan); int count = get_nz_count(tcoeffs, bwl, height, row, col);
return get_nz_map_ctx_from_count(count, tcoeffs, coeff_idx, bwl, iscan, return get_nz_map_ctx_from_count(count, coeff_idx, bwl, tx_type);
tx_type);
} }
static INLINE int get_eob_ctx(const tran_low_t *tcoeffs, static INLINE int get_eob_ctx(const tran_low_t *tcoeffs,
......
...@@ -96,12 +96,10 @@ uint8_t av1_read_coeffs_txb(const AV1_COMMON *const cm, MACROBLOCKD *xd, ...@@ -96,12 +96,10 @@ uint8_t av1_read_coeffs_txb(const AV1_COMMON *const cm, MACROBLOCKD *xd,
av1_get_tx_type(plane_type, xd, blk_row, blk_col, block, tx_size); av1_get_tx_type(plane_type, xd, blk_row, blk_col, block, tx_size);
const SCAN_ORDER *const scan_order = get_scan(cm, tx_size, tx_type, mbmi); const SCAN_ORDER *const scan_order = get_scan(cm, tx_size, tx_type, mbmi);
const int16_t *scan = scan_order->scan; const int16_t *scan = scan_order->scan;
const int16_t *iscan = scan_order->iscan;
for (c = 0; c < seg_eob; ++c) { for (c = 0; c < seg_eob; ++c) {
int is_nz; int is_nz;
int coeff_ctx = int coeff_ctx = get_nz_map_ctx(tcoeffs, scan[c], bwl, height, tx_type);
get_nz_map_ctx(tcoeffs, scan[c], bwl, height, iscan, tx_type);
int eob_ctx = get_eob_ctx(tcoeffs, scan[c], txs_ctx); int eob_ctx = get_eob_ctx(tcoeffs, scan[c], txs_ctx);
if (c < seg_eob - 1) { if (c < seg_eob - 1) {
......
...@@ -107,7 +107,6 @@ void av1_write_coeffs_txb(const AV1_COMMON *const cm, MACROBLOCKD *xd, ...@@ -107,7 +107,6 @@ void av1_write_coeffs_txb(const AV1_COMMON *const cm, MACROBLOCKD *xd,
av1_get_tx_type(plane_type, xd, blk_row, blk_col, block, tx_size); av1_get_tx_type(plane_type, xd, blk_row, blk_col, block, tx_size);
const SCAN_ORDER *const scan_order = get_scan(cm, tx_size, tx_type, mbmi); const SCAN_ORDER *const scan_order = get_scan(cm, tx_size, tx_type, mbmi);
const int16_t *scan = scan_order->scan; const int16_t *scan = scan_order->scan;
const int16_t *iscan = scan_order->iscan;
int c; int c;
int is_nz; int is_nz;
const int bwl = b_width_log2_lookup[txsize_to_bsize[tx_size]] + 2; const int bwl = b_width_log2_lookup[txsize_to_bsize[tx_size]] + 2;
...@@ -137,8 +136,7 @@ void av1_write_coeffs_txb(const AV1_COMMON *const cm, MACROBLOCKD *xd, ...@@ -137,8 +136,7 @@ void av1_write_coeffs_txb(const AV1_COMMON *const cm, MACROBLOCKD *xd,
#endif #endif
for (c = 0; c < eob; ++c) { for (c = 0; c < eob; ++c) {
int coeff_ctx = int coeff_ctx = get_nz_map_ctx(tcoeff, scan[c], bwl, height, tx_type);
get_nz_map_ctx(tcoeff, scan[c], bwl, height, iscan, tx_type);
int eob_ctx = get_eob_ctx(tcoeff, scan[c], txs_ctx); int eob_ctx = get_eob_ctx(tcoeff, scan[c], txs_ctx);
tran_low_t v = tcoeff[scan[c]]; tran_low_t v = tcoeff[scan[c]];
...@@ -376,7 +374,6 @@ int av1_cost_coeffs_txb(const AV1_COMMON *const cm, MACROBLOCK *x, int plane, ...@@ -376,7 +374,6 @@ int av1_cost_coeffs_txb(const AV1_COMMON *const cm, MACROBLOCK *x, int plane,
const SCAN_ORDER *const scan_order = get_scan(cm, tx_size, tx_type, mbmi); const SCAN_ORDER *const scan_order = get_scan(cm, tx_size, tx_type, mbmi);
const int16_t *scan = scan_order->scan; const int16_t *scan = scan_order->scan;
const int16_t *iscan = scan_order->iscan;
LV_MAP_COEFF_COST *coeff_costs = &x->coeff_costs[txs_ctx][plane_type]; LV_MAP_COEFF_COST *coeff_costs = &x->coeff_costs[txs_ctx][plane_type];
...@@ -398,8 +395,7 @@ int av1_cost_coeffs_txb(const AV1_COMMON *const cm, MACROBLOCK *x, int plane, ...@@ -398,8 +395,7 @@ int av1_cost_coeffs_txb(const AV1_COMMON *const cm, MACROBLOCK *x, int plane,
int level = abs(v); int level = abs(v);
if (c < seg_eob) { if (c < seg_eob) {
int coeff_ctx = int coeff_ctx = get_nz_map_ctx(qcoeff, scan[c], bwl, height, tx_type);
get_nz_map_ctx(qcoeff, scan[c], bwl, height, iscan, tx_type);
cost += coeff_costs->nz_map_cost[coeff_ctx][is_nz]; cost += coeff_costs->nz_map_cost[coeff_ctx][is_nz];
} }
...@@ -511,7 +507,6 @@ static INLINE int get_golomb_cost(int abs_qc) { ...@@ -511,7 +507,6 @@ static INLINE int get_golomb_cost(int abs_qc) {
void gen_txb_cache(TxbCache *txb_cache, TxbInfo *txb_info) { void gen_txb_cache(TxbCache *txb_cache, TxbInfo *txb_info) {
// gen_nz_count_arr // gen_nz_count_arr
const int16_t *scan = txb_info->scan_order->scan; const int16_t *scan = txb_info->scan_order->scan;
const int16_t *iscan = txb_info->scan_order->iscan;
const int bwl = txb_info->bwl; const int bwl = txb_info->bwl;
const int height = txb_info->height; const int height = txb_info->height;
tran_low_t *qcoeff = txb_info->qcoeff; tran_low_t *qcoeff = txb_info->qcoeff;
...@@ -522,10 +517,10 @@ void gen_txb_cache(TxbCache *txb_cache, TxbInfo *txb_info) { ...@@ -522,10 +517,10 @@ void gen_txb_cache(TxbCache *txb_cache, TxbInfo *txb_info) {
const int row = coeff_idx >> bwl; const int row = coeff_idx >> bwl;
const int col = coeff_idx - (row << bwl); const int col = coeff_idx - (row << bwl);
txb_cache->nz_count_arr[coeff_idx] = txb_cache->nz_count_arr[coeff_idx] =
get_nz_count(qcoeff, bwl, height, row, col, iscan); get_nz_count(qcoeff, bwl, height, row, col);
const int nz_count = txb_cache->nz_count_arr[coeff_idx]; const int nz_count = txb_cache->nz_count_arr[coeff_idx];
txb_cache->nz_ctx_arr[coeff_idx] = get_nz_map_ctx_from_count( txb_cache->nz_ctx_arr[coeff_idx] =
nz_count, qcoeff, coeff_idx, bwl, iscan, txb_info->tx_type); get_nz_map_ctx_from_count(nz_count, coeff_idx, bwl, txb_info->tx_type);
// gen_base_count_mag_arr // gen_base_count_mag_arr
if (!has_base(qcoeff[coeff_idx], 0)) continue; if (!has_base(qcoeff[coeff_idx], 0)) continue;
...@@ -731,9 +726,8 @@ static int try_neighbor_level_down_nz(int coeff_idx, int nb_coeff_idx, ...@@ -731,9 +726,8 @@ static int try_neighbor_level_down_nz(int coeff_idx, int nb_coeff_idx,
const int count = txb_cache->nz_count_arr[coeff_idx]; const int count = txb_cache->nz_count_arr[coeff_idx];
assert(count > 0); assert(count > 0);
txb_info->qcoeff[nb_coeff_idx] = get_lower_coeff(nb_coeff); txb_info->qcoeff[nb_coeff_idx] = get_lower_coeff(nb_coeff);