Refactored find_neighboring_blocks() and moved the test for corrupt stream

and intra concealment inside vp8_decode_macroblock to be able tocapture
and conceal errors in the residual before reconstruction.

Change-Id: Id0f0bd87945a9bb1db0c20bb5467e2ff9aae5d28
This commit is contained in:
Stefan Holmer
2011-04-19 15:33:46 +02:00
parent a64b37fdbc
commit 1b913c1f78
2 changed files with 49 additions and 83 deletions

View File

@@ -177,9 +177,12 @@ void clamp_mvs(MACROBLOCKD *xd)
}
void vp8_decode_macroblock(VP8D_COMP *pbi, MACROBLOCKD *xd, unsigned int mb_idx)
void vp8_decode_macroblock(VP8D_COMP *pbi, MACROBLOCKD *xd)
{
int eobtotal = 0;
int corrupt_partition;
int mb_row = ((-xd->mb_to_top_edge)/16)>>3;
int mb_col = ((-xd->mb_to_left_edge)/16)>>3;
int i, do_clamp = xd->mode_info_context->mbmi.need_to_clamp_mvs;
if (xd->mode_info_context->mbmi.mb_skip_coeff)
@@ -191,6 +194,24 @@ void vp8_decode_macroblock(VP8D_COMP *pbi, MACROBLOCKD *xd, unsigned int mb_idx)
eobtotal = vp8_decode_mb_tokens(pbi, xd);
}
/* check if the boolean decoder has suffered an error */
corrupt_partition = vp8dx_bool_error(xd->current_bc);
xd->corrupted |= corrupt_partition;
if (xd->mode_info_context->mbmi.ref_frame == INTRA_FRAME &&
corrupt_partition)
{
/* We have an intra block with corrupt coefficients,
* better to conceal with an inter block. Interpolate MVs
* from neighboring MBs.
*/
vp8_interpolate_mv(xd->mode_info_context,
mb_row, mb_col,
pbi->common.mb_rows, pbi->common.mb_cols,
pbi->common.mode_info_stride);
}
/* Perform temporary clamping of the MV to be used for prediction */
if (do_clamp)
{
@@ -228,7 +249,8 @@ void vp8_decode_macroblock(VP8D_COMP *pbi, MACROBLOCKD *xd, unsigned int mb_idx)
/* TODO(holmer): change when we have MB level error tracking */
if (pbi->ec_enabled && xd->mode_info_context->mbmi.ref_frame != INTRA_FRAME
&& (xd->corrupted || mb_idx >= pbi->mvs_corrupt_from_mb))
&& (xd->corrupted ||
mb_row*pbi->common.mb_cols + mb_col >= pbi->mvs_corrupt_from_mb))
{
vp8_conceal_corrupt_block(xd);
return;
@@ -342,7 +364,6 @@ void vp8_decode_mb_row(VP8D_COMP *pbi,
int dst_fb_idx = pc->new_fb_idx;
int recon_y_stride = pc->yv12_fb[ref_fb_idx].y_stride;
int recon_uv_stride = pc->yv12_fb[ref_fb_idx].uv_stride;
int corrupt_partition = 0;
vpx_memset(&pc->left_context, 0, sizeof(pc->left_context));
recon_yoffset = mb_row * recon_y_stride * 16;
@@ -357,19 +378,6 @@ void vp8_decode_mb_row(VP8D_COMP *pbi,
for (mb_col = 0; mb_col < pc->mb_cols; mb_col++)
{
if (xd->mode_info_context->mbmi.ref_frame == INTRA_FRAME &&
corrupt_partition)
{
/* We have an intra block with corrupt coefficients,
* better to conceal with an inter block. Interpolate MVs
* from neighboring MBs.
*/
vp8_interpolate_mv(xd->mode_info_context,
mb_row, mb_col,
pc->mb_rows, pc->mb_cols,
pc->mode_info_stride);
}
if (xd->mode_info_context->mbmi.mode == SPLITMV || xd->mode_info_context->mbmi.mode == B_PRED)
{
for (i = 0; i < 16; i++)
@@ -417,11 +425,10 @@ void vp8_decode_mb_row(VP8D_COMP *pbi,
else
pbi->debugoutput =0;
*/
vp8_decode_macroblock(pbi, xd, mb_row * pc->mb_cols + mb_col);
vp8_decode_macroblock(pbi, xd);
/* check if the boolean decoder has suffered an error */
corrupt_partition = vp8dx_bool_error(xd->current_bc);
xd->corrupted |= corrupt_partition;
xd->corrupted |= vp8dx_bool_error(xd->current_bc);
recon_yoffset += 16;
recon_uvoffset += 8;