Commit 82d5e6fa authored by Loren Merritt's avatar Loren Merritt

with B-pyramid, forget old refs in POC order instead of coded order.

(before, b_skip was unavailable with pyramid and ref=1)



git-svn-id: svn://svn.videolan.org/x264/trunk@305 df754926-b1dd-0310-bc7b-ec298dee348c
parent 4223e387
...@@ -977,8 +977,8 @@ void x264_macroblock_cache_init( x264_t *h ) ...@@ -977,8 +977,8 @@ void x264_macroblock_cache_init( x264_t *h )
for( i=0; i<2; i++ ) for( i=0; i<2; i++ )
{ {
int i_refs = i ? 1 + h->param.b_bframe_pyramid : h->param.i_frame_reference; int i_refs = (i ? 1 : h->param.i_frame_reference) + h->param.b_bframe_pyramid;
for( j=0; j < i_refs; j++ ) for( j=0; j < i_refs && j < 16; j++ )
h->mb.mvr[i][j] = x264_malloc( 2 * i_mb_count * sizeof( int16_t ) ); h->mb.mvr[i][j] = x264_malloc( 2 * i_mb_count * sizeof( int16_t ) );
} }
......
...@@ -315,7 +315,6 @@ static void x264_slice_header_write( bs_t *s, x264_slice_header_t *sh, int i_nal ...@@ -315,7 +315,6 @@ static void x264_slice_header_write( bs_t *s, x264_slice_header_t *sh, int i_nal
else else
{ {
bs_write1( s, 0 ); /* adaptive_ref_pic_marking_mode_flag */ bs_write1( s, 0 ); /* adaptive_ref_pic_marking_mode_flag */
/* FIXME */
} }
} }
...@@ -403,11 +402,6 @@ static int x264_validate_parameters( x264_t *h ) ...@@ -403,11 +402,6 @@ static int x264_validate_parameters( x264_t *h )
h->param.i_bframe = x264_clip3( h->param.i_bframe, 0, X264_BFRAME_MAX ); h->param.i_bframe = x264_clip3( h->param.i_bframe, 0, X264_BFRAME_MAX );
h->param.i_bframe_bias = x264_clip3( h->param.i_bframe_bias, -90, 100 ); h->param.i_bframe_bias = x264_clip3( h->param.i_bframe_bias, -90, 100 );
h->param.b_bframe_pyramid = h->param.b_bframe_pyramid && h->param.i_bframe > 1; h->param.b_bframe_pyramid = h->param.b_bframe_pyramid && h->param.i_bframe > 1;
h->frames.i_delay = h->param.i_bframe;
h->frames.i_max_ref0 = h->param.i_frame_reference;
h->frames.i_max_ref1 = h->param.b_bframe_pyramid ? 2
: h->param.i_bframe ? 1 : 0;
h->frames.i_max_dpb = X264_MIN( 16, h->frames.i_max_ref0 + h->frames.i_max_ref1 ) + 1;
h->param.i_deblocking_filter_alphac0 = x264_clip3( h->param.i_deblocking_filter_alphac0, -6, 6 ); h->param.i_deblocking_filter_alphac0 = x264_clip3( h->param.i_deblocking_filter_alphac0, -6, 6 );
h->param.i_deblocking_filter_beta = x264_clip3( h->param.i_deblocking_filter_beta, -6, 6 ); h->param.i_deblocking_filter_beta = x264_clip3( h->param.i_deblocking_filter_beta, -6, 6 );
...@@ -544,6 +538,11 @@ x264_t *x264_encoder_open ( x264_param_t *param ) ...@@ -544,6 +538,11 @@ x264_t *x264_encoder_open ( x264_param_t *param )
h->mb.i_mb_count = h->sps->i_mb_width * h->sps->i_mb_height; h->mb.i_mb_count = h->sps->i_mb_width * h->sps->i_mb_height;
/* Init frames. */ /* Init frames. */
h->frames.i_delay = h->param.i_bframe;
h->frames.i_max_ref0 = h->param.i_frame_reference;
h->frames.i_max_ref1 = h->sps->vui.i_num_reorder_frames;
h->frames.i_max_dpb = h->sps->vui.i_max_dec_frame_buffering + 1;
for( i = 0; i < X264_BFRAME_MAX + 3; i++ ) for( i = 0; i < X264_BFRAME_MAX + 3; i++ )
{ {
h->frames.current[i] = NULL; h->frames.current[i] = NULL;
...@@ -851,7 +850,6 @@ static inline void x264_reference_update( x264_t *h ) ...@@ -851,7 +850,6 @@ static inline void x264_reference_update( x264_t *h )
h->frames.last_nonb = h->fdec; h->frames.last_nonb = h->fdec;
/* move frame in the buffer */ /* move frame in the buffer */
/* FIXME: override to forget earliest pts, not earliest dts */
h->fdec = h->frames.reference[h->frames.i_max_dpb-1]; h->fdec = h->frames.reference[h->frames.i_max_dpb-1];
for( i = h->frames.i_max_dpb-1; i > 0; i-- ) for( i = h->frames.i_max_dpb-1; i > 0; i-- )
{ {
......
...@@ -113,8 +113,10 @@ void x264_sps_init( x264_sps_t *sps, int i_id, x264_param_t *param ) ...@@ -113,8 +113,10 @@ void x264_sps_init( x264_sps_t *sps, int i_id, x264_param_t *param )
} }
sps->vui.i_num_reorder_frames = param->b_bframe_pyramid ? 2 : param->i_bframe ? 1 : 0; sps->vui.i_num_reorder_frames = param->b_bframe_pyramid ? 2 : param->i_bframe ? 1 : 0;
/* extra slot with pyramid so that we don't have to override the
* order of forgetting old pictures */
sps->vui.i_max_dec_frame_buffering = sps->vui.i_max_dec_frame_buffering =
sps->i_num_ref_frames = X264_MIN(16, param->i_frame_reference + sps->vui.i_num_reorder_frames); sps->i_num_ref_frames = X264_MIN(16, param->i_frame_reference + sps->vui.i_num_reorder_frames + param->b_bframe_pyramid);
sps->b_gaps_in_frame_num_value_allowed = 0; sps->b_gaps_in_frame_num_value_allowed = 0;
sps->i_mb_width = ( param->i_width + 15 ) / 16; sps->i_mb_width = ( param->i_width + 15 ) / 16;
......
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