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

Commit 3f692411 authored by Andy Hung's avatar Andy Hung
Browse files

AudioResampler: Minor test code fixes

Test: resampler_tests
Bug: 123920996
Change-Id: I11aa8f883854ebc492e230bc48311009d5a8920f
parent b02be352
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -243,7 +243,7 @@ void AudioResamplerDyn<TC, TI, TO>::createKaiserFir(Constants &c,
{
    // compute the normalized transition bandwidth
    const double tbw = firKaiserTbw(c.mHalfNumCoefs, stopBandAtten);
    const double halfbw = tbw / 2.;
    const double halfbw = tbw * 0.5;

    double fcr; // compute fcr, the 3 dB amplitude cut-off.
    if (inSampleRate < outSampleRate) { // upsample
@@ -290,7 +290,7 @@ void AudioResamplerDyn<TC, TI, TO>::createKaiserFir(Constants &c,

#if 0
    // Keep this debug code in case an app causes resampler design issues.
    const double halfbw = tbw / 2.;
    const double halfbw = tbw * 0.5;
    // print basic filter stats
    ALOGD("L:%d  hnc:%d  stopBandAtten:%lf  fcr:%lf  atten:%lf  tbw:%lf\n",
            c.mL, c.mHalfNumCoefs, stopBandAtten, fcr, attenuation, tbw);
@@ -305,7 +305,7 @@ void AudioResamplerDyn<TC, TI, TO>::createKaiserFir(Constants &c,

    const int32_t passSteps = 1000;

    testFir(coefs, c.mL, c.mHalfNumCoefs, fp, fs, passSteps, passSteps * c.ML /*stopSteps*/,
    testFir(coefs, c.mL, c.mHalfNumCoefs, fp, fs, passSteps, passSteps * c.mL /*stopSteps*/,
            passMin, passMax, passRipple, stopMax, stopRipple);
    ALOGD("passband(%lf, %lf): %.8lf %.8lf %.8lf\n", 0., fp, passMin, passMax, passRipple);
    ALOGD("stopband(%lf, %lf): %.8lf %.3lf\n", fs, 0.5, stopMax, stopRipple);
+2 −2
Original line number Diff line number Diff line
@@ -547,8 +547,8 @@ static void testFir(const T* coef, int L, int halfNumCoef,
        wstart += wstep;
    }
    // renormalize - this is needed for integer filter types, use 1 for float or double.
    constexpr int64_t integralShift = std::is_integral<T>::value ? (sizeof(T) * 8 - 1) : 0;
    const double norm = 1. / (L << integralShift);
    constexpr int integralShift = std::is_integral<T>::value ? (sizeof(T) * CHAR_BIT - 1) : 0;
    const double norm = 1. / (int64_t{L} << integralShift);

    firMin = fmin * norm;
    firMax = fmax * norm;
+1 −1
Original line number Diff line number Diff line
@@ -5,8 +5,8 @@ cc_defaults {

    header_libs: ["libbase_headers"],
    shared_libs: [
        "libaudioutils",
        "libaudioprocessing",
        "libaudioutils",
        "libcutils",
        "liblog",
        "libutils",