Commit 0b34d467 authored by Fiona Glaser's avatar Fiona Glaser

Fix regression in direct=auto/temporal in r1364

Bug caused rare race condition in frame reference handling.
This resulted in invalid bitstreams in some B-frames and, very rarely, crashes.
parent c0e6a945
......@@ -835,6 +835,20 @@ void x264_macroblock_slice_init( x264_t *h )
setup_inverse_delta_pocs( h );
h->mb.i_neighbour4[6] =
h->mb.i_neighbour4[9] =
h->mb.i_neighbour4[12] =
h->mb.i_neighbour4[14] = MB_LEFT|MB_TOP|MB_TOPLEFT|MB_TOPRIGHT;
h->mb.i_neighbour4[3] =
h->mb.i_neighbour4[7] =
h->mb.i_neighbour4[11] =
h->mb.i_neighbour4[13] =
h->mb.i_neighbour4[15] =
h->mb.i_neighbour8[3] = MB_LEFT|MB_TOP|MB_TOPLEFT;
}
void x264_macroblock_thread_init( x264_t *h )
{
/* fdec: fenc:
* yyyyyyy
* yYYYY YYYY
......@@ -851,17 +865,6 @@ void x264_macroblock_slice_init( x264_t *h )
h->mb.pic.p_fdec[0] = h->mb.pic.fdec_buf + 2*FDEC_STRIDE;
h->mb.pic.p_fdec[1] = h->mb.pic.fdec_buf + 19*FDEC_STRIDE;
h->mb.pic.p_fdec[2] = h->mb.pic.fdec_buf + 19*FDEC_STRIDE + 16;
h->mb.i_neighbour4[6] =
h->mb.i_neighbour4[9] =
h->mb.i_neighbour4[12] =
h->mb.i_neighbour4[14] = MB_LEFT|MB_TOP|MB_TOPLEFT|MB_TOPRIGHT;
h->mb.i_neighbour4[3] =
h->mb.i_neighbour4[7] =
h->mb.i_neighbour4[11] =
h->mb.i_neighbour4[13] =
h->mb.i_neighbour4[15] =
h->mb.i_neighbour8[3] = MB_LEFT|MB_TOP|MB_TOPLEFT;
}
void x264_prefetch_fenc( x264_t *h, x264_frame_t *fenc, int i_mb_x, int i_mb_y )
......
......@@ -263,6 +263,7 @@ enum cabac_ctx_block_cat_e
int x264_macroblock_cache_init( x264_t *h );
void x264_macroblock_slice_init( x264_t *h );
void x264_macroblock_thread_init( x264_t *h );
void x264_macroblock_cache_load( x264_t *h, int i_mb_x, int i_mb_y );
void x264_macroblock_cache_save( x264_t *h );
void x264_macroblock_cache_end( x264_t *h );
......
......@@ -1602,6 +1602,8 @@ static inline void x264_slice_init( x264_t *h, int i_nal_type, int i_global_qp )
{
/* Nothing to do ? */
}
x264_macroblock_slice_init( h );
}
static int x264_slice_write( x264_t *h )
......@@ -1620,7 +1622,7 @@ static int x264_slice_write( x264_t *h )
x264_nal_start( h, h->i_nal_type, h->i_nal_ref_idc );
/* Slice header */
x264_macroblock_slice_init( h );
x264_macroblock_thread_init( h );
x264_slice_header_write( &h->out.bs, &h->sh, h->i_nal_ref_idc );
if( h->param.b_cabac )
{
......
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