[FFmpeg-cvslog] motion_est: fix some signed overflows

Mans Rullgard git at videolan.org
Mon Mar 19 05:30:32 CET 2012


ffmpeg | branch: release/0.8 | Mans Rullgard <mans at mansr.com> | Sat Oct  8 13:52:44 2011 +0100| [fe3314a4137682bd7556d8c20798ea9e45f9863f] | committer: Reinhard Tartler

motion_est: fix some signed overflows

Signed-off-by: Mans Rullgard <mans at mansr.com>
(cherry picked from commit e708afd3c026a9eb547dab07781320a7e2564312)

Signed-off-by: Anton Khirnov <anton at khirnov.net>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=fe3314a4137682bd7556d8c20798ea9e45f9863f
---

 libavcodec/motion_est.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavcodec/motion_est.c b/libavcodec/motion_est.c
index 5f10456..72184ed 100644
--- a/libavcodec/motion_est.c
+++ b/libavcodec/motion_est.c
@@ -1040,7 +1040,7 @@ void ff_estimate_p_frame_motion(MpegEncContext * s,
     /* intra / predictive decision */
     pix = c->src[0][0];
     sum = s->dsp.pix_sum(pix, s->linesize);
-    varc = s->dsp.pix_norm1(pix, s->linesize) - (((unsigned)(sum*sum))>>8) + 500;
+    varc = s->dsp.pix_norm1(pix, s->linesize) - (((unsigned)sum*sum)>>8) + 500;
 
     pic->mb_mean[s->mb_stride * mb_y + mb_x] = (sum+128)>>8;
     pic->mb_var [s->mb_stride * mb_y + mb_x] = (varc+128)>>8;
@@ -1202,7 +1202,7 @@ void ff_estimate_p_frame_motion(MpegEncContext * s,
         if((c->avctx->mb_cmp&0xFF)==FF_CMP_SSE){
             intra_score= varc - 500;
         }else{
-            int mean= (sum+128)>>8;
+            unsigned mean = (sum+128)>>8;
             mean*= 0x01010101;
 
             for(i=0; i<16; i++){



More information about the ffmpeg-cvslog mailing list