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