Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0e8d9896 authored by Andy Hung's avatar Andy Hung Committed by Android (Google) Code Review
Browse files

Merge "AudioResampler: Add property for resampler testing." into qt-dev

parents d233276a 86571a97
Loading
Loading
Loading
Loading
+13 −3
Original line number Diff line number Diff line
@@ -201,6 +201,8 @@ AudioResamplerDyn<TC, TI, TO>::AudioResamplerDyn(
            "ro.audio.resampler.psd.stopband", mPropertyStopbandAttenuation);
    mPropertyCutoffPercent = property_get_int32(
            "ro.audio.resampler.psd.cutoff_percent", mPropertyCutoffPercent);
    mPropertyTransitionBandwidthCheat = property_get_int32(
            "ro.audio.resampler.psd.tbwcheat", mPropertyTransitionBandwidthCheat);
}

template<typename TC, typename TI, typename TO>
@@ -379,9 +381,17 @@ void AudioResamplerDyn<TC, TI, TO>::setSampleRate(int32_t inSampleRate)
            halfLength = mPropertyHalfFilterLength;
            stopBandAtten = mPropertyStopbandAttenuation;
            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
                        ? 0.5 : 0.5 * mSampleRate / mInSampleRate;
                fcr *= mPropertyCutoffPercent / 100.;
            }
        } else {
            // Voice quality devices have lower sampling rates
            // (and may be a consequence of downstream AMR-WB / G.722 codecs).
+7 −0
Original line number Diff line number Diff line
@@ -193,6 +193,13 @@ private:
              int32_t mPropertyCutoffPercent = 100;
                      // "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()
             double mStopbandAttenuationDb = 0.;
             double mPassbandRippleDb = 0.;