]> git.sesse.net Git - ffmpeg/commitdiff
h263enc: test that dimensions are a multiple of 4
authorMichael Niedermayer <michaelni@gmx.at>
Sun, 13 May 2012 07:59:12 +0000 (09:59 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Sun, 13 May 2012 09:24:46 +0000 (11:24 +0200)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavcodec/mpegvideo_enc.c

index a10421ceccac40953dc10a393133e1f77f29a389..cba7d9d9a214d60745f16c57b6710067ff1a61df 100644 (file)
@@ -487,6 +487,13 @@ av_cold int ff_MPV_encode_init(AVCodecContext *avctx)
         av_log(avctx, AV_LOG_ERROR, "H.263 does not support resolutions above 2048x1152\n");
         return -1;
     }
+    if ((s->codec_id == CODEC_ID_H263  ||
+         s->codec_id == CODEC_ID_H263P) &&
+        ((avctx->width &3) ||
+         (avctx->height&3) )) {
+        av_log(avctx, AV_LOG_ERROR, "w/h must be a multiple of 4\n");
+        return -1;
+    }
 
     if ((s->flags & (CODEC_FLAG_INTERLACED_DCT | CODEC_FLAG_INTERLACED_ME)) &&
         s->codec_id != CODEC_ID_MPEG4 && s->codec_id != CODEC_ID_MPEG2VIDEO) {