File tree Expand file tree Collapse file tree 1 file changed +13
-6
lines changed Expand file tree Collapse file tree 1 file changed +13
-6
lines changed Original file line number Diff line number Diff line change @@ -452,9 +452,9 @@ int main(int _argc,const char **_argv){
452452 Ef2 = 0 ;
453453 Ef4 = 0 ;
454454 for (bi = 0 ;bi < ybands ;bi ++ ){
455- double Eb ;
455+ double Eb2 , Eb4 ;
456456 double w ;
457- Eb = 0 ;
457+ Eb2 = Eb4 = 0 ;
458458 w = .5 + .5 * tanh (.5 * (22 - bi ));
459459 for (xj = BANDS [bi ];xj < BANDS [bi + 1 ]&& xj < max_compare ;xj ++ ){
460460 for (ci = 0 ;ci < nchannels ;ci ++ ){
@@ -464,12 +464,19 @@ int main(int _argc,const char **_argv){
464464 im = re - log (re )- 1 ;
465465 /* Per-band error weighting. */
466466 im *= w ;
467- Eb += im ;
467+ Eb2 += im ;
468+ /* 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 );
470+ im = re - log (re )- 1 ;
471+ /* Per-band error weighting. */
472+ im *= w ;
473+ Eb4 += im ;
468474 }
469475 }
470- Eb /= (BANDS [bi + 1 ]- BANDS [bi ])* nchannels ;
471- Ef2 += Eb ;
472- Ef4 += Eb * Eb ;
476+ Eb2 /= (BANDS [bi + 1 ]- BANDS [bi ])* nchannels ;
477+ Eb4 /= (BANDS [bi + 1 ]- BANDS [bi ])* nchannels ;
478+ Ef2 += Eb2 ;
479+ Ef4 += Eb4 * Eb4 ;
473480 }
474481 /*Using a fixed normalization value means we're willing to accept slightly
475482 lower quality for lower sampling rates.*/
You can’t perform that action at this time.
0 commit comments