Commit 57605531 authored by Angie Chiang's avatar Angie Chiang
Browse files

Move PVQ flag checking into av1_optimize_b

Change-Id: I00554b925c0a870e766bc116c6d9cb02bd47a101
parent 6a71ad1f
......@@ -144,6 +144,7 @@ static inline int64_t get_token_bit_costs(
int av1_optimize_b(const AV1_COMMON *cm, MACROBLOCK *mb, int plane, int block,
TX_SIZE tx_size, int ctx) {
#if !CONFIG_PVQ
MACROBLOCKD *const xd = &mb->e_mbd;
struct macroblock_plane *const p = &mb->plane[plane];
struct macroblockd_plane *const pd = &xd->plane[plane];
......@@ -485,6 +486,13 @@ int av1_optimize_b(const AV1_COMMON *cm, MACROBLOCK *mb, int plane, int block,
mb->plane[plane].eobs[block] = final_eob;
assert(final_eob <= default_eob);
return final_eob;
#else // !CONFIG_PVQ
(void)cm;
(void)tx_size;
(void)ctx;
struct macroblock_plane *const p = &mb->plane[plane];
return p->eobs[block];
#endif // !CONFIG_PVQ
}
#if !CONFIG_PVQ
......@@ -1097,7 +1105,6 @@ void av1_encode_block_intra(int plane, int block, int blk_row, int blk_col,
const int dst_stride = pd->dst.stride;
uint8_t *dst =
&pd->dst.buf[(blk_row * dst_stride + blk_col) << tx_size_wide_log2[0]];
int ctx = 0;
#if CONFIG_PVQ
int tx_blk_size;
int i, j;
......@@ -1107,11 +1114,9 @@ void av1_encode_block_intra(int plane, int block, int blk_row, int blk_col,
tx_size);
av1_subtract_txb(x, plane, plane_bsize, blk_col, blk_row, tx_size);
#if !CONFIG_PVQ
const ENTROPY_CONTEXT *a = &args->ta[blk_col];
const ENTROPY_CONTEXT *l = &args->tl[blk_row];
ctx = combine_entropy_contexts(*a, *l);
int ctx = combine_entropy_contexts(*a, *l);
if (args->enable_optimize_b) {
av1_xform_quant(cm, x, plane, block, blk_row, blk_col, plane_bsize, tx_size,
ctx, AV1_XFORM_QUANT_FP);
......@@ -1123,13 +1128,7 @@ void av1_encode_block_intra(int plane, int block, int blk_row, int blk_col,
ctx, AV1_XFORM_QUANT_B);
}
av1_inverse_transform_block(xd, dqcoeff, tx_type, tx_size, dst, dst_stride,
*eob);
#else // #if !CONFIG_PVQ
av1_xform_quant(cm, x, plane, block, blk_row, blk_col, plane_bsize, tx_size,
ctx, AV1_XFORM_QUANT_FP);
#if CONFIG_PVQ
// *(args->skip) == mbmi->skip
if (!x->pvq_skip[plane]) *(args->skip) = 0;
......@@ -1154,11 +1153,9 @@ void av1_encode_block_intra(int plane, int block, int blk_row, int blk_col,
#if CONFIG_AOM_HIGHBITDEPTH
}
#endif // CONFIG_AOM_HIGHBITDEPTH
#endif // #if CONFIG_PVQ
av1_inverse_transform_block(xd, dqcoeff, tx_type, tx_size, dst, dst_stride,
*eob);
#endif // #if !CONFIG_PVQ
#if !CONFIG_PVQ
if (*eob) *(args->skip) = 0;
#else
......
......@@ -1625,10 +1625,8 @@ static void block_rd_txfm(int plane, int block, int blk_row, int blk_col,
// full forward transform and quantization
av1_xform_quant(cm, x, plane, block, blk_row, blk_col, plane_bsize, tx_size,
coeff_ctx, AV1_XFORM_QUANT_FP);
#if !CONFIG_PVQ
if (x->plane[plane].eobs[block] && !xd->lossless[mbmi->segment_id])
av1_optimize_b(cm, x, plane, block, tx_size, coeff_ctx);
#endif // !CONFIG_PVQ
dist_block(args->cpi, x, plane, plane_bsize, block, blk_row, blk_col,
tx_size, &this_rd_stats.dist, &this_rd_stats.sse);
}
......@@ -3995,7 +3993,6 @@ void av1_tx_block_rd_b(const AV1_COMP *cpi, MACROBLOCK *x, TX_SIZE tx_size,
av1_xform_quant(cm, x, plane, block, blk_row, blk_col, plane_bsize, tx_size,
coeff_ctx, AV1_XFORM_QUANT_FP);
// TODO(yushin) : If PVQ is enabled, this should not be called.
av1_optimize_b(cm, x, plane, block, tx_size, coeff_ctx);
// TODO(any): Use dist_block to compute distortion
......@@ -5374,15 +5371,10 @@ static int64_t encode_inter_mb_segment_sub8x8(
assert(IMPLIES(tx_size == TX_4X8 || tx_size == TX_8X4,
idx == 0 && idy == 0));
coeff_ctx = combine_entropy_contexts(*(ta + (k & 1)), *(tl + (k >> 1)));
#if !CONFIG_PVQ
av1_xform_quant(cm, x, 0, block, idy + (i >> 1), idx + (i & 0x01),
BLOCK_8X8, tx_size, coeff_ctx, AV1_XFORM_QUANT_FP);
if (xd->lossless[xd->mi[0]->mbmi.segment_id] == 0)
av1_optimize_b(cm, x, 0, block, tx_size, coeff_ctx);
#else
av1_xform_quant(cm, x, 0, block, idy + (i >> 1), idx + (i & 0x01),
BLOCK_8X8, tx_size, coeff_ctx, AV1_XFORM_QUANT_FP);
#endif // !CONFIG_PVQ
dist_block(cpi, x, 0, BLOCK_8X8, block, idy + (i >> 1), idx + (i & 0x1),
tx_size, &dist, &ssz);
thisdistortion += dist;
......
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