Loading media/libeffects/preprocessing/PreProcessing.cpp +30 −39 Original line number Diff line number Diff line Loading @@ -20,13 +20,13 @@ // #define LOG_NDEBUG 0 #include <audio_effects/effect_aec.h> #include <audio_effects/effect_agc.h> #include <hardware/audio_effect.h> #include <utils/Log.h> #include <utils/Timers.h> #include <audio_effects/effect_agc2.h> #include <audio_effects/effect_ns.h> #include <audio_processing.h> #include <hardware/audio_effect.h> #include <module_common_types.h> #include <utils/Log.h> #include <utils/Timers.h> // undefine to perform multi channels API functional tests // #define DUAL_MIC_TEST Loading Loading @@ -212,17 +212,14 @@ static const effect_descriptor_t sNsDescriptor = { "Noise Suppression", "The Android Open Source Project"}; static const effect_descriptor_t* sDescriptors[PREPROC_NUM_EFFECTS] = {&sAgcDescriptor, &sAgc2Descriptor, &sAecDescriptor, &sNsDescriptor}; static const effect_descriptor_t* sDescriptors[PREPROC_NUM_EFFECTS] = { &sAgcDescriptor, &sAgc2Descriptor, &sAecDescriptor, &sNsDescriptor}; //------------------------------------------------------------------------------ // Helper functions //------------------------------------------------------------------------------ const effect_uuid_t* const sUuidToPreProcTable[PREPROC_NUM_EFFECTS] = {FX_IID_AGC, FX_IID_AGC2, const effect_uuid_t* const sUuidToPreProcTable[PREPROC_NUM_EFFECTS] = {FX_IID_AGC, FX_IID_AGC2, FX_IID_AEC, FX_IID_NS}; const effect_uuid_t* ProcIdToUuid(int procId) { Loading Loading @@ -543,11 +540,9 @@ static const preproc_ops_t sAgc2Ops = {Agc2Create, Agc2Init, NULL, // Acoustic Echo Canceler (AEC) //------------------------------------------------------------------------------ int AecInit(preproc_effect_t* effect) { ALOGV("AecInit"); effect->session->config = effect->session->apm->GetConfig(); effect->session->config.echo_canceller.mobile_mode = true; effect->session->apm->ApplyConfig(effect->session->config); return 0; } Loading @@ -571,9 +566,8 @@ int AecGetParameter(preproc_effect_t* effect, void* pParam, uint32_t* pValueSize ALOGV("AecGetParameter() echo delay %d us", *(uint32_t*)pValue); break; case AEC_PARAM_MOBILE_MODE: effect->session->config = effect->session->apm->GetConfig(); *(uint32_t*)pValue = effect->session->config.echo_canceller.mobile_mode; ALOGV("AecGetParameter() mobile mode %d us", *(uint32_t*)pValue); *(uint32_t*)pValue = false; ALOGI("%s: AEC_PARAM_MOBILE_MODE ignored", __func__); break; default: ALOGW("AecGetParameter() unknown param %08x value %08x", param, *(uint32_t*)pValue); Loading @@ -595,10 +589,8 @@ int AecSetParameter(preproc_effect_t* effect, void* pParam, void* pValue) { ALOGV("AecSetParameter() echo delay %d us, status %d", value, status); break; case AEC_PARAM_MOBILE_MODE: effect->session->config = effect->session->apm->GetConfig(); effect->session->config.echo_canceller.mobile_mode = value; ALOGV("AecSetParameter() mobile mode %d us", value); effect->session->apm->ApplyConfig(effect->session->config); ALOGI("%s: AEC_PARAM_MOBILE_MODE ignored", __func__); status = (value != 0) ? -EINVAL : 0; break; default: ALOGW("AecSetParameter() unknown param %08x value %08x", param, *(uint32_t*)pValue); Loading Loading @@ -697,9 +689,8 @@ void NsDisable(preproc_effect_t* effect) { static const preproc_ops_t sNsOps = {NsCreate, NsInit, NULL, NsEnable, NsDisable, NsSetParameter, NsGetParameter, NULL}; static const preproc_ops_t* sPreProcOps[PREPROC_NUM_EFFECTS] = {&sAgcOps, &sAgc2Ops, &sAecOps, &sNsOps}; static const preproc_ops_t* sPreProcOps[PREPROC_NUM_EFFECTS] = {&sAgcOps, &sAgc2Ops, &sAecOps, &sNsOps}; //------------------------------------------------------------------------------ // Effect functions Loading Loading
media/libeffects/preprocessing/PreProcessing.cpp +30 −39 Original line number Diff line number Diff line Loading @@ -20,13 +20,13 @@ // #define LOG_NDEBUG 0 #include <audio_effects/effect_aec.h> #include <audio_effects/effect_agc.h> #include <hardware/audio_effect.h> #include <utils/Log.h> #include <utils/Timers.h> #include <audio_effects/effect_agc2.h> #include <audio_effects/effect_ns.h> #include <audio_processing.h> #include <hardware/audio_effect.h> #include <module_common_types.h> #include <utils/Log.h> #include <utils/Timers.h> // undefine to perform multi channels API functional tests // #define DUAL_MIC_TEST Loading Loading @@ -212,17 +212,14 @@ static const effect_descriptor_t sNsDescriptor = { "Noise Suppression", "The Android Open Source Project"}; static const effect_descriptor_t* sDescriptors[PREPROC_NUM_EFFECTS] = {&sAgcDescriptor, &sAgc2Descriptor, &sAecDescriptor, &sNsDescriptor}; static const effect_descriptor_t* sDescriptors[PREPROC_NUM_EFFECTS] = { &sAgcDescriptor, &sAgc2Descriptor, &sAecDescriptor, &sNsDescriptor}; //------------------------------------------------------------------------------ // Helper functions //------------------------------------------------------------------------------ const effect_uuid_t* const sUuidToPreProcTable[PREPROC_NUM_EFFECTS] = {FX_IID_AGC, FX_IID_AGC2, const effect_uuid_t* const sUuidToPreProcTable[PREPROC_NUM_EFFECTS] = {FX_IID_AGC, FX_IID_AGC2, FX_IID_AEC, FX_IID_NS}; const effect_uuid_t* ProcIdToUuid(int procId) { Loading Loading @@ -543,11 +540,9 @@ static const preproc_ops_t sAgc2Ops = {Agc2Create, Agc2Init, NULL, // Acoustic Echo Canceler (AEC) //------------------------------------------------------------------------------ int AecInit(preproc_effect_t* effect) { ALOGV("AecInit"); effect->session->config = effect->session->apm->GetConfig(); effect->session->config.echo_canceller.mobile_mode = true; effect->session->apm->ApplyConfig(effect->session->config); return 0; } Loading @@ -571,9 +566,8 @@ int AecGetParameter(preproc_effect_t* effect, void* pParam, uint32_t* pValueSize ALOGV("AecGetParameter() echo delay %d us", *(uint32_t*)pValue); break; case AEC_PARAM_MOBILE_MODE: effect->session->config = effect->session->apm->GetConfig(); *(uint32_t*)pValue = effect->session->config.echo_canceller.mobile_mode; ALOGV("AecGetParameter() mobile mode %d us", *(uint32_t*)pValue); *(uint32_t*)pValue = false; ALOGI("%s: AEC_PARAM_MOBILE_MODE ignored", __func__); break; default: ALOGW("AecGetParameter() unknown param %08x value %08x", param, *(uint32_t*)pValue); Loading @@ -595,10 +589,8 @@ int AecSetParameter(preproc_effect_t* effect, void* pParam, void* pValue) { ALOGV("AecSetParameter() echo delay %d us, status %d", value, status); break; case AEC_PARAM_MOBILE_MODE: effect->session->config = effect->session->apm->GetConfig(); effect->session->config.echo_canceller.mobile_mode = value; ALOGV("AecSetParameter() mobile mode %d us", value); effect->session->apm->ApplyConfig(effect->session->config); ALOGI("%s: AEC_PARAM_MOBILE_MODE ignored", __func__); status = (value != 0) ? -EINVAL : 0; break; default: ALOGW("AecSetParameter() unknown param %08x value %08x", param, *(uint32_t*)pValue); Loading Loading @@ -697,9 +689,8 @@ void NsDisable(preproc_effect_t* effect) { static const preproc_ops_t sNsOps = {NsCreate, NsInit, NULL, NsEnable, NsDisable, NsSetParameter, NsGetParameter, NULL}; static const preproc_ops_t* sPreProcOps[PREPROC_NUM_EFFECTS] = {&sAgcOps, &sAgc2Ops, &sAecOps, &sNsOps}; static const preproc_ops_t* sPreProcOps[PREPROC_NUM_EFFECTS] = {&sAgcOps, &sAgc2Ops, &sAecOps, &sNsOps}; //------------------------------------------------------------------------------ // Effect functions Loading