From 3e976bba2124f20bde60eec67b3011cbf1bf0a53 Mon Sep 17 00:00:00 2001 From: Yaowu Xu Date: Tue, 27 Nov 2012 16:02:35 -0800 Subject: [PATCH] Localize Y2 entropy coding context This commit makes sure Y2 entropy coding context is always updated on every macroblock even there is no Y2 block. Change-Id: Ie307cfc46526efe55613be39f9f178d2531b56ba --- vp9/decoder/vp9_decodframe.c | 2 ++ vp9/decoder/vp9_detokenize.c | 6 ++++++ vp9/encoder/vp9_tokenize.c | 13 ++++++++++++- 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/vp9/decoder/vp9_decodframe.c b/vp9/decoder/vp9_decodframe.c index 2c456658d..a89670108 100644 --- a/vp9/decoder/vp9_decodframe.c +++ b/vp9/decoder/vp9_decodframe.c @@ -505,6 +505,8 @@ static void decode_macroblock(VP9D_COMP *pbi, MACROBLOCKD *xd, vp9_dequant_idct_add(b->qcoeff, b->dequant, b->predictor, *(b->base_dst) + b->dst, 16, b->dst_stride); } + xd->above_context->y2 = 1; + xd->left_context->y2 = 1; } if (!xd->mode_info_context->mbmi.mb_skip_coeff) vp9_decode_mb_tokens_4x4_uv(pbi, xd, bc); diff --git a/vp9/decoder/vp9_detokenize.c b/vp9/decoder/vp9_detokenize.c index 8c469c403..c55e3620a 100644 --- a/vp9/decoder/vp9_detokenize.c +++ b/vp9/decoder/vp9_detokenize.c @@ -70,6 +70,8 @@ void vp9_reset_mb_tokens_context(MACROBLOCKD* const xd) { } 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; } } @@ -321,6 +323,8 @@ static int vp9_decode_mb_tokens_8x8(VP9D_COMP* const pbi, eobtotal += c - 4; type = PLANE_TYPE_Y_NO_DC; } else { + xd->above_context->y2 = 1; + xd->left_context->y2 = 1; type = PLANE_TYPE_Y_WITH_DC; } @@ -431,6 +435,8 @@ static int vp9_decode_mb_tokens_4x4(VP9D_COMP* const dx, eobtotal += vp9_decode_coefs_4x4(dx, xd, bc, PLANE_TYPE_Y2, 24) - 16; type = PLANE_TYPE_Y_NO_DC; } else { + xd->above_context->y2 = 1; + xd->left_context->y2 = 1; type = PLANE_TYPE_Y_WITH_DC; } diff --git a/vp9/encoder/vp9_tokenize.c b/vp9/encoder/vp9_tokenize.c index c08040830..1713cdb73 100644 --- a/vp9/encoder/vp9_tokenize.c +++ b/vp9/encoder/vp9_tokenize.c @@ -358,8 +358,11 @@ void vp9_tokenize_mb(VP9_COMP *cpi, } plane_type = PLANE_TYPE_Y_NO_DC; - } else + } else { + xd->above_context->y2 = 1; + xd->left_context->y2 = 1; plane_type = PLANE_TYPE_Y_WITH_DC; + } if (tx_size == TX_16X16) { tokenize_b(cpi, xd, xd->block, t, PLANE_TYPE_Y_WITH_DC, @@ -743,6 +746,8 @@ static void stuff_mb_8x8(VP9_COMP *cpi, MACROBLOCKD *xd, TX_8X8, dry_run); plane_type = PLANE_TYPE_Y_NO_DC; } else { + xd->above_context->y2 = 1; + xd->left_context->y2 = 1; plane_type = PLANE_TYPE_Y_WITH_DC; } @@ -796,6 +801,8 @@ static void stuff_mb_4x4(VP9_COMP *cpi, MACROBLOCKD *xd, L + vp9_block2left[24], TX_4X4, dry_run); plane_type = PLANE_TYPE_Y_NO_DC; } else { + xd->above_context->y2 = 1; + xd->left_context->y2 = 1; plane_type = PLANE_TYPE_Y_WITH_DC; } @@ -825,6 +832,8 @@ static void stuff_mb_8x8_4x4uv(VP9_COMP *cpi, MACROBLOCKD *xd, for (b = 16; b < 24; b++) stuff_b(cpi, xd, xd->block + b, t, PLANE_TYPE_UV, A + vp9_block2above[b], L + vp9_block2left[b], TX_4X4, dry_run); + xd->above_context->y2 = 1; + xd->left_context->y2 = 1; } void vp9_stuff_mb(VP9_COMP *cpi, MACROBLOCKD *xd, TOKENEXTRA **t, int dry_run) { @@ -861,5 +870,7 @@ void vp9_fix_contexts(MACROBLOCKD *xd) { } 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; } }