changeset 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 e9bfaabcf07d
children 8c8c3b6ff8c1
files motion_est.c mpegvideo.c
diffstat 2 files changed, 4 insertions(+), 6 deletions(-) [+]
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);
--- a/mpegvideo.c	Thu Oct 31 00:07:13 2002 +0000
+++ b/mpegvideo.c	Thu Oct 31 00:48:05 2002 +0000
@@ -2590,11 +2590,10 @@
                     int varc;
                     int 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;
 
                     s->mb_var [s->mb_width * mb_y + mb_x] = varc;
-                    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;
                 }
             }