[FFmpeg-cvslog] Merge commit '58640fe89ec4f2a3d67c0a2585fca8de34440857'

Timothy Gu git at videolan.org
Thu Aug 4 21:17:01 EEST 2016


ffmpeg | branch: master | Timothy Gu <timothygu99 at gmail.com> | Wed Aug  3 20:07:21 2016 -0700| [7f7cedd7139f18480e3dacd1abcfd94bda01fa17] | committer: Timothy Gu

Merge commit '58640fe89ec4f2a3d67c0a2585fca8de34440857'

* commit '58640fe89ec4f2a3d67c0a2585fca8de34440857':
  h264: handle frame recovery in h264_field_start()

Conflicts:
	libavcodec/h264dec.c

Merged-by: Timothy Gu <timothygu99 at gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=7f7cedd7139f18480e3dacd1abcfd94bda01fa17
---

 libavcodec/h264_slice.c | 32 ++++++++++++++++++++++++++++++++
 libavcodec/h264dec.c    | 32 --------------------------------
 2 files changed, 32 insertions(+), 32 deletions(-)

diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c
index c6f40e5..25a5890 100644
--- a/libavcodec/h264_slice.c
+++ b/libavcodec/h264_slice.c
@@ -1499,6 +1499,38 @@ static int h264_field_start(H264Context *h, const H264SliceContext *sl,
 
     h->picture_idr = nal->type == H264_NAL_IDR_SLICE;
 
+    if (h->sei.recovery_point.recovery_frame_cnt >= 0) {
+        const int sei_recovery_frame_cnt = h->sei.recovery_point.recovery_frame_cnt;
+
+        if (h->poc.frame_num != sei_recovery_frame_cnt || sl->slice_type_nos != AV_PICTURE_TYPE_I)
+            h->valid_recovery_point = 1;
+
+        if (   h->recovery_frame < 0
+            || av_mod_uintp2(h->recovery_frame - h->poc.frame_num, h->ps.sps->log2_max_frame_num) > sei_recovery_frame_cnt) {
+            h->recovery_frame = av_mod_uintp2(h->poc.frame_num + sei_recovery_frame_cnt, h->ps.sps->log2_max_frame_num);
+
+            if (!h->valid_recovery_point)
+                h->recovery_frame = h->poc.frame_num;
+        }
+    }
+
+    h->cur_pic_ptr->f->key_frame |= (nal->type == H264_NAL_IDR_SLICE);
+
+    if (nal->type == H264_NAL_IDR_SLICE ||
+        (h->recovery_frame == h->poc.frame_num && nal->ref_idc)) {
+        h->recovery_frame         = -1;
+        h->cur_pic_ptr->recovered = 1;
+    }
+    // If we have an IDR, all frames after it in decoded order are
+    // "recovered".
+    if (nal->type == H264_NAL_IDR_SLICE)
+        h->frame_recovered |= FRAME_RECOVERED_IDR;
+#if 1
+    h->cur_pic_ptr->recovered |= h->frame_recovered;
+#else
+    h->cur_pic_ptr->recovered |= !!(h->frame_recovered & FRAME_RECOVERED_IDR);
+#endif
+
     /* Set the frame properties/side data. Only done for the second field in
      * field coded frames, since some SEI information is present for each field
      * and is merged by the SEI parsing code. */
diff --git a/libavcodec/h264dec.c b/libavcodec/h264dec.c
index c72a7fc..9313301 100644
--- a/libavcodec/h264dec.c
+++ b/libavcodec/h264dec.c
@@ -802,38 +802,6 @@ again:
             if (sl->redundant_pic_count > 0)
                 break;
 
-            if (h->sei.recovery_point.recovery_frame_cnt >= 0) {
-                const int sei_recovery_frame_cnt = h->sei.recovery_point.recovery_frame_cnt;
-
-                if (h->poc.frame_num != sei_recovery_frame_cnt || sl->slice_type_nos != AV_PICTURE_TYPE_I)
-                    h->valid_recovery_point = 1;
-
-                if (   h->recovery_frame < 0
-                    || av_mod_uintp2(h->recovery_frame - h->poc.frame_num, h->ps.sps->log2_max_frame_num) > sei_recovery_frame_cnt) {
-                    h->recovery_frame = av_mod_uintp2(h->poc.frame_num + sei_recovery_frame_cnt, h->ps.sps->log2_max_frame_num);
-
-                    if (!h->valid_recovery_point)
-                        h->recovery_frame = h->poc.frame_num;
-                }
-            }
-
-            h->cur_pic_ptr->f->key_frame |= (nal->type == H264_NAL_IDR_SLICE);
-
-            if (nal->type == H264_NAL_IDR_SLICE ||
-                (h->recovery_frame == h->poc.frame_num && nal->ref_idc)) {
-                h->recovery_frame         = -1;
-                h->cur_pic_ptr->recovered = 1;
-            }
-            // If we have an IDR, all frames after it in decoded order are
-            // "recovered".
-            if (nal->type == H264_NAL_IDR_SLICE)
-                h->frame_recovered |= FRAME_RECOVERED_IDR;
-#if 1
-            h->cur_pic_ptr->recovered |= h->frame_recovered;
-#else
-            h->cur_pic_ptr->recovered |= !!(h->frame_recovered & FRAME_RECOVERED_IDR);
-#endif
-
             if (h->current_slice == 1) {
                 if (!(avctx->flags2 & AV_CODEC_FLAG2_CHUNKS))
                     decode_postinit(h, i >= nals_needed);


======================================================================

diff --cc libavcodec/h264_slice.c
index c6f40e5,2b7e088..25a5890
--- a/libavcodec/h264_slice.c
+++ b/libavcodec/h264_slice.c
@@@ -1499,6 -1335,24 +1499,38 @@@ static int h264_field_start(H264Contex
  
      h->picture_idr = nal->type == H264_NAL_IDR_SLICE;
  
 -    if (h->sei.recovery_point.recovery_frame_cnt >= 0 && h->recovery_frame < 0) {
 -        h->recovery_frame = (h->poc.frame_num + h->sei.recovery_point.recovery_frame_cnt) &
 -                            ((1 << h->ps.sps->log2_max_frame_num) - 1);
++    if (h->sei.recovery_point.recovery_frame_cnt >= 0) {
++        const int sei_recovery_frame_cnt = h->sei.recovery_point.recovery_frame_cnt;
++
++        if (h->poc.frame_num != sei_recovery_frame_cnt || sl->slice_type_nos != AV_PICTURE_TYPE_I)
++            h->valid_recovery_point = 1;
++
++        if (   h->recovery_frame < 0
++            || av_mod_uintp2(h->recovery_frame - h->poc.frame_num, h->ps.sps->log2_max_frame_num) > sei_recovery_frame_cnt) {
++            h->recovery_frame = av_mod_uintp2(h->poc.frame_num + sei_recovery_frame_cnt, h->ps.sps->log2_max_frame_num);
++
++            if (!h->valid_recovery_point)
++                h->recovery_frame = h->poc.frame_num;
++        }
+     }
+ 
 -    h->cur_pic_ptr->f->key_frame |= (nal->type == H264_NAL_IDR_SLICE) ||
 -                                    (h->sei.recovery_point.recovery_frame_cnt >= 0);
++    h->cur_pic_ptr->f->key_frame |= (nal->type == H264_NAL_IDR_SLICE);
+ 
 -    if (nal->type == H264_NAL_IDR_SLICE || h->recovery_frame == h->poc.frame_num) {
++    if (nal->type == H264_NAL_IDR_SLICE ||
++        (h->recovery_frame == h->poc.frame_num && nal->ref_idc)) {
+         h->recovery_frame         = -1;
+         h->cur_pic_ptr->recovered = 1;
+     }
+     // If we have an IDR, all frames after it in decoded order are
+     // "recovered".
+     if (nal->type == H264_NAL_IDR_SLICE)
+         h->frame_recovered |= FRAME_RECOVERED_IDR;
++#if 1
++    h->cur_pic_ptr->recovered |= h->frame_recovered;
++#else
+     h->cur_pic_ptr->recovered |= !!(h->frame_recovered & FRAME_RECOVERED_IDR);
++#endif
+ 
      /* Set the frame properties/side data. Only done for the second field in
       * field coded frames, since some SEI information is present for each field
       * and is merged by the SEI parsing code. */



More information about the ffmpeg-cvslog mailing list