fixing q>0.0 assert failure caused by overflow of variance for b frames
authorMichael Niedermayer <michaelni@gmx.at>
Wed, 30 Oct 2002 22:55:07 +0000 (22:55 +0000)
committerMichael Niedermayer <michaelni@gmx.at>
Wed, 30 Oct 2002 22:55:07 +0000 (22:55 +0000)
Originally committed as revision 1120 to svn://svn.ffmpeg.org/ffmpeg/trunk

libavcodec/motion_est.c

index f8064b1..547c619 100644 (file)
@@ -1558,7 +1558,7 @@ void ff_estimate_b_frame_motion(MpegEncContext * s,
             score=fbmin;
             type= MB_TYPE_BIDIR;
         }
-        score= (score*score + 128*256)>>16;
+        score= ((unsigned)(score*score + 128*256))>>16;
         s->mc_mb_var_sum += score;
         s->mc_mb_var[mb_y*s->mb_width + mb_x] = score; //FIXME use SSD
     }