Browse code

vp56: don't reset dimensions to 0 in codec init

Originally committed as revision 16140 to svn://svn.ffmpeg.org/ffmpeg/trunk

Aurelien Jacobs authored on 2008/12/15 09:00:16
Showing 3 changed files
... ...
@@ -58,7 +58,8 @@ static int vp5_parse_header(VP56Context *s, const uint8_t *buf, int buf_size,
58 58
         vp56_rac_gets(c, 8);  /* number of displayed macroblock rows */
59 59
         vp56_rac_gets(c, 8);  /* number of displayed macroblock cols */
60 60
         vp56_rac_gets(c, 2);
61
-        if (16*cols != s->avctx->coded_width ||
61
+        if (!s->macroblocks || /* first frame */
62
+            16*cols != s->avctx->coded_width ||
62 63
             16*rows != s->avctx->coded_height) {
63 64
             avcodec_set_dimensions(s->avctx, 16*cols, 16*rows);
64 65
             return 2;
... ...
@@ -657,8 +657,6 @@ av_cold void vp56_init(AVCodecContext *avctx, int flip, int has_alpha)
657 657
     dsputil_init(&s->dsp, avctx);
658 658
     ff_init_scantable(s->dsp.idct_permutation, &s->scantable,ff_zigzag_direct);
659 659
 
660
-    avcodec_set_dimensions(avctx, 0, 0);
661
-
662 660
     for (i=0; i<4; i++)
663 661
         s->framep[i] = &s->frames[i];
664 662
     s->framep[VP56_FRAME_UNUSED] = s->framep[VP56_FRAME_GOLDEN];
... ...
@@ -75,7 +75,8 @@ static int vp6_parse_header(VP56Context *s, const uint8_t *buf, int buf_size,
75 75
         /* buf[4] is number of displayed macroblock rows */
76 76
         /* buf[5] is number of displayed macroblock cols */
77 77
 
78
-        if (16*cols != s->avctx->coded_width ||
78
+        if (!s->macroblocks || /* first frame */
79
+            16*cols != s->avctx->coded_width ||
79 80
             16*rows != s->avctx->coded_height) {
80 81
             avcodec_set_dimensions(s->avctx, 16*cols, 16*rows);
81 82
             if (s->avctx->extradata_size == 1) {