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
This commit is contained in:
Yaowu Xu 2012-11-27 16:02:35 -08:00
parent 12da793d00
commit 3e976bba21
3 changed files with 20 additions and 1 deletions

View File

@ -505,6 +505,8 @@ static void decode_macroblock(VP9D_COMP *pbi, MACROBLOCKD *xd,
vp9_dequant_idct_add(b->qcoeff, b->dequant, b->predictor, vp9_dequant_idct_add(b->qcoeff, b->dequant, b->predictor,
*(b->base_dst) + b->dst, 16, b->dst_stride); *(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) if (!xd->mode_info_context->mbmi.mb_skip_coeff)
vp9_decode_mb_tokens_4x4_uv(pbi, xd, bc); vp9_decode_mb_tokens_4x4_uv(pbi, xd, bc);

View File

@ -70,6 +70,8 @@ void vp9_reset_mb_tokens_context(MACROBLOCKD* const xd) {
} else { } else {
vpx_memset(xd->above_context, 0, sizeof(ENTROPY_CONTEXT_PLANES) - 1); vpx_memset(xd->above_context, 0, sizeof(ENTROPY_CONTEXT_PLANES) - 1);
vpx_memset(xd->left_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; eobtotal += c - 4;
type = PLANE_TYPE_Y_NO_DC; type = PLANE_TYPE_Y_NO_DC;
} else { } else {
xd->above_context->y2 = 1;
xd->left_context->y2 = 1;
type = PLANE_TYPE_Y_WITH_DC; 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; eobtotal += vp9_decode_coefs_4x4(dx, xd, bc, PLANE_TYPE_Y2, 24) - 16;
type = PLANE_TYPE_Y_NO_DC; type = PLANE_TYPE_Y_NO_DC;
} else { } else {
xd->above_context->y2 = 1;
xd->left_context->y2 = 1;
type = PLANE_TYPE_Y_WITH_DC; type = PLANE_TYPE_Y_WITH_DC;
} }

View File

@ -358,8 +358,11 @@ void vp9_tokenize_mb(VP9_COMP *cpi,
} }
plane_type = PLANE_TYPE_Y_NO_DC; 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; plane_type = PLANE_TYPE_Y_WITH_DC;
}
if (tx_size == TX_16X16) { if (tx_size == TX_16X16) {
tokenize_b(cpi, xd, xd->block, t, PLANE_TYPE_Y_WITH_DC, 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); TX_8X8, dry_run);
plane_type = PLANE_TYPE_Y_NO_DC; 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; 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); L + vp9_block2left[24], TX_4X4, dry_run);
plane_type = PLANE_TYPE_Y_NO_DC; 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; 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++) for (b = 16; b < 24; b++)
stuff_b(cpi, xd, xd->block + b, t, PLANE_TYPE_UV, A + vp9_block2above[b], stuff_b(cpi, xd, xd->block + b, t, PLANE_TYPE_UV, A + vp9_block2above[b],
L + vp9_block2left[b], TX_4X4, dry_run); 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) { 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 { } else {
vpx_memset(xd->above_context, 0, sizeof(ENTROPY_CONTEXT_PLANES) - 1); vpx_memset(xd->above_context, 0, sizeof(ENTROPY_CONTEXT_PLANES) - 1);
vpx_memset(xd->left_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;
} }
} }