Commit e40a7690 authored by John Koleszar's avatar John Koleszar

Fix incorrect dequant used in detokenize

The quantizer can vary per-plane, and the dequantization vector is
available in the per-plane part of MACROBLOCKD. The previous code would
incorrectly use the Y quantizer for the whole macroblock.

Change-Id: I3ab418aef9168ea0ddcfa4b7c0be32ae48b536d7
parent a99e1aa8
......@@ -352,8 +352,7 @@ static void decode_4x4(VP9D_COMP *pbi, MACROBLOCKD *xd, vp9_reader *r) {
xd->mode_info_context->bmi[i].as_mode.context = b->bmi.as_mode.context =
vp9_find_bpred_context(xd, b);
if (!xd->mode_info_context->mbmi.mb_skip_coeff)
vp9_decode_coefs_4x4(pbi, xd, r, PLANE_TYPE_Y_WITH_DC, i,
xd->plane[0].dequant);
vp9_decode_coefs_4x4(pbi, xd, r, PLANE_TYPE_Y_WITH_DC, i);
#endif
vp9_intra4x4_predict(xd, b, b_mode, *(b->base_dst) + b->dst,
b->dst_stride);
......@@ -362,7 +361,7 @@ static void decode_4x4(VP9D_COMP *pbi, MACROBLOCKD *xd, vp9_reader *r) {
}
#if CONFIG_NEWBINTRAMODES
if (!xd->mode_info_context->mbmi.mb_skip_coeff)
vp9_decode_mb_tokens_4x4_uv(pbi, xd, r, xd->plane[1].dequant);
vp9_decode_mb_tokens_4x4_uv(pbi, xd, r);
#endif
vp9_build_intra_predictors_sbuv_s(xd, BLOCK_SIZE_MB16X16);
xd->itxm_add_uv_block(xd->plane[1].qcoeff, xd->plane[1].dst.buf,
......@@ -595,7 +594,7 @@ static void decode_sb(VP9D_COMP *pbi, MACROBLOCKD *xd, int mb_row, int mb_col,
mb_init_dequantizer(pbi, xd);
// dequantization and idct
eobtotal = vp9_decode_tokens(pbi, xd, r, bsize, xd->plane[0].dequant);
eobtotal = vp9_decode_tokens(pbi, xd, r, bsize);
if (eobtotal == 0) { // skip loopfilter
for (n = 0; n < bw * bh; n++) {
const int x_idx = n & (bw - 1), y_idx = n >> bwl;
......@@ -669,8 +668,7 @@ static void decode_mb(VP9D_COMP *pbi, MACROBLOCKD *xd,
#if CONFIG_NEWBINTRAMODES
if (mode != I4X4_PRED)
#endif
eobtotal = vp9_decode_tokens(pbi, xd, r, BLOCK_SIZE_MB16X16,
xd->plane[0].dequant);
eobtotal = vp9_decode_tokens(pbi, xd, r, BLOCK_SIZE_MB16X16);
}
}
......
......@@ -421,7 +421,6 @@ struct decode_block_args {
MACROBLOCKD *xd;
vp9_reader *r;
int *eobtotal;
const int16_t *dq;
};
static void decode_block(int plane, int block,
BLOCK_SIZE_TYPE bsize,
......@@ -441,7 +440,7 @@ static void decode_block(int plane, int block,
const int eob = decode_coefs(arg->pbi, arg->xd, arg->r, old_block_idx,
arg->xd->plane[plane].plane_type, seg_eob,
BLOCK_OFFSET(qcoeff_base, block, 16),
ss_tx_size, arg->dq);
ss_tx_size, arg->xd->plane[plane].dequant);
arg->xd->plane[plane].eobs[block] = eob;
arg->eobtotal[0] += eob;
......@@ -450,10 +449,9 @@ static void decode_block(int plane, int block,
int vp9_decode_tokens(VP9D_COMP* const pbi,
MACROBLOCKD* const xd,
vp9_reader *r,
BLOCK_SIZE_TYPE bsize,
const int16_t *dq) {
BLOCK_SIZE_TYPE bsize) {
int eobtotal = 0;
struct decode_block_args args = {pbi, xd, r, &eobtotal, dq};
struct decode_block_args args = {pbi, xd, r, &eobtotal};
foreach_transformed_block(xd, bsize, decode_block, &args);
return eobtotal;
}
......@@ -461,12 +459,11 @@ int vp9_decode_tokens(VP9D_COMP* const pbi,
#if CONFIG_NEWBINTRAMODES
static int decode_coefs_4x4(VP9D_COMP *dx, MACROBLOCKD *xd,
vp9_reader *r,
PLANE_TYPE type, int i, int seg_eob,
const int16_t *dq) {
PLANE_TYPE type, int i, int seg_eob) {
const struct plane_block_idx pb_idx = plane_block_idx(16, i);
const int c = decode_coefs(dx, xd, r, i, type, seg_eob,
BLOCK_OFFSET(xd->plane[pb_idx.plane].qcoeff, pb_idx.block, 16), TX_4X4,
dq);
xd->plane[pb_idx.plane].dequant);
xd->plane[pb_idx.plane].eobs[pb_idx.block] = c;
return c;
}
......@@ -474,31 +471,30 @@ static int decode_coefs_4x4(VP9D_COMP *dx, MACROBLOCKD *xd,
static int decode_mb_tokens_4x4_uv(VP9D_COMP* const dx,
MACROBLOCKD* const xd,
vp9_reader *r,
int seg_eob,
const int16_t *dq) {
int seg_eob) {
int i, eobtotal = 0;
// chroma blocks
for (i = 16; i < 24; i++)
eobtotal += decode_coefs_4x4(dx, xd, r, PLANE_TYPE_UV, i, seg_eob, dq);
eobtotal += decode_coefs_4x4(dx, xd, r, PLANE_TYPE_UV, i, seg_eob);
return eobtotal;
}
int vp9_decode_mb_tokens_4x4_uv(VP9D_COMP* const dx,
MACROBLOCKD* const xd,
vp9_reader *r, const int16_t *dq) {
vp9_reader *r) {
const int segment_id = xd->mode_info_context->mbmi.segment_id;
const int seg_eob = get_eob(xd, segment_id, 16);
return decode_mb_tokens_4x4_uv(dx, xd, r, seg_eob, dq);
return decode_mb_tokens_4x4_uv(dx, xd, r, seg_eob);
}
int vp9_decode_coefs_4x4(VP9D_COMP *dx, MACROBLOCKD *xd,
vp9_reader *r,
PLANE_TYPE type, int i, const int16_t *dq) {
PLANE_TYPE type, int i) {
const int segment_id = xd->mode_info_context->mbmi.segment_id;
const int seg_eob = get_eob(xd, segment_id, 16);
return decode_coefs_4x4(dx, xd, r, type, i, seg_eob, dq);
return decode_coefs_4x4(dx, xd, r, type, i, seg_eob);
}
#endif
......@@ -17,15 +17,14 @@
int vp9_decode_tokens(VP9D_COMP* const pbi,
MACROBLOCKD* const xd,
vp9_reader *r,
BLOCK_SIZE_TYPE bsize,
const int16_t *dq);
BLOCK_SIZE_TYPE bsize);
#if CONFIG_NEWBINTRAMODES
int vp9_decode_mb_tokens_4x4_uv(VP9D_COMP* const dx, MACROBLOCKD* const xd,
vp9_reader *r, const int16_t *dq);
vp9_reader *r);
int vp9_decode_coefs_4x4(VP9D_COMP *dx, MACROBLOCKD *xd,
vp9_reader *r,
PLANE_TYPE type, int i, const int16_t *dq);
PLANE_TYPE type, int i);
#endif
#endif // VP9_DECODER_VP9_DETOKENIZE_H_
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