Commit 675da3e8 authored by Monty Montgomery's avatar Monty Montgomery

Commit a fix to a bug whose meme stretches back to an arithmetic error

Segher made in a Vorbis optimization years ago.... the error wasn't
backed out of Vorbis because we tuned around it (in the end making no
difference), and removing the bug would undo the tuning.
Unfortunately, other code that borrowed the todB and fromdB
approximations that use IEEE754 float32 bitpatterns borrowed the bug
as well.  This fixes the offset value in fromdB_a and todB_a.



git-svn-id: https://svn.xiph.org/trunk/postfish@6577 0101bb08-14d6-0310-b084-bc0e0c8e3800
parent a839f47f
......@@ -356,7 +356,6 @@ static void under_compand(float *x,float zerocorner,
}
static void multicompand_work(void *vs){
return;
multicompand_state *ms=(multicompand_state *)vs;
subband_state *ss=&ms->ss;
int i,j,k,bypass_visible=1;
......@@ -406,12 +405,12 @@ static void multicompand_work(void *vs){
(i>=w->freq_bands?0:adj));
over_compand(x,
bc[bank].static_o[i],
&ms->over_attack,
&ms->over_decay,
&ms->over_iir[i][j],
&ms->over_peak[i][j],
(i>=w->freq_bands?0:adj));
bc[bank].static_o[i],
&ms->over_attack,
&ms->over_decay,
&ms->over_iir[i][j],
&ms->over_peak[i][j],
(i>=w->freq_bands?0:adj));
}
......@@ -448,11 +447,11 @@ static void multicompand_work(void *vs){
if(active){
base_compand(x,
&ms->base_attack,
&ms->base_decay,
&ms->base_iir[i][j],
&ms->base_peak[i][j],
(i>=w->freq_bands?0:adj));
&ms->base_attack,
&ms->base_decay,
&ms->base_iir[i][j],
&ms->base_peak[i][j],
(i>=w->freq_bands?0:adj));
if(ss->effect_activeC[j]){
for(k=0;k<input_size;k++)
......
......@@ -61,11 +61,11 @@ static inline float fromdB(float x){
#ifdef UGLY_IEEE754_FLOAT32_HACK
static inline float todB_a(const float *x){
return (float)((*(int32_t *)x)&0x7fffffff) * 7.1771144e-7f -764.27118f;
return (float)((*(int32_t *)x)&0x7fffffff) * 7.17711438e-7f -764.6161886f;
}
static inline float fromdB_a(float x){
int y=1.3933e+06f*(x+764.27118f);
int y=1.39331762961e+06f*(x+764.6161886f);
return *(float *)&y;
}
......
#define VERSION "$Id$ "
/* DO NOT EDIT: Automated versioning hack [Thu Apr 22 07:19:26 EDT 2004] */
/* DO NOT EDIT: Automated versioning hack [Thu Apr 22 07:48:59 EDT 2004] */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment