From dd9d4f9e1ad0bcc5f46fbd81ec00f2127cc18dcc Mon Sep 17 00:00:00 2001 From: "Ronald S. Bultje" Date: Sat, 10 Nov 2012 12:08:27 -0800 Subject: [PATCH] Fix data type for eobs[] array in SB 4x4 IDCT code. This fixes encoder/decoder mismatches with the superblock experiment turned on whenever a superblock is encoded using the 4x4 transform. Change-Id: Iefec7055e8d25f8efdbba66c4261bbd322d335a3 --- vp9/decoder/dequantize.h | 6 ++++-- vp9/decoder/idct_blk.c | 6 ++++-- vp9/encoder/encodeframe.c | 23 ++++++++++------------- 3 files changed, 18 insertions(+), 17 deletions(-) diff --git a/vp9/decoder/dequantize.h b/vp9/decoder/dequantize.h index 026bd2af6..4d7ee427d 100644 --- a/vp9/decoder/dequantize.h +++ b/vp9/decoder/dequantize.h @@ -76,7 +76,8 @@ void vp9_dequant_dc_idct_add_y_block_8x8_inplace_c(short *q, short *dq, void vp9_dequant_dc_idct_add_y_block_4x4_inplace_c(short *q, short *dq, unsigned char *dst, - int stride, char *eobs, + int stride, + unsigned short *eobs, short *dc, MACROBLOCKD *xd); void vp9_dequant_idct_add_uv_block_8x8_inplace_c(short *q, short *dq, @@ -89,7 +90,8 @@ void vp9_dequant_idct_add_uv_block_8x8_inplace_c(short *q, short *dq, void vp9_dequant_idct_add_uv_block_4x4_inplace_c(short *q, short *dq, unsigned char *dstu, unsigned char *dstv, - int stride, char *eobs, + int stride, + unsigned short *eobs, MACROBLOCKD *xd); #endif diff --git a/vp9/decoder/idct_blk.c b/vp9/decoder/idct_blk.c index efe451e6c..cbf96e0da 100644 --- a/vp9/decoder/idct_blk.c +++ b/vp9/decoder/idct_blk.c @@ -39,7 +39,8 @@ void vp9_dequant_dc_idct_add_y_block_c(short *q, short *dq, #if CONFIG_SUPERBLOCKS void vp9_dequant_dc_idct_add_y_block_4x4_inplace_c(short *q, short *dq, unsigned char *dst, - int stride, char *eobs, + int stride, + unsigned short *eobs, short *dc, MACROBLOCKD *xd) { int i, j; @@ -131,7 +132,8 @@ void vp9_dequant_idct_add_uv_block_c(short *q, short *dq, unsigned char *pre, void vp9_dequant_idct_add_uv_block_4x4_inplace_c(short *q, short *dq, unsigned char *dstu, unsigned char *dstv, - int stride, char *eobs, + int stride, + unsigned short *eobs, MACROBLOCKD *xd) { int i, j; diff --git a/vp9/encoder/encodeframe.c b/vp9/encoder/encodeframe.c index 18ab2f0c1..0f5835c47 100644 --- a/vp9/encoder/encodeframe.c +++ b/vp9/encoder/encodeframe.c @@ -2318,6 +2318,13 @@ static void encode_inter_superblock(VP9_COMP *cpi, MACROBLOCK *x, for (n = 0; n < 4; n++) { int x_idx = n & 1, y_idx = n >> 1; + xd->left_context = cm->left_context + y_idx; + xd->above_context = cm->above_context + mb_col + x_idx; + memcpy(&ta[n], xd->above_context, sizeof(ta[n])); + memcpy(&tl[n], xd->left_context, sizeof(tl[n])); + tp[n] = *t; + xd->mode_info_context = mi + x_idx + y_idx * cm->mode_info_stride; + vp9_subtract_mby_s_c(x->src_diff, src + x_idx * 16 + y_idx * 16 * src_y_stride, src_y_stride, @@ -2339,12 +2346,6 @@ static void encode_inter_superblock(VP9_COMP *cpi, MACROBLOCK *x, if (!x->skip) { if (output_enabled) { - xd->left_context = cm->left_context + (n >> 1); - xd->above_context = cm->above_context + mb_col + (n & 1); - memcpy(&ta[n], xd->above_context, sizeof(ta[n])); - memcpy(&tl[n], xd->left_context, sizeof(tl[n])); - tp[n] = *t; - xd->mode_info_context = mi + x_idx + y_idx * cm->mode_info_stride; vp9_tokenize_mb(cpi, &x->e_mbd, t, 0); skip[n] = xd->mode_info_context->mbmi.mb_skip_coeff; } @@ -2354,18 +2355,14 @@ static void encode_inter_superblock(VP9_COMP *cpi, MACROBLOCK *x, (x->e_mbd.mode_info_context - 1)->mbmi.mb_skip_coeff + (x->e_mbd.mode_info_context - cpi->common.mode_info_stride)->mbmi.mb_skip_coeff : 0; + xd->mode_info_context->mbmi.mb_skip_coeff = skip[n] = 1; if (cpi->common.mb_no_coeff_skip) { - skip[n] = xd->mode_info_context->mbmi.mb_skip_coeff = 1; - xd->left_context = cm->left_context + (n >> 1); - xd->above_context = cm->above_context + mb_col + (n & 1); - memcpy(&ta[n], xd->above_context, sizeof(ta[n])); - memcpy(&tl[n], xd->left_context, sizeof(tl[n])); - tp[n] = *t; + // TODO(rbultje) this should be done per-sb instead of per-mb? cpi->skip_true_count[mb_skip_context]++; vp9_fix_contexts(xd); } else { vp9_stuff_mb(cpi, xd, t, 0); - xd->mode_info_context->mbmi.mb_skip_coeff = 0; + // TODO(rbultje) this should be done per-sb instead of per-mb? cpi->skip_false_count[mb_skip_context]++; } }