[vorbis-dev] Possible bug in psy.c

Monty xiphmont at xiph.org
Wed Jul 5 16:30:02 PDT 2000



> Hi all,
> 
> I'm quite new to Vorbis, so please excuse me if I'm writing complete
> nonsense (and, if possible, tell me where I'm wrong).
> 
> While searching for optimization possibilities in lib/psy.c, I found the following
> piece of code in _vp_compute_mask():
> 
>   if(p->vi->smoothp){
>     /* compute power^.5 of three neighboring bins to smooth for peaks
>        that get split twixt bins/peaks that nail the bin.  This evens
>        out treatment as we're not doing additive masking any longer. */
>     double acc=work[0]*work[0]+work[1]*work[1];
>     double prev=work[0];
> 
>     work[0]=sqrt(acc);
>     for(i=1;i<n-1;i++){
>       double this=work[i];
>       acc+=work[i+1]*work[i+1];
>       work[i]=sqrt(acc);
>       acc-=prev*prev;
>       prev=this;
>     }
>     work[n-1]=sqrt(acc);
>   }
> 
> If this is intended to be a simple smoothing operation, I would expect that
> work[0] and work[n-1] must be divided by sqrt(2) and all other entries in work
> must be divided by sqrt(3) in order to renormalize work[].

it computes 'sqrt(work[i-1]^2+work[i]^2+work[i+1]^2)' as intended.

Monty

--- >8 ----
List archives:  http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/



More information about the Vorbis-dev mailing list