[xiph-cvs] cvs commit: vorbis/lib floor1.c
Monty
xiphmont at xiph.org
Mon Jun 11 19:44:28 PDT 2001
xiphmont 01/06/11 19:44:27
Modified: lib floor1.c
Log:
When fixing the default: case bug, forgot there were a number of
additional optimizations that can't go on mainline without the rest of
my [not ready] work. Rolled back, applied just the bug fix.
Monty
Revision Changes Path
1.6 +31 -67 vorbis/lib/floor1.c
Index: floor1.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/floor1.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- floor1.c 2001/06/11 23:10:50 1.5
+++ floor1.c 2001/06/12 02:44:27 1.6
@@ -11,7 +11,7 @@
********************************************************************
function: floor backend 1 implementation
- last mod: $Id: floor1.c,v 1.5 2001/06/11 23:10:50 xiphmont Exp $
+ last mod: $Id: floor1.c,v 1.6 2001/06/12 02:44:27 xiphmont Exp $
********************************************************************/
@@ -382,31 +382,6 @@
ady-=abs(base*adx);
- d[x]*=FLOOR_fromdB_LOOKUP[y];
- while(++x<x1){
- err=err+ady;
- if(err>=adx){
- err-=adx;
- y+=sy;
- }else{
- y+=base;
- }
- d[x]*=FLOOR_fromdB_LOOKUP[y];
- }
-}
-
-static void render_line0(int x0,int x1,int y0,int y1,float *d){
- int dy=y1-y0;
- int adx=x1-x0;
- int ady=abs(dy);
- int base=dy/adx;
- int sy=(dy<0?base-1:base+1);
- int x=x0;
- int y=y0;
- int err=0;
-
- ady-=abs(base*adx);
-
d[x]=FLOOR_fromdB_LOOKUP[y];
while(++x<x1){
err=err+ady;
@@ -535,6 +510,7 @@
double fx=x;
double fy=y;
double fx2=x2;
+ double fy2=y2;
double fxy=xy;
double denom=1./(an*fx2-fx*fx);
double a=(fy*fx2-fxy*fx)*denom;
@@ -552,7 +528,7 @@
}
}
-/*static void fit_line_point(lsfit_acc *a,int fits,int *y0,int *y1){
+static void fit_line_point(lsfit_acc *a,int fits,int *y0,int *y1){
long y=0;
int i;
@@ -560,7 +536,7 @@
y+=a[i].ya;
*y0=*y1=y;
- }*/
+}
static int inspect_error(int x0,int x1,int y0,int y1,const float *mask,
const float *mdct,
@@ -983,14 +959,13 @@
int hx;
int lx=0;
int ly=fit_valueA[0]*info->mult;
-
for(j=1;j<posts;j++){
int current=look->forward_index[j];
if(!(fit_valueA[current]&0x8000)){
int hy=(fit_valueA[current]&0x7fff)*info->mult;
hx=info->postlist[current];
- render_line0(lx,hx,ly,hy,codedflr);
+ render_line(lx,hx,ly,hy,codedflr);
lx=hx;
ly=hy;
@@ -1021,18 +996,19 @@
return(nonzero);
}
-static void *floor1_inverse1(vorbis_block *vb,vorbis_look_floor *in){
+static int floor1_inverse(vorbis_block *vb,vorbis_look_floor *in,float *out){
vorbis_look_floor1 *look=(vorbis_look_floor1 *)in;
vorbis_info_floor1 *info=look->vi;
-
+
codec_setup_info *ci=vb->vd->vi->codec_setup;
+ int n=ci->blocksizes[vb->mode]/2;
int i,j,k;
codebook *books=((backend_lookup_state *)(vb->vd->backend_state))->
fullbooks;
/* unpack wrapped/predicted values from stream */
if(oggpack_read(&vb->opb,1)==1){
- int *fit_value=_vorbis_block_alloc(vb,(look->posts)*sizeof(int));
+ int fit_value[VIF_POSIT+2];
fit_value[0]=oggpack_read(&vb->opb,ilog(look->quant_q-1));
fit_value[1]=oggpack_read(&vb->opb,ilog(look->quant_q-1));
@@ -1103,44 +1079,32 @@
}
- return(fit_value);
- }
- eop:
- return(NULL);
-}
-
-static int floor1_inverse2(vorbis_block *vb,vorbis_look_floor *in,void *memo,
- float *out){
- vorbis_look_floor1 *look=(vorbis_look_floor1 *)in;
- vorbis_info_floor1 *info=look->vi;
-
- codec_setup_info *ci=vb->vd->vi->codec_setup;
- int n=ci->blocksizes[vb->mode]/2;
- int j;
-
- if(memo){
/* render the lines */
- int *fit_value=(int *)memo;
- int hx;
- int lx=0;
- int ly=fit_value[0]*info->mult;
- for(j=1;j<look->posts;j++){
- int current=look->forward_index[j];
- int hy=fit_value[current]&0x7fff;
- if(hy==fit_value[current]){
-
- hy*=info->mult;
- hx=info->postlist[current];
-
- render_line(lx,hx,ly,hy,out);
-
- lx=hx;
- ly=hy;
+ {
+ int hx;
+ int lx=0;
+ int ly=fit_value[0]*info->mult;
+ for(j=1;j<look->posts;j++){
+ int current=look->forward_index[j];
+ int hy=fit_value[current]&0x7fff;
+ if(hy==fit_value[current]){
+
+ hy*=info->mult;
+ hx=info->postlist[current];
+
+ render_line(lx,hx,ly,hy,out);
+
+ lx=hx;
+ ly=hy;
+ }
}
- }
- for(j=hx;j<n;j++)out[j]*=out[j-1]; /* be certain */
+ for(j=hx;j<n;j++)out[j]=out[j-1]; /* be certain */
+ }
return(1);
}
+
+ /* fall through */
+ eop:
memset(out,0,sizeof(float)*n);
return(0);
}
@@ -1148,6 +1112,6 @@
/* export hooks */
vorbis_func_floor floor1_exportbundle={
&floor1_pack,&floor1_unpack,&floor1_look,&floor1_copy_info,&floor1_free_info,
- &floor1_free_look,&floor1_forward,&floor1_inverse1,&floor1_inverse2
+ &floor1_free_look,&floor1_forward,&floor1_inverse
};
--- >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