Replace mult by left shift in get_level_count_mag() Change-Id: I58cdf4d1260759f085e12e871d48f59a89a346c4
diff --git a/av1/common/txb_common.h b/av1/common/txb_common.h index 5620a70..cbecacb 100644 --- a/av1/common/txb_common.h +++ b/av1/common/txb_common.h
@@ -75,15 +75,16 @@ } } static INLINE int get_level_count_mag(int *mag, const tran_low_t *tcoeffs, - int stride, int height, int row, int col, + int bwl, int height, int row, int col, int level, int (*nb_offset)[2], int nb_num) { + const int stride = 1 << bwl; int count = 0; *mag = 0; for (int idx = 0; idx < nb_num; ++idx) { const int ref_row = row + nb_offset[idx][0]; const int ref_col = col + nb_offset[idx][1]; - const int pos = ref_row * stride + ref_col; + const int pos = (ref_row << bwl) + ref_col; if (ref_row < 0 || ref_col < 0 || ref_row >= height || ref_col >= stride) continue; tran_low_t abs_coeff = abs(tcoeffs[pos]); @@ -119,14 +120,13 @@ int c, // raster order const int bwl, const int height, const int level) { - const int stride = 1 << bwl; const int row = c >> bwl; const int col = c - (row << bwl); const int level_minus_1 = level - 1; int mag; - int count = get_level_count_mag(&mag, tcoeffs, stride, height, row, col, - level_minus_1, base_ref_offset, - BASE_CONTEXT_POSITION_NUM); + int count = + get_level_count_mag(&mag, tcoeffs, bwl, height, row, col, level_minus_1, + base_ref_offset, BASE_CONTEXT_POSITION_NUM); int ctx_idx = get_base_ctx_from_count_mag(row, col, count, mag, level); return ctx_idx; } @@ -177,14 +177,13 @@ static INLINE int get_br_ctx(const tran_low_t *tcoeffs, const int c, // raster order const int bwl, const int height) { - const int stride = 1 << bwl; const int row = c >> bwl; const int col = c - (row << bwl); const int level_minus_1 = NUM_BASE_LEVELS; int mag; - const int count = get_level_count_mag(&mag, tcoeffs, stride, height, row, col, - level_minus_1, br_ref_offset, - BR_CONTEXT_POSITION_NUM); + const int count = + get_level_count_mag(&mag, tcoeffs, bwl, height, row, col, level_minus_1, + br_ref_offset, BR_CONTEXT_POSITION_NUM); const int ctx = get_br_ctx_from_count_mag(row, col, count, mag); return ctx; }