[Ffmpeg-devel] [PATCH] Fix MPEG-2 motion_est.c

Christophe Massiot cmassiot
Mon Aug 1 17:09:28 CEST 2005


Hello,

Revision 1.107 of motion_est.c breaks MPEG-2 encoding when
avctx->me_range == 0, with an assert error (range <=256 || !(s->codec_id
== CODEC_ID_MPEG2VIDEO && s->avctx->strict_std_compliance >=
FF_COMPLIANCE_NORMAL))

Attached patch (or anything equivalent) should fix it.

-- 
Christophe Massiot                  Freebox S.A.
-------------- next part --------------
Index: libavcodec/motion_est.c
===================================================================
RCS file: /cvsroot/ffmpeg/ffmpeg/libavcodec/motion_est.c,v
retrieving revision 1.107
diff -u -r1.107 motion_est.c
--- libavcodec/motion_est.c	27 Jul 2005 13:16:35 -0000	1.107
+++ libavcodec/motion_est.c	1 Aug 2005 14:40:15 -0000
@@ -1891,15 +1891,21 @@
 {
     if(s->me_method>=ME_EPZS){
         int score[8];
-        int i, y, range= s->avctx->me_range;
+        int i, y, range= 0;
         uint8_t * fcode_tab= s->fcode_tab;
         int best_fcode=-1;
         int best_score=-10000000;
 
         if(s->msmpeg4_version) 
-            range= FFMIN(range, 16);
+            range= 16;
         else if(s->codec_id == CODEC_ID_MPEG2VIDEO && s->avctx->strict_std_compliance >= FF_COMPLIANCE_NORMAL)
-            range= FFMIN(range, 256);
+            range= 256;
+        if(s->avctx->me_range){
+            if(range)
+                range= FFMIN(range, s->avctx->me_range);
+            else
+                range= s->avctx->me_range;
+        }
 
         for(i=0; i<8; i++) score[i]= s->mb_num*(8-i);
 



More information about the ffmpeg-devel mailing list