Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mpc-hc/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-02-23 21:14:59 +0400
committerMichael Niedermayer <michaelni@gmx.at>2014-02-23 21:14:59 +0400
commit42361bdf51c4495ca71a532efbb7769475c1822c (patch)
treebc5a4968d1c37d00810656d96de254ed8bb343b3 /libavcodec
parent5642dd41ccb91284f2f606c62b21acba2262fbf9 (diff)
avcodec/mpegvideo: fix buffer clear code so it should work with negative linesizes
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/mpegvideo.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c
index ebaeedd08b..441e7fc8f3 100644
--- a/libavcodec/mpegvideo.c
+++ b/libavcodec/mpegvideo.c
@@ -1774,14 +1774,15 @@ int ff_MPV_frame_start(MpegEncContext *s, AVCodecContext *avctx)
return -1;
}
- memset(s->last_picture_ptr->f.data[0], 0x80,
- 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]);
+ for(i=0; i<avctx->height; i++)
+ memset(s->last_picture_ptr->f.data[0] + s->last_picture_ptr->f.linesize[0]*i,
+ 0x80, avctx->width);
+ for(i=0; i<FF_CEIL_RSHIFT(avctx->height, v_chroma_shift); i++) {
+ memset(s->last_picture_ptr->f.data[1] + s->last_picture_ptr->f.linesize[1]*i,
+ 0x80, FF_CEIL_RSHIFT(avctx->width, h_chroma_shift));
+ memset(s->last_picture_ptr->f.data[2] + s->last_picture_ptr->f.linesize[2]*i,
+ 0x80, FF_CEIL_RSHIFT(avctx->width, h_chroma_shift));
+ }
if(s->codec_id == AV_CODEC_ID_FLV1 || s->codec_id == AV_CODEC_ID_H263){
for(i=0; i<avctx->height; i++)