Commit 7055d13f authored by Simon Horlick's avatar Simon Horlick Committed by Fiona Glaser

MBAFF: Disallow skip where predicted interlace flag would be wrong

parent a1974d1c
......@@ -618,6 +618,7 @@ struct x264_t
int i_mb_topright_y;
x264_left_table_t *left_index_table;
int topleft_partition;
int b_allow_skip;
/**** thread synchronization ends here ****/
/* subsequent variables are either thread-local or constant,
......
......@@ -1109,6 +1109,31 @@ void x264_macroblock_cache_load( x264_t *h, int mb_x, int mb_y )
}
}
/* Check whether skip here would cause decoder to predict interlace mode incorrectly.
* FIXME: It might be better to change the interlace type rather than forcing a skip to be non-skip. */
h->mb.b_allow_skip = 1;
if( h->sh.b_mbaff )
{
if( (mb_y&1) && IS_SKIP(h->mb.type[h->mb.i_mb_xy - h->mb.i_mb_stride]) )
{
if( h->mb.i_neighbour & MB_LEFT )
{
if( h->mb.field[h->mb.i_mb_xy - 1] != h->mb.b_interlaced )
h->mb.b_allow_skip = 0;
}
else if( h->mb.i_neighbour & MB_TOP )
{
if( h->mb.field[h->mb.i_mb_top_xy] != h->mb.b_interlaced )
h->mb.b_allow_skip = 0;
}
else // Frame mb pair is predicted
{
if( h->mb.b_interlaced )
h->mb.b_allow_skip = 0;
}
}
}
/* load skip */
if( h->sh.i_type == SLICE_TYPE_B )
{
......
......@@ -569,13 +569,8 @@ void x264_macroblock_encode( x264_t *h )
return;
}
if( h->sh.b_mbaff
&& h->mb.i_mb_xy == h->sh.i_first_mb + h->mb.i_mb_stride
&& IS_SKIP(h->mb.type[h->sh.i_first_mb]) )
if( !h->mb.b_allow_skip )
{
/* The first skip is predicted to be a frame mb pair.
* We don't yet support the aff part of mbaff, so force it to non-skip
* so that we can pick the aff flag. */
b_force_no_skip = 1;
if( IS_SKIP(h->mb.i_type) )
{
......
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