diff mbox series

[FFmpeg-devel,31/32] avcodec/ac3tab: Move ff_ac3_enc_channel_map to its only user

Message ID 20210220050107.2572205-2-andreas.rheinhardt@gmail.com
State Accepted
Commit d0d96674ec647a6b6b08bbf339e6cb995c780e6c
Headers show
Series [FFmpeg-devel,01/29] configure, libavcodec/Makefile: Remove spurious CAF demuxer dependencies | expand

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished
andriy/PPC64_make success Make finished
andriy/PPC64_make_fate success Make fate finished

Commit Message

Andreas Rheinhardt Feb. 20, 2021, 5:01 a.m. UTC
and make it static.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
---
 libavcodec/ac3enc.c | 11 ++++++++++-
 libavcodec/ac3tab.c | 18 ------------------
 libavcodec/ac3tab.h |  9 ++++++++-
 3 files changed, 18 insertions(+), 20 deletions(-)

Comments

Lynne Feb. 20, 2021, 1:18 p.m. UTC | #1
Feb 20, 2021, 06:01 by andreas.rheinhardt@gmail.com:

> and make it static.
>
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
> ---
>  libavcodec/ac3enc.c | 11 ++++++++++-
>  libavcodec/ac3tab.c | 18 ------------------
>  libavcodec/ac3tab.h |  9 ++++++++-
>  3 files changed, 18 insertions(+), 20 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;
> diff --git a/libavcodec/ac3tab.c b/libavcodec/ac3tab.c
> index 99307218cc..5a352340e7 100644
> --- a/libavcodec/ac3tab.c
> +++ b/libavcodec/ac3tab.c
> @@ -97,24 +97,6 @@ const uint16_t avpriv_ac3_channel_layout_tab[8] = {
>  AV_CH_LAYOUT_5POINT0
>  };
>  
> -#define COMMON_CHANNEL_MAP \
> -    { { 0, 1,          }, { 0, 1, 2,         } },\
> -    { { 0,             }, { 0, 1,            } },\
> -    { { 0, 1,          }, { 0, 1, 2,         } },\
> -    { { 0, 2, 1,       }, { 0, 2, 1, 3,      } },\
> -    { { 0, 1, 2,       }, { 0, 1, 3, 2,      } },\
> -    { { 0, 2, 1, 3,    }, { 0, 2, 1, 4, 3,   } },
> -
> -/**
> - * Table to remap channels from SMPTE order to AC-3 order.
> - * [channel_mode][lfe][ch]
> - */
> -const uint8_t ff_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 } },
> -};
> -
>  /**
>  * Table to remap channels from AC-3 order to SMPTE order.
>  * [channel_mode][lfe][ch]
> diff --git a/libavcodec/ac3tab.h b/libavcodec/ac3tab.h
> index a0036a301b..f41f7b6da0 100644
> --- a/libavcodec/ac3tab.h
> +++ b/libavcodec/ac3tab.h
> @@ -31,7 +31,6 @@
>  extern const uint16_t ff_ac3_frame_size_tab[38][3];
>  extern const uint8_t  ff_ac3_channels_tab[8];
>  extern av_export_avcodec const uint16_t avpriv_ac3_channel_layout_tab[8];
> -extern const uint8_t  ff_ac3_enc_channel_map[8][2][6];
>  extern const uint8_t  ff_ac3_dec_channel_map[8][2][6];
>  extern const int      ff_ac3_sample_rate_tab[];
>  extern const uint16_t ff_ac3_bitrate_tab[19];
> @@ -67,4 +66,12 @@ enum CustomChannelMapLocation{
>  AC3_CHMAP_LFE =     1<<(15-15)
>  };
>  
> +#define COMMON_CHANNEL_MAP \
> +    { { 0, 1,          }, { 0, 1, 2,         } },\
> +    { { 0,             }, { 0, 1,            } },\
> +    { { 0, 1,          }, { 0, 1, 2,         } },\
> +    { { 0, 2, 1,       }, { 0, 2, 1, 3,      } },\
> +    { { 0, 1, 2,       }, { 0, 1, 3, 2,      } },\
> +    { { 0, 2, 1, 3,    }, { 0, 2, 1, 4, 3,   } },
> +
>  #endif /* AVCODEC_AC3TAB_H */
> -- 
> 2.27.0
>
> _______________________________________________
> 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".
>

LGTM
diff mbox series

Patch

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;
diff --git a/libavcodec/ac3tab.c b/libavcodec/ac3tab.c
index 99307218cc..5a352340e7 100644
--- a/libavcodec/ac3tab.c
+++ b/libavcodec/ac3tab.c
@@ -97,24 +97,6 @@  const uint16_t avpriv_ac3_channel_layout_tab[8] = {
     AV_CH_LAYOUT_5POINT0
 };
 
-#define COMMON_CHANNEL_MAP \
-    { { 0, 1,          }, { 0, 1, 2,         } },\
-    { { 0,             }, { 0, 1,            } },\
-    { { 0, 1,          }, { 0, 1, 2,         } },\
-    { { 0, 2, 1,       }, { 0, 2, 1, 3,      } },\
-    { { 0, 1, 2,       }, { 0, 1, 3, 2,      } },\
-    { { 0, 2, 1, 3,    }, { 0, 2, 1, 4, 3,   } },
-
-/**
- * Table to remap channels from SMPTE order to AC-3 order.
- * [channel_mode][lfe][ch]
- */
-const uint8_t ff_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 } },
-};
-
 /**
  * Table to remap channels from AC-3 order to SMPTE order.
  * [channel_mode][lfe][ch]
diff --git a/libavcodec/ac3tab.h b/libavcodec/ac3tab.h
index a0036a301b..f41f7b6da0 100644
--- a/libavcodec/ac3tab.h
+++ b/libavcodec/ac3tab.h
@@ -31,7 +31,6 @@ 
 extern const uint16_t ff_ac3_frame_size_tab[38][3];
 extern const uint8_t  ff_ac3_channels_tab[8];
 extern av_export_avcodec const uint16_t avpriv_ac3_channel_layout_tab[8];
-extern const uint8_t  ff_ac3_enc_channel_map[8][2][6];
 extern const uint8_t  ff_ac3_dec_channel_map[8][2][6];
 extern const int      ff_ac3_sample_rate_tab[];
 extern const uint16_t ff_ac3_bitrate_tab[19];
@@ -67,4 +66,12 @@  enum CustomChannelMapLocation{
     AC3_CHMAP_LFE =     1<<(15-15)
 };
 
+#define COMMON_CHANNEL_MAP \
+    { { 0, 1,          }, { 0, 1, 2,         } },\
+    { { 0,             }, { 0, 1,            } },\
+    { { 0, 1,          }, { 0, 1, 2,         } },\
+    { { 0, 2, 1,       }, { 0, 2, 1, 3,      } },\
+    { { 0, 1, 2,       }, { 0, 1, 3, 2,      } },\
+    { { 0, 2, 1, 3,    }, { 0, 2, 1, 4, 3,   } },
+
 #endif /* AVCODEC_AC3TAB_H */