[FFmpeg-cvslog] crystalhd: We don't need the track the last picture number anymore

Philip Langdale git at videolan.org
Wed Nov 2 22:50:40 EET 2016


ffmpeg | branch: master | Philip Langdale <philipl at overt.org> | Sun Oct 16 11:01:40 2016 -0700| [89ba55dc0dfa5495be6e68d13a60de44560129af] | committer: Philip Langdale

crystalhd: We don't need the track the last picture number anymore

This was needed to detect an interlaced failure case that doesn't
happen with the new decode api.

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

 libavcodec/crystalhd.c | 40 ----------------------------------------
 1 file changed, 40 deletions(-)

diff --git a/libavcodec/crystalhd.c b/libavcodec/crystalhd.c
index d738ddb..3db0e17 100644
--- a/libavcodec/crystalhd.c
+++ b/libavcodec/crystalhd.c
@@ -133,8 +133,6 @@ typedef struct {
     uint8_t is_nal;
     uint8_t need_second_field;
 
-    uint64_t last_picture;
-
     OpaqueList *head;
     OpaqueList *tail;
 
@@ -310,7 +308,6 @@ static void flush(AVCodecContext *avctx)
 {
     CHDContext *priv = avctx->priv_data;
 
-    priv->last_picture      = -1;
     priv->need_second_field = 0;
 
     av_frame_unref (priv->pic);
@@ -446,7 +443,6 @@ static av_cold int init(AVCodecContext *avctx)
     priv               = avctx->priv_data;
     priv->avctx        = avctx;
     priv->is_nal       = avctx->extradata_size > 0 && *(avctx->extradata) == 1;
-    priv->last_picture = -1;
     priv->pic          = av_frame_alloc();
 
     subtype = id2subtype(priv, avctx->codec->id);
@@ -609,19 +605,6 @@ static inline CopyRet copy_frame(AVCodecContext *avctx,
        return RET_ERROR;
     }
 
-    /*
-     * If we got a false negative for interlaced on the first field,
-     * we will realise our mistake here when we see that the picture number is that
-     * of the previous picture. We cannot recover the frame and should discard the
-     * second field to keep the correct number of output frames.
-     */
-    if (output->PicInfo.picture_number == priv->last_picture && !priv->need_second_field) {
-        av_log(avctx, AV_LOG_WARNING,
-               "Incorrectly guessed progressive frame. Discarding second field\n");
-        /* Returning without providing a picture. */
-        return RET_OK;
-    }
-
     interlaced = output->PicInfo.flags & VDEC_FLAG_INTERLACED_SRC;
 
     av_log(avctx, AV_LOG_VERBOSE, "Interlaced state: %d\n",
@@ -786,42 +769,19 @@ static inline CopyRet receive_frame(AVCodecContext *avctx,
     } else if (ret == BC_STS_SUCCESS) {
         int copy_ret = -1;
         if (output.PoutFlags & BC_POUT_FLAGS_PIB_VALID) {
-            if (priv->last_picture == -1) {
-                /*
-                 * Init to one less, so that the incrementing code doesn't
-                 * need to be special-cased.
-                 */
-                priv->last_picture = output.PicInfo.picture_number - 1;
-            }
-
             if (avctx->codec->id == AV_CODEC_ID_MPEG4 &&
                 output.PicInfo.timeStamp == 0 && priv->bframe_bug) {
                 if (!priv->bframe_bug) {
                     av_log(avctx, AV_LOG_VERBOSE,
                            "CrystalHD: Not returning packed frame twice.\n");
                 }
-                priv->last_picture++;
                 DtsReleaseOutputBuffs(dev, NULL, FALSE);
                 return RET_COPY_AGAIN;
             }
 
             print_frame_info(priv, &output);
 
-            if (priv->last_picture + 1 < output.PicInfo.picture_number) {
-                av_log(avctx, AV_LOG_WARNING,
-                       "CrystalHD: Picture Number discontinuity\n");
-                /*
-                 * XXX: I have no idea what the semantics of this situation
-                 * are so I don't even know if we've lost frames or which
-                 * ones.
-                 */
-               priv->last_picture = output.PicInfo.picture_number - 1;
-            }
-
             copy_ret = copy_frame(avctx, &output, data, got_frame);
-            if (*got_frame > 0) {
-                priv->last_picture++;
-            }
         } else {
             /*
              * An invalid frame has been consumed.



More information about the ffmpeg-cvslog mailing list