[xiph-cvs] cvs commit: vorbis/vq huffbuild.c latticehint.c
Monty
xiphmont at xiph.org
Sun May 13 15:40:27 PDT 2001
xiphmont 01/05/13 15:40:27
Modified: lib Tag: monty-branch-20010404 floor1.c mapping0.c
scales.h
lib/modes Tag: monty-branch-20010404 mode_A.h
vq Tag: monty-branch-20010404 huffbuild.c
latticehint.c
Log:
floor 1 tuning and bugfixes
Revision Changes Path
No revision
No revision
1.1.2.6 +27 -23 vorbis/lib/Attic/floor1.c
Index: floor1.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/Attic/floor1.c,v
retrieving revision 1.1.2.5
retrieving revision 1.1.2.6
diff -u -r1.1.2.5 -r1.1.2.6
--- floor1.c 2001/05/11 22:07:49 1.1.2.5
+++ floor1.c 2001/05/13 22:40:24 1.1.2.6
@@ -11,7 +11,7 @@
********************************************************************
function: floor backend 1 implementation
- last mod: $Id: floor1.c,v 1.1.2.5 2001/05/11 22:07:49 xiphmont Exp $
+ last mod: $Id: floor1.c,v 1.1.2.6 2001/05/13 22:40:24 xiphmont Exp $
********************************************************************/
@@ -516,20 +516,22 @@
for(i=x0;i<x1;i++){
int quantized=vorbis_floor1_dBquant(flr+i);
- if(mdct[i]+info->twofitatten>=flr[i]){
- xa += i;
- ya += quantized;
- x2a += i*i;
- y2a += quantized*quantized;
- xya += i*quantized;
- na++;
- }else{
- xb += i;
- yb += quantized;
- x2b += i*i;
- y2b += quantized*quantized;
- xyb += i*quantized;
- nb++;
+ if(quantized){
+ if(mdct[i]+info->twofitatten>=flr[i]){
+ xa += i;
+ ya += quantized;
+ x2a += i*i;
+ y2a += quantized*quantized;
+ xya += i*quantized;
+ na++;
+ }else{
+ xb += i;
+ yb += quantized;
+ x2b += i*i;
+ y2b += quantized*quantized;
+ xyb += i*quantized;
+ nb++;
+ }
}
}
@@ -640,7 +642,7 @@
*y0=*y1=y;
}
-static int inspect_error(int x0,int x1,int y0,int y1,const float *flr,
+static int inspect_error(int x0,int x1,int y0,int y1,const float *mask,
const float *mdct,
vorbis_info_floor1 *info){
int dy=y1-y0;
@@ -651,13 +653,13 @@
int x=x0;
int y=y0;
int err=0;
- int val=vorbis_floor1_dBquant(flr+x);
+ int val=vorbis_floor1_dBquant(mask+x);
int mse=0;
int n=0;
ady-=abs(base*adx);
- if(mdct[x]+info->twofitatten>=flr[x]){
+ if(mdct[x]+info->twofitatten>=mask[x]){
if(y+info->maxover<val)return(1);
if(y-info->maxunder>val)return(1);
mse=(y-val);
@@ -674,8 +676,8 @@
y+=base;
}
- if(mdct[x]+info->twofitatten>=flr[x]){
- val=vorbis_floor1_dBquant(flr+x);
+ if(mdct[x]+info->twofitatten>=mask[x]){
+ val=vorbis_floor1_dBquant(mask+x);
if(val){
if(y+info->maxover<val)return(1);
if(y-info->maxunder>val)return(1);
@@ -685,9 +687,11 @@
}
}
- if(info->maxover*info->maxover/n>info->maxerr)return(0);
- if(info->maxunder*info->maxunder/n>info->maxerr)return(0);
- if(mse/n>info->maxerr)return(1);
+ if(n){
+ if(info->maxover*info->maxover/n>info->maxerr)return(0);
+ if(info->maxunder*info->maxunder/n>info->maxerr)return(0);
+ if(mse/n>info->maxerr)return(1);
+ }
return(0);
}
1.27.4.5 +2 -2 vorbis/lib/mapping0.c
Index: mapping0.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/mapping0.c,v
retrieving revision 1.27.4.4
retrieving revision 1.27.4.5
diff -u -r1.27.4.4 -r1.27.4.5
--- mapping0.c 2001/05/11 22:07:50 1.27.4.4
+++ mapping0.c 2001/05/13 22:40:24 1.27.4.5
@@ -11,7 +11,7 @@
********************************************************************
function: channel mapping 0 implementation
- last mod: $Id: mapping0.c,v 1.27.4.4 2001/05/11 22:07:50 xiphmont Exp $
+ last mod: $Id: mapping0.c,v 1.27.4.5 2001/05/13 22:40:24 xiphmont Exp $
********************************************************************/
@@ -279,7 +279,7 @@
res,
codedflr);
- _analysis_output("codedflr",seq,codedflr,n/2,0,0);
+ _analysis_output("codedflr",seq,codedflr,n/2,0,1);
_analysis_output("res",seq++,res,n/2,0,0);
#ifdef TRAIN_RES
1.15.4.2 +26 -11 vorbis/lib/scales.h
Index: scales.h
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/scales.h,v
retrieving revision 1.15.4.1
retrieving revision 1.15.4.2
diff -u -r1.15.4.1 -r1.15.4.2
--- scales.h 2001/05/11 22:07:50 1.15.4.1
+++ scales.h 2001/05/13 22:40:24 1.15.4.2
@@ -11,7 +11,7 @@
********************************************************************
function: linear scale -> dB, Bark and Mel scales
- last mod: $Id: scales.h,v 1.15.4.1 2001/05/11 22:07:50 xiphmont Exp $
+ last mod: $Id: scales.h,v 1.15.4.2 2001/05/13 22:40:24 xiphmont Exp $
********************************************************************/
@@ -23,7 +23,7 @@
/* 20log10(x) */
#ifdef VORBIS_IEEE_FLOAT32
-static float todB_LOOKUP[196]={
+static float todB_LOOKUP[256]={
-140.277330f, -139.633636f, -139.034372f, -138.473797f,
-137.450747f, -136.535597f, -135.707743f, -134.951972f,
-134.256730f, -133.613036f, -133.013772f, -132.453198f,
@@ -68,16 +68,31 @@
-17.038749f, -16.123599f, -15.295746f, -14.539974f,
-13.844732f, -13.201039f, -12.601774f, -12.041200f,
-11.018149f, -10.103000f, -9.275146f, -8.519375f,
- -7.824132f, -7.180439f, -6.581174f, -6.020600f,
- -4.997549f, -4.082400f, -3.254546f, -2.498775f,
- -1.803533f, -1.159839f, -0.560574f, 0.000000f,
- 1.023050f, 1.938200f, 2.766054f, 3.521825f,
- 4.217067f, 4.860761f, 5.460025f, 6.020600f
+ -7.824132f, -7.180439f, -6.581174f, -6.020600f,
+ -4.997549f, -4.082400f, -3.254546f, -2.498775f,
+ -1.803533f, -1.159839f, -0.560574f, 0.000000f,
+ 1.023050f, 1.938200f, 2.766054f, 3.521825f,
+ 4.217067f, 4.860761f, 5.460025f, 6.020600f,
+ 7.043650f, 7.958800f, 8.786654f, 9.542425f,
+ 10.237667f, 10.881361f, 11.480625f, 12.041200f,
+ 13.064250f, 13.979400f, 14.807254f, 15.563025f,
+ 16.258267f, 16.901961f, 17.501225f, 18.061800f,
+ 19.084850f, 20.000000f, 20.827854f, 21.583625f,
+ 22.278867f, 22.922561f, 23.521825f, 24.082400f,
+ 25.105450f, 26.020600f, 26.848453f, 27.604225f,
+ 28.299467f, 28.943161f, 29.542425f, 30.102999f,
+ 31.126050f, 32.041200f, 32.869053f, 33.624825f,
+ 34.320067f, 34.963760f, 35.563025f, 36.123599f,
+ 37.146650f, 38.061800f, 38.889653f, 39.645424f,
+ 40.340667f, 40.984360f, 41.583625f, 42.144199f,
+ 43.167250f, 44.082399f, 44.910253f, 45.666024f,
+ 46.361266f, 47.004960f, 47.604225f, 48.164799f,
+ 49.187850f, 50.102999f, 50.930853f, 51.686624f
};
-static float todB(float *x) {
+static float todB(float *x){
ogg_int32_t *i=(ogg_int32_t *)x;
- ogg_int32_t temp=(*i&0x7fffffff)-0x33cfffff;
+ ogg_int32_t temp=((*i&0x7fffffff)-0x33cfffff)>>20;
if(temp<0)return -400.f;
return(todB_LOOKUP[temp]);
}
@@ -86,8 +101,8 @@
#else
-#define todB(x) ((*x)==0?-400.f:log((*x)*(*x))*4.34294480f)
-#define todB_nn(x) ((*x)==0.f?-400.f:log(*x)*8.6858896f)
+#define todB(x) (*(x)==0?-400.f:log(*(x)**(x))*4.34294480f)
+#define todB_nn(x) (*(x)==0.f?-400.f:log(*(x))*8.6858896f)
#endif
No revision
No revision
1.14.4.4 +31 -24 vorbis/lib/modes/mode_A.h
Index: mode_A.h
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/modes/mode_A.h,v
retrieving revision 1.14.4.3
retrieving revision 1.14.4.4
diff -u -r1.14.4.3 -r1.14.4.4
--- mode_A.h 2001/05/11 22:07:53 1.14.4.3
+++ mode_A.h 2001/05/13 22:40:25 1.14.4.4
@@ -11,7 +11,7 @@
********************************************************************
function: predefined encoding modes
- last mod: $Id: mode_A.h,v 1.14.4.3 2001/05/11 22:07:53 xiphmont Exp $
+ last mod: $Id: mode_A.h,v 1.14.4.4 2001/05/13 22:40:25 xiphmont Exp $
********************************************************************/
@@ -259,7 +259,7 @@
{3,3,3},
{1,2,2},
{0,1,2},
- {{7,8},{-1,9,10,11},{-1,12,13,14}},
+ {{3,4},{-1,5,6,7},{-1,8,9,10}},
4,
{0,128,
@@ -270,30 +270,36 @@
45,30,73},
60,30,600,
- 999,999,0,0.,
+ 999,999,0,18.,
8,96};
static vorbis_info_floor1 _floor_set1A={10,
- {0,1,2,2,2,2,3,3,3,3},
+ {0,1,2,2,2,2,2, 3,3,3},
{3,4,3,3},
{1,1,2,2},
- {3,4,5,6},
- {{15,16},{17,18},
- {-1,19,20,21},{-1,22,23,24}},
+ {11,12,13,14},
+ {{15,16},
+ {17,18},
+ {-1,19,20,21},
+ {-1,22,23,24},
+ },
4,
{0,1024,
+
88,31,243,
- 14,54,143,460,
+ 14,54,143,460,
+
6,3,10, 22,18,26, 41,36,47,
69,61,78, 112,99,126, 185,162,211,
- 329,282,387, 672,553,825},
+ 329,282,387, 672,553,825
+ },
60,30,600,
20,8,1,18.,
- 40,768};
+ 20,768};
static vorbis_info_residue0 _residue_set0A={0,96,16,6,25,
{0,1,1,1,1,1},
@@ -341,27 +347,28 @@
{&_huff_book_line0_class0, /* 0 */
&_huff_book_line0_class1,
&_huff_book_line0_class2, /* 2 */
- &_huff_book_line1_class0,
- &_huff_book_line1_class1, /* 4 */
- &_huff_book_line1_class2,
- &_huff_book_line1_class3, /* 6 */
- &_huff_book_line0_0sub0,
+ &_huff_book_line0_0sub0, /* 3 */
&_huff_book_line0_0sub1,
- &_huff_book_line0_1sub1,
+ &_huff_book_line0_1sub1, /* 5 */
&_huff_book_line0_1sub2,
- &_huff_book_line0_1sub3,
+ &_huff_book_line0_1sub3, /* 7 */
&_huff_book_line0_2sub1,
- &_huff_book_line0_2sub2,
- &_huff_book_line0_2sub3, /* 14 */
+ &_huff_book_line0_2sub2, /* 9 */
+ &_huff_book_line0_2sub3,
+
+ &_huff_book_line1_class0,
+ &_huff_book_line1_class1, /* 12 */
+ &_huff_book_line1_class2,
+ &_huff_book_line1_class3, /* 14 */
&_huff_book_line1_0sub0,
- &_huff_book_line1_0sub1,
- &_huff_book_line1_1sub0,
+ &_huff_book_line1_0sub1, /* 16 */
+ &_huff_book_line1_1sub0,
&_huff_book_line1_1sub1,
- &_huff_book_line1_2sub1,
- &_huff_book_line1_2sub2,
- &_huff_book_line1_2sub3,
+ &_huff_book_line1_2sub1,
+ &_huff_book_line1_2sub2, /* 20 */
+ &_huff_book_line1_2sub3,
&_huff_book_line1_3sub1,
&_huff_book_line1_3sub2,
&_huff_book_line1_3sub3, /* 24 */
No revision
No revision
1.8.4.2 +16 -10 vorbis/vq/huffbuild.c
Index: huffbuild.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/vq/huffbuild.c,v
retrieving revision 1.8.4.1
retrieving revision 1.8.4.2
diff -u -r1.8.4.1 -r1.8.4.2
--- huffbuild.c 2001/05/11 22:07:54 1.8.4.1
+++ huffbuild.c 2001/05/13 22:40:26 1.8.4.2
@@ -11,7 +11,7 @@
********************************************************************
function: hufftree builder
- last mod: $Id: huffbuild.c,v 1.8.4.1 2001/05/11 22:07:54 xiphmont Exp $
+ last mod: $Id: huffbuild.c,v 1.8.4.2 2001/05/13 22:40:26 xiphmont Exp $
********************************************************************/
@@ -106,7 +106,11 @@
file=fopen(infile,"r");
if(!file){
fprintf(stderr,"Could not open file %s\n",infile);
- exit(1);
+ if(!maxval)
+ exit(1);
+ else
+ fprintf(stderr," making untrained books.\n");
+
}
if(!maxval){
@@ -129,15 +133,17 @@
for(j=loval;j<vals;j++)hist[j]=guard;
- reset_next_value();
- i/=subn;
- while(!feof(file)){
- long val=getval(file,begin,n,subn,maxval);
- if(val==-1 || val>=maxval)break;
- hist[val]++;
- if(!(i--&0xff))spinnit("loading... ",i*subn);
+ if(file){
+ reset_next_value();
+ i/=subn;
+ while(!feof(file)){
+ long val=getval(file,begin,n,subn,maxval);
+ if(val==-1 || val>=maxval)break;
+ hist[val]++;
+ if(!(i--&0xff))spinnit("loading... ",i*subn);
+ }
+ fclose(file);
}
- fclose(file);
/* we have the probabilities, build the tree */
fprintf(stderr,"Building tree for %ld entries\n",vals);
1.8.4.1 +2 -2 vorbis/vq/latticehint.c
Index: latticehint.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/vq/latticehint.c,v
retrieving revision 1.8
retrieving revision 1.8.4.1
diff -u -r1.8 -r1.8.4.1
--- latticehint.c 2001/02/26 03:51:12 1.8
+++ latticehint.c 2001/05/13 22:40:26 1.8.4.1
@@ -11,7 +11,7 @@
********************************************************************
function: utility main for building thresh/pigeonhole encode hints
- last mod: $Id: latticehint.c,v 1.8 2001/02/26 03:51:12 xiphmont Exp $
+ last mod: $Id: latticehint.c,v 1.8.4.1 2001/05/13 22:40:26 xiphmont Exp $
********************************************************************/
@@ -186,7 +186,7 @@
if(dB){
if(fabs(v1)<.01)v1=(v1+v2)*.5;
if(fabs(v2)<.01)v2=(v1+v2)*.5;
- t->quantthresh[i]=fromdB((todB(v1)+todB(v2))*.5);
+ t->quantthresh[i]=fromdB((todB(&v1)+todB(&v2))*.5);
if(v1<0 || v2<0)t->quantthresh[i]*=-1;
}else{
--- >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