]> granicus.if.org Git - libx264/commitdiff
non-referenced B-frames should have the same frame_num as the following ref frame...
authorLoren Merritt <pengvado@videolan.org>
Fri, 19 May 2006 19:14:29 +0000 (19:14 +0000)
committerLoren Merritt <pengvado@videolan.org>
Fri, 19 May 2006 19:14:29 +0000 (19:14 +0000)
patch by Loic Le Loarer.

git-svn-id: svn://svn.videolan.org/x264/trunk@524 df754926-b1dd-0310-bc7b-ec298dee348c

encoder/encoder.c

index cae7fb2a18a02201939a1c1f25df1d6ff183072f..7c3ec53afaf79e9bd4f03059ccf1b62a454c8558 100644 (file)
@@ -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;