Loading audio/aidl/vts/VtsHalDownmixTargetTest.cpp +14 −15 Original line number Diff line number Diff line Loading @@ -96,8 +96,7 @@ class DownmixEffectHelper : public EffectHelper { Parameter::Specific specific = getDefaultParamSpecific(); Parameter::Common common = EffectHelper::createParamCommon( 0 /* session */, 1 /* ioHandle */, 44100 /* iSampleRate */, 44100 /* oSampleRate */, kInputFrameCount /* iFrameCount */, kOutputFrameCount /* oFrameCount */, inputChannelLayout, kFrameCount /* iFrameCount */, kFrameCount /* oFrameCount */, inputChannelLayout, AudioChannelLayout::make<AudioChannelLayout::layoutMask>( AudioChannelLayout::LAYOUT_STEREO)); ASSERT_NO_FATAL_FAILURE(open(mEffect, common, specific, &mOpenEffectReturn, EX_NONE)); Loading Loading @@ -139,14 +138,14 @@ class DownmixEffectHelper : public EffectHelper { } void setDataTestParams(int32_t layoutType) { mInputBuffer.resize(kBufferSize); // Get the number of channels used mInputChannelCount = getChannelCount( AudioChannelLayout::make<AudioChannelLayout::layoutMask>(layoutType)); mInputBufferSize = kFrameCount * mInputChannelCount; mInputBuffer.resize(mInputBufferSize); // In case of downmix, output is always configured to stereo layout. mOutputBufferSize = (mInputBuffer.size() / mInputChannelCount) * kOutputChannelCount; mOutputBufferSize = kFrameCount * kOutputChannelCount; mOutputBuffer.resize(mOutputBufferSize); } Loading @@ -173,7 +172,12 @@ class DownmixEffectHelper : public EffectHelper { return true; } static constexpr long kInputFrameCount = 100, kOutputFrameCount = 100; static const long kFrameCount = 256; static constexpr float kMaxDownmixSample = 1; static constexpr int kOutputChannelCount = 2; // Mask for layouts greater than MAX_INPUT_CHANNELS_SUPPORTED static constexpr int32_t kMaxChannelMask = ~((1 << ChannelMix<AUDIO_CHANNEL_OUT_STEREO>::MAX_INPUT_CHANNELS_SUPPORTED) - 1); std::shared_ptr<IFactory> mFactory; Descriptor mDescriptor; std::shared_ptr<IEffect> mEffect; Loading @@ -183,12 +187,7 @@ class DownmixEffectHelper : public EffectHelper { std::vector<float> mOutputBuffer; size_t mInputChannelCount; size_t mOutputBufferSize; static constexpr size_t kBufferSize = 128; static constexpr float kMaxDownmixSample = 1; static constexpr int kOutputChannelCount = 2; // Mask for layouts greater than MAX_INPUT_CHANNELS_SUPPORTED static constexpr int32_t kMaxChannelMask = ~((1 << ChannelMix<AUDIO_CHANNEL_OUT_STEREO>::MAX_INPUT_CHANNELS_SUPPORTED) - 1); size_t mInputBufferSize; }; /** Loading Loading @@ -401,9 +400,9 @@ class DownmixStripDataTest : public ::testing::TestWithParam<DownmixStripDataTes void TearDown() override { TearDownDownmix(); } void validateOutput() { ASSERT_EQ(kBufferSize, mInputBuffer.size()); ASSERT_GE(kBufferSize, mOutputBufferSize); for (size_t i = 0, j = 0; i < kBufferSize && j < mOutputBufferSize; ASSERT_EQ(mInputBufferSize, mInputBuffer.size()); ASSERT_GE(mInputBufferSize, mOutputBufferSize); for (size_t i = 0, j = 0; i < mInputBufferSize && j < mOutputBufferSize; i += mInputChannelCount, j += kOutputChannelCount) { ASSERT_EQ(mOutputBuffer[j], mInputBuffer[i]); ASSERT_EQ(mOutputBuffer[j + 1], mInputBuffer[i + 1]); Loading audio/aidl/vts/VtsHalLoudnessEnhancerTargetTest.cpp +11 −6 Original line number Diff line number Diff line Loading @@ -23,6 +23,7 @@ using namespace android; using aidl::android::hardware::audio::common::getChannelCount; using aidl::android::hardware::audio::effect::Descriptor; using aidl::android::hardware::audio::effect::getEffectTypeUuidLoudnessEnhancer; using aidl::android::hardware::audio::effect::IEffect; Loading Loading @@ -50,7 +51,7 @@ class LoudnessEnhancerEffectHelper : public EffectHelper { Parameter::Specific specific = getDefaultParamSpecific(); Parameter::Common common = createParamCommon( 0 /* session */, 1 /* ioHandle */, 44100 /* iSampleRate */, 44100 /* oSampleRate */, kInputFrameCount /* iFrameCount */, kOutputFrameCount /* oFrameCount */); kFrameCount /* iFrameCount */, kFrameCount /* oFrameCount */); ASSERT_NO_FATAL_FAILURE(open(mEffect, common, specific, &mOpenEffectReturn, EX_NONE)); ASSERT_NE(nullptr, mEffect); mVersion = EffectFactoryHelper::getHalVersion(mFactory); Loading Loading @@ -110,7 +111,7 @@ class LoudnessEnhancerEffectHelper : public EffectHelper { << "\ngetParam:" << getParam.toString(); } static const long kInputFrameCount = 0x100, kOutputFrameCount = 0x100; static const long kFrameCount = 256; IEffect::OpenEffectReturn mOpenEffectReturn; std::shared_ptr<IFactory> mFactory; std::shared_ptr<IEffect> mEffect; Loading Loading @@ -153,8 +154,12 @@ class LoudnessEnhancerDataTest : public ::testing::TestWithParam<LoudnessEnhance public: LoudnessEnhancerDataTest() { std::tie(mFactory, mDescriptor) = GetParam(); mBufferSize = kFrameCount * getChannelCount(AudioChannelLayout::make<AudioChannelLayout::layoutMask>( AudioChannelLayout::LAYOUT_STEREO)); generateInputBuffer(); mOutputBuffer.resize(kBufferSize); mOutputBuffer.resize(mBufferSize); } void SetUp() override { Loading @@ -174,7 +179,7 @@ class LoudnessEnhancerDataTest : public ::testing::TestWithParam<LoudnessEnhance // Fill inputBuffer with random values between -kMaxAudioSample to kMaxAudioSample void generateInputBuffer() { for (size_t i = 0; i < kBufferSize; i++) { for (size_t i = 0; i < mBufferSize; i++) { mInputBuffer.push_back(((static_cast<float>(std::rand()) / RAND_MAX) * 2 - 1) * kMaxAudioSample); } Loading Loading @@ -215,7 +220,7 @@ class LoudnessEnhancerDataTest : public ::testing::TestWithParam<LoudnessEnhance } void assertSequentialGains(const std::vector<int>& gainValues, bool isIncreasing) { std::vector<float> baseOutput(kBufferSize); std::vector<float> baseOutput(mBufferSize); // Process a reference output buffer with 0 gain which gives compressed input values binder_exception_t expected; Loading Loading @@ -252,7 +257,7 @@ class LoudnessEnhancerDataTest : public ::testing::TestWithParam<LoudnessEnhance std::vector<float> mInputBuffer; std::vector<float> mOutputBuffer; static constexpr float kBufferSize = 128; size_t mBufferSize; }; TEST_P(LoudnessEnhancerDataTest, IncreasingGains) { Loading Loading
audio/aidl/vts/VtsHalDownmixTargetTest.cpp +14 −15 Original line number Diff line number Diff line Loading @@ -96,8 +96,7 @@ class DownmixEffectHelper : public EffectHelper { Parameter::Specific specific = getDefaultParamSpecific(); Parameter::Common common = EffectHelper::createParamCommon( 0 /* session */, 1 /* ioHandle */, 44100 /* iSampleRate */, 44100 /* oSampleRate */, kInputFrameCount /* iFrameCount */, kOutputFrameCount /* oFrameCount */, inputChannelLayout, kFrameCount /* iFrameCount */, kFrameCount /* oFrameCount */, inputChannelLayout, AudioChannelLayout::make<AudioChannelLayout::layoutMask>( AudioChannelLayout::LAYOUT_STEREO)); ASSERT_NO_FATAL_FAILURE(open(mEffect, common, specific, &mOpenEffectReturn, EX_NONE)); Loading Loading @@ -139,14 +138,14 @@ class DownmixEffectHelper : public EffectHelper { } void setDataTestParams(int32_t layoutType) { mInputBuffer.resize(kBufferSize); // Get the number of channels used mInputChannelCount = getChannelCount( AudioChannelLayout::make<AudioChannelLayout::layoutMask>(layoutType)); mInputBufferSize = kFrameCount * mInputChannelCount; mInputBuffer.resize(mInputBufferSize); // In case of downmix, output is always configured to stereo layout. mOutputBufferSize = (mInputBuffer.size() / mInputChannelCount) * kOutputChannelCount; mOutputBufferSize = kFrameCount * kOutputChannelCount; mOutputBuffer.resize(mOutputBufferSize); } Loading @@ -173,7 +172,12 @@ class DownmixEffectHelper : public EffectHelper { return true; } static constexpr long kInputFrameCount = 100, kOutputFrameCount = 100; static const long kFrameCount = 256; static constexpr float kMaxDownmixSample = 1; static constexpr int kOutputChannelCount = 2; // Mask for layouts greater than MAX_INPUT_CHANNELS_SUPPORTED static constexpr int32_t kMaxChannelMask = ~((1 << ChannelMix<AUDIO_CHANNEL_OUT_STEREO>::MAX_INPUT_CHANNELS_SUPPORTED) - 1); std::shared_ptr<IFactory> mFactory; Descriptor mDescriptor; std::shared_ptr<IEffect> mEffect; Loading @@ -183,12 +187,7 @@ class DownmixEffectHelper : public EffectHelper { std::vector<float> mOutputBuffer; size_t mInputChannelCount; size_t mOutputBufferSize; static constexpr size_t kBufferSize = 128; static constexpr float kMaxDownmixSample = 1; static constexpr int kOutputChannelCount = 2; // Mask for layouts greater than MAX_INPUT_CHANNELS_SUPPORTED static constexpr int32_t kMaxChannelMask = ~((1 << ChannelMix<AUDIO_CHANNEL_OUT_STEREO>::MAX_INPUT_CHANNELS_SUPPORTED) - 1); size_t mInputBufferSize; }; /** Loading Loading @@ -401,9 +400,9 @@ class DownmixStripDataTest : public ::testing::TestWithParam<DownmixStripDataTes void TearDown() override { TearDownDownmix(); } void validateOutput() { ASSERT_EQ(kBufferSize, mInputBuffer.size()); ASSERT_GE(kBufferSize, mOutputBufferSize); for (size_t i = 0, j = 0; i < kBufferSize && j < mOutputBufferSize; ASSERT_EQ(mInputBufferSize, mInputBuffer.size()); ASSERT_GE(mInputBufferSize, mOutputBufferSize); for (size_t i = 0, j = 0; i < mInputBufferSize && j < mOutputBufferSize; i += mInputChannelCount, j += kOutputChannelCount) { ASSERT_EQ(mOutputBuffer[j], mInputBuffer[i]); ASSERT_EQ(mOutputBuffer[j + 1], mInputBuffer[i + 1]); Loading
audio/aidl/vts/VtsHalLoudnessEnhancerTargetTest.cpp +11 −6 Original line number Diff line number Diff line Loading @@ -23,6 +23,7 @@ using namespace android; using aidl::android::hardware::audio::common::getChannelCount; using aidl::android::hardware::audio::effect::Descriptor; using aidl::android::hardware::audio::effect::getEffectTypeUuidLoudnessEnhancer; using aidl::android::hardware::audio::effect::IEffect; Loading Loading @@ -50,7 +51,7 @@ class LoudnessEnhancerEffectHelper : public EffectHelper { Parameter::Specific specific = getDefaultParamSpecific(); Parameter::Common common = createParamCommon( 0 /* session */, 1 /* ioHandle */, 44100 /* iSampleRate */, 44100 /* oSampleRate */, kInputFrameCount /* iFrameCount */, kOutputFrameCount /* oFrameCount */); kFrameCount /* iFrameCount */, kFrameCount /* oFrameCount */); ASSERT_NO_FATAL_FAILURE(open(mEffect, common, specific, &mOpenEffectReturn, EX_NONE)); ASSERT_NE(nullptr, mEffect); mVersion = EffectFactoryHelper::getHalVersion(mFactory); Loading Loading @@ -110,7 +111,7 @@ class LoudnessEnhancerEffectHelper : public EffectHelper { << "\ngetParam:" << getParam.toString(); } static const long kInputFrameCount = 0x100, kOutputFrameCount = 0x100; static const long kFrameCount = 256; IEffect::OpenEffectReturn mOpenEffectReturn; std::shared_ptr<IFactory> mFactory; std::shared_ptr<IEffect> mEffect; Loading Loading @@ -153,8 +154,12 @@ class LoudnessEnhancerDataTest : public ::testing::TestWithParam<LoudnessEnhance public: LoudnessEnhancerDataTest() { std::tie(mFactory, mDescriptor) = GetParam(); mBufferSize = kFrameCount * getChannelCount(AudioChannelLayout::make<AudioChannelLayout::layoutMask>( AudioChannelLayout::LAYOUT_STEREO)); generateInputBuffer(); mOutputBuffer.resize(kBufferSize); mOutputBuffer.resize(mBufferSize); } void SetUp() override { Loading @@ -174,7 +179,7 @@ class LoudnessEnhancerDataTest : public ::testing::TestWithParam<LoudnessEnhance // Fill inputBuffer with random values between -kMaxAudioSample to kMaxAudioSample void generateInputBuffer() { for (size_t i = 0; i < kBufferSize; i++) { for (size_t i = 0; i < mBufferSize; i++) { mInputBuffer.push_back(((static_cast<float>(std::rand()) / RAND_MAX) * 2 - 1) * kMaxAudioSample); } Loading Loading @@ -215,7 +220,7 @@ class LoudnessEnhancerDataTest : public ::testing::TestWithParam<LoudnessEnhance } void assertSequentialGains(const std::vector<int>& gainValues, bool isIncreasing) { std::vector<float> baseOutput(kBufferSize); std::vector<float> baseOutput(mBufferSize); // Process a reference output buffer with 0 gain which gives compressed input values binder_exception_t expected; Loading Loading @@ -252,7 +257,7 @@ class LoudnessEnhancerDataTest : public ::testing::TestWithParam<LoudnessEnhance std::vector<float> mInputBuffer; std::vector<float> mOutputBuffer; static constexpr float kBufferSize = 128; size_t mBufferSize; }; TEST_P(LoudnessEnhancerDataTest, IncreasingGains) { Loading