From 361b283acbcc2d4b1ff8171ac2945449936e5b93 Mon Sep 17 00:00:00 2001 From: Loren Merritt Date: Fri, 19 May 2006 19:14:29 +0000 Subject: [PATCH] non-referenced B-frames should have the same frame_num as the following ref frame, not the previous. patch by Loic Le Loarer. git-svn-id: svn://svn.videolan.org/x264/trunk@524 df754926-b1dd-0310-bc7b-ec298dee348c --- encoder/encoder.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/encoder/encoder.c b/encoder/encoder.c index cae7fb2a..7c3ec53a 100644 --- a/encoder/encoder.c +++ b/encoder/encoder.c @@ -864,14 +864,14 @@ static inline void x264_slice_init( x264_t *h, int i_nal_type, int i_slice_type, /* ------------------------ Create slice header ----------------------- */ if( i_nal_type == NAL_SLICE_IDR ) { - x264_slice_header_init( h, &h->sh, h->sps, h->pps, i_slice_type, h->i_idr_pic_id, h->i_frame_num - 1, i_global_qp ); + x264_slice_header_init( h, &h->sh, h->sps, h->pps, i_slice_type, h->i_idr_pic_id, h->i_frame_num, i_global_qp ); /* increment id */ h->i_idr_pic_id = ( h->i_idr_pic_id + 1 ) % 65536; } else { - x264_slice_header_init( h, &h->sh, h->sps, h->pps, i_slice_type, -1, h->i_frame_num - 1, i_global_qp ); + x264_slice_header_init( h, &h->sh, h->sps, h->pps, i_slice_type, -1, h->i_frame_num, i_global_qp ); /* always set the real higher num of ref frame used */ h->sh.b_num_ref_idx_override = 1; @@ -1292,12 +1292,12 @@ do_encode: if( i_slice_type == SLICE_TYPE_B ) x264_macroblock_bipred_init( h ); - if( h->fenc->b_kept_as_ref ) - h->i_frame_num++; - /* ------------------------ Create slice header ----------------------- */ x264_slice_init( h, i_nal_type, i_slice_type, i_global_qp ); + if( h->fenc->b_kept_as_ref ) + h->i_frame_num++; + /* ---------------------- Write the bitstream -------------------------- */ /* Init bitstream context */ h->out.i_nal = 0; -- 2.40.0