* [FFmpeg-devel] [PATCH 1/4 v2] avcodec/aacdec: fix parsing streams with channel configuration 11
@ 2022-10-28 12:21 James Almer
2022-10-28 12:21 ` [FFmpeg-devel] [PATCH 2/4 v2] avutil/channel_layout: add a 7.1(top) channel layout James Almer
` (2 more replies)
0 siblings, 3 replies; 8+ messages in thread
From: James Almer @ 2022-10-28 12:21 UTC (permalink / raw)
To: ffmpeg-devel
Set the correct amount of tags in tags_per_config[] and ensure the side
channels (Surround in the spec) are used.
Signed-off-by: James Almer <jamrial@gmail.com>
---
libavcodec/aacdec_template.c | 4 +---
libavcodec/aacdectab.h | 4 ++--
2 files changed, 3 insertions(+), 5 deletions(-)
diff --git a/libavcodec/aacdec_template.c b/libavcodec/aacdec_template.c
index 4a9513d53e..c10bc743b6 100644
--- a/libavcodec/aacdec_template.c
+++ b/libavcodec/aacdec_template.c
@@ -731,9 +731,7 @@ static ChannelElement *get_che(AACContext *ac, int type, int elem_id)
return ac->tag_che_map[TYPE_CPE][elem_id] = ac->che[TYPE_CPE][2];
}
case 11:
- if (ac->tags_mapped == 2 &&
- ac->oc[1].m4ac.chan_config == 11 &&
- type == TYPE_SCE) {
+ if (ac->tags_mapped == 3 && type == TYPE_SCE) {
ac->tags_mapped++;
return ac->tag_che_map[TYPE_SCE][elem_id] = ac->che[TYPE_SCE][1];
}
diff --git a/libavcodec/aacdectab.h b/libavcodec/aacdectab.h
index e38b93a534..b820f10556 100644
--- a/libavcodec/aacdectab.h
+++ b/libavcodec/aacdectab.h
@@ -35,7 +35,7 @@
#include <stdint.h>
-static const int8_t tags_per_config[16] = { 0, 1, 1, 2, 3, 3, 4, 5, 0, 0, 0, 4, 5, 16, 5, 0 };
+static const int8_t tags_per_config[16] = { 0, 1, 1, 2, 3, 3, 4, 5, 0, 0, 0, 5, 5, 16, 5, 0 };
static const uint8_t aac_channel_layout_map[16][16][3] = {
{ { TYPE_SCE, 0, AAC_CHANNEL_FRONT }, },
@@ -48,7 +48,7 @@ static const uint8_t aac_channel_layout_map[16][16][3] = {
{ { 0, } },
{ { 0, } },
{ { 0, } },
- { { TYPE_SCE, 0, AAC_CHANNEL_FRONT }, { TYPE_CPE, 0, AAC_CHANNEL_FRONT }, { TYPE_CPE, 1, AAC_CHANNEL_BACK }, { TYPE_SCE, 1, AAC_CHANNEL_BACK }, { TYPE_LFE, 0, AAC_CHANNEL_LFE }, },
+ { { TYPE_SCE, 0, AAC_CHANNEL_FRONT }, { TYPE_CPE, 0, AAC_CHANNEL_FRONT }, { TYPE_CPE, 1, AAC_CHANNEL_SIDE }, { TYPE_SCE, 1, AAC_CHANNEL_BACK }, { TYPE_LFE, 0, AAC_CHANNEL_LFE }, },
{ { TYPE_SCE, 0, AAC_CHANNEL_FRONT }, { TYPE_CPE, 0, AAC_CHANNEL_FRONT }, { TYPE_CPE, 1, AAC_CHANNEL_SIDE }, { TYPE_CPE, 2, AAC_CHANNEL_BACK }, { TYPE_LFE, 0, AAC_CHANNEL_LFE }, },
{
{ TYPE_SCE, 0, AAC_CHANNEL_FRONT }, // SCE1 = FC,
--
2.38.1
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 8+ messages in thread
* [FFmpeg-devel] [PATCH 2/4 v2] avutil/channel_layout: add a 7.1(top) channel layout
2022-10-28 12:21 [FFmpeg-devel] [PATCH 1/4 v2] avcodec/aacdec: fix parsing streams with channel configuration 11 James Almer
@ 2022-10-28 12:21 ` James Almer
2022-10-28 12:21 ` [FFmpeg-devel] [PATCH 3/4 v2] avcodec/aacdec: add support for channel configuration 14 James Almer
2022-10-28 12:21 ` [FFmpeg-devel] [PATCH 4/4] avformat/mov_chan: add missing AAC 7.1 mappings James Almer
2 siblings, 0 replies; 8+ messages in thread
From: James Almer @ 2022-10-28 12:21 UTC (permalink / raw)
To: ffmpeg-devel
Signed-off-by: James Almer <jamrial@gmail.com>
---
doc/APIchanges | 3 +++
doc/utils.texi | 2 ++
libavutil/channel_layout.c | 1 +
libavutil/channel_layout.h | 2 ++
tests/ref/fate/channel_layout | 1 +
5 files changed, 9 insertions(+)
diff --git a/doc/APIchanges b/doc/APIchanges
index 5807bf8069..75bbcaddff 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -14,6 +14,9 @@ libavutil: 2021-04-27
API changes, most recent first:
+2022-10-xx - xxxxxxxxxx - lavu 57.xx.xxx - channel_layout.h
+ Add AV_CH_LAYOUT_7POINT1_TOP and AV_CHANNEL_LAYOUT_7POINT1_TOP.
+
2022-10-11 - xxxxxxxxxx - lavu 57.39.101 - pixfmt.h
Add AV_PIX_FMT_RGBF32 and AV_PIX_FMT_RGBAF32.
diff --git a/doc/utils.texi b/doc/utils.texi
index 627b55d154..d19523a5f4 100644
--- a/doc/utils.texi
+++ b/doc/utils.texi
@@ -713,6 +713,8 @@ FL+FR+FC+LFE+BL+BR+SL+SR
FL+FR+FC+LFE+BL+BR+FLC+FRC
@item 7.1(wide-side)
FL+FR+FC+LFE+FLC+FRC+SL+SR
+@item 7.1(top)
+FL+FR+FC+LFE+SL+SR+TFL+TFR
@item octagonal
FL+FR+FC+BL+BR+BC+SL+SR
@item hexadecagonal
diff --git a/libavutil/channel_layout.c b/libavutil/channel_layout.c
index 21b70173b7..bc0016d346 100644
--- a/libavutil/channel_layout.c
+++ b/libavutil/channel_layout.c
@@ -196,6 +196,7 @@ static const struct channel_layout_name channel_layout_map[] = {
{ "7.1", AV_CHANNEL_LAYOUT_7POINT1 },
{ "7.1(wide)", AV_CHANNEL_LAYOUT_7POINT1_WIDE_BACK },
{ "7.1(wide-side)", AV_CHANNEL_LAYOUT_7POINT1_WIDE },
+ { "7.1(top)", AV_CHANNEL_LAYOUT_7POINT1_TOP },
{ "octagonal", AV_CHANNEL_LAYOUT_OCTAGONAL },
{ "hexadecagonal", AV_CHANNEL_LAYOUT_HEXADECAGONAL },
{ "downmix", AV_CHANNEL_LAYOUT_STEREO_DOWNMIX, },
diff --git a/libavutil/channel_layout.h b/libavutil/channel_layout.h
index 059ff70841..9246562807 100644
--- a/libavutil/channel_layout.h
+++ b/libavutil/channel_layout.h
@@ -232,6 +232,7 @@ enum AVChannelOrder {
#define AV_CH_LAYOUT_7POINT1 (AV_CH_LAYOUT_5POINT1|AV_CH_BACK_LEFT|AV_CH_BACK_RIGHT)
#define AV_CH_LAYOUT_7POINT1_WIDE (AV_CH_LAYOUT_5POINT1|AV_CH_FRONT_LEFT_OF_CENTER|AV_CH_FRONT_RIGHT_OF_CENTER)
#define AV_CH_LAYOUT_7POINT1_WIDE_BACK (AV_CH_LAYOUT_5POINT1_BACK|AV_CH_FRONT_LEFT_OF_CENTER|AV_CH_FRONT_RIGHT_OF_CENTER)
+#define AV_CH_LAYOUT_7POINT1_TOP (AV_CH_LAYOUT_5POINT1|AV_CH_TOP_FRONT_LEFT|AV_CH_TOP_FRONT_RIGHT)
#define AV_CH_LAYOUT_OCTAGONAL (AV_CH_LAYOUT_5POINT0|AV_CH_BACK_LEFT|AV_CH_BACK_CENTER|AV_CH_BACK_RIGHT)
#define AV_CH_LAYOUT_HEXADECAGONAL (AV_CH_LAYOUT_OCTAGONAL|AV_CH_WIDE_LEFT|AV_CH_WIDE_RIGHT|AV_CH_TOP_BACK_LEFT|AV_CH_TOP_BACK_RIGHT|AV_CH_TOP_BACK_CENTER|AV_CH_TOP_FRONT_CENTER|AV_CH_TOP_FRONT_LEFT|AV_CH_TOP_FRONT_RIGHT)
#define AV_CH_LAYOUT_STEREO_DOWNMIX (AV_CH_STEREO_LEFT|AV_CH_STEREO_RIGHT)
@@ -388,6 +389,7 @@ typedef struct AVChannelLayout {
#define AV_CHANNEL_LAYOUT_7POINT1 AV_CHANNEL_LAYOUT_MASK(8, AV_CH_LAYOUT_7POINT1)
#define AV_CHANNEL_LAYOUT_7POINT1_WIDE AV_CHANNEL_LAYOUT_MASK(8, AV_CH_LAYOUT_7POINT1_WIDE)
#define AV_CHANNEL_LAYOUT_7POINT1_WIDE_BACK AV_CHANNEL_LAYOUT_MASK(8, AV_CH_LAYOUT_7POINT1_WIDE_BACK)
+#define AV_CHANNEL_LAYOUT_7POINT1_TOP AV_CHANNEL_LAYOUT_MASK(8, AV_CH_LAYOUT_7POINT1_TOP)
#define AV_CHANNEL_LAYOUT_OCTAGONAL AV_CHANNEL_LAYOUT_MASK(8, AV_CH_LAYOUT_OCTAGONAL)
#define AV_CHANNEL_LAYOUT_HEXADECAGONAL AV_CHANNEL_LAYOUT_MASK(16, AV_CH_LAYOUT_HEXADECAGONAL)
#define AV_CHANNEL_LAYOUT_STEREO_DOWNMIX AV_CHANNEL_LAYOUT_MASK(2, AV_CH_LAYOUT_STEREO_DOWNMIX)
diff --git a/tests/ref/fate/channel_layout b/tests/ref/fate/channel_layout
index 19bcbce7d8..918b01584d 100644
--- a/tests/ref/fate/channel_layout
+++ b/tests/ref/fate/channel_layout
@@ -24,6 +24,7 @@ hexagonal FL+FR+FC+BL+BR+BC
7.1 FL+FR+FC+LFE+BL+BR+SL+SR
7.1(wide) FL+FR+FC+LFE+BL+BR+FLC+FRC
7.1(wide-side) FL+FR+FC+LFE+FLC+FRC+SL+SR
+7.1(top) FL+FR+FC+LFE+SL+SR+TFL+TFR
octagonal FL+FR+FC+BL+BR+BC+SL+SR
hexadecagonal FL+FR+FC+BL+BR+BC+SL+SR+TFL+TFC+TFR+TBL+TBC+TBR+WL+WR
downmix DL+DR
--
2.38.1
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 8+ messages in thread
* [FFmpeg-devel] [PATCH 3/4 v2] avcodec/aacdec: add support for channel configuration 14
2022-10-28 12:21 [FFmpeg-devel] [PATCH 1/4 v2] avcodec/aacdec: fix parsing streams with channel configuration 11 James Almer
2022-10-28 12:21 ` [FFmpeg-devel] [PATCH 2/4 v2] avutil/channel_layout: add a 7.1(top) channel layout James Almer
@ 2022-10-28 12:21 ` James Almer
2022-10-28 12:31 ` Andreas Rheinhardt
2022-10-28 12:21 ` [FFmpeg-devel] [PATCH 4/4] avformat/mov_chan: add missing AAC 7.1 mappings James Almer
2 siblings, 1 reply; 8+ messages in thread
From: James Almer @ 2022-10-28 12:21 UTC (permalink / raw)
To: ffmpeg-devel
It corresponds to the 7.1(top) layout.
Signed-off-by: James Almer <jamrial@gmail.com>
---
libavcodec/aacdec_template.c | 23 ++++++++++++++++++++++-
libavcodec/aacdectab.h | 6 +++---
libavcodec/mpeg4audio.c | 5 +++--
libavcodec/mpeg4audio.h | 2 +-
4 files changed, 29 insertions(+), 7 deletions(-)
diff --git a/libavcodec/aacdec_template.c b/libavcodec/aacdec_template.c
index c10bc743b6..4b8e29ba71 100644
--- a/libavcodec/aacdec_template.c
+++ b/libavcodec/aacdec_template.c
@@ -404,6 +404,21 @@ static uint64_t sniff_channel_order(uint8_t (*layout_map)[3], int tags)
i++;
}
+ // The previous checks would end up at 4 at this point for chan_config 14
+ if (layout == AV_CH_LAYOUT_5POINT1 && tags == 5 && i == 4) {
+ const uint8_t (*reference_layout_map)[3] = aac_channel_layout_map[13];
+ for (int j = 0; j < tags; j++) {
+ if (layout_map[j][0] != reference_layout_map[j][0] ||
+ layout_map[j][2] != reference_layout_map[j][2])
+ goto end_of_layout_definition;
+ }
+
+ i += assign_pair(e2c_vec, layout_map, i,
+ AV_CH_TOP_FRONT_LEFT,
+ AV_CH_TOP_FRONT_RIGHT,
+ AAC_CHANNEL_FRONT,
+ &layout);
+ }
// The previous checks would end up at 8 at this point for 22.2
if (layout == PREFIX_FOR_22POINT2 && tags == 16 && i == 8) {
const uint8_t (*reference_layout_map)[3] = aac_channel_layout_map[12];
@@ -633,7 +648,7 @@ static int set_default_channel_config(AACContext *ac, AVCodecContext *avctx,
int channel_config)
{
if (channel_config < 1 || (channel_config > 7 && channel_config < 11) ||
- channel_config > 13) {
+ channel_config > 14) {
av_log(avctx, AV_LOG_ERROR,
"invalid default channel configuration (%d)\n",
channel_config);
@@ -717,6 +732,12 @@ static ChannelElement *get_che(AACContext *ac, int type, int elem_id)
/* For indexed channel configurations map the channels solely based
* on position. */
switch (ac->oc[1].m4ac.chan_config) {
+ case 14:
+ if (ac->tags_mapped > 2 && ((type == TYPE_CPE && elem_id < 3) ||
+ (type == TYPE_LFE && elem_id < 1))) {
+ ac->tags_mapped++;
+ return ac->tag_che_map[type][elem_id] = ac->che[type][elem_id];
+ }
case 13:
if (ac->tags_mapped > 3 && ((type == TYPE_CPE && elem_id < 8) ||
(type == TYPE_SCE && elem_id < 6) ||
diff --git a/libavcodec/aacdectab.h b/libavcodec/aacdectab.h
index b820f10556..e9bbd1fe13 100644
--- a/libavcodec/aacdectab.h
+++ b/libavcodec/aacdectab.h
@@ -68,8 +68,8 @@ static const uint8_t aac_channel_layout_map[16][16][3] = {
{ TYPE_SCE, 5, AAC_CHANNEL_FRONT }, // SCE6 = BtFC,
{ TYPE_CPE, 7, AAC_CHANNEL_FRONT }, // CPE8 = BtFL and BtFR
},
+ { { TYPE_SCE, 0, AAC_CHANNEL_FRONT }, { TYPE_CPE, 0, AAC_CHANNEL_FRONT }, { TYPE_CPE, 1, AAC_CHANNEL_SIDE }, { TYPE_LFE, 0, AAC_CHANNEL_LFE }, { TYPE_CPE, 2, AAC_CHANNEL_FRONT }, },
{ { 0, } },
- /* TODO: Add 7+1 TOP configuration */
};
#if FF_API_OLD_CHANNEL_LAYOUT
@@ -84,8 +84,8 @@ static const uint64_t aac_channel_layout[] = {
AV_CH_LAYOUT_6POINT1,
AV_CH_LAYOUT_7POINT1,
AV_CH_LAYOUT_22POINT2,
+ AV_CH_LAYOUT_7POINT1_TOP,
0,
- /* AV_CH_LAYOUT_7POINT1_TOP, */
};
#endif
@@ -100,8 +100,8 @@ static const AVChannelLayout aac_ch_layout[] = {
AV_CHANNEL_LAYOUT_6POINT1,
AV_CHANNEL_LAYOUT_7POINT1,
AV_CHANNEL_LAYOUT_22POINT2,
+ AV_CHANNEL_LAYOUT_7POINT1_TOP,
{ 0 },
- /* AV_CHANNEL_LAYOUT_7POINT1_TOP, */
};
#endif /* AVCODEC_AACDECTAB_H */
diff --git a/libavcodec/mpeg4audio.c b/libavcodec/mpeg4audio.c
index e38a8c0852..4a996411d1 100644
--- a/libavcodec/mpeg4audio.c
+++ b/libavcodec/mpeg4audio.c
@@ -56,7 +56,7 @@ static int parse_config_ALS(GetBitContext *gb, MPEG4AudioConfig *c, void *logctx
return 0;
}
-const uint8_t ff_mpeg4audio_channels[14] = {
+const uint8_t ff_mpeg4audio_channels[15] = {
0,
1, // mono (1/0)
2, // stereo (2/0)
@@ -70,7 +70,8 @@ const uint8_t ff_mpeg4audio_channels[14] = {
0,
7, // 3/3.1
8, // 3/2/2.1
- 24 // 3/3/3 - 5/2/3 - 3/0/0.2
+ 24, // 3/3/3 - 5/2/3 - 3/0/0.2
+ 8 // 3/2.1 - 2/0
};
static inline int get_object_type(GetBitContext *gb)
diff --git a/libavcodec/mpeg4audio.h b/libavcodec/mpeg4audio.h
index a6f71cff58..56615ef321 100644
--- a/libavcodec/mpeg4audio.h
+++ b/libavcodec/mpeg4audio.h
@@ -42,7 +42,7 @@ typedef struct MPEG4AudioConfig {
} MPEG4AudioConfig;
extern const int ff_mpeg4audio_sample_rates[16];
-extern const uint8_t ff_mpeg4audio_channels[14];
+extern const uint8_t ff_mpeg4audio_channels[15];
/**
* Parse MPEG-4 systems extradata from a potentially unaligned GetBitContext to retrieve audio configuration.
--
2.38.1
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 8+ messages in thread
* [FFmpeg-devel] [PATCH 4/4] avformat/mov_chan: add missing AAC 7.1 mappings
2022-10-28 12:21 [FFmpeg-devel] [PATCH 1/4 v2] avcodec/aacdec: fix parsing streams with channel configuration 11 James Almer
2022-10-28 12:21 ` [FFmpeg-devel] [PATCH 2/4 v2] avutil/channel_layout: add a 7.1(top) channel layout James Almer
2022-10-28 12:21 ` [FFmpeg-devel] [PATCH 3/4 v2] avcodec/aacdec: add support for channel configuration 14 James Almer
@ 2022-10-28 12:21 ` James Almer
2 siblings, 0 replies; 8+ messages in thread
From: James Almer @ 2022-10-28 12:21 UTC (permalink / raw)
To: ffmpeg-devel
Signed-off-by: James Almer <jamrial@gmail.com>
---
libavformat/mov_chan.c | 5 +++++
libavformat/mov_chan.h | 2 ++
2 files changed, 7 insertions(+)
diff --git a/libavformat/mov_chan.c b/libavformat/mov_chan.c
index 5b757c6a8a..19da01996c 100644
--- a/libavformat/mov_chan.c
+++ b/libavformat/mov_chan.c
@@ -186,6 +186,9 @@ static const struct MovChannelLayoutMap mov_ch_layout_map_8ch[] = {
{ MOV_CH_LAYOUT_MPEG_7_1_C, AV_CH_LAYOUT_7POINT1 }, // L, R, C, LFE, Ls, Rs, Rls, Rrs
{ MOV_CH_LAYOUT_EAC3_7_1_A, AV_CH_LAYOUT_7POINT1 }, // L, C, R, Ls, Rs, LFE, Rls, Rrs
+ { MOV_CH_LAYOUT_AAC_7_1_B, AV_CH_LAYOUT_7POINT1 }, // C, L, R, Ls, Rs, Rls, Rrs, LFE
+
+ { MOV_CH_LAYOUT_AAC_7_1_C, AV_CH_LAYOUT_7POINT1_TOP }, // C, L, R, Ls, Rs, LFE, Vhl, Vhr
{ MOV_CH_LAYOUT_SMPTE_DTV, AV_CH_LAYOUT_5POINT1 | // L, R, C, LFE, Ls, Rs, Lt, Rt
AV_CH_LAYOUT_STEREO_DOWNMIX },
@@ -276,6 +279,8 @@ static const enum MovChannelLayoutTag mov_ch_layouts_aac[] = {
MOV_CH_LAYOUT_DTS_6_1_A,
MOV_CH_LAYOUT_AAC_OCTAGONAL,
MOV_CH_LAYOUT_MPEG_7_1_B,
+ MOV_CH_LAYOUT_AAC_7_1_B,
+ MOV_CH_LAYOUT_AAC_7_1_C,
MOV_CH_LAYOUT_DTS_8_0_A,
0,
};
diff --git a/libavformat/mov_chan.h b/libavformat/mov_chan.h
index 93d9878798..322fdecff8 100644
--- a/libavformat/mov_chan.h
+++ b/libavformat/mov_chan.h
@@ -135,6 +135,8 @@ enum MovChannelLayoutTag {
MOV_CH_LAYOUT_DTS_8_0_B = (179 << 16) | 8,
MOV_CH_LAYOUT_DTS_8_1_A = (180 << 16) | 9,
MOV_CH_LAYOUT_DTS_8_1_B = (181 << 16) | 9,
+ MOV_CH_LAYOUT_AAC_7_1_B = (183 << 16) | 8,
+ MOV_CH_LAYOUT_AAC_7_1_C = (184 << 16) | 8,
};
/**
--
2.38.1
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [FFmpeg-devel] [PATCH 3/4 v2] avcodec/aacdec: add support for channel configuration 14
2022-10-28 12:21 ` [FFmpeg-devel] [PATCH 3/4 v2] avcodec/aacdec: add support for channel configuration 14 James Almer
@ 2022-10-28 12:31 ` Andreas Rheinhardt
2022-10-28 12:34 ` James Almer
0 siblings, 1 reply; 8+ messages in thread
From: Andreas Rheinhardt @ 2022-10-28 12:31 UTC (permalink / raw)
To: ffmpeg-devel
James Almer:
> It corresponds to the 7.1(top) layout.
>
> Signed-off-by: James Almer <jamrial@gmail.com>
> ---
> libavcodec/aacdec_template.c | 23 ++++++++++++++++++++++-
> libavcodec/aacdectab.h | 6 +++---
> libavcodec/mpeg4audio.c | 5 +++--
> libavcodec/mpeg4audio.h | 2 +-
> 4 files changed, 29 insertions(+), 7 deletions(-)
>
> diff --git a/libavcodec/aacdec_template.c b/libavcodec/aacdec_template.c
> index c10bc743b6..4b8e29ba71 100644
> --- a/libavcodec/aacdec_template.c
> +++ b/libavcodec/aacdec_template.c
> @@ -404,6 +404,21 @@ static uint64_t sniff_channel_order(uint8_t (*layout_map)[3], int tags)
> i++;
> }
>
> + // The previous checks would end up at 4 at this point for chan_config 14
> + if (layout == AV_CH_LAYOUT_5POINT1 && tags == 5 && i == 4) {
> + const uint8_t (*reference_layout_map)[3] = aac_channel_layout_map[13];
> + for (int j = 0; j < tags; j++) {
> + if (layout_map[j][0] != reference_layout_map[j][0] ||
> + layout_map[j][2] != reference_layout_map[j][2])
> + goto end_of_layout_definition;
> + }
> +
> + i += assign_pair(e2c_vec, layout_map, i,
> + AV_CH_TOP_FRONT_LEFT,
> + AV_CH_TOP_FRONT_RIGHT,
> + AAC_CHANNEL_FRONT,
> + &layout);
> + }
> // The previous checks would end up at 8 at this point for 22.2
> if (layout == PREFIX_FOR_22POINT2 && tags == 16 && i == 8) {
> const uint8_t (*reference_layout_map)[3] = aac_channel_layout_map[12];
> @@ -633,7 +648,7 @@ static int set_default_channel_config(AACContext *ac, AVCodecContext *avctx,
> int channel_config)
> {
> if (channel_config < 1 || (channel_config > 7 && channel_config < 11) ||
> - channel_config > 13) {
> + channel_config > 14) {
> av_log(avctx, AV_LOG_ERROR,
> "invalid default channel configuration (%d)\n",
> channel_config);
> @@ -717,6 +732,12 @@ static ChannelElement *get_che(AACContext *ac, int type, int elem_id)
> /* For indexed channel configurations map the channels solely based
> * on position. */
> switch (ac->oc[1].m4ac.chan_config) {
> + case 14:
> + if (ac->tags_mapped > 2 && ((type == TYPE_CPE && elem_id < 3) ||
> + (type == TYPE_LFE && elem_id < 1))) {
> + ac->tags_mapped++;
> + return ac->tag_che_map[type][elem_id] = ac->che[type][elem_id];
> + }
> case 13:
> if (ac->tags_mapped > 3 && ((type == TYPE_CPE && elem_id < 8) ||
> (type == TYPE_SCE && elem_id < 6) ||
> diff --git a/libavcodec/aacdectab.h b/libavcodec/aacdectab.h
> index b820f10556..e9bbd1fe13 100644
> --- a/libavcodec/aacdectab.h
> +++ b/libavcodec/aacdectab.h
> @@ -68,8 +68,8 @@ static const uint8_t aac_channel_layout_map[16][16][3] = {
> { TYPE_SCE, 5, AAC_CHANNEL_FRONT }, // SCE6 = BtFC,
> { TYPE_CPE, 7, AAC_CHANNEL_FRONT }, // CPE8 = BtFL and BtFR
> },
> + { { TYPE_SCE, 0, AAC_CHANNEL_FRONT }, { TYPE_CPE, 0, AAC_CHANNEL_FRONT }, { TYPE_CPE, 1, AAC_CHANNEL_SIDE }, { TYPE_LFE, 0, AAC_CHANNEL_LFE }, { TYPE_CPE, 2, AAC_CHANNEL_FRONT }, },
> { { 0, } },
> - /* TODO: Add 7+1 TOP configuration */
> };
>
> #if FF_API_OLD_CHANNEL_LAYOUT
> @@ -84,8 +84,8 @@ static const uint64_t aac_channel_layout[] = {
> AV_CH_LAYOUT_6POINT1,
> AV_CH_LAYOUT_7POINT1,
> AV_CH_LAYOUT_22POINT2,
> + AV_CH_LAYOUT_7POINT1_TOP,
> 0,
> - /* AV_CH_LAYOUT_7POINT1_TOP, */
> };
> #endif
>
> @@ -100,8 +100,8 @@ static const AVChannelLayout aac_ch_layout[] = {
> AV_CHANNEL_LAYOUT_6POINT1,
> AV_CHANNEL_LAYOUT_7POINT1,
> AV_CHANNEL_LAYOUT_22POINT2,
> + AV_CHANNEL_LAYOUT_7POINT1_TOP,
> { 0 },
> - /* AV_CHANNEL_LAYOUT_7POINT1_TOP, */
> };
>
> #endif /* AVCODEC_AACDECTAB_H */
> diff --git a/libavcodec/mpeg4audio.c b/libavcodec/mpeg4audio.c
> index e38a8c0852..4a996411d1 100644
> --- a/libavcodec/mpeg4audio.c
> +++ b/libavcodec/mpeg4audio.c
> @@ -56,7 +56,7 @@ static int parse_config_ALS(GetBitContext *gb, MPEG4AudioConfig *c, void *logctx
> return 0;
> }
>
> -const uint8_t ff_mpeg4audio_channels[14] = {
> +const uint8_t ff_mpeg4audio_channels[15] = {
> 0,
> 1, // mono (1/0)
> 2, // stereo (2/0)
> @@ -70,7 +70,8 @@ const uint8_t ff_mpeg4audio_channels[14] = {
> 0,
> 7, // 3/3.1
> 8, // 3/2/2.1
> - 24 // 3/3/3 - 5/2/3 - 3/0/0.2
> + 24, // 3/3/3 - 5/2/3 - 3/0/0.2
> + 8 // 3/2.1 - 2/0
Is it guaranteed that 8 will always be the last element of this array?
If not, you should use "8,", so that the comma won't have to be added
when someone makes an addition in the future.
> };
>
> static inline int get_object_type(GetBitContext *gb)
> diff --git a/libavcodec/mpeg4audio.h b/libavcodec/mpeg4audio.h
> index a6f71cff58..56615ef321 100644
> --- a/libavcodec/mpeg4audio.h
> +++ b/libavcodec/mpeg4audio.h
> @@ -42,7 +42,7 @@ typedef struct MPEG4AudioConfig {
> } MPEG4AudioConfig;
>
> extern const int ff_mpeg4audio_sample_rates[16];
> -extern const uint8_t ff_mpeg4audio_channels[14];
> +extern const uint8_t ff_mpeg4audio_channels[15];
>
> /**
> * Parse MPEG-4 systems extradata from a potentially unaligned GetBitContext to retrieve audio configuration.
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [FFmpeg-devel] [PATCH 3/4 v2] avcodec/aacdec: add support for channel configuration 14
2022-10-28 12:31 ` Andreas Rheinhardt
@ 2022-10-28 12:34 ` James Almer
2022-10-28 12:50 ` Andreas Rheinhardt
0 siblings, 1 reply; 8+ messages in thread
From: James Almer @ 2022-10-28 12:34 UTC (permalink / raw)
To: ffmpeg-devel
On 10/28/2022 9:31 AM, Andreas Rheinhardt wrote:
> James Almer:
>> It corresponds to the 7.1(top) layout.
>>
>> Signed-off-by: James Almer <jamrial@gmail.com>
>> ---
>> libavcodec/aacdec_template.c | 23 ++++++++++++++++++++++-
>> libavcodec/aacdectab.h | 6 +++---
>> libavcodec/mpeg4audio.c | 5 +++--
>> libavcodec/mpeg4audio.h | 2 +-
>> 4 files changed, 29 insertions(+), 7 deletions(-)
>>
>> diff --git a/libavcodec/aacdec_template.c b/libavcodec/aacdec_template.c
>> index c10bc743b6..4b8e29ba71 100644
>> --- a/libavcodec/aacdec_template.c
>> +++ b/libavcodec/aacdec_template.c
>> @@ -404,6 +404,21 @@ static uint64_t sniff_channel_order(uint8_t (*layout_map)[3], int tags)
>> i++;
>> }
>>
>> + // The previous checks would end up at 4 at this point for chan_config 14
>> + if (layout == AV_CH_LAYOUT_5POINT1 && tags == 5 && i == 4) {
>> + const uint8_t (*reference_layout_map)[3] = aac_channel_layout_map[13];
>> + for (int j = 0; j < tags; j++) {
>> + if (layout_map[j][0] != reference_layout_map[j][0] ||
>> + layout_map[j][2] != reference_layout_map[j][2])
>> + goto end_of_layout_definition;
>> + }
>> +
>> + i += assign_pair(e2c_vec, layout_map, i,
>> + AV_CH_TOP_FRONT_LEFT,
>> + AV_CH_TOP_FRONT_RIGHT,
>> + AAC_CHANNEL_FRONT,
>> + &layout);
>> + }
>> // The previous checks would end up at 8 at this point for 22.2
>> if (layout == PREFIX_FOR_22POINT2 && tags == 16 && i == 8) {
>> const uint8_t (*reference_layout_map)[3] = aac_channel_layout_map[12];
>> @@ -633,7 +648,7 @@ static int set_default_channel_config(AACContext *ac, AVCodecContext *avctx,
>> int channel_config)
>> {
>> if (channel_config < 1 || (channel_config > 7 && channel_config < 11) ||
>> - channel_config > 13) {
>> + channel_config > 14) {
>> av_log(avctx, AV_LOG_ERROR,
>> "invalid default channel configuration (%d)\n",
>> channel_config);
>> @@ -717,6 +732,12 @@ static ChannelElement *get_che(AACContext *ac, int type, int elem_id)
>> /* For indexed channel configurations map the channels solely based
>> * on position. */
>> switch (ac->oc[1].m4ac.chan_config) {
>> + case 14:
>> + if (ac->tags_mapped > 2 && ((type == TYPE_CPE && elem_id < 3) ||
>> + (type == TYPE_LFE && elem_id < 1))) {
>> + ac->tags_mapped++;
>> + return ac->tag_che_map[type][elem_id] = ac->che[type][elem_id];
>> + }
>> case 13:
>> if (ac->tags_mapped > 3 && ((type == TYPE_CPE && elem_id < 8) ||
>> (type == TYPE_SCE && elem_id < 6) ||
>> diff --git a/libavcodec/aacdectab.h b/libavcodec/aacdectab.h
>> index b820f10556..e9bbd1fe13 100644
>> --- a/libavcodec/aacdectab.h
>> +++ b/libavcodec/aacdectab.h
>> @@ -68,8 +68,8 @@ static const uint8_t aac_channel_layout_map[16][16][3] = {
>> { TYPE_SCE, 5, AAC_CHANNEL_FRONT }, // SCE6 = BtFC,
>> { TYPE_CPE, 7, AAC_CHANNEL_FRONT }, // CPE8 = BtFL and BtFR
>> },
>> + { { TYPE_SCE, 0, AAC_CHANNEL_FRONT }, { TYPE_CPE, 0, AAC_CHANNEL_FRONT }, { TYPE_CPE, 1, AAC_CHANNEL_SIDE }, { TYPE_LFE, 0, AAC_CHANNEL_LFE }, { TYPE_CPE, 2, AAC_CHANNEL_FRONT }, },
>> { { 0, } },
>> - /* TODO: Add 7+1 TOP configuration */
>> };
>>
>> #if FF_API_OLD_CHANNEL_LAYOUT
>> @@ -84,8 +84,8 @@ static const uint64_t aac_channel_layout[] = {
>> AV_CH_LAYOUT_6POINT1,
>> AV_CH_LAYOUT_7POINT1,
>> AV_CH_LAYOUT_22POINT2,
>> + AV_CH_LAYOUT_7POINT1_TOP,
>> 0,
>> - /* AV_CH_LAYOUT_7POINT1_TOP, */
>> };
>> #endif
>>
>> @@ -100,8 +100,8 @@ static const AVChannelLayout aac_ch_layout[] = {
>> AV_CHANNEL_LAYOUT_6POINT1,
>> AV_CHANNEL_LAYOUT_7POINT1,
>> AV_CHANNEL_LAYOUT_22POINT2,
>> + AV_CHANNEL_LAYOUT_7POINT1_TOP,
>> { 0 },
>> - /* AV_CHANNEL_LAYOUT_7POINT1_TOP, */
>> };
>>
>> #endif /* AVCODEC_AACDECTAB_H */
>> diff --git a/libavcodec/mpeg4audio.c b/libavcodec/mpeg4audio.c
>> index e38a8c0852..4a996411d1 100644
>> --- a/libavcodec/mpeg4audio.c
>> +++ b/libavcodec/mpeg4audio.c
>> @@ -56,7 +56,7 @@ static int parse_config_ALS(GetBitContext *gb, MPEG4AudioConfig *c, void *logctx
>> return 0;
>> }
>>
>> -const uint8_t ff_mpeg4audio_channels[14] = {
>> +const uint8_t ff_mpeg4audio_channels[15] = {
>> 0,
>> 1, // mono (1/0)
>> 2, // stereo (2/0)
>> @@ -70,7 +70,8 @@ const uint8_t ff_mpeg4audio_channels[14] = {
>> 0,
>> 7, // 3/3.1
>> 8, // 3/2/2.1
>> - 24 // 3/3/3 - 5/2/3 - 3/0/0.2
>> + 24, // 3/3/3 - 5/2/3 - 3/0/0.2
>> + 8 // 3/2.1 - 2/0
>
> Is it guaranteed that 8 will always be the last element of this array?
> If not, you should use "8,", so that the comma won't have to be added
> when someone makes an addition in the future.
What does the pedantic gcc option say about this? I recall it complained
about either having or missing the comma in the last element, so given
that it makes no real difference I'd go with whatever keeps it quiet.
>
>> };
>>
>> static inline int get_object_type(GetBitContext *gb)
>> diff --git a/libavcodec/mpeg4audio.h b/libavcodec/mpeg4audio.h
>> index a6f71cff58..56615ef321 100644
>> --- a/libavcodec/mpeg4audio.h
>> +++ b/libavcodec/mpeg4audio.h
>> @@ -42,7 +42,7 @@ typedef struct MPEG4AudioConfig {
>> } MPEG4AudioConfig;
>>
>> extern const int ff_mpeg4audio_sample_rates[16];
>> -extern const uint8_t ff_mpeg4audio_channels[14];
>> +extern const uint8_t ff_mpeg4audio_channels[15];
>>
>> /**
>> * Parse MPEG-4 systems extradata from a potentially unaligned GetBitContext to retrieve audio configuration.
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [FFmpeg-devel] [PATCH 3/4 v2] avcodec/aacdec: add support for channel configuration 14
2022-10-28 12:34 ` James Almer
@ 2022-10-28 12:50 ` Andreas Rheinhardt
2022-10-28 12:53 ` James Almer
0 siblings, 1 reply; 8+ messages in thread
From: Andreas Rheinhardt @ 2022-10-28 12:50 UTC (permalink / raw)
To: ffmpeg-devel
James Almer:
> On 10/28/2022 9:31 AM, Andreas Rheinhardt wrote:
>> James Almer:
>>> It corresponds to the 7.1(top) layout.
>>>
>>> Signed-off-by: James Almer <jamrial@gmail.com>
>>> ---
>>> libavcodec/aacdec_template.c | 23 ++++++++++++++++++++++-
>>> libavcodec/aacdectab.h | 6 +++---
>>> libavcodec/mpeg4audio.c | 5 +++--
>>> libavcodec/mpeg4audio.h | 2 +-
>>> 4 files changed, 29 insertions(+), 7 deletions(-)
>>>
>>> diff --git a/libavcodec/aacdec_template.c b/libavcodec/aacdec_template.c
>>> index c10bc743b6..4b8e29ba71 100644
>>> --- a/libavcodec/aacdec_template.c
>>> +++ b/libavcodec/aacdec_template.c
>>> @@ -404,6 +404,21 @@ static uint64_t sniff_channel_order(uint8_t
>>> (*layout_map)[3], int tags)
>>> i++;
>>> }
>>> + // The previous checks would end up at 4 at this point for
>>> chan_config 14
>>> + if (layout == AV_CH_LAYOUT_5POINT1 && tags == 5 && i == 4) {
>>> + const uint8_t (*reference_layout_map)[3] =
>>> aac_channel_layout_map[13];
>>> + for (int j = 0; j < tags; j++) {
>>> + if (layout_map[j][0] != reference_layout_map[j][0] ||
>>> + layout_map[j][2] != reference_layout_map[j][2])
>>> + goto end_of_layout_definition;
>>> + }
>>> +
>>> + i += assign_pair(e2c_vec, layout_map, i,
>>> + AV_CH_TOP_FRONT_LEFT,
>>> + AV_CH_TOP_FRONT_RIGHT,
>>> + AAC_CHANNEL_FRONT,
>>> + &layout);
>>> + }
>>> // The previous checks would end up at 8 at this point for 22.2
>>> if (layout == PREFIX_FOR_22POINT2 && tags == 16 && i == 8) {
>>> const uint8_t (*reference_layout_map)[3] =
>>> aac_channel_layout_map[12];
>>> @@ -633,7 +648,7 @@ static int set_default_channel_config(AACContext
>>> *ac, AVCodecContext *avctx,
>>> int channel_config)
>>> {
>>> if (channel_config < 1 || (channel_config > 7 && channel_config
>>> < 11) ||
>>> - channel_config > 13) {
>>> + channel_config > 14) {
>>> av_log(avctx, AV_LOG_ERROR,
>>> "invalid default channel configuration (%d)\n",
>>> channel_config);
>>> @@ -717,6 +732,12 @@ static ChannelElement *get_che(AACContext *ac,
>>> int type, int elem_id)
>>> /* For indexed channel configurations map the channels solely
>>> based
>>> * on position. */
>>> switch (ac->oc[1].m4ac.chan_config) {
>>> + case 14:
>>> + if (ac->tags_mapped > 2 && ((type == TYPE_CPE && elem_id <
>>> 3) ||
>>> + (type == TYPE_LFE && elem_id <
>>> 1))) {
>>> + ac->tags_mapped++;
>>> + return ac->tag_che_map[type][elem_id] =
>>> ac->che[type][elem_id];
>>> + }
>>> case 13:
>>> if (ac->tags_mapped > 3 && ((type == TYPE_CPE && elem_id <
>>> 8) ||
>>> (type == TYPE_SCE && elem_id <
>>> 6) ||
>>> diff --git a/libavcodec/aacdectab.h b/libavcodec/aacdectab.h
>>> index b820f10556..e9bbd1fe13 100644
>>> --- a/libavcodec/aacdectab.h
>>> +++ b/libavcodec/aacdectab.h
>>> @@ -68,8 +68,8 @@ static const uint8_t
>>> aac_channel_layout_map[16][16][3] = {
>>> { TYPE_SCE, 5, AAC_CHANNEL_FRONT }, // SCE6 = BtFC,
>>> { TYPE_CPE, 7, AAC_CHANNEL_FRONT }, // CPE8 = BtFL and BtFR
>>> },
>>> + { { TYPE_SCE, 0, AAC_CHANNEL_FRONT }, { TYPE_CPE, 0,
>>> AAC_CHANNEL_FRONT }, { TYPE_CPE, 1, AAC_CHANNEL_SIDE }, { TYPE_LFE,
>>> 0, AAC_CHANNEL_LFE }, { TYPE_CPE, 2, AAC_CHANNEL_FRONT }, },
>>> { { 0, } },
>>> - /* TODO: Add 7+1 TOP configuration */
>>> };
>>> #if FF_API_OLD_CHANNEL_LAYOUT
>>> @@ -84,8 +84,8 @@ static const uint64_t aac_channel_layout[] = {
>>> AV_CH_LAYOUT_6POINT1,
>>> AV_CH_LAYOUT_7POINT1,
>>> AV_CH_LAYOUT_22POINT2,
>>> + AV_CH_LAYOUT_7POINT1_TOP,
>>> 0,
>>> - /* AV_CH_LAYOUT_7POINT1_TOP, */
>>> };
>>> #endif
>>> @@ -100,8 +100,8 @@ static const AVChannelLayout aac_ch_layout[] = {
>>> AV_CHANNEL_LAYOUT_6POINT1,
>>> AV_CHANNEL_LAYOUT_7POINT1,
>>> AV_CHANNEL_LAYOUT_22POINT2,
>>> + AV_CHANNEL_LAYOUT_7POINT1_TOP,
>>> { 0 },
>>> - /* AV_CHANNEL_LAYOUT_7POINT1_TOP, */
>>> };
>>> #endif /* AVCODEC_AACDECTAB_H */
>>> diff --git a/libavcodec/mpeg4audio.c b/libavcodec/mpeg4audio.c
>>> index e38a8c0852..4a996411d1 100644
>>> --- a/libavcodec/mpeg4audio.c
>>> +++ b/libavcodec/mpeg4audio.c
>>> @@ -56,7 +56,7 @@ static int parse_config_ALS(GetBitContext *gb,
>>> MPEG4AudioConfig *c, void *logctx
>>> return 0;
>>> }
>>> -const uint8_t ff_mpeg4audio_channels[14] = {
>>> +const uint8_t ff_mpeg4audio_channels[15] = {
>>> 0,
>>> 1, // mono (1/0)
>>> 2, // stereo (2/0)
>>> @@ -70,7 +70,8 @@ const uint8_t ff_mpeg4audio_channels[14] = {
>>> 0,
>>> 7, // 3/3.1
>>> 8, // 3/2/2.1
>>> - 24 // 3/3/3 - 5/2/3 - 3/0/0.2
>>> + 24, // 3/3/3 - 5/2/3 - 3/0/0.2
>>> + 8 // 3/2.1 - 2/0
>>
>> Is it guaranteed that 8 will always be the last element of this array?
>> If not, you should use "8,", so that the comma won't have to be added
>> when someone makes an addition in the future.
>
> What does the pedantic gcc option say about this? I recall it complained
> about either having or missing the comma in the last element, so given
> that it makes no real difference I'd go with whatever keeps it quiet.
>
You are confusing this with enum declarations: In C90, a trailing comma
was not allowed in their declaration; C99 lifted this restriction (we
have enums that make use of this). But trailing commas were always
allowed in initializers.
- Andreas
PS: Do you use -pedantic?
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [FFmpeg-devel] [PATCH 3/4 v2] avcodec/aacdec: add support for channel configuration 14
2022-10-28 12:50 ` Andreas Rheinhardt
@ 2022-10-28 12:53 ` James Almer
0 siblings, 0 replies; 8+ messages in thread
From: James Almer @ 2022-10-28 12:53 UTC (permalink / raw)
To: ffmpeg-devel
On 10/28/2022 9:50 AM, Andreas Rheinhardt wrote:
> James Almer:
>> On 10/28/2022 9:31 AM, Andreas Rheinhardt wrote:
>>> James Almer:
>>>> It corresponds to the 7.1(top) layout.
>>>>
>>>> Signed-off-by: James Almer <jamrial@gmail.com>
>>>> ---
>>>> libavcodec/aacdec_template.c | 23 ++++++++++++++++++++++-
>>>> libavcodec/aacdectab.h | 6 +++---
>>>> libavcodec/mpeg4audio.c | 5 +++--
>>>> libavcodec/mpeg4audio.h | 2 +-
>>>> 4 files changed, 29 insertions(+), 7 deletions(-)
>>>>
>>>> diff --git a/libavcodec/aacdec_template.c b/libavcodec/aacdec_template.c
>>>> index c10bc743b6..4b8e29ba71 100644
>>>> --- a/libavcodec/aacdec_template.c
>>>> +++ b/libavcodec/aacdec_template.c
>>>> @@ -404,6 +404,21 @@ static uint64_t sniff_channel_order(uint8_t
>>>> (*layout_map)[3], int tags)
>>>> i++;
>>>> }
>>>> + // The previous checks would end up at 4 at this point for
>>>> chan_config 14
>>>> + if (layout == AV_CH_LAYOUT_5POINT1 && tags == 5 && i == 4) {
>>>> + const uint8_t (*reference_layout_map)[3] =
>>>> aac_channel_layout_map[13];
>>>> + for (int j = 0; j < tags; j++) {
>>>> + if (layout_map[j][0] != reference_layout_map[j][0] ||
>>>> + layout_map[j][2] != reference_layout_map[j][2])
>>>> + goto end_of_layout_definition;
>>>> + }
>>>> +
>>>> + i += assign_pair(e2c_vec, layout_map, i,
>>>> + AV_CH_TOP_FRONT_LEFT,
>>>> + AV_CH_TOP_FRONT_RIGHT,
>>>> + AAC_CHANNEL_FRONT,
>>>> + &layout);
>>>> + }
>>>> // The previous checks would end up at 8 at this point for 22.2
>>>> if (layout == PREFIX_FOR_22POINT2 && tags == 16 && i == 8) {
>>>> const uint8_t (*reference_layout_map)[3] =
>>>> aac_channel_layout_map[12];
>>>> @@ -633,7 +648,7 @@ static int set_default_channel_config(AACContext
>>>> *ac, AVCodecContext *avctx,
>>>> int channel_config)
>>>> {
>>>> if (channel_config < 1 || (channel_config > 7 && channel_config
>>>> < 11) ||
>>>> - channel_config > 13) {
>>>> + channel_config > 14) {
>>>> av_log(avctx, AV_LOG_ERROR,
>>>> "invalid default channel configuration (%d)\n",
>>>> channel_config);
>>>> @@ -717,6 +732,12 @@ static ChannelElement *get_che(AACContext *ac,
>>>> int type, int elem_id)
>>>> /* For indexed channel configurations map the channels solely
>>>> based
>>>> * on position. */
>>>> switch (ac->oc[1].m4ac.chan_config) {
>>>> + case 14:
>>>> + if (ac->tags_mapped > 2 && ((type == TYPE_CPE && elem_id <
>>>> 3) ||
>>>> + (type == TYPE_LFE && elem_id <
>>>> 1))) {
>>>> + ac->tags_mapped++;
>>>> + return ac->tag_che_map[type][elem_id] =
>>>> ac->che[type][elem_id];
>>>> + }
>>>> case 13:
>>>> if (ac->tags_mapped > 3 && ((type == TYPE_CPE && elem_id <
>>>> 8) ||
>>>> (type == TYPE_SCE && elem_id <
>>>> 6) ||
>>>> diff --git a/libavcodec/aacdectab.h b/libavcodec/aacdectab.h
>>>> index b820f10556..e9bbd1fe13 100644
>>>> --- a/libavcodec/aacdectab.h
>>>> +++ b/libavcodec/aacdectab.h
>>>> @@ -68,8 +68,8 @@ static const uint8_t
>>>> aac_channel_layout_map[16][16][3] = {
>>>> { TYPE_SCE, 5, AAC_CHANNEL_FRONT }, // SCE6 = BtFC,
>>>> { TYPE_CPE, 7, AAC_CHANNEL_FRONT }, // CPE8 = BtFL and BtFR
>>>> },
>>>> + { { TYPE_SCE, 0, AAC_CHANNEL_FRONT }, { TYPE_CPE, 0,
>>>> AAC_CHANNEL_FRONT }, { TYPE_CPE, 1, AAC_CHANNEL_SIDE }, { TYPE_LFE,
>>>> 0, AAC_CHANNEL_LFE }, { TYPE_CPE, 2, AAC_CHANNEL_FRONT }, },
>>>> { { 0, } },
>>>> - /* TODO: Add 7+1 TOP configuration */
>>>> };
>>>> #if FF_API_OLD_CHANNEL_LAYOUT
>>>> @@ -84,8 +84,8 @@ static const uint64_t aac_channel_layout[] = {
>>>> AV_CH_LAYOUT_6POINT1,
>>>> AV_CH_LAYOUT_7POINT1,
>>>> AV_CH_LAYOUT_22POINT2,
>>>> + AV_CH_LAYOUT_7POINT1_TOP,
>>>> 0,
>>>> - /* AV_CH_LAYOUT_7POINT1_TOP, */
>>>> };
>>>> #endif
>>>> @@ -100,8 +100,8 @@ static const AVChannelLayout aac_ch_layout[] = {
>>>> AV_CHANNEL_LAYOUT_6POINT1,
>>>> AV_CHANNEL_LAYOUT_7POINT1,
>>>> AV_CHANNEL_LAYOUT_22POINT2,
>>>> + AV_CHANNEL_LAYOUT_7POINT1_TOP,
>>>> { 0 },
>>>> - /* AV_CHANNEL_LAYOUT_7POINT1_TOP, */
>>>> };
>>>> #endif /* AVCODEC_AACDECTAB_H */
>>>> diff --git a/libavcodec/mpeg4audio.c b/libavcodec/mpeg4audio.c
>>>> index e38a8c0852..4a996411d1 100644
>>>> --- a/libavcodec/mpeg4audio.c
>>>> +++ b/libavcodec/mpeg4audio.c
>>>> @@ -56,7 +56,7 @@ static int parse_config_ALS(GetBitContext *gb,
>>>> MPEG4AudioConfig *c, void *logctx
>>>> return 0;
>>>> }
>>>> -const uint8_t ff_mpeg4audio_channels[14] = {
>>>> +const uint8_t ff_mpeg4audio_channels[15] = {
>>>> 0,
>>>> 1, // mono (1/0)
>>>> 2, // stereo (2/0)
>>>> @@ -70,7 +70,8 @@ const uint8_t ff_mpeg4audio_channels[14] = {
>>>> 0,
>>>> 7, // 3/3.1
>>>> 8, // 3/2/2.1
>>>> - 24 // 3/3/3 - 5/2/3 - 3/0/0.2
>>>> + 24, // 3/3/3 - 5/2/3 - 3/0/0.2
>>>> + 8 // 3/2.1 - 2/0
>>>
>>> Is it guaranteed that 8 will always be the last element of this array?
>>> If not, you should use "8,", so that the comma won't have to be added
>>> when someone makes an addition in the future.
>>
>> What does the pedantic gcc option say about this? I recall it complained
>> about either having or missing the comma in the last element, so given
>> that it makes no real difference I'd go with whatever keeps it quiet.
>>
>
> You are confusing this with enum declarations: In C90, a trailing comma
> was not allowed in their declaration; C99 lifted this restriction (we
> have enums that make use of this). But trailing commas were always
> allowed in initializers.
>
> - Andreas
>
> PS: Do you use -pedantic?
No, but i remember someone started contributing patches long ago to
silence -pedantic warnings, so might as well not introduce new ones.
Will add the comma then.
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2022-10-28 12:53 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-28 12:21 [FFmpeg-devel] [PATCH 1/4 v2] avcodec/aacdec: fix parsing streams with channel configuration 11 James Almer
2022-10-28 12:21 ` [FFmpeg-devel] [PATCH 2/4 v2] avutil/channel_layout: add a 7.1(top) channel layout James Almer
2022-10-28 12:21 ` [FFmpeg-devel] [PATCH 3/4 v2] avcodec/aacdec: add support for channel configuration 14 James Almer
2022-10-28 12:31 ` Andreas Rheinhardt
2022-10-28 12:34 ` James Almer
2022-10-28 12:50 ` Andreas Rheinhardt
2022-10-28 12:53 ` James Almer
2022-10-28 12:21 ` [FFmpeg-devel] [PATCH 4/4] avformat/mov_chan: add missing AAC 7.1 mappings James Almer
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
This inbox may be cloned and mirrored by anyone:
git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
ffmpegdev@gitmailbox.com
public-inbox-index ffmpegdev
Example config snippet for mirrors.
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git