aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2013-01-30 16:37:31 +0100
committerAnton Khirnov <anton@khirnov.net>2013-02-06 10:21:52 +0100
commit293065bdb56e603589ad8a29326406c39323e153 (patch)
tree8b7d35f90353ff2aea7330dd4f4c6f3033ec48a7 /libavcodec
parentdff6197dfb9b2d145729885c63f865c5fdd184aa (diff)
downloadffmpeg-293065bdb56e603589ad8a29326406c39323e153.tar.gz
mpegvideo: initialize dummy reference frames.
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.
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/mpegvideo.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c
index a4105a5dcd..82bc57d1d9 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[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;