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
This commit is contained in:
parent
6507376fb9
commit
53238b1afd
1 changed files with 5 additions and 11 deletions
|
@ -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: {
|
||||
|
|
Loading…
Reference in a new issue