From 2b9ec585d6469b4a8031f3326039bfdc2894ccff Mon Sep 17 00:00:00 2001 From: Yaowu Xu Date: Thu, 13 Dec 2012 14:58:30 -0800 Subject: [PATCH] fixed an encoder/decoder mismatch The mismatch was caused by an improper merge of cleanup code around tokenize_b() and stuff_b() with TX32X32 experiment. Change-Id: I225ae62f015983751f017386548d9c988c30664c --- vp9/encoder/vp9_tokenize.c | 53 +++++++++++++++++++------------------- 1 file changed, 26 insertions(+), 27 deletions(-) diff --git a/vp9/encoder/vp9_tokenize.c b/vp9/encoder/vp9_tokenize.c index c8d1d91fc..2d6138114 100644 --- a/vp9/encoder/vp9_tokenize.c +++ b/vp9/encoder/vp9_tokenize.c @@ -173,8 +173,10 @@ static void tokenize_b(VP9_COMP *cpi, break; case TX_16X16: #if CONFIG_CNVCONTEXT - a_ec = (a[0] + a[1] + a[2] + a[3]) != 0; - l_ec = (l[0] + l[1] + l[2] + l[3]) != 0; + if (type != PLANE_TYPE_UV) { + a_ec = (a[0] + a[1] + a[2] + a[3]) != 0; + l_ec = (l[0] + l[1] + l[2] + l[3]) != 0; + } #endif seg_eob = 256; bands = vp9_coef_bands_16x16; @@ -246,8 +248,15 @@ static void tokenize_b(VP9_COMP *cpi, a[1] = a_ec; l[1] = l_ec; } else if (tx_size == TX_16X16) { - a[1] = a[2] = a[3] = a_ec; - l[1] = l[2] = l[3] = l_ec; + if (type != PLANE_TYPE_UV) { + a[1] = a[2] = a[3] = a_ec; + l[1] = l[2] = l[3] = l_ec; +#if CONFIG_TX32X32 && CONFIG_SUPERBLOCKS + } else { + a[1] = a_ec; + l[1] = l_ec; +#endif + } } } @@ -378,8 +387,6 @@ void vp9_tokenize_sb(VP9_COMP *cpi, for (b = 16; b < 24; b += 4) { tokenize_b(cpi, xd, b, t, PLANE_TYPE_UV, TX_16X16, dry_run); - A[0][vp9_block2above[TX_16X16][b] + 1] = A[0][vp9_block2above[TX_16X16][b]]; - L[0][vp9_block2left[TX_16X16][b] + 1] = L[0][vp9_block2left[TX_16X16][b]]; } vpx_memset(&A[0][8], 0, sizeof(A[0][8])); vpx_memset(&L[0][8], 0, sizeof(L[0][8])); @@ -749,8 +756,10 @@ static __inline void stuff_b(VP9_COMP *cpi, break; case TX_16X16: #if CONFIG_CNVCONTEXT - a_ec = (a[0] + a[1] + a[2] + a[3]) != 0; - l_ec = (l[0] + l[1] + l[2] + l[3]) != 0; + if (type != PLANE_TYPE_UV) { + a_ec = (a[0] + a[1] + a[2] + a[3]) != 0; + l_ec = (l[0] + l[1] + l[2] + l[3]) != 0; + } #endif bands = vp9_coef_bands_16x16; if (tx_type != DCT_DCT) { @@ -783,8 +792,15 @@ static __inline void stuff_b(VP9_COMP *cpi, a[1] = 0; l[1] = 0; } else if (tx_size == TX_16X16) { - a[1] = a[2] = a[3] = 0; - l[1] = l[2] = l[3] = 0; + if (type != PLANE_TYPE_UV) { + a[1] = a[2] = a[3] = 0; + l[1] = l[2] = l[3] = 0; +#if CONFIG_TX32X32 && CONFIG_SUPERBLOCKS + } else { + a[1] = 0; + l[1] = 0; +#endif + } } if (!dry_run) { @@ -932,23 +948,6 @@ void vp9_stuff_sb(VP9_COMP *cpi, MACROBLOCKD *xd, TOKENEXTRA **t, int dry_run) { } #endif -void vp9_fix_contexts(MACROBLOCKD *xd) { - /* Clear entropy contexts for blocks */ - if ((xd->mode_info_context->mbmi.mode != B_PRED - && xd->mode_info_context->mbmi.mode != I8X8_PRED - && xd->mode_info_context->mbmi.mode != SPLITMV) - || xd->mode_info_context->mbmi.txfm_size == TX_16X16 - ) { - vpx_memset(xd->above_context, 0, sizeof(ENTROPY_CONTEXT_PLANES)); - vpx_memset(xd->left_context, 0, sizeof(ENTROPY_CONTEXT_PLANES)); - } else { - vpx_memset(xd->above_context, 0, sizeof(ENTROPY_CONTEXT_PLANES) - 1); - vpx_memset(xd->left_context, 0, sizeof(ENTROPY_CONTEXT_PLANES) - 1); - xd->above_context->y2 = 1; - xd->left_context->y2 = 1; - } -} - #if CONFIG_TX32X32 && CONFIG_SUPERBLOCKS void vp9_fix_contexts_sb(MACROBLOCKD *xd) { vpx_memset(xd->above_context, 0, sizeof(ENTROPY_CONTEXT_PLANES) * 2); -- 2.40.0