> 
> Hi all.
> 
> I found a bug of MS threshold adjustment, but I don't have a paper
> describing the algorithm(*). so I want to someone to check this.
> 

Hi Takehiro,

I put that code in a while ago, before we had the freq2bark() formula.
Since the scalefactor bands are supposed to be equally spaced in
barks, (sb/SBPSY) is a reasonable approximation to (bark/15.5).
So it is not really a bug, but an approximation :-)

But I went ahead and updated the routine as you suggested.  
(but changing 576 to 192*2 for short blocks, and 576*2 for
long blocks)

Mark







> (*) Johnston & Ferreira 1992 ICASSP paper
> 
> current LAME calculates mld as
> 
>     /* setup stereo demasking thresholds */
>     /* formula reverse enginerred from plot in paper */
>     for ( sb = 0; sb < SBPSY_s; sb++ ) {
>       FLOAT8 mld = 1.25*(1-cos(PI*sb/SBPSY_s))-2.5;
>       gfc->mld_s[sb] = pow(10.0,mld);
>     }
>     for ( sb = 0; sb < SBPSY_l; sb++ ) {
>       FLOAT8 mld = 1.25*(1-cos(PI*sb/SBPSY_l))-2.5;
>       gfc->mld_l[sb] = pow(10.0,mld);
>     }
> 
> but this is clearly bug, I think. it does not think the sampling frequency.
> see the FAAC code, we should bark value of sb, not sb itself.
> 
> the code should be like below
> 
>     /* setup stereo demasking thresholds */
>     /* formula reverse enginerred from plot in paper */
>     for ( sb = 0; sb < SBPSY_s; sb++ ) {
>       FLOAT8 bark = freq2bark(sfreq * scale_band.s[sb] / 576);
>       FLOAT8 mld = 1.25*(1-cos(PI*Min(bark, 15.5)/15.5))-2.5;
>       gfc->mld_s[sb] = pow(10.0,mld);
>     }
>     for ( sb = 0; sb < SBPSY_l; sb++ ) {
>       FLOAT8 bark = freq2bark(sfreq * scale_band.l[sb] / 576);
>       FLOAT8 mld = 1.25*(1-cos(PI*Min(bark, 15.5)/15.5))-2.5;
>       gfc->mld_l[sb] = pow(10.0,mld);
>     }
> 
> does it fit the paper's algorithm ?
> --- 
> Takehiro TOMINAGA // may the source be with you!
> --
> MP3 ENCODER mailing list ( http://geek.rcc.se/mp3encoder/ )
> 
--
MP3 ENCODER mailing list ( http://geek.rcc.se/mp3encoder/ )

Reply via email to