DynamicsProcessing: Update the Limiter post gain test
This change checks that the output dB value with gain is same as the dB value of full scale sine wave
Bug: 305866207
Test: atest VtsHalDynamicsProcessingTargetTest
Change-Id: I2cee5140a0253011f8e0b9e9c4594e3d30da15f6
diff --git a/audio/aidl/vts/EffectHelper.h b/audio/aidl/vts/EffectHelper.h
index 5c75e48..e334ee9 100644
--- a/audio/aidl/vts/EffectHelper.h
+++ b/audio/aidl/vts/EffectHelper.h
@@ -88,6 +88,7 @@
static constexpr int kNPointFFT = 16384;
static constexpr int kSamplingFrequency = 44100;
static constexpr int kDefaultChannelLayout = AudioChannelLayout::LAYOUT_STEREO;
+static constexpr float kLn10Div20 = -0.11512925f; // -ln(10)/20
class EffectHelper {
public:
@@ -595,6 +596,8 @@
}
}
+ constexpr float dBToAmplitude(float dB) { return std::exp(dB * kLn10Div20); }
+
static int getHalVersion(const std::shared_ptr<IEffect>& effect) {
int version = 0;
return (effect && effect->getInterfaceVersion(&version).isOk()) ? version : 0;