Loading media/libaudioprocessing/AudioResamplerDyn.cpp +13 −3 Original line number Original line Diff line number Diff line Loading @@ -201,6 +201,8 @@ AudioResamplerDyn<TC, TI, TO>::AudioResamplerDyn( "ro.audio.resampler.psd.stopband", mPropertyStopbandAttenuation); "ro.audio.resampler.psd.stopband", mPropertyStopbandAttenuation); mPropertyCutoffPercent = property_get_int32( mPropertyCutoffPercent = property_get_int32( "ro.audio.resampler.psd.cutoff_percent", mPropertyCutoffPercent); "ro.audio.resampler.psd.cutoff_percent", mPropertyCutoffPercent); mPropertyTransitionBandwidthCheat = property_get_int32( "ro.audio.resampler.psd.tbwcheat", mPropertyTransitionBandwidthCheat); } } template<typename TC, typename TI, typename TO> template<typename TC, typename TI, typename TO> Loading Loading @@ -379,9 +381,17 @@ void AudioResamplerDyn<TC, TI, TO>::setSampleRate(int32_t inSampleRate) halfLength = mPropertyHalfFilterLength; halfLength = mPropertyHalfFilterLength; stopBandAtten = mPropertyStopbandAttenuation; stopBandAtten = mPropertyStopbandAttenuation; useS32 = true; useS32 = true; // Use either the stopband location for design (tbwCheat) // or use the 3dB cutoff location for design (fcr). // This choice is exclusive and based on whether fcr > 0. if (mPropertyTransitionBandwidthCheat != 0) { tbwCheat = mPropertyTransitionBandwidthCheat / 100.; } else { fcr = mInSampleRate <= mSampleRate fcr = mInSampleRate <= mSampleRate ? 0.5 : 0.5 * mSampleRate / mInSampleRate; ? 0.5 : 0.5 * mSampleRate / mInSampleRate; fcr *= mPropertyCutoffPercent / 100.; fcr *= mPropertyCutoffPercent / 100.; } } else { } else { // Voice quality devices have lower sampling rates // Voice quality devices have lower sampling rates // (and may be a consequence of downstream AMR-WB / G.722 codecs). // (and may be a consequence of downstream AMR-WB / G.722 codecs). Loading media/libaudioprocessing/AudioResamplerDyn.h +7 −0 Original line number Original line Diff line number Diff line Loading @@ -193,6 +193,13 @@ private: int32_t mPropertyCutoffPercent = 100; int32_t mPropertyCutoffPercent = 100; // "ro.audio.resampler.psd.cutoff_percent" // "ro.audio.resampler.psd.cutoff_percent" // Specify the transition bandwidth extension beyond Nyquist. // If this is nonzero then mPropertyCutoffPercent is ignored. // A value of 100 or greater is typically used, where 100 means the // stopband is at Nyquist (this is a typical design). int32_t mPropertyTransitionBandwidthCheat = 0; // "ro.audio.resampler.psd.tbwcheat" // Filter creation design parameters, see setSampleRate() // Filter creation design parameters, see setSampleRate() double mStopbandAttenuationDb = 0.; double mStopbandAttenuationDb = 0.; double mPassbandRippleDb = 0.; double mPassbandRippleDb = 0.; Loading Loading
media/libaudioprocessing/AudioResamplerDyn.cpp +13 −3 Original line number Original line Diff line number Diff line Loading @@ -201,6 +201,8 @@ AudioResamplerDyn<TC, TI, TO>::AudioResamplerDyn( "ro.audio.resampler.psd.stopband", mPropertyStopbandAttenuation); "ro.audio.resampler.psd.stopband", mPropertyStopbandAttenuation); mPropertyCutoffPercent = property_get_int32( mPropertyCutoffPercent = property_get_int32( "ro.audio.resampler.psd.cutoff_percent", mPropertyCutoffPercent); "ro.audio.resampler.psd.cutoff_percent", mPropertyCutoffPercent); mPropertyTransitionBandwidthCheat = property_get_int32( "ro.audio.resampler.psd.tbwcheat", mPropertyTransitionBandwidthCheat); } } template<typename TC, typename TI, typename TO> template<typename TC, typename TI, typename TO> Loading Loading @@ -379,9 +381,17 @@ void AudioResamplerDyn<TC, TI, TO>::setSampleRate(int32_t inSampleRate) halfLength = mPropertyHalfFilterLength; halfLength = mPropertyHalfFilterLength; stopBandAtten = mPropertyStopbandAttenuation; stopBandAtten = mPropertyStopbandAttenuation; useS32 = true; useS32 = true; // Use either the stopband location for design (tbwCheat) // or use the 3dB cutoff location for design (fcr). // This choice is exclusive and based on whether fcr > 0. if (mPropertyTransitionBandwidthCheat != 0) { tbwCheat = mPropertyTransitionBandwidthCheat / 100.; } else { fcr = mInSampleRate <= mSampleRate fcr = mInSampleRate <= mSampleRate ? 0.5 : 0.5 * mSampleRate / mInSampleRate; ? 0.5 : 0.5 * mSampleRate / mInSampleRate; fcr *= mPropertyCutoffPercent / 100.; fcr *= mPropertyCutoffPercent / 100.; } } else { } else { // Voice quality devices have lower sampling rates // Voice quality devices have lower sampling rates // (and may be a consequence of downstream AMR-WB / G.722 codecs). // (and may be a consequence of downstream AMR-WB / G.722 codecs). Loading
media/libaudioprocessing/AudioResamplerDyn.h +7 −0 Original line number Original line Diff line number Diff line Loading @@ -193,6 +193,13 @@ private: int32_t mPropertyCutoffPercent = 100; int32_t mPropertyCutoffPercent = 100; // "ro.audio.resampler.psd.cutoff_percent" // "ro.audio.resampler.psd.cutoff_percent" // Specify the transition bandwidth extension beyond Nyquist. // If this is nonzero then mPropertyCutoffPercent is ignored. // A value of 100 or greater is typically used, where 100 means the // stopband is at Nyquist (this is a typical design). int32_t mPropertyTransitionBandwidthCheat = 0; // "ro.audio.resampler.psd.tbwcheat" // Filter creation design parameters, see setSampleRate() // Filter creation design parameters, see setSampleRate() double mStopbandAttenuationDb = 0.; double mStopbandAttenuationDb = 0.; double mPassbandRippleDb = 0.; double mPassbandRippleDb = 0.; Loading