[FFmpeg-cvslog] Merge commit 'd1f539c97e04e7cebecaf6916c5064f243d39fcf'

Clément Bœsch git at videolan.org
Fri Jul 1 14:21:09 CEST 2016


ffmpeg | branch: master | Clément Bœsch <clement at stupeflix.com> | Fri Jul  1 14:17:56 2016 +0200| [2021326f995ff2eda5cd2aae600853f6eddb507d] | committer: Clément Bœsch

Merge commit 'd1f539c97e04e7cebecaf6916c5064f243d39fcf'

* commit 'd1f539c97e04e7cebecaf6916c5064f243d39fcf':
  h264: merge the two reinit blocks in slice_header_parse()

Merged-by: Clément Bœsch <clement at stupeflix.com>

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

 libavcodec/h264_slice.c |   22 ++--------------------
 1 file changed, 2 insertions(+), 20 deletions(-)

diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c
index 359c6a9..30594c1 100644
--- a/libavcodec/h264_slice.c
+++ b/libavcodec/h264_slice.c
@@ -1414,8 +1414,7 @@ static int h264_slice_header_parse(H264Context *h, H264SliceContext *sl)
         }
     }
 
-    if (h->context_initialized &&
-        (must_reinit || needs_reinit)) {
+    if (!h->context_initialized || must_reinit || needs_reinit) {
         h->context_initialized = 0;
         if (sl != h->slice_ctx) {
             av_log(h->avctx, AV_LOG_ERROR,
@@ -1435,7 +1434,7 @@ static int h264_slice_header_parse(H264Context *h, H264SliceContext *sl)
             return ret;
         h->avctx->pix_fmt = ret;
 
-        av_log(h->avctx, AV_LOG_INFO, "Reinit context to %dx%d, "
+        av_log(h->avctx, AV_LOG_VERBOSE, "Reinit context to %dx%d, "
                "pix_fmt: %s\n", h->width, h->height, av_get_pix_fmt_name(h->avctx->pix_fmt));
 
         if ((ret = h264_slice_header_init(h)) < 0) {
@@ -1444,23 +1443,6 @@ static int h264_slice_header_parse(H264Context *h, H264SliceContext *sl)
             return ret;
         }
     }
-    if (!h->context_initialized) {
-        if (sl != h->slice_ctx) {
-            av_log(h->avctx, AV_LOG_ERROR,
-                   "Cannot (re-)initialize context during parallel decoding.\n");
-            return AVERROR_PATCHWELCOME;
-        }
-
-        if ((ret = get_pixel_format(h, 1)) < 0)
-            return ret;
-        h->avctx->pix_fmt = ret;
-
-        if ((ret = h264_slice_header_init(h)) < 0) {
-            av_log(h->avctx, AV_LOG_ERROR,
-                   "h264_slice_header_init() failed\n");
-            return ret;
-        }
-    }
 
     frame_num = get_bits(&sl->gb, sps->log2_max_frame_num);
     if (!first_slice) {


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

diff --cc libavcodec/h264_slice.c
index 359c6a9,13988f4..30594c1
--- a/libavcodec/h264_slice.c
+++ b/libavcodec/h264_slice.c
@@@ -1414,8 -1201,7 +1414,7 @@@ static int h264_slice_header_parse(H264
          }
      }
  
-     if (h->context_initialized &&
-         (must_reinit || needs_reinit)) {
 -    if (!h->context_initialized || needs_reinit) {
++    if (!h->context_initialized || must_reinit || needs_reinit) {
          h->context_initialized = 0;
          if (sl != h->slice_ctx) {
              av_log(h->avctx, AV_LOG_ERROR,
@@@ -1435,8 -1219,8 +1434,8 @@@
              return ret;
          h->avctx->pix_fmt = ret;
  
-         av_log(h->avctx, AV_LOG_INFO, "Reinit context to %dx%d, "
+         av_log(h->avctx, AV_LOG_VERBOSE, "Reinit context to %dx%d, "
 -               "pix_fmt: %d\n", h->width, h->height, h->avctx->pix_fmt);
 +               "pix_fmt: %s\n", h->width, h->height, av_get_pix_fmt_name(h->avctx->pix_fmt));
  
          if ((ret = h264_slice_header_init(h)) < 0) {
              av_log(h->avctx, AV_LOG_ERROR,
@@@ -1444,33 -1228,8 +1443,16 @@@
              return ret;
          }
      }
-     if (!h->context_initialized) {
-         if (sl != h->slice_ctx) {
-             av_log(h->avctx, AV_LOG_ERROR,
-                    "Cannot (re-)initialize context during parallel decoding.\n");
-             return AVERROR_PATCHWELCOME;
-         }
- 
-         if ((ret = get_pixel_format(h, 1)) < 0)
-             return ret;
-         h->avctx->pix_fmt = ret;
- 
-         if ((ret = h264_slice_header_init(h)) < 0) {
-             av_log(h->avctx, AV_LOG_ERROR,
-                    "h264_slice_header_init() failed\n");
-             return ret;
-         }
-     }
  
      frame_num = get_bits(&sl->gb, sps->log2_max_frame_num);
 +    if (!first_slice) {
 +        if (h->poc.frame_num != frame_num) {
 +            av_log(h->avctx, AV_LOG_ERROR, "Frame num change from %d to %d\n",
 +                   h->poc.frame_num, frame_num);
 +            return AVERROR_INVALIDDATA;
 +        }
 +    }
 +
      if (!h->setup_finished)
          h->poc.frame_num = frame_num;
  



More information about the ffmpeg-cvslog mailing list