xref: /aosp_15_r20/system/media/audio_utils/tests/spatializer_utils_tests.cpp (revision b9df5ad1c9ac98a7fefaac271a55f7ae3db05414)
1 /*
2  * Copyright (C) 2023 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 
17 #include <gtest/gtest.h>
18 #include <log/log.h>
19 #include <system/audio.h>
20 
TEST(spatializer_utils_tests,basic)21 TEST(spatializer_utils_tests, basic)
22 {
23     // We don't spatialize mono at this time.
24     ASSERT_FALSE(audio_is_channel_mask_spatialized(AUDIO_CHANNEL_OUT_MONO));
25 
26     // These common multichannel formats we spatialize.
27     ASSERT_TRUE(audio_is_channel_mask_spatialized(AUDIO_CHANNEL_OUT_QUAD));
28     ASSERT_TRUE(audio_is_channel_mask_spatialized(AUDIO_CHANNEL_OUT_QUAD_SIDE));
29     ASSERT_TRUE(audio_is_channel_mask_spatialized(AUDIO_CHANNEL_OUT_5POINT1));
30     ASSERT_TRUE(audio_is_channel_mask_spatialized(AUDIO_CHANNEL_OUT_5POINT1_SIDE));
31     ASSERT_TRUE(audio_is_channel_mask_spatialized(AUDIO_CHANNEL_OUT_5POINT1POINT4));
32     ASSERT_TRUE(audio_is_channel_mask_spatialized(AUDIO_CHANNEL_OUT_7POINT1));
33     ASSERT_TRUE(audio_is_channel_mask_spatialized(AUDIO_CHANNEL_OUT_7POINT1POINT2));
34     ASSERT_TRUE(audio_is_channel_mask_spatialized(AUDIO_CHANNEL_OUT_7POINT1POINT4));
35     ASSERT_TRUE(audio_is_channel_mask_spatialized(AUDIO_CHANNEL_OUT_9POINT1POINT4));
36     ASSERT_TRUE(audio_is_channel_mask_spatialized(AUDIO_CHANNEL_OUT_9POINT1POINT6));
37     ASSERT_TRUE(audio_is_channel_mask_spatialized(AUDIO_CHANNEL_OUT_13POINT_360RA));
38     ASSERT_TRUE(audio_is_channel_mask_spatialized(AUDIO_CHANNEL_OUT_22POINT2));
39 }
40