[xiph-commits] r17078 - trunk/vorbis/lib

xiphmont at svn.xiph.org xiphmont at svn.xiph.org
Thu Mar 25 23:39:18 PDT 2010


Author: xiphmont
Date: 2010-03-25 23:39:18 -0700 (Thu, 25 Mar 2010)
New Revision: 17078

Modified:
   trunk/vorbis/lib/floor1.c
Log:
reinstantiate floor1 weighting changes.



Modified: trunk/vorbis/lib/floor1.c
===================================================================
--- trunk/vorbis/lib/floor1.c	2010-03-26 06:22:19 UTC (rev 17077)
+++ trunk/vorbis/lib/floor1.c	2010-03-26 06:39:18 UTC (rev 17078)
@@ -470,28 +470,27 @@
 
 static int fit_line(lsfit_acc *a,int fits,int *y0,int *y1,
                     vorbis_info_floor1 *info){
+  double weight;
+  double xa=0,ya=0,x2a=0,y2a=0,xya=0,an=0;
   double xb=0,yb=0,x2b=0,y2b=0,xyb=0,bn=0;
   int i;
   int x0=a[0].x0;
   int x1=a[fits-1].x1;
 
   for(i=0;i<fits;i++){
+    xa+=a[i].xa;
+    ya+=a[i].ya;
+    x2a+=a[i].x2a;
+    y2a+=a[i].y2a;
+    xya+=a[i].xya;
+    an+=a[i].an;
 
-    /* This process is a bit odd as I'm preserving the weighting
-       behavior of 1.2.3 for now.  Although I can hear no difference,
-       what appears to be a better more straightforward weighting
-       slightly drops PEAQ and increases bitrate.  For that reason,
-       I'm preserving the old behavior until I can explain why the
-       bettwer weighting measures poorly. */
-
-    double weight = floor((a[i].bn+a[i].an)*info->twofitweight/(a[i].an+1))+1.;
-
-    xb+=a[i].xb + a[i].xa * weight;
-    yb+=a[i].yb + a[i].ya * weight;
-    x2b+=a[i].x2b + a[i].x2a * weight;
-    y2b+=a[i].y2b + a[i].y2a * weight;
-    xyb+=a[i].xyb + a[i].xya * weight;
-    bn+=a[i].bn + a[i].an * weight;
+    xb+=a[i].xb;
+    yb+=a[i].yb;
+    x2b+=a[i].x2b;
+    y2b+=a[i].y2b;
+    xyb+=a[i].xyb;
+    bn+=a[i].bn;
   }
 
   if(*y0>=0){
@@ -512,6 +511,14 @@
     bn++;
   }
 
+  weight = (bn+an)*info->twofitweight/(an+1)+1.;
+  xb += xa * weight;
+  yb += ya * weight;
+  x2b += x2a * weight;
+  y2b += y2a * weight;
+  xyb += xya * weight;
+  bn += an * weight;
+
   {
     double denom=(bn*x2b-xb*xb);
 



More information about the commits mailing list