Commit d915e4ee authored by Jingning Han's avatar Jingning Han
Browse files

Avoid using multiplication in context fetch

Replace the multiplication with shifts.

Change-Id: I245efaddea2019d789179569e82e81bb7cb97715
parent 8682cd91
...@@ -251,6 +251,7 @@ typedef enum ATTRIBUTE_PACKED { ...@@ -251,6 +251,7 @@ typedef enum ATTRIBUTE_PACKED {
#define MAX_TX_SQUARE (MAX_TX_SIZE * MAX_TX_SIZE) #define MAX_TX_SQUARE (MAX_TX_SIZE * MAX_TX_SIZE)
// Pad 4 extra columns to remove horizontal availability check. // Pad 4 extra columns to remove horizontal availability check.
#define TX_PAD_HOR_LOG2 2
#define TX_PAD_HOR 4 #define TX_PAD_HOR 4
// Pad 6 extra rows (2 on top and 4 on bottom) to remove vertical availability // Pad 6 extra rows (2 on top and 4 on bottom) to remove vertical availability
// check. // check.
......
...@@ -314,7 +314,6 @@ static const int sig_ref_offset_horiz[SIG_REF_OFFSET_NUM][2] = { ...@@ -314,7 +314,6 @@ static const int sig_ref_offset_horiz[SIG_REF_OFFSET_NUM][2] = {
static INLINE int get_nz_count_mag(const uint8_t *const levels, const int bwl, static INLINE int get_nz_count_mag(const uint8_t *const levels, const int bwl,
const int row, const int col, const int row, const int col,
const TX_CLASS tx_class, int *const mag) { const TX_CLASS tx_class, int *const mag) {
const int stride = (1 << bwl) + TX_PAD_HOR;
int count = 0; int count = 0;
*mag = 0; *mag = 0;
for (int idx = 0; idx < SIG_REF_OFFSET_NUM; ++idx) { for (int idx = 0; idx < SIG_REF_OFFSET_NUM; ++idx) {
...@@ -330,7 +329,8 @@ static INLINE int get_nz_count_mag(const uint8_t *const levels, const int bwl, ...@@ -330,7 +329,8 @@ static INLINE int get_nz_count_mag(const uint8_t *const levels, const int bwl,
: sig_ref_offset_horiz[idx][1])); : sig_ref_offset_horiz[idx][1]));
const int ref_row = row + row_offset; const int ref_row = row + row_offset;
const int ref_col = col + col_offset; const int ref_col = col + col_offset;
const int nb_pos = ref_row * stride + ref_col; const int nb_pos =
(ref_row << bwl) + (ref_row << TX_PAD_HOR_LOG2) + ref_col;
const int level = levels[nb_pos]; const int level = levels[nb_pos];
count += (level != 0); count += (level != 0);
#if 1 #if 1
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment