Commit e40a7690 authored by John Koleszar's avatar John Koleszar
Browse files

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