diff motion_est.c @ 809:79de6308c34d libavcodec

fixing another assert q>0.0 issue caused by variance < 0, this fix allso changes the inter/intra decission very slightly -> all regression checksums need to be updated
author michaelni
date Thu, 31 Oct 2002 00:48:05 +0000
parents 0e1d375c537f
children f3c369b8ddca
line wrap: on
line diff
--- a/motion_est.c	Thu Oct 31 00:07:13 2002 +0000
+++ b/motion_est.c	Thu Oct 31 00:48:05 2002 +0000
@@ -1135,14 +1135,13 @@
     
     sum = pix_sum(pix, s->linesize);
     
-    sum= (sum+8)>>4;
-    varc = (pix_norm1(pix, s->linesize) - sum*sum + 500 + 128)>>8;
+    varc = (pix_norm1(pix, s->linesize) - (((unsigned)(sum*sum))>>8) + 500 + 128)>>8;
     vard = (pix_norm(pix, ppix, s->linesize)+128)>>8;
 
 //printf("%d %d %d %X %X %X\n", s->mb_width, mb_x, mb_y,(int)s, (int)s->mb_var, (int)s->mc_mb_var); fflush(stdout);
     s->mb_var   [s->mb_width * mb_y + mb_x] = varc;
     s->mc_mb_var[s->mb_width * mb_y + mb_x] = vard;
-    s->mb_mean  [s->mb_width * mb_y + mb_x] = (sum+7)>>4;
+    s->mb_mean  [s->mb_width * mb_y + mb_x] = (sum+128)>>8;
     s->mb_var_sum    += varc;
     s->mc_mb_var_sum += vard;
 //printf("E%d %d %d %X %X %X\n", s->mb_width, mb_x, mb_y,(int)s, (int)s->mb_var, (int)s->mc_mb_var); fflush(stdout);