[FFmpeg-cvslog] avutil/tests/channel_layout: test the output of av_channel_layout_subset()
James Almer
git at videolan.org
Fri Mar 25 17:27:21 EET 2022
ffmpeg | branch: master | James Almer <jamrial at gmail.com> | Fri Mar 25 11:21:17 2022 -0300| [95ac380252f70f0e36438b3bfeb4161f7a144472] | committer: James Almer
avutil/tests/channel_layout: test the output of av_channel_layout_subset()
Should increase test coverage a bit
Signed-off-by: James Almer <jamrial at gmail.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=95ac380252f70f0e36438b3bfeb4161f7a144472
---
libavutil/tests/channel_layout.c | 18 ++++++++++++++++++
tests/ref/fate/channel_layout | 9 +++++++++
2 files changed, 27 insertions(+)
diff --git a/libavutil/tests/channel_layout.c b/libavutil/tests/channel_layout.c
index 79d3a1caed..eb9cf1b950 100644
--- a/libavutil/tests/channel_layout.c
+++ b/libavutil/tests/channel_layout.c
@@ -49,6 +49,9 @@
if (ret < 0) \
ret = -1
+#define CHANNEL_LAYOUT_SUBSET(x) \
+ mask = av_channel_layout_subset(&layout, x)
+
#define CHANNEL_LAYOUT_INDEX_FROM_CHANNEL(x) \
ret = av_channel_layout_index_from_channel(&layout, x); \
if (ret < 0) \
@@ -70,6 +73,7 @@ int main(void)
AVChannelLayout layout = { 0 };
AVBPrint bp;
void *iter = NULL;
+ uint64_t mask;
int ret;
av_bprint_init(&bp, 64, AV_BPRINT_SIZE_AUTOMATIC);
@@ -216,6 +220,14 @@ int main(void)
CHANNEL_LAYOUT_INDEX_FROM_STRING("BC");
printf("On 5.1(side) layout with \"BC\": %21d\n", ret);
+ printf("\nTesting av_channel_layout_subset\n");
+ CHANNEL_LAYOUT_SUBSET(AV_CH_LAYOUT_STEREO);
+ printf("On 5.1(side) layout with AV_CH_LAYOUT_STEREO: 0x%"PRIx64"\n", mask);
+ CHANNEL_LAYOUT_SUBSET(AV_CH_LAYOUT_2POINT1);
+ printf("On 5.1(side) layout with AV_CH_LAYOUT_2POINT1: 0x%"PRIx64"\n", mask);
+ CHANNEL_LAYOUT_SUBSET(AV_CH_LAYOUT_4POINT1);
+ printf("On 5.1(side) layout with AV_CH_LAYOUT_4POINT1: 0x%"PRIx64"\n", mask);
+
printf("\n==Custom layouts==\n");
printf("\nTesting av_channel_layout_from_string\n");
@@ -292,6 +304,12 @@ int main(void)
CHANNEL_LAYOUT_CHANNEL_FROM_INDEX(3);
printf("On \"FR+FL at Foo+USR63@Foo\" layout with 3: %21d\n", ret);
+ printf("\nTesting av_channel_layout_subset\n");
+ CHANNEL_LAYOUT_SUBSET(AV_CH_LAYOUT_STEREO);
+ printf("On \"FR+FL at Foo+USR63@Foo\" layout with AV_CH_LAYOUT_STEREO: 0x%"PRIx64"\n", mask);
+ CHANNEL_LAYOUT_SUBSET(AV_CH_LAYOUT_QUAD);
+ printf("On \"FR+FL at Foo+USR63@Foo\" layout with AV_CH_LAYOUT_QUAD: 0x%"PRIx64"\n", mask);
+
printf("\n==Ambisonic layouts==\n");
printf("\nTesting av_channel_layout_from_string\n");
diff --git a/tests/ref/fate/channel_layout b/tests/ref/fate/channel_layout
index 8e452da5a9..b1a4dcb1b1 100644
--- a/tests/ref/fate/channel_layout
+++ b/tests/ref/fate/channel_layout
@@ -103,6 +103,11 @@ On 5.1(side) layout with "SL": 4
On 5.1(side) layout with "SR": 5
On 5.1(side) layout with "BC": -1
+Testing av_channel_layout_subset
+On 5.1(side) layout with AV_CH_LAYOUT_STEREO: 0x3
+On 5.1(side) layout with AV_CH_LAYOUT_2POINT1: 0xb
+On 5.1(side) layout with AV_CH_LAYOUT_4POINT1: 0xf
+
==Custom layouts==
Testing av_channel_layout_from_string
@@ -147,6 +152,10 @@ On "FR+FL at Foo+USR63@Foo" layout with 1: 0
On "FR+FL at Foo+USR63@Foo" layout with 2: 63
On "FR+FL at Foo+USR63@Foo" layout with 3: -1
+Testing av_channel_layout_subset
+On "FR+FL at Foo+USR63@Foo" layout with AV_CH_LAYOUT_STEREO: 0x3
+On "FR+FL at Foo+USR63@Foo" layout with AV_CH_LAYOUT_QUAD: 0x3
+
==Ambisonic layouts==
Testing av_channel_layout_from_string
More information about the ffmpeg-cvslog
mailing list