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            |   13 ++++
 tests/ref/fate/filter-yadif-mode0 |   60 +++++++++---------
 tests/ref/fate/filter-yadif-mode1 |  122 ++++++++++++++++++-------------------
 3 files changed, 104 insertions(+), 91 deletions(-)

diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c
index a4105a5..3fb382d 100644
--- a/libavcodec/mpegvideo.c
+++ b/libavcodec/mpegvideo.c
@@ -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[0], 0,
+                   (avctx->height >> v_chroma_shift) *
+                   s->last_picture_ptr->f.linesize[0]);
+            memset(s->last_picture_ptr->f.data[0], 0,
+                   (avctx->height >> v_chroma_shift) *
+                   s->last_picture_ptr->f.linesize[0]);
+
             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;
diff --git a/tests/ref/fate/filter-yadif-mode0 
b/tests/ref/fate/filter-yadif-mode0
index e260977..65046c6 100644
--- a/tests/ref/fate/filter-yadif-mode0
+++ b/tests/ref/fate/filter-yadif-mode0
@@ -1,32 +1,32 @@
 #tb 0: 1/180000
-0,      64800,      64800,        0,   622080, 0x4440caef
-0,      72000,      72000,        0,   622080, 0xce67e69d
-0,      79200,      79200,        0,   622080, 0x1dbdc653
-0,      86400,      86400,        0,   622080, 0x82c591d1
-0,      93600,      93600,        0,   622080, 0x8193740b
-0,     100800,     100800,        0,   622080, 0xcb219711
-0,     108000,     108000,        0,   622080, 0x1870783b
-0,     115200,     115200,        0,   622080, 0x7080590b
-0,     122400,     122400,        0,   622080, 0x6df4175d
-0,     129600,     129600,        0,   622080, 0x6b530e95
-0,     136800,     136800,        0,   622080, 0x7f9d66f7
-0,     144000,     144000,        0,   622080, 0x338cda81
+0,      64800,      64800,        0,   622080, 0x6331caee
+0,      72000,      72000,        0,   622080, 0xa459e690
+0,      79200,      79200,        0,   622080, 0xaa7ec647
+0,      86400,      86400,        0,   622080, 0x260b91c9
+0,      93600,      93600,        0,   622080, 0xdb9f7407
+0,     100800,     100800,        0,   622080, 0xdc0a970c
+0,     108000,     108000,        0,   622080, 0xc4097837
+0,     115200,     115200,        0,   622080, 0x38465907
+0,     122400,     122400,        0,   622080, 0x50761757
+0,     129600,     129600,        0,   622080, 0x9cb40e87
+0,     136800,     136800,        0,   622080, 0x730966f0
+0,     144000,     144000,        0,   622080, 0x7456da79
 0,     151200,     151200,        0,   622080, 0xb13797f8
-0,     158400,     158400,        0,   622080, 0xb51e7ca4
-0,     165600,     165600,        0,   622080, 0x353eed75
-0,     172800,     172800,        0,   622080, 0xf93e92b0
-0,     180000,     180000,        0,   622080, 0xd0811094
-0,     187200,     187200,        0,   622080, 0xb04a3141
-0,     194400,     194400,        0,   622080, 0x4ab84909
-0,     201600,     201600,        0,   622080, 0xa0fcb8fb
-0,     208800,     208800,        0,   622080, 0x9003aebb
-0,     216000,     216000,        0,   622080, 0x153faa3e
-0,     223200,     223200,        0,   622080, 0xae724063
-0,     230400,     230400,        0,   622080, 0xeb4de77a
-0,     237600,     237600,        0,   622080, 0x209ed8c7
-0,     244800,     244800,        0,   622080, 0xe2bbac96
-0,     252000,     252000,        0,   622080, 0xe945441e
-0,     259200,     259200,        0,   622080, 0x8f8cbd5f
-0,     266400,     266400,        0,   622080, 0xbc3cf717
-0,     273600,     273600,        0,   622080, 0x0109f125
-0,     280800,     280800,        0,   622080, 0x230c373f
+0,     158400,     158400,        0,   622080, 0xce727ca1
+0,     165600,     165600,        0,   622080, 0x4621ed73
+0,     172800,     172800,        0,   622080, 0x371b92b3
+0,     180000,     180000,        0,   622080, 0x220b1098
+0,     187200,     187200,        0,   622080, 0xe032313a
+0,     194400,     194400,        0,   622080, 0xc5254904
+0,     201600,     201600,        0,   622080, 0x9897b8f7
+0,     208800,     208800,        0,   622080, 0xa951aeb9
+0,     216000,     216000,        0,   622080, 0xfbe9aa3b
+0,     223200,     223200,        0,   622080, 0x24a54063
+0,     230400,     230400,        0,   622080, 0x8e75e77c
+0,     237600,     237600,        0,   622080, 0x344ad8c8
+0,     244800,     244800,        0,   622080, 0xaeafac98
+0,     252000,     252000,        0,   622080, 0xb6a2441d
+0,     259200,     259200,        0,   622080, 0xe3eebd5e
+0,     266400,     266400,        0,   622080, 0x67d8f718
+0,     273600,     273600,        0,   622080, 0x83c9f128
+0,     280800,     280800,        0,   622080, 0xcbd1373e
diff --git a/tests/ref/fate/filter-yadif-mode1 
b/tests/ref/fate/filter-yadif-mode1
index b498137..d643786 100644
--- a/tests/ref/fate/filter-yadif-mode1
+++ b/tests/ref/fate/filter-yadif-mode1
@@ -1,63 +1,63 @@
 #tb 0: 1/180000
-0,      64800,      64800,        0,   622080, 0x4440caef
-0,      68400,      68400,        0,   622080, 0xa5cea88b
-0,      72000,      72000,        0,   622080, 0xce67e69d
-0,      75600,      75600,        0,   622080, 0x9a57891f
-0,      79200,      79200,        0,   622080, 0x1dbdc653
-0,      82800,      82800,        0,   622080, 0xc171c0c5
-0,      86400,      86400,        0,   622080, 0x82c591d1
-0,      90000,      90000,        0,   622080, 0x20db9890
-0,      93600,      93600,        0,   622080, 0x8193740b
-0,      97200,      97200,        0,   622080, 0xdb181d52
-0,     100800,     100800,        0,   622080, 0xcb219711
-0,     104400,     104400,        0,   622080, 0xc2b913d1
-0,     108000,     108000,        0,   622080, 0x1870783b
-0,     111600,     111600,        0,   622080, 0xf1d9c5fb
-0,     115200,     115200,        0,   622080, 0x7080590b
-0,     118800,     118800,        0,   622080, 0x669c5775
-0,     122400,     122400,        0,   622080, 0x6df4175d
-0,     126000,     126000,        0,   622080, 0x01921a16
-0,     129600,     129600,        0,   622080, 0x6b530e95
-0,     133200,     133200,        0,   622080, 0xd5047bc9
-0,     136800,     136800,        0,   622080, 0x7f9d66f7
-0,     140400,     140400,        0,   622080, 0xa8b006eb
-0,     144000,     144000,        0,   622080, 0x338cda81
-0,     147600,     147600,        0,   622080, 0xf0e125a7
+0,      64800,      64800,        0,   622080, 0x6331caee
+0,      68400,      68400,        0,   622080, 0x420aa882
+0,      72000,      72000,        0,   622080, 0xa459e690
+0,      75600,      75600,        0,   622080, 0xab3a891d
+0,      79200,      79200,        0,   622080, 0xaa7ec647
+0,      82800,      82800,        0,   622080, 0x3922c0bc
+0,      86400,      86400,        0,   622080, 0x260b91c9
+0,      90000,      90000,        0,   622080, 0xda9a9881
+0,      93600,      93600,        0,   622080, 0xdb9f7407
+0,      97200,      97200,        0,   622080, 0x28991d46
+0,     100800,     100800,        0,   622080, 0xdc0a970c
+0,     104400,     104400,        0,   622080, 0x633013ca
+0,     108000,     108000,        0,   622080, 0xc4097837
+0,     111600,     111600,        0,   622080, 0x55c8c5f8
+0,     115200,     115200,        0,   622080, 0x38465907
+0,     118800,     118800,        0,   622080, 0x07015772
+0,     122400,     122400,        0,   622080, 0x50761757
+0,     126000,     126000,        0,   622080, 0x1f151a14
+0,     129600,     129600,        0,   622080, 0x9cb40e87
+0,     133200,     133200,        0,   622080, 0x74047bc6
+0,     136800,     136800,        0,   622080, 0x730966f0
+0,     140400,     140400,        0,   622080, 0x6abf06ee
+0,     144000,     144000,        0,   622080, 0x7456da79
+0,     147600,     147600,        0,   622080, 0xb02725a9
 0,     151200,     151200,        0,   622080, 0xb13797f8
-0,     154800,     154800,        0,   622080, 0x4afe2976
-0,     158400,     158400,        0,   622080, 0xb51e7ca4
-0,     162000,     162000,        0,   622080, 0x637fcbfe
-0,     165600,     165600,        0,   622080, 0x353eed75
-0,     169200,     169200,        0,   622080, 0xd9a8f5ac
-0,     172800,     172800,        0,   622080, 0xf93e92b0
-0,     176400,     176400,        0,   622080, 0x4540039f
-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,     194400,     194400,        0,   622080, 0x4ab84909
-0,     198000,     198000,        0,   622080, 0x82de12ee
-0,     201600,     201600,        0,   622080, 0xa0fcb8fb
-0,     205200,     205200,        0,   622080, 0x7e849cc9
-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,     223200,     223200,        0,   622080, 0xae724063
-0,     226800,     226800,        0,   622080, 0x15fe44b4
-0,     230400,     230400,        0,   622080, 0xeb4de77a
-0,     234000,     234000,        0,   622080, 0x380f8563
-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,     252000,     252000,        0,   622080, 0xe945441e
-0,     255600,     255600,        0,   622080, 0xd0afb742
-0,     259200,     259200,        0,   622080, 0x8f8cbd5f
-0,     262800,     262800,        0,   622080, 0xb9a15294
-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,     280800,     280800,        0,   622080, 0x230c373f
-0,     284400,     284400,        0,   622080, 0x82dfb1f2
+0,     154800,     154800,        0,   622080, 0xc8202977
+0,     158400,     158400,        0,   622080, 0xce727ca1
+0,     162000,     162000,        0,   622080, 0x9086cbfc
+0,     165600,     165600,        0,   622080, 0x4621ed73
+0,     169200,     169200,        0,   622080, 0x2004f5ac
+0,     172800,     172800,        0,   622080, 0x371b92b3
+0,     176400,     176400,        0,   622080, 0xcc3803a0
+0,     180000,     180000,        0,   622080, 0x220b1098
+0,     183600,     183600,        0,   622080, 0x4dc1906e
+0,     187200,     187200,        0,   622080, 0xe032313a
+0,     190800,     190800,        0,   622080, 0xc3142cf3
+0,     194400,     194400,        0,   622080, 0xc5254904
+0,     198000,     198000,        0,   622080, 0x763f12e8
+0,     201600,     201600,        0,   622080, 0x9897b8f7
+0,     205200,     205200,        0,   622080, 0x76179cc6
+0,     208800,     208800,        0,   622080, 0xa951aeb9
+0,     212400,     212400,        0,   622080, 0x5e2ef76c
+0,     216000,     216000,        0,   622080, 0xfbe9aa3b
+0,     219600,     219600,        0,   622080, 0xc605322f
+0,     223200,     223200,        0,   622080, 0x24a54063
+0,     226800,     226800,        0,   622080, 0x8c1744b5
+0,     230400,     230400,        0,   622080, 0x8e75e77c
+0,     234000,     234000,        0,   622080, 0xe6648562
+0,     237600,     237600,        0,   622080, 0x344ad8c8
+0,     241200,     241200,        0,   622080, 0xcd1fd70b
+0,     244800,     244800,        0,   622080, 0xaeafac98
+0,     248400,     248400,        0,   622080, 0x8eacf7f2
+0,     252000,     252000,        0,   622080, 0xb6a2441d
+0,     255600,     255600,        0,   622080, 0x9f71b742
+0,     259200,     259200,        0,   622080, 0xe3eebd5e
+0,     262800,     262800,        0,   622080, 0x654e5290
+0,     266400,     266400,        0,   622080, 0x67d8f718
+0,     270000,     270000,        0,   622080, 0x387b01a6
+0,     273600,     273600,        0,   622080, 0x83c9f128
+0,     277200,     277200,        0,   622080, 0x1cd8371f
+0,     280800,     280800,        0,   622080, 0xcbd1373e
+0,     284400,     284400,        0,   622080, 0xa1cdb1f2
-- 
1.7.10.4

_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to