From 5a7ca80f8af863f699303af9627632028e81191c Mon Sep 17 00:00:00 2001 From: Trevor Johnson Date: Tue, 28 Aug 2001 23:12:06 +0000 Subject: Avoid division by zero when encoding on the Alpha. Submitted by: Christian Weisgerber (maintainer) Obtained from: vorbis CVS --- audio/libvorbis/files/patch-lib_psy.c | 167 ++++++++++++++++++++++++++++++++++ 1 file changed, 167 insertions(+) create mode 100644 audio/libvorbis/files/patch-lib_psy.c diff --git a/audio/libvorbis/files/patch-lib_psy.c b/audio/libvorbis/files/patch-lib_psy.c new file mode 100644 index 000000000000..5d9cc6a4f8c6 --- /dev/null +++ b/audio/libvorbis/files/patch-lib_psy.c @@ -0,0 +1,167 @@ + +$FreeBSD$ + +--- lib/psy.c.orig Mon Aug 13 03:36:57 2001 ++++ lib/psy.c Tue Aug 28 01:47:19 2001 +@@ -594,95 +594,11 @@ + + } + +-static void bark_noise_pointmp(int n,const long *b, +- const float *f, +- float *noise, +- const int fixed){ +- long i,hi=0,lo=0,hif=0,lof=0; +- double xa=0,xb=0; +- double ya=0,yb=0; +- double x2a=0,x2b=0; +- double y2a=0,y2b=0; +- double xya=0,xyb=0; +- double na=0,nb=0; +- +- for(i=0;i>16; +- for(;hi0){ +- int bi=i+fixed/2; +- if(bi>n)bi=n; +- for(;hif0){ +- double denomf=1./(nb*x2b-xb*xb); +- double af=(yb*x2b-xyb*xb)*denomf; +- double bf=(nb*xyb-xb*yb)*denomf; +- double vb=af+bf*i; +- if(va>vb)va=vb; +- } +- +- noise[i]=va-140.f; +- } +- } +-} +- + static void bark_noise_hybridmp(int n,const long *b, +- const float *f, +- float *noise, +- const int fixed){ ++ const float *f, ++ float *noise, ++ const float offset, ++ const int fixed){ + long i,hi=0,lo=0,hif=0,lof=0; + double xa=0,xb=0; + double ya=0,yb=0; +@@ -699,7 +615,7 @@ + /* find new lo/hi */ + int bi=b[i]>>16; + for(;hi0.f){ + double nn= bin*bin; + nn*=nn; +@@ -716,7 +632,7 @@ + } + bi=b[i]&0xffff; + for(;lo0.f){ + double nn= bin*bin; + nn*=nn; +@@ -744,7 +660,7 @@ + if(bi>n)bi=n; + + for(;hif0.f){ + double nn= bin*bin; + nn*=nn; +@@ -762,7 +678,7 @@ + bi=i-(fixed+1)/2; + if(bi<0)bi=0; + for(;lof0.f){ + double nn= bin*bin; + nn*=nn; +@@ -817,7 +733,7 @@ + + } + +- noise[i]=va; ++ noise[i]=va-offset; + } + } + } +@@ -859,13 +775,13 @@ + if(p->vi->noisemaskp){ + float *work=alloca(n*sizeof(float)); + +- bark_noise_pointmp(n,p->bark,logmdct,logmask, +- -1); ++ bark_noise_hybridmp(n,p->bark,logmdct,logmask, ++ 140.,-1); + + for(i=0;ibark,work,logmask, ++ bark_noise_hybridmp(n,p->bark,work,logmask,0., + p->vi->noisewindowfixed); + + for(i=0;i