]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/flashsv2enc.c
lavfi/hflip: copy palette data in start_frame()
[ffmpeg] / libavcodec / flashsv2enc.c
index fd7f5c72768f32b72af0bef6d5caf1aebf197df4..8ab904616e3f780ebdb5edf674aecfb9de24d0a8 100644 (file)
@@ -192,6 +192,11 @@ static av_cold int flashsv2_encode_init(AVCodecContext * avctx)
                "Input dimensions too large, input must be max 4096x4096 !\n");
         return -1;
     }
+    if ((avctx->width < 16) || (avctx->height < 16)) {
+        av_log(avctx, AV_LOG_ERROR,
+               "Input dimensions too small, input must be at least 16x16 !\n");
+        return -1;
+    }
 
     if (av_image_check_size(avctx->width, avctx->height, 0, avctx) < 0)
         return -1;
@@ -205,6 +210,11 @@ static av_cold int flashsv2_encode_init(AVCodecContext * avctx)
     s->block_width  = (s->image_width /  12) & ~15;
     s->block_height = (s->image_height / 12) & ~15;
 
+    if(!s->block_width)
+        s->block_width = 1;
+    if(!s->block_height)
+        s->block_height = 1;
+
     s->rows = (s->image_height + s->block_height - 1) / s->block_height;
     s->cols = (s->image_width +  s->block_width -  1) / s->block_width;