From d594bdea8b6010abb54286f7eaccaddafe86df5e Mon Sep 17 00:00:00 2001 From: Monty Date: Sat, 22 Dec 2001 09:40:40 +0000 Subject: [PATCH] Tuned out Dibrom's tone/noise masking bug. The problem was the long-suspect 8kHz data from Fielder's paper; now we have proof it's wrong. Monty svn path=/trunk/vorbis/; revision=2896 --- lib/masking.h | 82 +++++++++++++++++++--------------------------------- lib/modes/psych_44.h | 10 +++---- lib/psy.c | 10 +++---- lib/vorbisenc.c | 4 +-- 4 files changed, 41 insertions(+), 65 deletions(-) diff --git a/lib/masking.h b/lib/masking.h index 512ad6e..55f4135 100644 --- a/lib/masking.h +++ b/lib/masking.h @@ -11,7 +11,7 @@ ******************************************************************** function: masking curve data for psychoacoustics - last mod: $Id: masking.h,v 1.20 2001/12/20 01:00:28 segher Exp $ + last mod: $Id: masking.h,v 1.21 2001/12/22 09:40:39 xiphmont Exp $ ********************************************************************/ @@ -166,77 +166,53 @@ static float tone_4000_100dB_SL[EHMER_MAX]={ -900,-900,-900,-900,-900,-900,-900,-900}; +/* here the data collected by ehmer is clearly suspect as I have + several samples that provide counterexamples. the data below is + derated from Ehmers original numbers */ + static float tone_8000_40dB_SL[EHMER_MAX]={ -900,-900,-900,-900,-900,-900,-900,-900, -900,-900,-900,-900, -10, 3, 10, 18, - 26, 21, 14, 5, 0, 0, 5, 10, 20, 35, 55, 45, 70, 70, 70, 70, + 26, 21, 14, 5, 0, 0, 0, 0, 20, 35, 55, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, -900,-900,-900,-900,-900,-900,-900,-900, -900,-900,-900,-900,-900,-900,-900,-900}; static float tone_8000_60dB_SL[EHMER_MAX]={ -900,-900,-900,-900,-900,-900,-900,-900, -900,-900,-900,-900, -10, 5, 12, 30, - 43, 40, 36, 35, 36, 38, 41, 43, 45, 60, 70, 70, 70, 70, 70, 70, + 43, 34, 22, 15, 10, 5, 0, 0, 20, 55, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, -900,-900,-900,-900,-900,-900,-900,-900, -900,-900,-900,-900,-900,-900,-900,-900}; static float tone_8000_80dB_SL[EHMER_MAX]={ -900,-900,-900,-900,-900,-900,-900, -10, -1, 2, 6, 10, 13, 19, 25, 35, - 63, 59, 57, 56, 57, 59, 61, 62, 63, 65, 70, 70, 70, 70, 70, 70, - 70, 70, 70, 70,-900,-900,-900,-900, -900,-900,-900,-900,-900,-900,-900,-900, + 63, 50, 35, 35, 36, 36, 36, 31, 40, 55, 70, 70, 70, 70, 70, 70, + 70, 70, 70, 70, 70, 70, 70, 70, -900,-900,-900,-900,-900,-900,-900,-900, -900,-900,-900,-900,-900,-900,-900,-900}; static float tone_8000_100dB_SL[EHMER_MAX]={ -18, -12, -7, -3, 0, 2, 5, 8, 10, 14, 18, 20, 20, 22, 40, 40, - 70, 50, 30, 30, 30, 30, 30, 30, 30, 40, 70, 70, 70, 70, 70, 70, + 70, 50, 30, 30, 30, 30, 30, 32, 43, 55, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, -900,-900,-900,-900,-900,-900,-900,-900, -900,-900,-900,-900,-900,-900,-900,-900}; -#if 0 /* not used for the time being */ -static float noise_500_60dB_SL[EHMER_MAX]={ --900,-900,-900,-900,-900, -20, -11, -2, 7, 16, 25, 34, 43, 52, 61, 66, - 69, 68, 58, 50, 44, 38, 32, 28, 25, 24, 20, 18, 17, 12, 10, 8, - 5, 0, -5, -8, -12, -15, -18, -22, -900,-900,-900,-900,-900,-900,-900,-900, --900,-900,-900,-900,-900,-900,-900,-900}; - -static float noise_500_80dB_SL[EHMER_MAX]={ --900,-900,-900, -20, -10, -1, 8, 17, 26, 35, 44, 53, 62, 70, 79, 83, - 85, 85, 81, 77, 74, 71, 68, 63, 61, 59, 56, 55, 54, 52, 48, 47, - 45, 46, 45, 43, 40, 37, 33, 32, 35, 32, 30, 29, 20, 10, 0, -10, - -20, -30,-900,-900,-900,-900,-900,-900}; - -static float noise_1000_60dB_SL[EHMER_MAX]={ --900,-900,-900,-900, -24, -15, -6, 3, 12, 21, 28, 34, 40, 48, 57, 60, - 61, 56, 54, 45, 36, 27, 21, 19, 17, 13, 10, 0, -10, -20, -20,-900, --900,-900,-900,-900,-900,-900,-900,-900, -900,-900,-900,-900,-900,-900,-900,-900, --900,-900,-900,-900,-900,-900,-900,-900}; +/* a complete guess, but reasonably conservative and borne out by some + empirical testing */ -static float noise_1000_80dB_SL[EHMER_MAX]={ --900, -26, -17, -8, 1, 10, 19, 28, 37, 41, 46, 51, 58, 68, 74, 81, - 80, 81, 70, 66, 58, 61, 59, 55, 54, 53, 52, 49, 48, 42, 38, 38, - 39, 34, 30, 27, 20, 10, 0, -10, -20, -30,-900,-900,-900,-900,-900,-900, +static float tone_16000_40dB_SL[EHMER_MAX]={ +-900,-900,-900,-900,-900,-900,-900,-900, -900,-900,-900,-900, -10, 3, 10, 18, + 26, 35, 55, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, +-900,-900,-900,-900,-900,-900,-900,-900, -900,-900,-900,-900,-900,-900,-900,-900, -900,-900,-900,-900,-900,-900,-900,-900}; - -static float noise_2000_60dB_SL[EHMER_MAX]={ --900,-900,-900, -34, -25, -16, -7, 2, 11, 18, 23, 30, 35, 42, 51, 58, - 58, 57, 50, 40,-900,-900,-900,-900, -900,-900,-900,-900,-900,-900,-900,-900, +static float tone_16000_60dB_SL[EHMER_MAX]={ +-900,-900,-900,-900,-900,-900,-900,-900, -900,-900,-900,-900, -10, 5, 12, 30, + 43, 55, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, -900,-900,-900,-900,-900,-900,-900,-900, -900,-900,-900,-900,-900,-900,-900,-900, --900,-900,-900,-900,-900,-900,-900,-900}; - -static float noise_2000_80dB_SL[EHMER_MAX]={ --900, -26, -17, -8, 1, 10, 19, 28, 33, 38, 43, 48, 53, 62, 70, 77, - 77, 75, 70, 67, 68, 66, 62, 61, 60, 59, 52, 47, 39, 35, 34, 35, - 35, 33, 30, 27, 20, 10, 0, -10, -20, -30,-900,-900,-900,-900,-900,-900, --900,-900,-900,-900,-900,-900,-900,-900}; - -static float noise_4000_60dB_SL[EHMER_MAX]={ --900,-900,-900, -34, -25, -16, -7, 2, 11, 20, 25, 31, 37, 45, 56, 62, - 64, 61,-900,-900,-900,-900,-900,-900, -900,-900,-900,-900,-900,-900,-900,-900, + -900,-900,-900,-900,-900,-900,-900,-900}; +static float tone_16000_80dB_SL[EHMER_MAX]={ +-900,-900,-900,-900,-900,-900,-900, -10, -1, 2, 6, 10, 13, 19, 25, 35, + 63, 55, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, -900,-900,-900,-900,-900,-900,-900,-900, -900,-900,-900,-900,-900,-900,-900,-900, --900,-900,-900,-900,-900,-900,-900,-900}; - -static float noise_4000_80dB_SL[EHMER_MAX]={ --900, -26, -17, -8, 1, 10, 19, 26, 33, 39, 45, 50, 55, 65, 75, 82, - 84, 81, 78, 72, 70, 69, 66, 61, 50, 48, 46, 40, 35, 30, 25, 20, - 15, 10, 5, 0, -10, -20, -30,-900, -900,-900,-900,-900,-900,-900,-900,-900, --900,-900,-900,-900,-900,-900,-900,-900}; + -900,-900,-900,-900,-900,-900,-900,-900}; +static float tone_16000_100dB_SL[EHMER_MAX]={ + -18, -12, -7, -3, 0, 2, 5, 8, 10, 14, 18, 20, 20, 22, 40, 40, + 70, 55, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, +-900,-900,-900,-900,-900,-900,-900,-900, -900,-900,-900,-900,-900,-900,-900,-900, + -900,-900,-900,-900,-900,-900,-900,-900}; #endif -#endif - - diff --git a/lib/modes/psych_44.h b/lib/modes/psych_44.h index 707586f..7001416 100644 --- a/lib/modes/psych_44.h +++ b/lib/modes/psych_44.h @@ -11,7 +11,7 @@ ******************************************************************** function: key psychoacoustic settings for 44.1/48kHz - last mod: $Id: psych_44.h,v 1.6 2001/12/20 01:00:37 segher Exp $ + last mod: $Id: psych_44.h,v 1.7 2001/12/22 09:40:40 xiphmont Exp $ ********************************************************************/ @@ -614,17 +614,17 @@ static float ATH_Bark_dB[][27]={ { 0.f, 15.f, 15.f, 15.f, 11.f, 10.f, 8.f, 7.f, 7.f, 7.f, 6.f, 2.f, 0.f, 0.f, -2.f, -5.f, -6.f, -6.f, -4.f, 4.f, - 14.f, 20.f, 19.f, 17.f, 30.f, 60.f, 60.f, + 14.f, 20.f, 19.f, 17.f, 30.f, 60.f, 70.f, }, { 0.f, 15.f, 15.f, 15.f, 11.f, 10.f, 8.f, 7.f, 7.f, 7.f, 6.f, 2.f, 0.f, 0.f, -2.f, -5.f, -6.f, -6.f, -4.f, 0.f, - 2.f, 6.f, 5.f, 5.f, 15.f, 25.f, 35.f, + 2.f, 6.f, 5.f, 5.f, 15.f, 30.f, 50.f, }, { 0.f, 15.f, 15.f, 15.f, 11.f, 10.f, 8.f, 7.f, 7.f, 7.f, - 6.f, 2.f, 0.f, 0.f, -3.f, -5.f, -6.f, -6.f,-4.5f, 0.f, - 2.f, 6.f, 5.f, 5.f, 15.f, 15.f, 15.f, + 6.f, 2.f, 0.f, 0.f, -3.f, -5.f, -6.f, -6.f, -4.5f, -4.f, + 2.f, 6.f, 5.f, 5.f, 15.f, 20.f, 40.f, } }; diff --git a/lib/psy.c b/lib/psy.c index 79892db..0fdda52 100644 --- a/lib/psy.c +++ b/lib/psy.c @@ -11,7 +11,7 @@ ******************************************************************** function: psychoacoustics not including preecho - last mod: $Id: psy.c,v 1.63 2001/12/21 15:24:43 segher Exp $ + last mod: $Id: psy.c,v 1.64 2001/12/22 09:40:39 xiphmont Exp $ ********************************************************************/ @@ -296,10 +296,10 @@ void _vp_psy_init(vorbis_look_psy *p,vorbis_info_psy *vi, memcpy(p->tonecurves[14][8]+2,tone_8000_80dB_SL,sizeof(*p->tonecurves[14][8])*EHMER_MAX); memcpy(p->tonecurves[14][10]+2,tone_8000_100dB_SL,sizeof(*p->tonecurves[14][10])*EHMER_MAX); - memcpy(p->tonecurves[16][4]+2,tone_8000_40dB_SL,sizeof(*p->tonecurves[16][4])*EHMER_MAX); - memcpy(p->tonecurves[16][6]+2,tone_8000_60dB_SL,sizeof(*p->tonecurves[16][6])*EHMER_MAX); - memcpy(p->tonecurves[16][8]+2,tone_8000_80dB_SL,sizeof(*p->tonecurves[16][8])*EHMER_MAX); - memcpy(p->tonecurves[16][10]+2,tone_8000_100dB_SL,sizeof(*p->tonecurves[16][10])*EHMER_MAX); + memcpy(p->tonecurves[16][4]+2,tone_16000_40dB_SL,sizeof(*p->tonecurves[16][4])*EHMER_MAX); + memcpy(p->tonecurves[16][6]+2,tone_16000_60dB_SL,sizeof(*p->tonecurves[16][6])*EHMER_MAX); + memcpy(p->tonecurves[16][8]+2,tone_16000_80dB_SL,sizeof(*p->tonecurves[16][8])*EHMER_MAX); + memcpy(p->tonecurves[16][10]+2,tone_16000_100dB_SL,sizeof(*p->tonecurves[16][10])*EHMER_MAX); for(i=0;itone_masteratt=att[iq]*(1.-dq)+att[iq+1]*dq; - p->max_curve_dB=max[iq]; + p->max_curve_dB=max[iq]*(1.-dq)+max[iq+1]*dq; p->curvelimitp=peaklimit_bands[iq]; iq=q*5.; -- 2.7.4