summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMonty <xiphmont@xiph.org>2010-03-26 06:51:41 +0000
committerMonty <xiphmont@xiph.org>2010-03-26 06:51:41 +0000
commitfdbde9a241d18af61b6561d3cd1faf39f09e49b4 (patch)
treeeb589a08136595c7e8e52d7f647651af57c34b0f
parent82365f9c7cf8a553db0a56c60657dc8a167e9b9a (diff)
downloadlibvorbis-git-fdbde9a241d18af61b6561d3cd1faf39f09e49b4.tar.gz
OK, desired floor fit behavior settled
svn path=/trunk/vorbis/; revision=17079
-rw-r--r--lib/floor1.c31
1 files changed, 8 insertions, 23 deletions
diff --git a/lib/floor1.c b/lib/floor1.c
index 99358880..d5357b76 100644
--- a/lib/floor1.c
+++ b/lib/floor1.c
@@ -470,27 +470,20 @@ static int accumulate_fit(const float *flr,const float *mdct,
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;
-
- xb+=a[i].xb;
- yb+=a[i].yb;
- x2b+=a[i].x2b;
- y2b+=a[i].y2b;
- xyb+=a[i].xyb;
- bn+=a[i].bn;
+ double weight = (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;
}
if(*y0>=0){
@@ -511,14 +504,6 @@ static int fit_line(lsfit_acc *a,int fits,int *y0,int *y1,
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);