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

Commit 6a30c8fa authored by Harish Mahendrakar's avatar Harish Mahendrakar
Browse files

libeffects: Fix LVDBE biquad instance creation

LVDBE HPF biquad was created everytime LVDBE_Control was
called, but LVDBE_SetFilters was called only when there
was a change in parameters.

biquad creation is now done only when number of channels
changes and SetFilters is called for change in number of
channels as well.

Bug: 179462586
Test: lvm/tests/build_and_run_all_unit_tests.sh
Change-Id: I2edd4e02de28a36b3fb455cec6d6e63f16dbcc9f
parent 85ed8fd8
Loading
Loading
Loading
Loading
+5 −3
Original line number Diff line number Diff line
@@ -277,13 +277,15 @@ LVDBE_ReturnStatus_en LVDBE_Control(LVDBE_Handle_t hInstance, LVDBE_Params_t* pP
    /*
     * Create biquad instance
     */
    if (pInstance->Params.NrChannels != pParams->NrChannels) {
        pInstance->pHPFBiquad.reset(
                new android::audio_utils::BiquadFilter<LVM_FLOAT>(pParams->NrChannels));

    }
    /*
     * Update the filters
     */
    if ((pInstance->Params.SampleRate != pParams->SampleRate) ||
        (pInstance->Params.NrChannels != pParams->NrChannels) ||
        (pInstance->Params.CentreFrequency != pParams->CentreFrequency)) {
        LVDBE_SetFilters(pInstance, /* Instance pointer */
                         pParams);  /* New parameters */
+2 −1
Original line number Diff line number Diff line
@@ -79,6 +79,7 @@ LVDBE_ReturnStatus_en LVDBE_Init(LVDBE_Handle_t* phInstance, LVDBE_Capabilities_
    pInstance->Params.SampleRate = LVDBE_FS_8000;
    pInstance->Params.VolumeControl = LVDBE_VOLUME_OFF;
    pInstance->Params.VolumedB = 0;
    pInstance->Params.NrChannels = FCC_2;

    /*
     * Create pointer to data and coef memory
@@ -91,7 +92,7 @@ LVDBE_ReturnStatus_en LVDBE_Init(LVDBE_Handle_t* phInstance, LVDBE_Capabilities_
     * Create biquad instance
     */
    pInstance->pHPFBiquad.reset(
            new android::audio_utils::BiquadFilter<LVM_FLOAT>(LVM_MAX_CHANNELS));
            new android::audio_utils::BiquadFilter<LVM_FLOAT>(pInstance->Params.NrChannels));
    pInstance->pBPFBiquad.reset(new android::audio_utils::BiquadFilter<LVM_FLOAT>(FCC_1));

    /*