blob: d7db567a0b07ccb5f41b89c7f9b7578591ff976b [file] [log] [blame]
Sham Rathod40f55bd2022-11-14 14:24:49 +05301/*
2 * Copyright (C) 2022 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
Sham Rathod40f55bd2022-11-14 14:24:49 +053017#include <aidl/Vintf.h>
Mikhail Naganov872d4a62023-03-09 18:19:01 -080018#define LOG_TAG "VtsHalDownmixTargetTest"
19#include <android-base/logging.h>
20
Sneha Patilf533b502023-10-25 12:39:55 +053021#include <audio_utils/ChannelMix.h>
Sham Rathod40f55bd2022-11-14 14:24:49 +053022#include "EffectHelper.h"
23
24using namespace android;
25
Sneha Patilf533b502023-10-25 12:39:55 +053026using aidl::android::hardware::audio::common::getChannelCount;
Sham Rathod40f55bd2022-11-14 14:24:49 +053027using aidl::android::hardware::audio::effect::Descriptor;
28using aidl::android::hardware::audio::effect::Downmix;
Shunkai Yaof8be1ac2023-03-06 18:41:27 +000029using aidl::android::hardware::audio::effect::getEffectTypeUuidDownmix;
Sham Rathod40f55bd2022-11-14 14:24:49 +053030using aidl::android::hardware::audio::effect::IEffect;
31using aidl::android::hardware::audio::effect::IFactory;
Sham Rathod40f55bd2022-11-14 14:24:49 +053032using aidl::android::hardware::audio::effect::Parameter;
Sneha Patilf533b502023-10-25 12:39:55 +053033using android::audio_utils::channels::ChannelMix;
Jaideep Sharma74498412023-09-13 15:25:25 +053034using android::hardware::audio::common::testing::detail::TestExecutionTracer;
Sham Rathod40f55bd2022-11-14 14:24:49 +053035
36// Testing for enum values
Sneha Patilf533b502023-10-25 12:39:55 +053037static const std::vector<Downmix::Type> kTypeValues = {ndk::enum_range<Downmix::Type>().begin(),
38 ndk::enum_range<Downmix::Type>().end()};
Sham Rathod40f55bd2022-11-14 14:24:49 +053039
Sneha Patilf533b502023-10-25 12:39:55 +053040// Testing for supported layouts from AudioChannelLayout.h
41static const std::vector<int32_t> kLayoutValues = {
42 AudioChannelLayout::LAYOUT_STEREO, AudioChannelLayout::LAYOUT_2POINT1,
43 AudioChannelLayout::LAYOUT_TRI, AudioChannelLayout::LAYOUT_TRI_BACK,
44 AudioChannelLayout::LAYOUT_3POINT1, AudioChannelLayout::LAYOUT_2POINT0POINT2,
45 AudioChannelLayout::LAYOUT_2POINT1POINT2, AudioChannelLayout::LAYOUT_3POINT0POINT2,
46 AudioChannelLayout::LAYOUT_3POINT1POINT2, AudioChannelLayout::LAYOUT_QUAD,
47 AudioChannelLayout::LAYOUT_QUAD_SIDE, AudioChannelLayout::LAYOUT_SURROUND,
48 AudioChannelLayout::LAYOUT_PENTA, AudioChannelLayout::LAYOUT_5POINT1,
49 AudioChannelLayout::LAYOUT_5POINT1_SIDE, AudioChannelLayout::LAYOUT_5POINT1POINT2,
50 AudioChannelLayout::LAYOUT_5POINT1POINT4, AudioChannelLayout::LAYOUT_6POINT1,
51 AudioChannelLayout::LAYOUT_7POINT1, AudioChannelLayout::LAYOUT_7POINT1POINT2,
52 AudioChannelLayout::LAYOUT_7POINT1POINT4, AudioChannelLayout::LAYOUT_9POINT1POINT4,
53 AudioChannelLayout::LAYOUT_9POINT1POINT6, AudioChannelLayout::LAYOUT_13POINT_360RA,
54 AudioChannelLayout::LAYOUT_22POINT2};
55
56static const std::vector<int32_t> kChannels = {
57 AudioChannelLayout::CHANNEL_FRONT_LEFT,
58 AudioChannelLayout::CHANNEL_FRONT_RIGHT,
59 AudioChannelLayout::CHANNEL_FRONT_CENTER,
60 AudioChannelLayout::CHANNEL_LOW_FREQUENCY,
61 AudioChannelLayout::CHANNEL_BACK_LEFT,
62 AudioChannelLayout::CHANNEL_BACK_RIGHT,
63 AudioChannelLayout::CHANNEL_BACK_CENTER,
64 AudioChannelLayout::CHANNEL_SIDE_LEFT,
65 AudioChannelLayout::CHANNEL_SIDE_RIGHT,
66 AudioChannelLayout::CHANNEL_FRONT_LEFT_OF_CENTER,
67 AudioChannelLayout::CHANNEL_FRONT_RIGHT_OF_CENTER,
68 AudioChannelLayout::CHANNEL_TOP_CENTER,
69 AudioChannelLayout::CHANNEL_TOP_FRONT_LEFT,
70 AudioChannelLayout::CHANNEL_TOP_FRONT_CENTER,
71 AudioChannelLayout::CHANNEL_TOP_FRONT_RIGHT,
72 AudioChannelLayout::CHANNEL_TOP_BACK_LEFT,
73 AudioChannelLayout::CHANNEL_TOP_BACK_CENTER,
74 AudioChannelLayout::CHANNEL_TOP_BACK_RIGHT,
75 AudioChannelLayout::CHANNEL_TOP_SIDE_LEFT,
76 AudioChannelLayout::CHANNEL_TOP_SIDE_RIGHT,
77 AudioChannelLayout::CHANNEL_BOTTOM_FRONT_LEFT,
78 AudioChannelLayout::CHANNEL_BOTTOM_FRONT_CENTER,
79 AudioChannelLayout::CHANNEL_BOTTOM_FRONT_RIGHT,
80 AudioChannelLayout::CHANNEL_LOW_FREQUENCY_2,
81 AudioChannelLayout::CHANNEL_FRONT_WIDE_LEFT,
82 AudioChannelLayout::CHANNEL_FRONT_WIDE_RIGHT,
83};
84
85class DownmixEffectHelper : public EffectHelper {
Sham Rathod40f55bd2022-11-14 14:24:49 +053086 public:
Sneha Patilf533b502023-10-25 12:39:55 +053087 void SetUpDownmix(int32_t inputBufferLayout = AudioChannelLayout::LAYOUT_STEREO) {
Sham Rathod40f55bd2022-11-14 14:24:49 +053088 ASSERT_NE(nullptr, mFactory);
89 ASSERT_NO_FATAL_FAILURE(create(mFactory, mEffect, mDescriptor));
90
Sneha Patilf533b502023-10-25 12:39:55 +053091 AudioChannelLayout inputChannelLayout =
92 AudioChannelLayout::make<AudioChannelLayout::layoutMask>(inputBufferLayout);
93
Sham Rathod40f55bd2022-11-14 14:24:49 +053094 Parameter::Specific specific = getDefaultParamSpecific();
95 Parameter::Common common = EffectHelper::createParamCommon(
96 0 /* session */, 1 /* ioHandle */, 44100 /* iSampleRate */, 44100 /* oSampleRate */,
Sneha Patilf533b502023-10-25 12:39:55 +053097 kInputFrameCount /* iFrameCount */, kOutputFrameCount /* oFrameCount */,
98 inputChannelLayout);
99 ASSERT_NO_FATAL_FAILURE(open(mEffect, common, specific, &mOpenEffectReturn, EX_NONE));
Sham Rathod40f55bd2022-11-14 14:24:49 +0530100 ASSERT_NE(nullptr, mEffect);
101 }
102
Sneha Patilf533b502023-10-25 12:39:55 +0530103 void TearDownDownmix() {
Sham Rathod40f55bd2022-11-14 14:24:49 +0530104 ASSERT_NO_FATAL_FAILURE(close(mEffect));
105 ASSERT_NO_FATAL_FAILURE(destroy(mFactory, mEffect));
Sneha Patilf533b502023-10-25 12:39:55 +0530106 mOpenEffectReturn = IEffect::OpenEffectReturn{};
Sham Rathod40f55bd2022-11-14 14:24:49 +0530107 }
108
Sneha Patilf533b502023-10-25 12:39:55 +0530109 Parameter createDownmixParam(Downmix::Type type) {
110 return Parameter::make<Parameter::specific>(
111 Parameter::Specific::make<Parameter::Specific::downmix>(
112 Downmix::make<Downmix::type>(type)));
113 }
114 void setParameters(Downmix::Type type) {
115 // set parameter
116 auto param = createDownmixParam(type);
117 EXPECT_STATUS(EX_NONE, mEffect->setParameter(param)) << param.toString();
Sham Rathod40f55bd2022-11-14 14:24:49 +0530118 }
119
Sneha Patilf533b502023-10-25 12:39:55 +0530120 void validateParameters(Downmix::Type type) {
121 auto leId = Downmix::Id::make<Downmix::Id::commonTag>(Downmix::Tag(Downmix::type));
122 auto id = Parameter::Id::make<Parameter::Id::downmixTag>(leId);
123 // get parameter
124 Parameter getParam;
125 EXPECT_STATUS(EX_NONE, mEffect->getParameter(id, &getParam));
126 auto expectedParam = createDownmixParam(type);
127 EXPECT_EQ(expectedParam, getParam) << "\nexpectedParam:" << expectedParam.toString()
128 << "\ngetParam:" << getParam.toString();
Sham Rathod40f55bd2022-11-14 14:24:49 +0530129 }
130
131 Parameter::Specific getDefaultParamSpecific() {
132 Downmix dm = Downmix::make<Downmix::type>(Downmix::Type::STRIP);
133 Parameter::Specific specific = Parameter::Specific::make<Parameter::Specific::downmix>(dm);
134 return specific;
135 }
136
Sneha Patilf533b502023-10-25 12:39:55 +0530137 void setDataTestParams(int32_t layoutType) {
138 mInputBuffer.resize(kBufferSize);
139 mOutputBuffer.resize(kBufferSize);
140
141 // Get the number of channels used
142 mInputChannelCount = getChannelCount(
143 AudioChannelLayout::make<AudioChannelLayout::layoutMask>(layoutType));
144
145 // In case of downmix, output is always configured to stereo layout.
146 mOutputBufferSize = (mInputBuffer.size() / mInputChannelCount) * kOutputChannelCount;
147 }
148
149 // Generate mInputBuffer values between -kMaxDownmixSample to kMaxDownmixSample
150 void generateInputBuffer(size_t position, bool isStrip) {
151 size_t increment;
152 if (isStrip)
153 // Fill input at all the channels
154 increment = 1;
155 else
156 // Fill input at only one channel
157 increment = mInputChannelCount;
158
159 for (size_t i = position; i < mInputBuffer.size(); i += increment) {
160 mInputBuffer[i] =
161 ((static_cast<float>(std::rand()) / RAND_MAX) * 2 - 1) * kMaxDownmixSample;
162 }
163 }
164
165 bool isLayoutValid(int32_t inputLayout) {
166 if (inputLayout & kMaxChannelMask) {
167 return false;
168 }
169 return true;
170 }
171
172 static constexpr long kInputFrameCount = 100, kOutputFrameCount = 100;
173 std::shared_ptr<IFactory> mFactory;
174 Descriptor mDescriptor;
175 std::shared_ptr<IEffect> mEffect;
176 IEffect::OpenEffectReturn mOpenEffectReturn;
177
178 std::vector<float> mInputBuffer;
179 std::vector<float> mOutputBuffer;
180 size_t mInputChannelCount;
181 size_t mOutputBufferSize;
182 static constexpr size_t kBufferSize = 128;
183 static constexpr float kMaxDownmixSample = 1;
184 static constexpr int kOutputChannelCount = 2;
185 // Mask for layouts greater than MAX_INPUT_CHANNELS_SUPPORTED
186 static constexpr int32_t kMaxChannelMask =
187 ~((1 << ChannelMix<AUDIO_CHANNEL_OUT_STEREO>::MAX_INPUT_CHANNELS_SUPPORTED) - 1);
188};
189
190/**
191 * Here we focus on specific parameter checking, general IEffect interfaces testing performed in
192 * VtsAudioEffectTargetTest.
193 */
194enum ParamName { PARAM_INSTANCE_NAME, PARAM_TYPE };
195
196using DownmixParamTestParam =
197 std::tuple<std::pair<std::shared_ptr<IFactory>, Descriptor>, Downmix::Type>;
198
199class DownmixParamTest : public ::testing::TestWithParam<DownmixParamTestParam>,
200 public DownmixEffectHelper {
201 public:
202 DownmixParamTest() : mParamType(std::get<PARAM_TYPE>(GetParam())) {
203 std::tie(mFactory, mDescriptor) = std::get<PARAM_INSTANCE_NAME>(GetParam());
204 }
205
206 void SetUp() override { SetUpDownmix(); }
207
208 void TearDown() override { TearDownDownmix(); }
209
210 const Downmix::Type mParamType;
Sham Rathod40f55bd2022-11-14 14:24:49 +0530211};
212
213TEST_P(DownmixParamTest, SetAndGetType) {
Sneha Patilf533b502023-10-25 12:39:55 +0530214 ASSERT_NO_FATAL_FAILURE(setParameters(mParamType));
215 ASSERT_NO_FATAL_FAILURE(validateParameters(mParamType));
216}
217
218enum FoldParamName { FOLD_INSTANCE_NAME, FOLD_INPUT_LAYOUT, FOLD_TEST_CHANNEL };
219
220using DownmixDataTestParamFold =
221 std::tuple<std::pair<std::shared_ptr<IFactory>, Descriptor>, int32_t>;
222
223class DownmixFoldDataTest : public ::testing::TestWithParam<DownmixDataTestParamFold>,
224 public DownmixEffectHelper {
225 public:
226 DownmixFoldDataTest() : mInputChannelLayout(std::get<FOLD_INPUT_LAYOUT>(GetParam())) {
227 std::tie(mFactory, mDescriptor) = std::get<FOLD_INSTANCE_NAME>(GetParam());
228 }
229
230 void SetUp() override {
231 SetUpDownmix(mInputChannelLayout);
232 if (!isLayoutValid(mInputChannelLayout)) {
233 GTEST_SKIP() << "Layout not supported \n";
234 }
235 setDataTestParams(mInputChannelLayout);
236 }
237
238 void TearDown() override { TearDownDownmix(); }
239
240 void checkAtLeft(int32_t position) {
241 for (size_t i = 0, j = position; i < mOutputBufferSize;
242 i += kOutputChannelCount, j += mInputChannelCount) {
243 // Validate Left channel has audio
244 if (mInputBuffer[j] != 0) {
245 ASSERT_NE(mOutputBuffer[i], 0);
246 } else {
247 // No change in output when input is 0
248 ASSERT_EQ(mOutputBuffer[i], mInputBuffer[j]);
249 }
250 // Validate Right channel has no audio
251 ASSERT_EQ(mOutputBuffer[i + 1], 0);
252 }
253 }
254
255 void checkAtRight(int32_t position) {
256 for (size_t i = 0, j = position; i < mOutputBufferSize;
257 i += kOutputChannelCount, j += mInputChannelCount) {
258 // Validate Left channel has no audio
259 ASSERT_EQ(mOutputBuffer[i], 0);
260 // Validate Right channel has audio
261 if (mInputBuffer[j] != 0) {
262 ASSERT_NE(mOutputBuffer[i + 1], 0);
263 } else {
264 // No change in output when input is 0
265 ASSERT_EQ(mOutputBuffer[i + 1], mInputBuffer[j]);
266 }
267 }
268 }
269
270 void checkAtCenter(size_t position) {
271 for (size_t i = 0, j = position; i < mOutputBufferSize;
272 i += kOutputChannelCount, j += mInputChannelCount) {
273 // Validate both channels have audio
274 if (mInputBuffer[j] != 0) {
275 ASSERT_NE(mOutputBuffer[i], 0);
276 ASSERT_NE(mOutputBuffer[i + 1], 0);
277
278 } else {
279 // No change in output when input is 0
280 ASSERT_EQ(mOutputBuffer[i], mInputBuffer[j]);
281 ASSERT_EQ(mOutputBuffer[i + 1], mInputBuffer[j]);
282 }
283 }
284 }
285
286 void validateOutput(int32_t channel, size_t position) {
287 switch (channel) {
288 case AudioChannelLayout::CHANNEL_FRONT_LEFT:
289 case AudioChannelLayout::CHANNEL_BACK_LEFT:
290 case AudioChannelLayout::CHANNEL_SIDE_LEFT:
291 case AudioChannelLayout::CHANNEL_TOP_FRONT_LEFT:
292 case AudioChannelLayout::CHANNEL_BOTTOM_FRONT_LEFT:
293 case AudioChannelLayout::CHANNEL_TOP_BACK_LEFT:
294 case AudioChannelLayout::CHANNEL_FRONT_WIDE_LEFT:
295 case AudioChannelLayout::CHANNEL_TOP_SIDE_LEFT:
296 checkAtLeft(position);
297 break;
298
299 case AudioChannelLayout::CHANNEL_FRONT_RIGHT:
300 case AudioChannelLayout::CHANNEL_BACK_RIGHT:
301 case AudioChannelLayout::CHANNEL_SIDE_RIGHT:
302 case AudioChannelLayout::CHANNEL_TOP_FRONT_RIGHT:
303 case AudioChannelLayout::CHANNEL_BOTTOM_FRONT_RIGHT:
304 case AudioChannelLayout::CHANNEL_TOP_BACK_RIGHT:
305 case AudioChannelLayout::CHANNEL_FRONT_WIDE_RIGHT:
306 case AudioChannelLayout::CHANNEL_TOP_SIDE_RIGHT:
307 case AudioChannelLayout::CHANNEL_LOW_FREQUENCY_2:
308 checkAtRight(position);
309 break;
310
311 case AudioChannelLayout::CHANNEL_FRONT_CENTER:
312 case AudioChannelLayout::CHANNEL_BACK_CENTER:
313 case AudioChannelLayout::CHANNEL_TOP_FRONT_CENTER:
314 case AudioChannelLayout::CHANNEL_BOTTOM_FRONT_CENTER:
315 case AudioChannelLayout::CHANNEL_FRONT_LEFT_OF_CENTER:
316 case AudioChannelLayout::CHANNEL_FRONT_RIGHT_OF_CENTER:
317 case AudioChannelLayout::CHANNEL_TOP_CENTER:
318 case AudioChannelLayout::CHANNEL_TOP_BACK_CENTER:
319 checkAtCenter(position);
320 break;
321
322 case AudioChannelLayout::CHANNEL_LOW_FREQUENCY:
323 // If CHANNEL_LOW_FREQUENCY_2 is supported
324 if (mInputChannelLayout & AudioChannelLayout::CHANNEL_LOW_FREQUENCY_2) {
325 // Validate that only Left channel has audio
326 checkAtLeft(position);
327 } else {
328 // Validate that both channels have audio
329 checkAtCenter(position);
330 }
331 break;
332 }
333 }
334
335 std::set<int32_t> getInputChannelLayouts() {
336 std::set<int32_t> supportedChannels;
337 for (int32_t channel : kChannels) {
338 if ((mInputChannelLayout & channel) == channel) {
339 supportedChannels.insert(channel);
340 }
341 }
342 return supportedChannels;
343 }
344
345 int32_t mInputChannelLayout;
346};
347
348TEST_P(DownmixFoldDataTest, DownmixProcessData) {
349 // Set FOLD type parameter
350 ASSERT_NO_FATAL_FAILURE(setParameters(Downmix::Type::FOLD));
351
352 // Get all the channels from input layout
353 std::set<int32_t> supportedChannels = getInputChannelLayouts();
354
355 for (int32_t channel : supportedChannels) {
356 size_t position = std::distance(supportedChannels.begin(), supportedChannels.find(channel));
357 generateInputBuffer(position, false /*isStripe*/);
358 ASSERT_NO_FATAL_FAILURE(
359 processAndWriteToOutput(mInputBuffer, mOutputBuffer, mEffect, &mOpenEffectReturn));
360 validateOutput(channel, position);
361 std::fill(mInputBuffer.begin(), mInputBuffer.end(), 0);
362 }
363}
364
365enum StripParamName { STRIP_INSTANCE_NAME, STRIP_INPUT_LAYOUT };
366
367using DownmixStripDataTestParam =
368 std::tuple<std::pair<std::shared_ptr<IFactory>, Descriptor>, int32_t>;
369
370class DownmixStripDataTest : public ::testing::TestWithParam<DownmixStripDataTestParam>,
371 public DownmixEffectHelper {
372 public:
373 DownmixStripDataTest() : mInputChannelLayout(std::get<STRIP_INPUT_LAYOUT>(GetParam())) {
374 std::tie(mFactory, mDescriptor) = std::get<STRIP_INSTANCE_NAME>(GetParam());
375 }
376
377 void SetUp() override {
378 SetUpDownmix(mInputChannelLayout);
379 if (!isLayoutValid(mInputChannelLayout)) {
380 GTEST_SKIP() << "Layout not supported \n";
381 }
382 setDataTestParams(mInputChannelLayout);
383 }
384
385 void TearDown() override { TearDownDownmix(); }
386
387 void validateOutput() {
388 ASSERT_EQ(kBufferSize, mInputBuffer.size());
389 ASSERT_GE(kBufferSize, mOutputBufferSize);
390 for (size_t i = 0, j = 0; i < kBufferSize && j < mOutputBufferSize;
391 i += mInputChannelCount, j += kOutputChannelCount) {
392 ASSERT_EQ(mOutputBuffer[j], mInputBuffer[i]);
393 ASSERT_EQ(mOutputBuffer[j + 1], mInputBuffer[i + 1]);
394 }
395 for (size_t i = mOutputBufferSize; i < kBufferSize; i++) {
396 ASSERT_EQ(mOutputBuffer[i], mInputBuffer[i]);
397 }
398 }
399
400 int32_t mInputChannelLayout;
401};
402
403TEST_P(DownmixStripDataTest, DownmixProcessData) {
404 // Set STRIP type parameter
405 ASSERT_NO_FATAL_FAILURE(setParameters(Downmix::Type::STRIP));
406
407 // Generate input buffer, call process and compare outputs
408 generateInputBuffer(0 /*position*/, true /*isStripe*/);
409 ASSERT_NO_FATAL_FAILURE(
410 processAndWriteToOutput(mInputBuffer, mOutputBuffer, mEffect, &mOpenEffectReturn));
411 validateOutput();
Sham Rathod40f55bd2022-11-14 14:24:49 +0530412}
413
414INSTANTIATE_TEST_SUITE_P(
415 DownmixTest, DownmixParamTest,
416 ::testing::Combine(testing::ValuesIn(EffectFactoryHelper::getAllEffectDescriptors(
Shunkai Yaof8be1ac2023-03-06 18:41:27 +0000417 IFactory::descriptor, getEffectTypeUuidDownmix())),
Sham Rathod40f55bd2022-11-14 14:24:49 +0530418 testing::ValuesIn(kTypeValues)),
419 [](const testing::TestParamInfo<DownmixParamTest::ParamType>& info) {
420 auto descriptor = std::get<PARAM_INSTANCE_NAME>(info.param).second;
421 std::string type = std::to_string(static_cast<int>(std::get<PARAM_TYPE>(info.param)));
Jaideep Sharmae4c7a962023-06-14 19:14:44 +0530422 std::string name = getPrefix(descriptor) + "_type" + type;
Sham Rathod40f55bd2022-11-14 14:24:49 +0530423 std::replace_if(
424 name.begin(), name.end(), [](const char c) { return !std::isalnum(c); }, '_');
425 return name;
426 });
427
428GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(DownmixParamTest);
429
Sneha Patilf533b502023-10-25 12:39:55 +0530430INSTANTIATE_TEST_SUITE_P(
431 DownmixTest, DownmixFoldDataTest,
432 ::testing::Combine(testing::ValuesIn(EffectFactoryHelper::getAllEffectDescriptors(
433 IFactory::descriptor, getEffectTypeUuidDownmix())),
434 testing::ValuesIn(kLayoutValues)),
435 [](const testing::TestParamInfo<DownmixFoldDataTest::ParamType>& info) {
436 auto descriptor = std::get<FOLD_INSTANCE_NAME>(info.param).second;
437 std::string layout = std::to_string(std::get<FOLD_INPUT_LAYOUT>(info.param));
438 std::string name = getPrefix(descriptor) + "_fold" + "_layout" + layout;
439 std::replace_if(
440 name.begin(), name.end(), [](const char c) { return !std::isalnum(c); }, '_');
441 return name;
442 });
443
444GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(DownmixFoldDataTest);
445
446INSTANTIATE_TEST_SUITE_P(
447 DownmixTest, DownmixStripDataTest,
448 ::testing::Combine(testing::ValuesIn(EffectFactoryHelper::getAllEffectDescriptors(
449 IFactory::descriptor, getEffectTypeUuidDownmix())),
450 testing::ValuesIn(kLayoutValues)),
451 [](const testing::TestParamInfo<DownmixStripDataTest::ParamType>& info) {
452 auto descriptor = std::get<STRIP_INSTANCE_NAME>(info.param).second;
453 std::string layout =
454 std::to_string(static_cast<int>(std::get<STRIP_INPUT_LAYOUT>(info.param)));
455 std::string name = getPrefix(descriptor) + "_strip" + "_layout" + layout;
456 std::replace_if(
457 name.begin(), name.end(), [](const char c) { return !std::isalnum(c); }, '_');
458 return name;
459 });
460
461GTEST_ALLOW_UNINSTANTIATED_PARAMETERIZED_TEST(DownmixStripDataTest);
462
Sham Rathod40f55bd2022-11-14 14:24:49 +0530463int main(int argc, char** argv) {
464 ::testing::InitGoogleTest(&argc, argv);
Jaideep Sharma74498412023-09-13 15:25:25 +0530465 ::testing::UnitTest::GetInstance()->listeners().Append(new TestExecutionTracer());
Sham Rathod40f55bd2022-11-14 14:24:49 +0530466 ABinderProcess_setThreadPoolMaxThreadCount(1);
467 ABinderProcess_startThreadPool();
468 return RUN_ALL_TESTS();
469}