diff options
author | Monty <xiphmont@xiph.org> | 2000-08-31 08:01:34 +0000 |
---|---|---|
committer | Monty <xiphmont@xiph.org> | 2000-08-31 08:01:34 +0000 |
commit | 045a5f8746a28cb87a548abcc350dc914a9faf07 (patch) | |
tree | 2f27cb77fb90bf5bad5dd4d923c491d78ae69a3e | |
parent | 30b8e2365756b48e181963b4db87b5b4017befe7 (diff) | |
download | libvorbis-git-045a5f8746a28cb87a548abcc350dc914a9faf07.tar.gz |
Frames with no energy appeared to be non-silence dut to the ATH being
back in the masking curve. We check to see if there's any energy
relative to masking and if not, set the masking curve to 0.
Monty
svn path=/trunk/vorbis/; revision=609
-rw-r--r-- | lib/envelope.c | 27 | ||||
-rw-r--r-- | lib/floor0.c | 17 | ||||
-rw-r--r-- | lib/psy.c | 24 | ||||
-rw-r--r-- | lib/sharedbook.c | 6 |
4 files changed, 20 insertions, 54 deletions
diff --git a/lib/envelope.c b/lib/envelope.c index 63a3f939..a4681fed 100644 --- a/lib/envelope.c +++ b/lib/envelope.c @@ -12,7 +12,7 @@ ******************************************************************** function: PCM data envelope analysis and manipulation - last mod: $Id: envelope.c,v 1.21 2000/08/15 09:09:42 xiphmont Exp $ + last mod: $Id: envelope.c,v 1.22 2000/08/31 08:01:34 xiphmont Exp $ Preecho calculation. @@ -38,9 +38,9 @@ Command line: /www/usr/fisher/helpers/mkfilter -Ch \ -6.0000000000e+00 -Bp -o 5 -a 1.3605442177e-01 3.1746031746e-01 -l */ +#if 0 static int cheb_bandpass_stages=10; static double cheb_bandpass_gain=5.589612458e+01; -/* z^-stage, z^-stage+1... */ static double cheb_bandpass_B[]={-1.,0.,5.,0.,-10.,0.,10.,0.,-5.,0.,1}; static double cheb_bandpass_A[]={ -0.1917409386, @@ -53,6 +53,7 @@ static double cheb_bandpass_A[]={ 0.0451493360, -1.4471447397, 0.0303413711}; +#endif static int cheb_highpass_stages=10; static double cheb_highpass_gain= 5.291963434e+01; @@ -71,7 +72,6 @@ static double cheb_highpass_A[]={ 2.3920318913}; void _ve_envelope_init(envelope_lookup *e,vorbis_info *vi){ - long rate=vi->rate; int ch=vi->channels; int window=vi->envelopesa; int i; @@ -106,29 +106,8 @@ void _ve_envelope_clear(envelope_lookup *e){ memset(e,0,sizeof(envelope_lookup)); } -/*static int frameno=0;*/ - -static void smooth_noise(long n,double *f,double *noise){ - long i; - long lo=0,hi=0; - double acc=0.; - - for(i=0;i<n;i++){ - long newhi=i*1.0442718740+5; - long newlo=i*.8781245150-5; - if(newhi>n)newhi=n; - - for(;lo<newlo;lo++) - acc-=f[lo]*f[lo]; - for(;hi<newhi;hi++) - acc+=f[hi]*f[hi]; - noise[i]=todB(sqrt(acc/(hi-lo))); - } -} - static double _ve_deltai(envelope_lookup *ve,IIR_state *iir, double *pre,double *post){ - long no=ve->winlength/3; /* past the highpass rollon! */ long n2=ve->winlength*2; long n=ve->winlength; diff --git a/lib/floor0.c b/lib/floor0.c index f330b24b..0eb83dbc 100644 --- a/lib/floor0.c +++ b/lib/floor0.c @@ -12,7 +12,7 @@ ******************************************************************** function: floor backend 0 implementation - last mod: $Id: floor0.c,v 1.23 2000/08/23 10:16:56 xiphmont Exp $ + last mod: $Id: floor0.c,v 1.24 2000/08/31 08:01:34 xiphmont Exp $ ********************************************************************/ @@ -51,7 +51,7 @@ static long _f0_fit(codebook *book, double *workfit, int cursor){ int dim=book->dim; - double norm,base=0.,err=0.; + double norm,base=0.; int i,best=0; double *lsp=workfit+cursor; @@ -239,7 +239,7 @@ double _curve_to_lpc(double *curve,double *lpc, return vorbis_lpc_from_curve(work,lpc,&(l->lpclook)); } -/* generate the whole freq response curve of an LPC IIR filter */ +/* generate the whole freq response curve of an LSP IIR filter */ void _lsp_to_curve(double *curve,double *lsp,double amp, vorbis_look_floor0 *l,char *name,long frameno){ @@ -284,18 +284,13 @@ static int forward(vorbis_block *vb,vorbis_look_floor *i, /* our floor comes in on a linear scale; go to a [-Inf...0] dB scale. The curve has to be positive, so we offset it. */ - for(j=0;j<look->n;j++){ - double val=todB(in[j])+info->ampdB; - if(val<1.) - work[j]=1.; - else - work[j]=val; - } + for(j=0;j<look->n;j++) + work[j]=todB(in[j])+info->ampdB; /* use 'out' as temp storage */ /* Convert our floor to a set of lpc coefficients */ amp=sqrt(_curve_to_lpc(work,out,look,seq)); - + /* amp is in the range (0. to ampdB]. Encode that range using ampbits bits */ @@ -12,7 +12,7 @@ ******************************************************************** function: psychoacoustics not including preecho - last mod: $Id: psy.c,v 1.26 2000/08/23 06:38:49 xiphmont Exp $ + last mod: $Id: psy.c,v 1.27 2000/08/31 08:01:34 xiphmont Exp $ ********************************************************************/ @@ -309,8 +309,6 @@ static void compute_decay_fixed(vorbis_look_psy *p,double *f, double *decay, int double decscale=fromdB(p->vi->decay_coeff*n); double attscale=1./fromdB(p->vi->attack_coeff); - static int frameno=0; - for(i=10;i<n;i++){ double pre=decay[i]; if(decay[i]){ @@ -512,7 +510,6 @@ static void bark_noise(long n,double *b,double *f,double *noise){ double acc=0.,val,del=0.; double *norm=alloca(n*sizeof(double)); - double normacc=0; memset(noise,0,n*sizeof(double)); memset(norm,0,n*sizeof(double)); @@ -541,7 +538,6 @@ static void bark_noise(long n,double *b,double *f,double *noise){ { long ilo=i-lo; long hii=hi-i; - long hilo=hi-lo; for(;i<n;i++){ val=todB(f[i]*f[i])+400.; @@ -589,15 +585,6 @@ static void bark_noise(long n,double *b,double *f,double *noise){ } } -/* stability doesn't matter */ -static int comp(const void *a,const void *b){ - if(fabs(**(double **)a)<fabs(**(double **)b)) - return(1); - else - return(-1); -} - -static int frameno=0; void _vp_compute_mask(vorbis_look_psy *p,double *f, double *flr, double *decay){ @@ -685,7 +672,12 @@ void _vp_compute_mask(vorbis_look_psy *p,double *f, } - frameno++; + /* doing this here is clean, but we need to find a faster way to do + it than to just tack it on */ + + for(i=0;i<n;i++)if(2.*f[i]>flr[i] || -2.*f[i]>flr[i])break; + if(i==n)memset(flr,0,sizeof(double)*n); + } @@ -694,7 +686,7 @@ void _vp_compute_mask(vorbis_look_psy *p,double *f, /* f and flr are *linear* scale, not dB */ void _vp_apply_floor(vorbis_look_psy *p,double *f, double *flr){ double *work=alloca(p->n*sizeof(double)); - int i,j,addcount=0; + int j; /* subtract the floor */ for(j=0;j<p->n;j++){ diff --git a/lib/sharedbook.c b/lib/sharedbook.c index d4b9a37d..1e3670dd 100644 --- a/lib/sharedbook.c +++ b/lib/sharedbook.c @@ -12,7 +12,7 @@ ******************************************************************** function: basic shared codebook operations - last mod: $Id: sharedbook.c,v 1.7 2000/07/19 18:10:46 xiphmont Exp $ + last mod: $Id: sharedbook.c,v 1.8 2000/08/31 08:01:34 xiphmont Exp $ ********************************************************************/ @@ -336,8 +336,8 @@ int _best(codebook *book, double *a, int step){ encode_aux_pigeonhole *pt=book->c->pigeon_tree; int dim=book->dim; int ptr=0,k,o; - int savebest=-1; - double saverr; + /*int savebest=-1; + double saverr;*/ /* do we have a threshhold encode hint? */ if(tt){ |