]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/vp8.c
Merge remote-tracking branch 'qatar/master'
[ffmpeg] / libavcodec / vp8.c
index 07e5b61fcd4199248017645caa8649d205e6f9f8..dfaa4cde4f2ace063459c0ea33d3cd26bb76be8d 100644 (file)
@@ -108,7 +108,7 @@ static void vp8_decode_flush(AVCodecContext *avctx)
 
 static int update_dimensions(VP8Context *s, int width, int height)
 {
-    if (width  != s->avctx->width ||
+    if (width  != s->avctx->width || ((width+15)/16 != s->mb_width || (height+15)/16 != s->mb_height) && s->macroblocks_base ||
         height != s->avctx->height) {
         if (av_image_check_size(width, height, 0, s->avctx))
             return AVERROR_INVALIDDATA;
@@ -333,7 +333,7 @@ static int decode_frame_header(VP8Context *s, const uint8_t *buf, int buf_size)
     }
 
     if (!s->macroblocks_base || /* first frame */
-        width != s->avctx->width || height != s->avctx->height) {
+        width != s->avctx->width || height != s->avctx->height || (width+15)/16 != s->mb_width || (height+15)/16 != s->mb_height) {
         if ((ret = update_dimensions(s, width, height)) < 0)
             return ret;
     }
@@ -1834,6 +1834,8 @@ static int vp8_decode_update_thread_context(AVCodecContext *dst, const AVCodecCo
         (s_src->mb_width != s->mb_width || s_src->mb_height != s->mb_height)) {
         free_buffers(s);
         s->maps_are_invalid = 1;
+        s->mb_width  = s_src->mb_width;
+        s->mb_height = s_src->mb_height;
     }
 
     s->prob[0] = s_src->prob[!s_src->update_probabilities];