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

Commit 3bb9ecfe authored by Shunkai Yao's avatar Shunkai Yao Committed by Gerrit Code Review
Browse files

Merge "Remove loudness enhancer stereo channel abort" into main

parents 1352139e 3c8ef273
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@

#include "EffectLoudnessEnhancer.h"

using aidl::android::hardware::audio::common::getChannelCount;
using aidl::android::hardware::audio::effect::Descriptor;
using aidl::android::hardware::audio::effect::getEffectImplUuidLoudnessEnhancer;
using aidl::android::hardware::audio::effect::getEffectTypeUuidLoudnessEnhancer;
@@ -138,6 +139,11 @@ std::shared_ptr<EffectContext> LoudnessEnhancerImpl::createContext(
        LOG(DEBUG) << __func__ << " context already exist";
        return mContext;
    }
    if (2 < getChannelCount(common.input.base.channelMask)) {
        LOG(ERROR) << __func__
                   << " channelCount not supported: " << common.input.base.channelMask.toString();
        return nullptr;
    }

    mContext = std::make_shared<LoudnessEnhancerContext>(1 /* statusFmqDepth */, common);
    return mContext;
+0 −4
Original line number Diff line number Diff line
@@ -102,10 +102,6 @@ IEffect::Status LoudnessEnhancerContext::process(float* in, float* out, int samp
}

void LoudnessEnhancerContext::init_params() {
    int channelCount = ::aidl::android::hardware::audio::common::getChannelCount(
            mCommon.input.base.channelMask);
    LOG_ALWAYS_FATAL_IF(channelCount != 2, "channel count %d not supported", channelCount);

    mGain = LOUDNESS_ENHANCER_DEFAULT_TARGET_GAIN_MB;
    float targetAmp = pow(10, mGain / 2000.0f);  // mB to linear amplification
    LOG(VERBOSE) << __func__ << "Target gain = " << mGain << "mB <=> factor = " << targetAmp;