From 045a5f8746a28cb87a548abcc350dc914a9faf07 Mon Sep 17 00:00:00 2001 From: Monty Date: Thu, 31 Aug 2000 08:01:34 +0000 Subject: 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 --- lib/envelope.c | 27 +++------------------------ lib/floor0.c | 17 ++++++----------- lib/psy.c | 24 ++++++++---------------- 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;in)newhi=n; - - for(;lowinlength/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;jn;j++){ - double val=todB(in[j])+info->ampdB; - if(val<1.) - work[j]=1.; - else - work[j]=val; - } + for(j=0;jn;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 */ diff --git a/lib/psy.c b/lib/psy.c index 38f5cfee..6de47f22 100644 --- a/lib/psy.c +++ b/lib/psy.c @@ -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;iflr[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;jn;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){ -- cgit v1.2.1