Commit 3e976bba authored by Yaowu Xu's avatar Yaowu Xu

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
parent 12da793d
......@@ -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);
......
......@@ -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;
}
......
......@@ -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;
}
}
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