for( i=0; i<2; i++ )
{
- int i_refs = i ? 1 + h->param.b_bframe_pyramid : h->param.i_frame_reference;
- for( j=0; j < i_refs; j++ )
+ int i_refs = (i ? 1 : h->param.i_frame_reference) + h->param.b_bframe_pyramid;
+ for( j=0; j < i_refs && j < 16; j++ )
h->mb.mvr[i][j] = x264_malloc( 2 * i_mb_count * sizeof( int16_t ) );
}
else
{
bs_write1( s, 0 ); /* adaptive_ref_pic_marking_mode_flag */
- /* FIXME */
}
}
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.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_beta = x264_clip3( h->param.i_deblocking_filter_beta, -6, 6 );
h->mb.i_mb_count = h->sps->i_mb_width * h->sps->i_mb_height;
/* 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++ )
{
h->frames.current[i] = NULL;
h->frames.last_nonb = h->fdec;
/* 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];
for( i = h->frames.i_max_dpb-1; i > 0; i-- )
{
}
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->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->i_mb_width = ( param->i_width + 15 ) / 16;