Merge "Effect AIDL VTS: relax dynamics processing effect parameter validations" into 24D1-dev am: ad6464d43b

Original change: https://googleplex-android-review.googlesource.com/c/platform/hardware/interfaces/+/26767676

Change-Id: Ia9115becb833d3021f499708cf431e484d87bf0e
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
Shunkai Yao 2024-04-04 18:44:54 +00:00 committed by Automerger Merge Worker
commit 2475cd33e9

View file

@ -195,48 +195,42 @@ const std::set<std::vector<DynamicsProcessing::InputGain>>
template <typename T>
bool DynamicsProcessingTestHelper::isBandConfigValid(const std::vector<T>& cfgs, int bandCount) {
std::vector<float> freqs(cfgs.size(), -1);
std::unordered_set<int> 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<DynamicsProcessing::preEq>());
}
case DynamicsProcessing::postEq: {
if (!mEngineConfigApplied.postEqStage.inUse) return false;
return isChannelConfigValid(dp.get<DynamicsProcessing::postEq>());
}
case DynamicsProcessing::mbc: {
if (!mEngineConfigApplied.mbcStage.inUse) return false;
return isChannelConfigValid(dp.get<DynamicsProcessing::mbc>());
}
case DynamicsProcessing::preEqBand: {
if (!mEngineConfigApplied.preEqStage.inUse) return false;
return isBandConfigValid(dp.get<DynamicsProcessing::preEqBand>(),
mEngineConfigApplied.preEqStage.bandCount);
}
case DynamicsProcessing::postEqBand: {
if (!mEngineConfigApplied.postEqStage.inUse) return false;
return isBandConfigValid(dp.get<DynamicsProcessing::postEqBand>(),
mEngineConfigApplied.postEqStage.bandCount);
}
case DynamicsProcessing::mbcBand: {
if (!mEngineConfigApplied.mbcStage.inUse) return false;
return isBandConfigValid(dp.get<DynamicsProcessing::mbcBand>(),
mEngineConfigApplied.mbcStage.bandCount);
}
case DynamicsProcessing::limiter: {
if (!mEngineConfigApplied.limiterInUse) return false;
return isChannelConfigValid(dp.get<DynamicsProcessing::limiter>());
}
case DynamicsProcessing::inputGain: {