[FFmpeg-devel] [PATCH] MpegEncContext must be initialized before calling ff_h263_decode_init

Reimar Döffinger Reimar.Doeffinger
Sat Jun 27 11:19:48 CEST 2009


Hello,
ff_h263_decode_init calls MPV_common_init which then need mb_width to
calculate mb_stride.
So my conclusion is, MpegEncContext needs to be initialized before
calling this function.
This is probably what issue1233 is about.

-------------- next part --------------
Index: libavcodec/vc1dec.c
===================================================================
--- libavcodec/vc1dec.c	(revision 19281)
+++ libavcodec/vc1dec.c	(working copy)
@@ -2997,12 +2997,19 @@
         avctx->idct_algo=FF_IDCT_WMV2;
     }
 
+    avctx->coded_width = avctx->width;
+    avctx->coded_height = avctx->height;
+
+    avctx->has_b_frames= !!(avctx->max_b_frames);
+    s->low_delay = !avctx->has_b_frames;
+
+    s->mb_width = (avctx->coded_width+15)>>4;
+    s->mb_height = (avctx->coded_height+15)>>4;
+
     if(ff_h263_decode_init(avctx) < 0)
         return -1;
     if (vc1_init_common(v) < 0) return -1;
 
-    avctx->coded_width = avctx->width;
-    avctx->coded_height = avctx->height;
     if (avctx->codec_id == CODEC_ID_WMV3)
     {
         int count = 0;
@@ -3072,12 +3079,7 @@
             return -1;
         }
     }
-    avctx->has_b_frames= !!(avctx->max_b_frames);
-    s->low_delay = !avctx->has_b_frames;
 
-    s->mb_width = (avctx->coded_width+15)>>4;
-    s->mb_height = (avctx->coded_height+15)>>4;
-
     /* Allocate mb bitplanes */
     v->mv_type_mb_plane = av_malloc(s->mb_stride * s->mb_height);
     v->direct_mb_plane = av_malloc(s->mb_stride * s->mb_height);



More information about the ffmpeg-devel mailing list