Commit 0186a7ea authored by Jingning Han's avatar Jingning Han

Refactor tx_size use case in block encoding stage

Change-Id: Ib23ff963e78558a971aecc7e8b4c6184849ebf7a
parent a2495c26
......@@ -101,7 +101,7 @@ static int optimize_b(MACROBLOCK *mb, int plane, int block, TX_SIZE tx_size,
tran_low_t *const dqcoeff = BLOCK_OFFSET(pd->dqcoeff, block);
const int eob = p->eobs[block];
const PLANE_TYPE type = pd->plane_type;
const int default_eob = 16 << (tx_size << 1);
const int default_eob = 1 << (tx_size_1d_log2[tx_size] * 2);
const int mul = 1 + (tx_size == TX_32X32);
#if CONFIG_AOM_QM
int seg_id = xd->mi[0]->mbmi.segment_id;
......@@ -303,8 +303,8 @@ static int optimize_b(MACROBLOCK *mb, int plane, int block, TX_SIZE tx_size,
UPDATE_RD_COST();
best = rd_cost1 < rd_cost0;
final_eob = -1;
memset(qcoeff, 0, sizeof(*qcoeff) * (16 << (tx_size * 2)));
memset(dqcoeff, 0, sizeof(*dqcoeff) * (16 << (tx_size * 2)));
memset(qcoeff, 0, sizeof(*qcoeff) * default_eob);
memset(dqcoeff, 0, sizeof(*dqcoeff) * default_eob);
for (i = next; i < eob; i = next) {
const int x = tokens[i][best].qc;
const int rc = scan[i];
......@@ -747,7 +747,8 @@ static void encode_block(int plane, int block, int blk_row, int blk_col,
}
} else {
if (max_txsize_lookup[plane_bsize] == tx_size) {
int txfm_blk_index = (plane << 2) + (block >> (tx_size << 1));
int txfm_blk_index =
(plane << 2) + (block >> (tx_size_1d_in_unit_log2[tx_size] << 1));
if (x->skip_txfm[txfm_blk_index] == SKIP_TXFM_NONE) {
// full forward transform and quantization
av1_xform_quant(x, plane, block, blk_row, blk_col, plane_bsize,
......
......@@ -353,7 +353,7 @@ static INLINE void add_token_no_extra(TOKENEXTRA **t,
static INLINE int get_tx_eob(const struct segmentation *seg, int segment_id,
TX_SIZE tx_size) {
const int eob_max = 16 << (tx_size << 1);
const int eob_max = 1 << (tx_size_1d_log2[tx_size] * 2);
return segfeature_active(seg, segment_id, SEG_LVL_SKIP) ? 0 : eob_max;
}
......
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