]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/mpegvideo.c
Merge commit 'ee6280ca12696a67535ce2245c77190edc513794'
[ffmpeg] / libavcodec / mpegvideo.c
index ebaeedd08b21ae3c7bb2cf18f4b79cd7a1568a3e..3df13100e6d05bea548792173d6c85aef70b69ff 100644 (file)
@@ -1774,18 +1774,21 @@ 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]);
-
-        if(s->codec_id == AV_CODEC_ID_FLV1 || s->codec_id == AV_CODEC_ID_H263){
+        if (!avctx->hwaccel) {
             for(i=0; i<avctx->height; i++)
-            memset(s->last_picture_ptr->f.data[0] + s->last_picture_ptr->f.linesize[0]*i, 16, avctx->width);
+                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++)
+                memset(s->last_picture_ptr->f.data[0] + s->last_picture_ptr->f.linesize[0]*i, 16, avctx->width);
+            }
         }
 
         ff_thread_report_progress(&s->last_picture_ptr->tf, INT_MAX, 0);