[xiph-cvs] cvs commit: vorbis/lib lsp.c mdct.c os.h
Jack Moffitt
jack at xiph.org
Thu Oct 19 14:56:42 PDT 2000
jack 00/10/19 14:56:41
Modified: lib Tag: branch_beta3 lsp.c mdct.c os.h
Log:
merged yesterdays optimizations with yesterday's other optimizations :)
also commited Chris Hanson's fix :)
Revision Changes Path
No revision
No revision
1.10.2.2 +11 -5 vorbis/lib/lsp.c
Index: lsp.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/lsp.c,v
retrieving revision 1.10.2.1
retrieving revision 1.10.2.2
diff -u -r1.10.2.1 -r1.10.2.2
--- lsp.c 2000/10/19 10:21:02 1.10.2.1
+++ lsp.c 2000/10/19 21:56:40 1.10.2.2
@@ -12,7 +12,7 @@
********************************************************************
function: LSP (also called LSF) conversion routines
- last mod: $Id: lsp.c,v 1.10.2.1 2000/10/19 10:21:02 xiphmont Exp $
+ last mod: $Id: lsp.c,v 1.10.2.2 2000/10/19 21:56:40 jack Exp $
The LSP generation code is taken (with minimal modification) from
"On the Computation of the LSP Frequencies" by Joseph Rothweiler
@@ -77,9 +77,14 @@
float p=.7071067812;
float q=.7071067812;
float w=vorbis_coslook(wdel*k);
+ float *ftmp=lsp;
+ int c=m>>1;
- for(j=0;j<m;j+=2) p *= lsp[j]-w;
- for(j=1;j<m;j+=2) q *= lsp[j]-w;
+ do{
+ p*=ftmp[0]-w;
+ q*=ftmp[1]-w;
+ ftmp+=2;
+ }while(--c);
q=frexp(p*p*(1.+w)+q*q*(1.-w),&qexp);
q=vorbis_fromdBlook(amp*
@@ -87,8 +92,9 @@
vorbis_invsq2explook(qexp+m)-
ampoffset);
- curve[i++]=q;
- while(map[i]==k)curve[i++]=q;
+ do{
+ curve[i++]=q;
+ }while(map[i]==k);
}
vorbis_fpu_restore(fpu);
}
1.17.2.1 +52 -16 vorbis/lib/mdct.c
Index: mdct.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/mdct.c,v
retrieving revision 1.17
retrieving revision 1.17.2.1
diff -u -r1.17 -r1.17.2.1
--- mdct.c 2000/10/12 03:12:53 1.17
+++ mdct.c 2000/10/19 21:56:40 1.17.2.1
@@ -13,7 +13,7 @@
function: normalized modified discrete cosine transform
power of two length transform only [16 <= n ]
- last mod: $Id: mdct.c,v 1.17 2000/10/12 03:12:53 xiphmont Exp $
+ last mod: $Id: mdct.c,v 1.17.2.1 2000/10/19 21:56:40 jack Exp $
Algorithm adapted from _The use of multirate filter banks for coding
of high quality digital audio_, by T. Sporer, K. Brandenburg and
@@ -108,21 +108,17 @@
float *w2=w+n4;
float *A=init->trig+n2;
- for(i=0;i<n4;){
- float x0=*xA - *xB;
- float x1;
+ float x0,x1;
+ i=0;
+ do{
+ x0=*xA - *xB;
w2[i]= *xA++ + *xB++;
-
-
x1= *xA - *xB;
A-=4;
-
w[i++]= x0 * A[0] + x1 * A[1];
w[i]= x1 * A[0] - x0 * A[1];
-
w2[i++]= *xA++ + *xB++;
-
- }
+ }while(i<n4);
}
/* step 3 */
@@ -141,21 +137,60 @@
int w2=w1-(k0>>1);
float AEv= A[0],wA;
float AOv= A[1],wB;
+ int blah=1;
wbase-=2;
k0++;
- for(s=0;s<(2<<i);s++){
+ blah--;
+ if(blah>0){
+ s=2<<blah;
+ s>>=1;
+ do{
wB =w[w1] -w[w2];
x[w1] =w[w1] +w[w2];
-
wA =w[++w1] -w[++w2];
x[w1] =w[w1] +w[w2];
-
x[w2] =wA*AEv - wB*AOv;
x[w2-1]=wB*AEv + wA*AOv;
-
w1-=k0;
w2-=k0;
+ wB =w[w1] -w[w2];
+ x[w1] =w[w1] +w[w2];
+ wA =w[++w1] -w[++w2];
+ x[w1] =w[w1] +w[w2];
+ x[w2] =wA*AEv - wB*AOv;
+ x[w2-1]=wB*AEv + wA*AOv;
+ w1-=k0;
+ w2-=k0;
+ wB =w[w1] -w[w2];
+ x[w1] =w[w1] +w[w2];
+ wA =w[++w1] -w[++w2];
+ x[w1] =w[w1] +w[w2];
+ x[w2] =wA*AEv - wB*AOv;
+ x[w2-1]=wB*AEv + wA*AOv;
+ w1-=k0;
+ w2-=k0;
+ wB =w[w1] -w[w2];
+ x[w1] =w[w1] +w[w2];
+ wA =w[++w1] -w[++w2];
+ x[w1] =w[w1] +w[w2];
+ x[w2] =wA*AEv - wB*AOv;
+ x[w2-1]=wB*AEv + wA*AOv;
+ w1-=k0;
+ w2-=k0;
+ }while(--s);
+ }else{
+ s=2<<i;
+ do{
+ wB =w[w1] -w[w2];
+ x[w1] =w[w1] +w[w2];
+ wA =w[++w1] -w[++w2];
+ x[w1] =w[w1] +w[w2];
+ x[w2] =wA*AEv - wB*AOv;
+ x[w2-1]=wB*AEv + wA*AOv;
+ w1-=k0;
+ w2-=k0;
+ }while(--s);
}
k0--;
@@ -174,7 +209,8 @@
int *bit=init->bitrev;
float *x1=x;
float *x2=x+n2-1;
- for(i=0;i<n8;i++){
+ i=n8-1;
+ do{
int t1=*bit++;
int t2=*bit++;
@@ -192,7 +228,7 @@
*x2--=(-wD+wBCO-wACE)*.5;
*x1++=( wD+wBCO-wACE)*.5;
*x2--=( wC-wACO-wBCE)*.5;
- }
+ }while(i--);
}
return(x);
}
1.10.2.2 +2 -2 vorbis/lib/os.h
Index: os.h
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/os.h,v
retrieving revision 1.10.2.1
retrieving revision 1.10.2.2
diff -u -r1.10.2.1 -r1.10.2.2
--- os.h 2000/10/19 10:21:02 1.10.2.1
+++ os.h 2000/10/19 21:56:41 1.10.2.2
@@ -14,7 +14,7 @@
********************************************************************
function: #ifdef jail to whip a few platforms into the UNIX ideal.
- last mod: $Id: os.h,v 1.10.2.1 2000/10/19 10:21:02 xiphmont Exp $
+ last mod: $Id: os.h,v 1.10.2.2 2000/10/19 21:56:41 jack Exp $
********************************************************************/
@@ -102,7 +102,7 @@
}
-typedef vorbis_fpu_control int;
+typedef int vorbis_fpu_control;
static inline void vorbis_fpu_setround(vorbis_fpu_control *fpu){
}
--- >8 ----
List archives: http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'cvs-request at xiph.org'
containing only the word 'unsubscribe' in the body. No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.
More information about the commits
mailing list