[FFmpeg-cvslog] r19258 - in trunk/libavcodec: h264.c mpegvideo.h

cehoyos subversion
Tue Jun 23 23:03:36 CEST 2009


Author: cehoyos
Date: Tue Jun 23 23:03:35 2009
New Revision: 19258

Log:
Fix H.264 picture reordering, 2nd try.
First, reverted one was r19239.

Patch by Haruhiko Yamagata, h D yamagata A nifty D com

Modified:
   trunk/libavcodec/h264.c
   trunk/libavcodec/mpegvideo.h

Modified: trunk/libavcodec/h264.c
==============================================================================
--- trunk/libavcodec/h264.c	Tue Jun 23 20:17:15 2009	(r19257)
+++ trunk/libavcodec/h264.c	Tue Jun 23 23:03:35 2009	(r19258)
@@ -2240,6 +2240,7 @@ static int frame_start(H264Context *h){
      * See decode_nal_units().
      */
     s->current_picture_ptr->key_frame= 0;
+    s->current_picture_ptr->mmco_reseted= 0;
 
     assert(s->linesize && s->uvlinesize);
 
@@ -3369,6 +3370,7 @@ static int execute_ref_pic_marking(H264C
             h->poc_msb=
             h->frame_num=
             s->current_picture_ptr->frame_num= 0;
+            s->current_picture_ptr->mmco_reseted=1;
             break;
         default: assert(0);
         }
@@ -7708,7 +7710,7 @@ static int decode_frame(AVCodecContext *
 //FIXME factorize this with the output code below
         out = h->delayed_pic[0];
         out_idx = 0;
-        for(i=1; h->delayed_pic[i] && (h->delayed_pic[i]->poc && !h->delayed_pic[i]->key_frame); i++)
+        for(i=1; h->delayed_pic[i] && !h->delayed_pic[i]->key_frame && !h->delayed_pic[i]->mmco_reseted; i++)
             if(h->delayed_pic[i]->poc < out->poc){
                 out = h->delayed_pic[i];
                 out_idx = i;
@@ -7884,12 +7886,12 @@ static int decode_frame(AVCodecContext *
 
             out = h->delayed_pic[0];
             out_idx = 0;
-            for(i=1; h->delayed_pic[i] && (h->delayed_pic[i]->poc && !h->delayed_pic[i]->key_frame); i++)
+            for(i=1; h->delayed_pic[i] && !h->delayed_pic[i]->key_frame && !h->delayed_pic[i]->mmco_reseted; i++)
                 if(h->delayed_pic[i]->poc < out->poc){
                     out = h->delayed_pic[i];
                     out_idx = i;
                 }
-            cross_idr = !h->delayed_pic[0]->poc || !!h->delayed_pic[i] || h->delayed_pic[0]->key_frame;
+            cross_idr = !!h->delayed_pic[i] || h->delayed_pic[0]->key_frame || h->delayed_pic[0]->mmco_reseted;
 
             out_of_order = !cross_idr && out->poc < h->outputed_poc;
 

Modified: trunk/libavcodec/mpegvideo.h
==============================================================================
--- trunk/libavcodec/mpegvideo.h	Tue Jun 23 20:17:15 2009	(r19257)
+++ trunk/libavcodec/mpegvideo.h	Tue Jun 23 23:03:35 2009	(r19258)
@@ -116,6 +116,7 @@ typedef struct Picture{
     int field_poc[2];           ///< h264 top/bottom POC
     int poc;                    ///< h264 frame POC
     int frame_num;              ///< h264 frame_num (raw frame_num from slice header)
+    int mmco_reseted;           ///< h264 MMCO_RESET set this 1. Reordering code must not mix pictures before and after MMCO_RESET.
     int pic_id;                 /**< h264 pic_num (short -> no wrap version of pic_num,
                                      pic_num & max_pic_num; long -> long_pic_num) */
     int long_ref;               ///< 1->long term reference 0->short term reference



More information about the ffmpeg-cvslog mailing list