Commit 42361bdf authored by Michael Niedermayer's avatar Michael Niedermayer

avcodec/mpegvideo: fix buffer clear code so it should work with negative linesizes

Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent 5642dd41
...@@ -1774,14 +1774,15 @@ int ff_MPV_frame_start(MpegEncContext *s, AVCodecContext *avctx) ...@@ -1774,14 +1774,15 @@ int ff_MPV_frame_start(MpegEncContext *s, AVCodecContext *avctx)
return -1; return -1;
} }
memset(s->last_picture_ptr->f.data[0], 0x80, for(i=0; i<avctx->height; i++)
avctx->height * s->last_picture_ptr->f.linesize[0]); memset(s->last_picture_ptr->f.data[0] + s->last_picture_ptr->f.linesize[0]*i,
memset(s->last_picture_ptr->f.data[1], 0x80, 0x80, avctx->width);
(avctx->height >> v_chroma_shift) * for(i=0; i<FF_CEIL_RSHIFT(avctx->height, v_chroma_shift); i++) {
s->last_picture_ptr->f.linesize[1]); memset(s->last_picture_ptr->f.data[1] + s->last_picture_ptr->f.linesize[1]*i,
memset(s->last_picture_ptr->f.data[2], 0x80, 0x80, FF_CEIL_RSHIFT(avctx->width, h_chroma_shift));
(avctx->height >> v_chroma_shift) * memset(s->last_picture_ptr->f.data[2] + s->last_picture_ptr->f.linesize[2]*i,
s->last_picture_ptr->f.linesize[2]); 0x80, FF_CEIL_RSHIFT(avctx->width, h_chroma_shift));
}
if(s->codec_id == AV_CODEC_ID_FLV1 || s->codec_id == AV_CODEC_ID_H263){ if(s->codec_id == AV_CODEC_ID_FLV1 || s->codec_id == AV_CODEC_ID_H263){
for(i=0; i<avctx->height; i++) for(i=0; i<avctx->height; i++)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment