summaryrefslogtreecommitdiff
path: root/libavcodec/ac3enc.c
diff options
context:
space:
mode:
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>2021-02-20 04:30:30 +0100
committerAndreas Rheinhardt <andreas.rheinhardt@gmail.com>2021-02-20 14:46:25 +0100
commitd0d96674ec647a6b6b08bbf339e6cb995c780e6c (patch)
treed5bab7317156602c9ae7876019fe66e21785a163 /libavcodec/ac3enc.c
parent89fe1935b18621af06587c76bcde6adcdc8f2249 (diff)
avcodec/ac3tab: Move ff_ac3_enc_channel_map to its only user
and make it static. Reviewed-by: Lynne <dev@lynne.ee> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Diffstat (limited to 'libavcodec/ac3enc.c')
-rw-r--r--libavcodec/ac3enc.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/libavcodec/ac3enc.c b/libavcodec/ac3enc.c
index bae7405fff..65602d2021 100644
--- a/libavcodec/ac3enc.c
+++ b/libavcodec/ac3enc.c
@@ -161,6 +161,15 @@ const uint64_t ff_ac3_channel_layouts[19] = {
0
};
+/**
+ * Table to remap channels from SMPTE order to AC-3 order.
+ * [channel_mode][lfe][ch]
+ */
+static const uint8_t ac3_enc_channel_map[8][2][6] = {
+ COMMON_CHANNEL_MAP
+ { { 0, 1, 2, 3, }, { 0, 1, 3, 4, 2, } },
+ { { 0, 2, 1, 3, 4, }, { 0, 2, 1, 4, 5, 3 } },
+};
/**
* LUT to select the bandwidth code based on the bit rate, sample rate, and
@@ -2184,7 +2193,7 @@ static av_cold int set_channel_info(AC3EncodeContext *s, int channels,
s->has_center = (s->channel_mode & 0x01) && s->channel_mode != AC3_CHMODE_MONO;
s->has_surround = s->channel_mode & 0x04;
- s->channel_map = ff_ac3_enc_channel_map[s->channel_mode][s->lfe_on];
+ s->channel_map = ac3_enc_channel_map[s->channel_mode][s->lfe_on];
*channel_layout = ch_layout;
if (s->lfe_on)
*channel_layout |= AV_CH_LOW_FREQUENCY;