File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -457,16 +457,20 @@ int main(int _argc,const char **_argv){
457457 Eb2 = Eb4 = 0 ;
458458 w = .5 + .5 * tanh (.5 * (22 - bi ));
459459 for (xj = BANDS [bi ];xj < BANDS [bi + 1 ]&& xj < max_compare ;xj ++ ){
460+ float f , thresh ;
461+ f = xj * OPUS_PI /240 ;
462+ /* Shape the lower threshold similar to 1/(1 - 0.85*z^-1) deemphasis filter at 48 kHz. */
463+ thresh = .1 /(.15 * .15 + f * f );
460464 for (ci = 0 ;ci < nchannels ;ci ++ ){
461465 float re ;
462466 float im ;
463- re = Y [(xi * yfreqs + xj )* nchannels + ci ]/ X [(xi * nfreqs + xj )* nchannels + ci ];
467+ re = ( Y [(xi * yfreqs + xj )* nchannels + ci ]+ thresh )/( X [(xi * nfreqs + xj )* nchannels + ci ]+ thresh ) ;
464468 im = re - log (re )- 1 ;
465469 /* Per-band error weighting. */
466470 im *= w ;
467471 Eb2 += im ;
468472 /* Same for 4th power, but make it less sensitive to very low energies. */
469- re = (Y [(xi * yfreqs + xj )* nchannels + ci ]+ 10 )/(X [(xi * nfreqs + xj )* nchannels + ci ]+ 10 );
473+ re = (Y [(xi * yfreqs + xj )* nchannels + ci ]+ 10 * thresh )/(X [(xi * nfreqs + xj )* nchannels + ci ]+ 10 * thresh );
470474 im = re - log (re )- 1 ;
471475 /* Per-band error weighting. */
472476 im *= w ;
You can’t perform that action at this time.
0 commit comments