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.
This commit is contained in:
Anton Khirnov 2013-01-30 16:37:31 +01:00
parent dff6197dfb
commit 293065bdb5
2 changed files with 17 additions and 4 deletions

View 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;

View 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