From 53238b1afd9bd940ab0f567ce28f67cde20bad34 Mon Sep 17 00:00:00 2001 From: Shunkai Yao Date: Fri, 29 Mar 2024 23:09:04 +0000 Subject: [PATCH] Effect AIDL VTS: relax dynamics processing effect parameter validations relaxing several parameter checking to align with HIDL - no need to have stage in use to set bands/channels - band settings no need to be sorted by frequency Bug: 328012516 Test: atest VtsHalDynamicsProcessingTargetTest Change-Id: If12d978ee69ee7f087a7e8758513a9c6bacf817f --- audio/aidl/vts/VtsHalDynamicsProcessingTest.cpp | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/audio/aidl/vts/VtsHalDynamicsProcessingTest.cpp b/audio/aidl/vts/VtsHalDynamicsProcessingTest.cpp index 3f7a76dae6..e95bd4d1d1 100644 --- a/audio/aidl/vts/VtsHalDynamicsProcessingTest.cpp +++ b/audio/aidl/vts/VtsHalDynamicsProcessingTest.cpp @@ -195,48 +195,42 @@ const std::set> template bool DynamicsProcessingTestHelper::isBandConfigValid(const std::vector& cfgs, int bandCount) { - std::vector freqs(cfgs.size(), -1); + std::unordered_set freqs; for (auto cfg : cfgs) { if (cfg.channel < 0 || cfg.channel >= mChannelCount) return false; if (cfg.band < 0 || cfg.band >= bandCount) return false; - freqs[cfg.band] = cfg.cutoffFrequencyHz; + // duplicated band index + if (freqs.find(cfg.band) != freqs.end()) return false; + freqs.insert(cfg.band); } - if (std::count(freqs.begin(), freqs.end(), -1)) return false; - return std::is_sorted(freqs.begin(), freqs.end()); + return true; } bool DynamicsProcessingTestHelper::isParamValid(const DynamicsProcessing::Tag& tag, const DynamicsProcessing& dp) { switch (tag) { case DynamicsProcessing::preEq: { - if (!mEngineConfigApplied.preEqStage.inUse) return false; return isChannelConfigValid(dp.get()); } case DynamicsProcessing::postEq: { - if (!mEngineConfigApplied.postEqStage.inUse) return false; return isChannelConfigValid(dp.get()); } case DynamicsProcessing::mbc: { - if (!mEngineConfigApplied.mbcStage.inUse) return false; return isChannelConfigValid(dp.get()); } case DynamicsProcessing::preEqBand: { - if (!mEngineConfigApplied.preEqStage.inUse) return false; return isBandConfigValid(dp.get(), mEngineConfigApplied.preEqStage.bandCount); } case DynamicsProcessing::postEqBand: { - if (!mEngineConfigApplied.postEqStage.inUse) return false; return isBandConfigValid(dp.get(), mEngineConfigApplied.postEqStage.bandCount); } case DynamicsProcessing::mbcBand: { - if (!mEngineConfigApplied.mbcStage.inUse) return false; return isBandConfigValid(dp.get(), mEngineConfigApplied.mbcStage.bandCount); } case DynamicsProcessing::limiter: { - if (!mEngineConfigApplied.limiterInUse) return false; return isChannelConfigValid(dp.get()); } case DynamicsProcessing::inputGain: {