[FFmpeg-cvslog] avcodec/aacdectab: Deduplicate common decoder tables

Andreas Rheinhardt git at videolan.org
Tue Oct 31 22:16:06 EET 2023


ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt at outlook.com> | Sun Sep 24 21:48:22 2023 +0200| [1f15a7e9a8374f94a0e7d26e2c9fd4d6f448d86c] | committer: Andreas Rheinhardt

avcodec/aacdectab: Deduplicate common decoder tables

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=1f15a7e9a8374f94a0e7d26e2c9fd4d6f448d86c
---

 libavcodec/Makefile          |   6 ++-
 libavcodec/aacdec.c          |   8 +--
 libavcodec/aacdec_common.c   | 119 +++++++++++++++++++++++++++++++++++++++++++
 libavcodec/aacdec_fixed.c    |   4 +-
 libavcodec/aacdec_template.c |  36 ++++++-------
 libavcodec/aacdectab.h       |  95 +++-------------------------------
 6 files changed, 154 insertions(+), 114 deletions(-)

diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index 580a8d6b54..ab7fba394a 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -176,10 +176,12 @@ OBJS-$(CONFIG_WMV2DSP)                 += wmv2dsp.o
 OBJS-$(CONFIG_ZERO12V_DECODER)         += 012v.o
 OBJS-$(CONFIG_A64MULTI_ENCODER)        += a64multienc.o elbg.o
 OBJS-$(CONFIG_A64MULTI5_ENCODER)       += a64multienc.o elbg.o
-OBJS-$(CONFIG_AAC_DECODER)             += aacdec.o aactab.o aacsbr.o aacps_common.o aacps_float.o \
+OBJS-$(CONFIG_AAC_DECODER)             += aacdec.o aacdec_common.o aactab.o \
+                                          aacsbr.o aacps_common.o aacps_float.o \
                                           kbdwin.o \
                                           sbrdsp.o aacpsdsp_float.o cbrt_data.o
-OBJS-$(CONFIG_AAC_FIXED_DECODER)       += aacdec_fixed.o aactab.o aacsbr_fixed.o aacps_common.o aacps_fixed.o \
+OBJS-$(CONFIG_AAC_FIXED_DECODER)       += aacdec_fixed.o aacdec_common.o aactab.o \
+                                          aacsbr_fixed.o aacps_common.o aacps_fixed.o \
                                           kbdwin.o \
                                           sbrdsp_fixed.o aacpsdsp_fixed.o cbrt_data_fixed.o
 OBJS-$(CONFIG_AAC_ENCODER)             += aacenc.o aaccoder.o aacenctab.o    \
diff --git a/libavcodec/aacdec.c b/libavcodec/aacdec.c
index ca31540d3c..d66ebf4a7c 100644
--- a/libavcodec/aacdec.c
+++ b/libavcodec/aacdec.c
@@ -564,8 +564,8 @@ const FFCodec ff_aac_decoder = {
     },
     .p.capabilities  = AV_CODEC_CAP_CHANNEL_CONF | AV_CODEC_CAP_DR1,
     .caps_internal   = FF_CODEC_CAP_INIT_CLEANUP,
-    CODEC_OLD_CHANNEL_LAYOUTS_ARRAY(aac_channel_layout)
-    .p.ch_layouts    = aac_ch_layout,
+    CODEC_OLD_CHANNEL_LAYOUTS_ARRAY(ff_aac_channel_layout)
+    .p.ch_layouts    = ff_aac_ch_layout,
     .flush = flush,
     .p.priv_class    = &aac_decoder_class,
     .p.profiles      = NULL_IF_CONFIG_SMALL(ff_aac_profiles),
@@ -590,8 +590,8 @@ const FFCodec ff_aac_latm_decoder = {
     },
     .p.capabilities  = AV_CODEC_CAP_CHANNEL_CONF | AV_CODEC_CAP_DR1,
     .caps_internal   = FF_CODEC_CAP_INIT_CLEANUP,
-    CODEC_OLD_CHANNEL_LAYOUTS_ARRAY(aac_channel_layout)
-    .p.ch_layouts    = aac_ch_layout,
+    CODEC_OLD_CHANNEL_LAYOUTS_ARRAY(ff_aac_channel_layout)
+    .p.ch_layouts    = ff_aac_ch_layout,
     .flush = flush,
     .p.profiles      = NULL_IF_CONFIG_SMALL(ff_aac_profiles),
 };
diff --git a/libavcodec/aacdec_common.c b/libavcodec/aacdec_common.c
new file mode 100644
index 0000000000..c75c6fadc6
--- /dev/null
+++ b/libavcodec/aacdec_common.c
@@ -0,0 +1,119 @@
+/*
+ * Common code and tables of the AAC fixed- and floating-point decoders
+ * Copyright (c) 2005-2006 Oded Shimon ( ods15 ods15 dyndns org )
+ * Copyright (c) 2006-2007 Maxim Gavrilov ( maxim.gavrilov gmail com )
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+/**
+ * @file
+ * Common code and tables of the AAC fixed- and floating-point decoders
+ */
+
+#include "aac.h"
+#include "aacdectab.h"
+
+const int8_t ff_tags_per_config[16] = { 0, 1, 1, 2, 3, 3, 4, 5, 0, 0, 0, 5, 5, 16, 5, 0 };
+
+const uint8_t ff_aac_channel_layout_map[16][16][3] = {
+    { { TYPE_SCE, 0, AAC_CHANNEL_FRONT }, },
+    { { TYPE_CPE, 0, AAC_CHANNEL_FRONT }, },
+    { { TYPE_SCE, 0, AAC_CHANNEL_FRONT }, { TYPE_CPE, 0, AAC_CHANNEL_FRONT }, },
+    { { TYPE_SCE, 0, AAC_CHANNEL_FRONT }, { TYPE_CPE, 0, AAC_CHANNEL_FRONT }, { TYPE_SCE, 1, AAC_CHANNEL_BACK }, },
+    { { TYPE_SCE, 0, AAC_CHANNEL_FRONT }, { TYPE_CPE, 0, AAC_CHANNEL_FRONT }, { TYPE_CPE, 1, AAC_CHANNEL_BACK }, },
+    { { TYPE_SCE, 0, AAC_CHANNEL_FRONT }, { TYPE_CPE, 0, AAC_CHANNEL_FRONT }, { TYPE_CPE, 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_FRONT }, { TYPE_CPE, 2, AAC_CHANNEL_BACK }, { TYPE_LFE, 0, AAC_CHANNEL_LFE  }, },
+    { { 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_BACK }, { TYPE_CPE, 2, AAC_CHANNEL_BACK }, { TYPE_LFE, 0, AAC_CHANNEL_LFE  }, },
+    {
+      { TYPE_SCE, 0, AAC_CHANNEL_FRONT }, // SCE1 = FC,
+      { TYPE_CPE, 0, AAC_CHANNEL_FRONT }, // CPE1 = FLc and FRc,
+      { TYPE_CPE, 1, AAC_CHANNEL_FRONT }, // CPE2 = FL and FR,
+      { TYPE_CPE, 2, AAC_CHANNEL_BACK  }, // CPE3 = SiL and SiR,
+      { TYPE_CPE, 3, AAC_CHANNEL_BACK  }, // CPE4 = BL and BR,
+      { TYPE_SCE, 1, AAC_CHANNEL_BACK  }, // SCE2 = BC,
+      { TYPE_LFE, 0, AAC_CHANNEL_LFE   }, // LFE1 = LFE1,
+      { TYPE_LFE, 1, AAC_CHANNEL_LFE   }, // LFE2 = LFE2,
+      { TYPE_SCE, 2, AAC_CHANNEL_FRONT }, // SCE3 = TpFC,
+      { TYPE_CPE, 4, AAC_CHANNEL_FRONT }, // CPE5 = TpFL and TpFR,
+      { TYPE_CPE, 5, AAC_CHANNEL_SIDE  }, // CPE6 = TpSiL and TpSiR,
+      { TYPE_SCE, 3, AAC_CHANNEL_SIDE  }, // SCE4 = TpC,
+      { TYPE_CPE, 6, AAC_CHANNEL_BACK  }, // CPE7 = TpBL and TpBR,
+      { TYPE_SCE, 4, AAC_CHANNEL_BACK  }, // SCE5 = TpBC,
+      { 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_BACK }, { TYPE_LFE, 0, AAC_CHANNEL_LFE }, { TYPE_CPE, 2, AAC_CHANNEL_FRONT  }, },
+    { { 0, } },
+};
+
+const int16_t ff_aac_channel_map[3][4][6] = {
+    {
+      { AV_CHAN_FRONT_CENTER,        AV_CHAN_FRONT_LEFT_OF_CENTER, AV_CHAN_FRONT_RIGHT_OF_CENTER, AV_CHAN_FRONT_LEFT,        AV_CHAN_FRONT_RIGHT,        AV_CHAN_NONE },
+      { AV_CHAN_UNUSED,              AV_CHAN_NONE,                 AV_CHAN_NONE,                  AV_CHAN_NONE,              AV_CHAN_NONE,               AV_CHAN_NONE },
+      { AV_CHAN_UNUSED,              AV_CHAN_SIDE_LEFT,            AV_CHAN_SIDE_RIGHT,            AV_CHAN_BACK_LEFT,         AV_CHAN_BACK_RIGHT,         AV_CHAN_BACK_CENTER },
+      { AV_CHAN_LOW_FREQUENCY,       AV_CHAN_LOW_FREQUENCY_2,      AV_CHAN_NONE,                  AV_CHAN_NONE,              AV_CHAN_NONE,               AV_CHAN_NONE },
+    },
+    {
+      { AV_CHAN_TOP_FRONT_CENTER,    AV_CHAN_NONE,                 AV_CHAN_NONE,                  AV_CHAN_TOP_FRONT_LEFT,    AV_CHAN_TOP_FRONT_RIGHT,    AV_CHAN_NONE },
+      { AV_CHAN_UNUSED,              AV_CHAN_TOP_SIDE_LEFT,        AV_CHAN_TOP_SIDE_RIGHT,        AV_CHAN_NONE,              AV_CHAN_NONE,               AV_CHAN_TOP_CENTER},
+      { AV_CHAN_UNUSED,              AV_CHAN_NONE,                 AV_CHAN_NONE,                  AV_CHAN_TOP_BACK_LEFT,     AV_CHAN_TOP_BACK_RIGHT,     AV_CHAN_TOP_BACK_CENTER},
+      { AV_CHAN_NONE,                AV_CHAN_NONE,                 AV_CHAN_NONE,                  AV_CHAN_NONE,              AV_CHAN_NONE,               AV_CHAN_NONE},
+    },
+    {
+      { AV_CHAN_BOTTOM_FRONT_CENTER, AV_CHAN_NONE,                 AV_CHAN_NONE,                  AV_CHAN_BOTTOM_FRONT_LEFT, AV_CHAN_BOTTOM_FRONT_RIGHT, AV_CHAN_NONE },
+      { AV_CHAN_NONE,                AV_CHAN_NONE,                 AV_CHAN_NONE,                  AV_CHAN_NONE,              AV_CHAN_NONE,               AV_CHAN_NONE },
+      { AV_CHAN_NONE,                AV_CHAN_NONE,                 AV_CHAN_NONE,                  AV_CHAN_NONE,              AV_CHAN_NONE,               AV_CHAN_NONE },
+      { AV_CHAN_NONE,                AV_CHAN_NONE,                 AV_CHAN_NONE,                  AV_CHAN_NONE,              AV_CHAN_NONE,               AV_CHAN_NONE },
+    },
+};
+
+#if FF_API_OLD_CHANNEL_LAYOUT
+const uint64_t ff_aac_channel_layout[] = {
+    AV_CH_LAYOUT_MONO,
+    AV_CH_LAYOUT_STEREO,
+    AV_CH_LAYOUT_SURROUND,
+    AV_CH_LAYOUT_4POINT0,
+    AV_CH_LAYOUT_5POINT0_BACK,
+    AV_CH_LAYOUT_5POINT1_BACK,
+    AV_CH_LAYOUT_7POINT1_WIDE_BACK,
+    AV_CH_LAYOUT_6POINT1_BACK,
+    AV_CH_LAYOUT_7POINT1,
+    AV_CH_LAYOUT_22POINT2,
+    AV_CH_LAYOUT_7POINT1_TOP_BACK,
+    0,
+};
+#endif
+
+const AVChannelLayout ff_aac_ch_layout[] = {
+    AV_CHANNEL_LAYOUT_MONO,
+    AV_CHANNEL_LAYOUT_STEREO,
+    AV_CHANNEL_LAYOUT_SURROUND,
+    AV_CHANNEL_LAYOUT_4POINT0,
+    AV_CHANNEL_LAYOUT_5POINT0_BACK,
+    AV_CHANNEL_LAYOUT_5POINT1_BACK,
+    AV_CHANNEL_LAYOUT_7POINT1_WIDE_BACK,
+    AV_CHANNEL_LAYOUT_6POINT1_BACK,
+    AV_CHANNEL_LAYOUT_7POINT1,
+    AV_CHANNEL_LAYOUT_22POINT2,
+    AV_CHANNEL_LAYOUT_7POINT1_TOP_BACK,
+    { 0 },
+};
diff --git a/libavcodec/aacdec_fixed.c b/libavcodec/aacdec_fixed.c
index 46f0ebf91b..2b8ac67659 100644
--- a/libavcodec/aacdec_fixed.c
+++ b/libavcodec/aacdec_fixed.c
@@ -465,8 +465,8 @@ const FFCodec ff_aac_fixed_decoder = {
     },
     .p.capabilities  = AV_CODEC_CAP_CHANNEL_CONF | AV_CODEC_CAP_DR1,
     .caps_internal   = FF_CODEC_CAP_INIT_CLEANUP,
-    CODEC_OLD_CHANNEL_LAYOUTS_ARRAY(aac_channel_layout)
-    .p.ch_layouts    = aac_ch_layout,
+    CODEC_OLD_CHANNEL_LAYOUTS_ARRAY(ff_aac_channel_layout)
+    .p.ch_layouts    = ff_aac_ch_layout,
     .p.priv_class    = &aac_decoder_class,
     .p.profiles      = NULL_IF_CONFIG_SMALL(ff_aac_profiles),
     .flush = flush,
diff --git a/libavcodec/aacdec_template.c b/libavcodec/aacdec_template.c
index 954399f86b..3a230e1128 100644
--- a/libavcodec/aacdec_template.c
+++ b/libavcodec/aacdec_template.c
@@ -283,10 +283,10 @@ static int assign_channels(struct elem_to_channel e2c_vec[MAX_ELEM_ID], uint8_t
 
     if (pos == AAC_CHANNEL_LFE) {
         while (nb_channels) {
-            if (aac_channel_map[layer][pos - 1][j] == AV_CHAN_NONE)
+            if (ff_aac_channel_map[layer][pos - 1][j] == AV_CHAN_NONE)
                 return -1;
             e2c_vec[i] = (struct elem_to_channel) {
-                .av_position  = 1ULL << aac_channel_map[layer][pos - 1][j],
+                .av_position  = 1ULL << ff_aac_channel_map[layer][pos - 1][j],
                 .syn_ele      = layout_map[i][0],
                 .elem_id      = layout_map[i][1],
                 .aac_position = pos
@@ -302,12 +302,12 @@ static int assign_channels(struct elem_to_channel e2c_vec[MAX_ELEM_ID], uint8_t
     }
 
     while (nb_channels & 1) {
-        if (aac_channel_map[layer][pos - 1][0] == AV_CHAN_NONE)
+        if (ff_aac_channel_map[layer][pos - 1][0] == AV_CHAN_NONE)
             return -1;
-        if (aac_channel_map[layer][pos - 1][0] == AV_CHAN_UNUSED)
+        if (ff_aac_channel_map[layer][pos - 1][0] == AV_CHAN_UNUSED)
             break;
         e2c_vec[i] = (struct elem_to_channel) {
-            .av_position  = 1ULL << aac_channel_map[layer][pos - 1][0],
+            .av_position  = 1ULL << ff_aac_channel_map[layer][pos - 1][0],
             .syn_ele      = layout_map[i][0],
             .elem_id      = layout_map[i][1],
             .aac_position = pos
@@ -319,21 +319,21 @@ static int assign_channels(struct elem_to_channel e2c_vec[MAX_ELEM_ID], uint8_t
 
     j = (pos != AAC_CHANNEL_SIDE) && nb_channels <= 3 ? 3 : 1;
     while (nb_channels >= 2) {
-        if (aac_channel_map[layer][pos - 1][j]   == AV_CHAN_NONE ||
-            aac_channel_map[layer][pos - 1][j+1] == AV_CHAN_NONE)
+        if (ff_aac_channel_map[layer][pos - 1][j]   == AV_CHAN_NONE ||
+            ff_aac_channel_map[layer][pos - 1][j+1] == AV_CHAN_NONE)
             return -1;
         i += assign_pair(e2c_vec, layout_map, i,
-                         1ULL << aac_channel_map[layer][pos - 1][j],
-                         1ULL << aac_channel_map[layer][pos - 1][j+1],
+                         1ULL << ff_aac_channel_map[layer][pos - 1][j],
+                         1ULL << ff_aac_channel_map[layer][pos - 1][j+1],
                          pos, layout);
         j += 2;
         nb_channels -= 2;
     }
     while (nb_channels & 1) {
-        if (aac_channel_map[layer][pos - 1][5] == AV_CHAN_NONE)
+        if (ff_aac_channel_map[layer][pos - 1][5] == AV_CHAN_NONE)
             return -1;
         e2c_vec[i] = (struct elem_to_channel) {
-            .av_position  = 1ULL << aac_channel_map[layer][pos - 1][5],
+            .av_position  = 1ULL << ff_aac_channel_map[layer][pos - 1][5],
             .syn_ele      = layout_map[i][0],
             .elem_id      = layout_map[i][1],
             .aac_position = pos
@@ -552,8 +552,8 @@ static int set_default_channel_config(AACContext *ac, AVCodecContext *avctx,
                channel_config);
         return AVERROR_INVALIDDATA;
     }
-    *tags = tags_per_config[channel_config];
-    memcpy(layout_map, aac_channel_layout_map[channel_config - 1],
+    *tags = ff_tags_per_config[channel_config];
+    memcpy(layout_map, ff_aac_channel_layout_map[channel_config - 1],
            *tags * sizeof(*layout_map));
 
     /*
@@ -661,7 +661,7 @@ static ChannelElement *get_che(AACContext *ac, int type, int elem_id)
          * SCE[0] CPE[0] CPE[1] LFE[0].
          * If we seem to have encountered such a stream, transfer
          * the LFE[0] element to the SCE[1]'s mapping */
-        if (ac->tags_mapped == tags_per_config[ac->oc[1].m4ac.chan_config] - 1 && (type == TYPE_LFE || type == TYPE_SCE)) {
+        if (ac->tags_mapped == ff_tags_per_config[ac->oc[1].m4ac.chan_config] - 1 && (type == TYPE_LFE || type == TYPE_SCE)) {
             if (!ac->warned_remapping_once && (type != TYPE_LFE || elem_id != 0)) {
                 av_log(ac->avctx, AV_LOG_WARNING,
                    "This stream seems to incorrectly report its last channel as %s[%d], mapping to LFE[0]\n",
@@ -683,7 +683,7 @@ static ChannelElement *get_che(AACContext *ac, int type, int elem_id)
          * SCE[0] CPE[0] SCE[1].
          * If we seem to have encountered such a stream, transfer
          * the SCE[1] element to the LFE[0]'s mapping */
-        if (ac->tags_mapped == tags_per_config[ac->oc[1].m4ac.chan_config] - 1 && (type == TYPE_LFE || type == TYPE_SCE)) {
+        if (ac->tags_mapped == ff_tags_per_config[ac->oc[1].m4ac.chan_config] - 1 && (type == TYPE_LFE || type == TYPE_SCE)) {
             if (!ac->warned_remapping_once && (type != TYPE_SCE || elem_id != 1)) {
                 av_log(ac->avctx, AV_LOG_WARNING,
                    "This stream seems to incorrectly report its last channel as %s[%d], mapping to SCE[1]\n",
@@ -3091,9 +3091,9 @@ static int aac_decode_er_frame(AVCodecContext *avctx, void *data,
                               chan_config);
         return AVERROR_INVALIDDATA;
     }
-    for (i = 0; i < tags_per_config[chan_config]; i++) {
-        const int elem_type = aac_channel_layout_map[chan_config-1][i][0];
-        const int elem_id   = aac_channel_layout_map[chan_config-1][i][1];
+    for (i = 0; i < ff_tags_per_config[chan_config]; i++) {
+        const int elem_type = ff_aac_channel_layout_map[chan_config-1][i][0];
+        const int elem_id   = ff_aac_channel_layout_map[chan_config-1][i][1];
         if (!(che=get_che(ac, elem_type, elem_id))) {
             av_log(ac->avctx, AV_LOG_ERROR,
                    "channel element %d.%d is not allocated\n",
diff --git a/libavcodec/aacdectab.h b/libavcodec/aacdectab.h
index 41f1db781d..db6fd0a04f 100644
--- a/libavcodec/aacdectab.h
+++ b/libavcodec/aacdectab.h
@@ -1,7 +1,5 @@
 /*
  * AAC decoder data
- * Copyright (c) 2005-2006 Oded Shimon ( ods15 ods15 dyndns org )
- * Copyright (c) 2006-2007 Maxim Gavrilov ( maxim.gavrilov gmail com )
  *
  * This file is part of FFmpeg.
  *
@@ -30,99 +28,20 @@
 #ifndef AVCODEC_AACDECTAB_H
 #define AVCODEC_AACDECTAB_H
 
-#include "libavutil/channel_layout.h"
-#include "aac.h"
-
 #include <stdint.h>
 
-static const int8_t tags_per_config[16] = { 0, 1, 1, 2, 3, 3, 4, 5, 0, 0, 0, 5, 5, 16, 5, 0 };
+#include "libavutil/channel_layout.h"
+
+extern const int8_t ff_tags_per_config[16];
 
-static const uint8_t aac_channel_layout_map[16][16][3] = {
-    { { TYPE_SCE, 0, AAC_CHANNEL_FRONT }, },
-    { { TYPE_CPE, 0, AAC_CHANNEL_FRONT }, },
-    { { TYPE_SCE, 0, AAC_CHANNEL_FRONT }, { TYPE_CPE, 0, AAC_CHANNEL_FRONT }, },
-    { { TYPE_SCE, 0, AAC_CHANNEL_FRONT }, { TYPE_CPE, 0, AAC_CHANNEL_FRONT }, { TYPE_SCE, 1, AAC_CHANNEL_BACK }, },
-    { { TYPE_SCE, 0, AAC_CHANNEL_FRONT }, { TYPE_CPE, 0, AAC_CHANNEL_FRONT }, { TYPE_CPE, 1, AAC_CHANNEL_BACK }, },
-    { { TYPE_SCE, 0, AAC_CHANNEL_FRONT }, { TYPE_CPE, 0, AAC_CHANNEL_FRONT }, { TYPE_CPE, 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_FRONT }, { TYPE_CPE, 2, AAC_CHANNEL_BACK }, { TYPE_LFE, 0, AAC_CHANNEL_LFE  }, },
-    { { 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_BACK }, { TYPE_CPE, 2, AAC_CHANNEL_BACK }, { TYPE_LFE, 0, AAC_CHANNEL_LFE  }, },
-    {
-      { TYPE_SCE, 0, AAC_CHANNEL_FRONT }, // SCE1 = FC,
-      { TYPE_CPE, 0, AAC_CHANNEL_FRONT }, // CPE1 = FLc and FRc,
-      { TYPE_CPE, 1, AAC_CHANNEL_FRONT }, // CPE2 = FL and FR,
-      { TYPE_CPE, 2, AAC_CHANNEL_BACK  }, // CPE3 = SiL and SiR,
-      { TYPE_CPE, 3, AAC_CHANNEL_BACK  }, // CPE4 = BL and BR,
-      { TYPE_SCE, 1, AAC_CHANNEL_BACK  }, // SCE2 = BC,
-      { TYPE_LFE, 0, AAC_CHANNEL_LFE   }, // LFE1 = LFE1,
-      { TYPE_LFE, 1, AAC_CHANNEL_LFE   }, // LFE2 = LFE2,
-      { TYPE_SCE, 2, AAC_CHANNEL_FRONT }, // SCE3 = TpFC,
-      { TYPE_CPE, 4, AAC_CHANNEL_FRONT }, // CPE5 = TpFL and TpFR,
-      { TYPE_CPE, 5, AAC_CHANNEL_SIDE  }, // CPE6 = TpSiL and TpSiR,
-      { TYPE_SCE, 3, AAC_CHANNEL_SIDE  }, // SCE4 = TpC,
-      { TYPE_CPE, 6, AAC_CHANNEL_BACK  }, // CPE7 = TpBL and TpBR,
-      { TYPE_SCE, 4, AAC_CHANNEL_BACK  }, // SCE5 = TpBC,
-      { 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_BACK }, { TYPE_LFE, 0, AAC_CHANNEL_LFE }, { TYPE_CPE, 2, AAC_CHANNEL_FRONT  }, },
-    { { 0, } },
-};
+extern const uint8_t ff_aac_channel_layout_map[16][16][3];
 
-static const int16_t aac_channel_map[3][4][6] = {
-    {
-      { AV_CHAN_FRONT_CENTER,        AV_CHAN_FRONT_LEFT_OF_CENTER, AV_CHAN_FRONT_RIGHT_OF_CENTER, AV_CHAN_FRONT_LEFT,        AV_CHAN_FRONT_RIGHT,        AV_CHAN_NONE },
-      { AV_CHAN_UNUSED,              AV_CHAN_NONE,                 AV_CHAN_NONE,                  AV_CHAN_NONE,              AV_CHAN_NONE,               AV_CHAN_NONE },
-      { AV_CHAN_UNUSED,              AV_CHAN_SIDE_LEFT,            AV_CHAN_SIDE_RIGHT,            AV_CHAN_BACK_LEFT,         AV_CHAN_BACK_RIGHT,         AV_CHAN_BACK_CENTER },
-      { AV_CHAN_LOW_FREQUENCY,       AV_CHAN_LOW_FREQUENCY_2,      AV_CHAN_NONE,                  AV_CHAN_NONE,              AV_CHAN_NONE,               AV_CHAN_NONE },
-    },
-    {
-      { AV_CHAN_TOP_FRONT_CENTER,    AV_CHAN_NONE,                 AV_CHAN_NONE,                  AV_CHAN_TOP_FRONT_LEFT,    AV_CHAN_TOP_FRONT_RIGHT,    AV_CHAN_NONE },
-      { AV_CHAN_UNUSED,              AV_CHAN_TOP_SIDE_LEFT,        AV_CHAN_TOP_SIDE_RIGHT,        AV_CHAN_NONE,              AV_CHAN_NONE,               AV_CHAN_TOP_CENTER},
-      { AV_CHAN_UNUSED,              AV_CHAN_NONE,                 AV_CHAN_NONE,                  AV_CHAN_TOP_BACK_LEFT,     AV_CHAN_TOP_BACK_RIGHT,     AV_CHAN_TOP_BACK_CENTER},
-      { AV_CHAN_NONE,                AV_CHAN_NONE,                 AV_CHAN_NONE,                  AV_CHAN_NONE,              AV_CHAN_NONE,               AV_CHAN_NONE},
-    },
-    {
-      { AV_CHAN_BOTTOM_FRONT_CENTER, AV_CHAN_NONE,                 AV_CHAN_NONE,                  AV_CHAN_BOTTOM_FRONT_LEFT, AV_CHAN_BOTTOM_FRONT_RIGHT, AV_CHAN_NONE },
-      { AV_CHAN_NONE,                AV_CHAN_NONE,                 AV_CHAN_NONE,                  AV_CHAN_NONE,              AV_CHAN_NONE,               AV_CHAN_NONE },
-      { AV_CHAN_NONE,                AV_CHAN_NONE,                 AV_CHAN_NONE,                  AV_CHAN_NONE,              AV_CHAN_NONE,               AV_CHAN_NONE },
-      { AV_CHAN_NONE,                AV_CHAN_NONE,                 AV_CHAN_NONE,                  AV_CHAN_NONE,              AV_CHAN_NONE,               AV_CHAN_NONE },
-    },
-};
+extern const int16_t ff_aac_channel_map[3][4][6];
 
 #if FF_API_OLD_CHANNEL_LAYOUT
-static const uint64_t aac_channel_layout[] = {
-    AV_CH_LAYOUT_MONO,
-    AV_CH_LAYOUT_STEREO,
-    AV_CH_LAYOUT_SURROUND,
-    AV_CH_LAYOUT_4POINT0,
-    AV_CH_LAYOUT_5POINT0_BACK,
-    AV_CH_LAYOUT_5POINT1_BACK,
-    AV_CH_LAYOUT_7POINT1_WIDE_BACK,
-    AV_CH_LAYOUT_6POINT1_BACK,
-    AV_CH_LAYOUT_7POINT1,
-    AV_CH_LAYOUT_22POINT2,
-    AV_CH_LAYOUT_7POINT1_TOP_BACK,
-    0,
-};
+extern const uint64_t ff_aac_channel_layout[];
 #endif
 
-static const AVChannelLayout aac_ch_layout[] = {
-    AV_CHANNEL_LAYOUT_MONO,
-    AV_CHANNEL_LAYOUT_STEREO,
-    AV_CHANNEL_LAYOUT_SURROUND,
-    AV_CHANNEL_LAYOUT_4POINT0,
-    AV_CHANNEL_LAYOUT_5POINT0_BACK,
-    AV_CHANNEL_LAYOUT_5POINT1_BACK,
-    AV_CHANNEL_LAYOUT_7POINT1_WIDE_BACK,
-    AV_CHANNEL_LAYOUT_6POINT1_BACK,
-    AV_CHANNEL_LAYOUT_7POINT1,
-    AV_CHANNEL_LAYOUT_22POINT2,
-    AV_CHANNEL_LAYOUT_7POINT1_TOP_BACK,
-    { 0 },
-};
+extern const AVChannelLayout ff_aac_ch_layout[];
 
 #endif /* AVCODEC_AACDECTAB_H */



More information about the ffmpeg-cvslog mailing list