aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMans Rullgard <mans@mansr.com>2011-10-08 13:52:44 +0100
committerMans Rullgard <mans@mansr.com>2011-10-08 20:03:55 +0100
commite708afd3c026a9eb547dab07781320a7e2564312 (patch)
tree31aed7deebc8bb4a0b1e1bd91a3fa63ab9de9b89
parent559c244d42be7a02c23976216b47fd63b80d6c7f (diff)
motion_est: fix some signed overflows
Signed-off-by: Mans Rullgard <mans@mansr.com>
-rw-r--r--libavcodec/motion_est.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/libavcodec/motion_est.c b/libavcodec/motion_est.c
index 4ad47faf66..d0f93673ac 100644
--- a/libavcodec/motion_est.c
+++ b/libavcodec/motion_est.c
@@ -1016,7 +1016,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;
@@ -1178,7 +1178,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++){