]> git.sesse.net Git - ffmpeg/commitdiff
h264: eliminate low_delay
authorAnton Khirnov <anton@khirnov.net>
Mon, 11 Apr 2016 13:38:42 +0000 (15:38 +0200)
committerAnton Khirnov <anton@khirnov.net>
Sun, 24 Apr 2016 08:06:24 +0000 (10:06 +0200)
It is always unconditionally initialized in decode_postinit() and then
immediately used in one place further below. All the other places where
it is accessed are just useless fluff.

libavcodec/h264.c
libavcodec/h264.h
libavcodec/h264_slice.c

index 434d561c0ea24f9c8b60be31237f8d0dcb612b26..47e3c935170092027f9d0224d2466e2d29646b4d 100644 (file)
@@ -334,10 +334,6 @@ av_cold int ff_h264_decode_init(AVCodecContext *avctx)
     if (ret < 0)
         return ret;
 
-    /* set defaults */
-    if (!avctx->has_b_frames)
-        h->low_delay = 1;
-
     ret = ff_thread_once(&h264_vlc_init, ff_h264_decode_init_vlc);
     if (ret != 0) {
         av_log(avctx, AV_LOG_ERROR, "pthread_once has failed.");
@@ -363,7 +359,6 @@ av_cold int ff_h264_decode_init(AVCodecContext *avctx)
     if (h->ps.sps && h->ps.sps->bitstream_restriction_flag &&
         h->avctx->has_b_frames < h->ps.sps->num_reorder_frames) {
         h->avctx->has_b_frames = h->ps.sps->num_reorder_frames;
-        h->low_delay           = 0;
     }
 
     avctx->internal->allocate_progress = 1;
@@ -581,7 +576,6 @@ static void decode_postinit(H264Context *h, int setup_finished)
         h->avctx->strict_std_compliance >= FF_COMPLIANCE_NORMAL) {
         h->avctx->has_b_frames = FFMAX(h->avctx->has_b_frames, sps->num_reorder_frames);
     }
-    h->low_delay = !h->avctx->has_b_frames;
 
     pics = 0;
     while (h->delayed_pic[pics])
@@ -646,12 +640,10 @@ static void decode_postinit(H264Context *h, int setup_finished)
         if (invalid + cnt < MAX_DELAYED_PIC_COUNT) {
             h->avctx->has_b_frames = FFMAX(h->avctx->has_b_frames, cnt);
         }
-        h->low_delay = 0;
-    } else if (h->low_delay &&
+    } else if (!h->avctx->has_b_frames &&
                ((h->next_outputed_poc != INT_MIN &&
                  out->poc > h->next_outputed_poc + 2) ||
                 cur->f->pict_type == AV_PICTURE_TYPE_B)) {
-        h->low_delay = 0;
         h->avctx->has_b_frames++;
     }
 
index f551d79209a56456e9247048336bcf062019662e..55c31f61b6d0ee0f3c21dc025e6df6906397ae15 100644 (file)
@@ -470,7 +470,6 @@ typedef struct H264Context {
 
     int droppable;
     int coded_picture_number;
-    int low_delay;
 
     int context_initialized;
     int flags;
index 1251ff576f40dfe25e28d0d460f1c593eacece37..fda6d3225ee85884b1035653005c2640c0427aac 100644 (file)
@@ -378,7 +378,6 @@ int ff_h264_update_thread_context(AVCodecContext *dst,
     h->first_field          = h1->first_field;
     h->picture_structure    = h1->picture_structure;
     h->droppable            = h1->droppable;
-    h->low_delay            = h1->low_delay;
 
     for (i = 0; i < H264_MAX_PICTURE_COUNT; i++) {
         ff_h264_unref_picture(h, &h->DPB[i]);
@@ -397,7 +396,6 @@ int ff_h264_update_thread_context(AVCodecContext *dst,
 
     h->enable_er       = h1->enable_er;
     h->workaround_bugs = h1->workaround_bugs;
-    h->low_delay       = h1->low_delay;
     h->droppable       = h1->droppable;
 
     // extradata/NAL handling
@@ -1014,20 +1012,6 @@ int ff_h264_decode_slice_header(H264Context *h, H264SliceContext *sl)
         if (h->bit_depth_luma    != h->ps.sps->bit_depth_luma ||
             h->chroma_format_idc != h->ps.sps->chroma_format_idc)
             needs_reinit         = 1;
-
-        if (h->flags & AV_CODEC_FLAG_LOW_DELAY ||
-            (h->ps.sps->bitstream_restriction_flag &&
-             !h->ps.sps->num_reorder_frames)) {
-            if (h->avctx->has_b_frames > 1 || h->delayed_pic[0])
-                av_log(h->avctx, AV_LOG_WARNING, "Delayed frames seen. "
-                       "Reenabling low delay requires a codec flush.\n");
-            else
-                h->low_delay = 1;
-        }
-
-        if (h->avctx->has_b_frames < 2)
-            h->avctx->has_b_frames = !h->low_delay;
-
     }
 
     pps = h->ps.pps;