]> git.sesse.net Git - ffmpeg/commitdiff
mpegvideo: initialize dummy reference frames.
authorAnton Khirnov <anton@khirnov.net>
Wed, 30 Jan 2013 15:37:31 +0000 (16:37 +0100)
committerAnton Khirnov <anton@khirnov.net>
Wed, 6 Feb 2013 09:21:52 +0000 (10:21 +0100)
Do not rely on get_buffer initializing them.

Changes yadif tests (off by one in one border pixel), because yadif
reads from those uninitialized lines.

libavcodec/mpegvideo.c
tests/ref/fate/filter-yadif-mode1

index a4105a5dcddb5f2d713d3310167bc15475e7b87c..82bc57d1d94a11e66c06685d5258fb0afa1948a3 100644 (file)
@@ -1470,6 +1470,9 @@ int ff_MPV_frame_start(MpegEncContext *s, AVCodecContext *avctx)
              s->last_picture_ptr->f.data[0] == NULL) &&
             (s->pict_type != AV_PICTURE_TYPE_I ||
              s->picture_structure != PICT_FRAME)) {
+            int h_chroma_shift, v_chroma_shift;
+            av_pix_fmt_get_chroma_sub_sample(s->avctx->pix_fmt,
+                                             &h_chroma_shift, &v_chroma_shift);
             if (s->pict_type != AV_PICTURE_TYPE_I)
                 av_log(avctx, AV_LOG_ERROR,
                        "warning: first frame is no keyframe\n");
@@ -1488,6 +1491,16 @@ int ff_MPV_frame_start(MpegEncContext *s, AVCodecContext *avctx)
                 s->last_picture_ptr = NULL;
                 return -1;
             }
+
+            memset(s->last_picture_ptr->f.data[0], 0,
+                   avctx->height * s->last_picture_ptr->f.linesize[0]);
+            memset(s->last_picture_ptr->f.data[1], 0x80,
+                   (avctx->height >> v_chroma_shift) *
+                   s->last_picture_ptr->f.linesize[1]);
+            memset(s->last_picture_ptr->f.data[2], 0x80,
+                   (avctx->height >> v_chroma_shift) *
+                   s->last_picture_ptr->f.linesize[2]);
+
             ff_thread_report_progress(&s->last_picture_ptr->f, INT_MAX, 0);
             ff_thread_report_progress(&s->last_picture_ptr->f, INT_MAX, 1);
             s->last_picture_ptr->f.reference = 3;
index b4981377ef30971ba34f27ad35c4a29801e149de..8917019ea06a2cb67a3f20f36dbd7072b8e6b197 100644 (file)
@@ -34,7 +34,7 @@
 0,     180000,     180000,        0,   622080, 0xd0811094
 0,     183600,     183600,        0,   622080, 0x3039906f
 0,     187200,     187200,        0,   622080, 0xb04a3141
-0,     190800,     190800,        0,   622080, 0x52872cf9
+0,     190800,     190800,        0,   622080, 0x638d2cf5
 0,     194400,     194400,        0,   622080, 0x4ab84909
 0,     198000,     198000,        0,   622080, 0x82de12ee
 0,     201600,     201600,        0,   622080, 0xa0fcb8fb
@@ -42,7 +42,7 @@
 0,     208800,     208800,        0,   622080, 0x9003aebb
 0,     212400,     212400,        0,   622080, 0xffe6f770
 0,     216000,     216000,        0,   622080, 0x153faa3e
-0,     219600,     219600,        0,   622080, 0xb67f3233
+0,     219600,     219600,        0,   622080, 0xbf023231
 0,     223200,     223200,        0,   622080, 0xae724063
 0,     226800,     226800,        0,   622080, 0x15fe44b4
 0,     230400,     230400,        0,   622080, 0xeb4de77a
@@ -50,7 +50,7 @@
 0,     237600,     237600,        0,   622080, 0x209ed8c7
 0,     241200,     241200,        0,   622080, 0xb964d70f
 0,     244800,     244800,        0,   622080, 0xe2bbac96
-0,     248400,     248400,        0,   622080, 0x4f60f7f4
+0,     248400,     248400,        0,   622080, 0x57e3f7f2
 0,     252000,     252000,        0,   622080, 0xe945441e
 0,     255600,     255600,        0,   622080, 0xd0afb742
 0,     259200,     259200,        0,   622080, 0x8f8cbd5f
@@ -58,6 +58,6 @@
 0,     266400,     266400,        0,   622080, 0xbc3cf717
 0,     270000,     270000,        0,   622080, 0xb70b01a9
 0,     273600,     273600,        0,   622080, 0x0109f125
-0,     277200,     277200,        0,   622080, 0xcb3a371f
+0,     277200,     277200,        0,   622080, 0x5806371c
 0,     280800,     280800,        0,   622080, 0x230c373f
 0,     284400,     284400,        0,   622080, 0x82dfb1f2