[FFmpeg-cvslog] Merge commit 'f0d3e43bd77b3194a28d75884cf83083b188bf30'

James Almer git at videolan.org
Fri Apr 7 06:21:01 EEST 2017


ffmpeg | branch: master | James Almer <jamrial at gmail.com> | Fri Apr  7 00:14:52 2017 -0300| [e7ec8c181fe4b78ba66cc37911e707a1fb4ec0df] | committer: James Almer

Merge commit 'f0d3e43bd77b3194a28d75884cf83083b188bf30'

* commit 'f0d3e43bd77b3194a28d75884cf83083b188bf30':
  ac3enc: Reshuffle functions to avoid forward declarations

Merged-by: James Almer <jamrial at gmail.com>

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

 libavcodec/ac3enc_fixed.c    | 58 +++++++++++++++----------------
 libavcodec/ac3enc_float.c    | 83 +++++++++++++++++++++++---------------------
 libavcodec/ac3enc_template.c | 12 -------
 3 files changed, 71 insertions(+), 82 deletions(-)

diff --git a/libavcodec/ac3enc_fixed.c b/libavcodec/ac3enc_fixed.c
index f10c3b5..5e4250a 100644
--- a/libavcodec/ac3enc_fixed.c
+++ b/libavcodec/ac3enc_fixed.c
@@ -43,36 +43,6 @@ static const AVClass ac3enc_class = {
     .version    = LIBAVUTIL_VERSION_INT,
 };
 
-static int normalize_samples(AC3EncodeContext *s);
-
-#include "ac3enc_template.c"
-
-
-/**
- * Finalize MDCT and free allocated memory.
- *
- * @param s  AC-3 encoder private context
- */
-av_cold void AC3_NAME(mdct_end)(AC3EncodeContext *s)
-{
-    ff_mdct_end(&s->mdct);
-}
-
-
-/**
- * Initialize MDCT tables.
- *
- * @param s  AC-3 encoder private context
- * @return   0 on success, negative error code on failure
- */
-av_cold int AC3_NAME(mdct_init)(AC3EncodeContext *s)
-{
-    int ret = ff_mdct_init(&s->mdct, 9, 0, -1.0);
-    s->mdct_window = ff_ac3_window;
-    return ret;
-}
-
-
 /*
  * Normalize the input samples to use the maximum available precision.
  * This assumes signed 16-bit input samples.
@@ -137,6 +107,34 @@ static CoefType calc_cpl_coord(CoefSumType energy_ch, CoefSumType energy_cpl)
 }
 
 
+#include "ac3enc_template.c"
+
+
+/**
+ * Finalize MDCT and free allocated memory.
+ *
+ * @param s  AC-3 encoder private context
+ */
+av_cold void AC3_NAME(mdct_end)(AC3EncodeContext *s)
+{
+    ff_mdct_end(&s->mdct);
+}
+
+
+/**
+ * Initialize MDCT tables.
+ *
+ * @param s  AC-3 encoder private context
+ * @return   0 on success, negative error code on failure
+ */
+av_cold int AC3_NAME(mdct_init)(AC3EncodeContext *s)
+{
+    int ret = ff_mdct_init(&s->mdct, 9, 0, -1.0);
+    s->mdct_window = ff_ac3_window;
+    return ret;
+}
+
+
 static av_cold int ac3_fixed_encode_init(AVCodecContext *avctx)
 {
     AC3EncodeContext *s = avctx->priv_data;
diff --git a/libavcodec/ac3enc_float.c b/libavcodec/ac3enc_float.c
index 79839df..d6e658b 100644
--- a/libavcodec/ac3enc_float.c
+++ b/libavcodec/ac3enc_float.c
@@ -43,6 +43,49 @@ static const AVClass ac3enc_class = {
     .version    = LIBAVUTIL_VERSION_INT,
 };
 
+
+/*
+ * Scale MDCT coefficients from float to 24-bit fixed-point.
+ */
+static void scale_coefficients(AC3EncodeContext *s)
+{
+    int chan_size = AC3_MAX_COEFS * s->num_blocks;
+    int cpl       = s->cpl_on;
+    s->ac3dsp.float_to_fixed24(s->fixed_coef_buffer + (chan_size * !cpl),
+                               s->mdct_coef_buffer  + (chan_size * !cpl),
+                               chan_size * (s->channels + cpl));
+}
+
+
+/*
+ * Clip MDCT coefficients to allowable range.
+ */
+static void clip_coefficients(AudioDSPContext *adsp, float *coef,
+                              unsigned int len)
+{
+    adsp->vector_clipf(coef, coef, len, COEF_MIN, COEF_MAX);
+}
+
+
+/*
+ * Calculate a single coupling coordinate.
+ */
+static CoefType calc_cpl_coord(CoefSumType energy_ch, CoefSumType energy_cpl)
+{
+    float coord = 0.125;
+    if (energy_cpl > 0)
+        coord *= sqrtf(energy_ch / energy_cpl);
+    return FFMIN(coord, COEF_MAX);
+}
+
+static void sum_square_butterfly(AC3EncodeContext *s, float sum[4],
+                                 const float *coef0, const float *coef1,
+                                 int len)
+{
+    s->ac3dsp.sum_square_butterfly_float(sum, coef0, coef1, len);
+}
+
+
 #include "ac3enc_template.c"
 
 
@@ -86,46 +129,6 @@ av_cold int ff_ac3_float_mdct_init(AC3EncodeContext *s)
 }
 
 
-/*
- * Scale MDCT coefficients from float to 24-bit fixed-point.
- */
-static void scale_coefficients(AC3EncodeContext *s)
-{
-    int chan_size = AC3_MAX_COEFS * s->num_blocks;
-    int cpl       = s->cpl_on;
-    s->ac3dsp.float_to_fixed24(s->fixed_coef_buffer + (chan_size * !cpl),
-                               s->mdct_coef_buffer  + (chan_size * !cpl),
-                               chan_size * (s->channels + cpl));
-}
-
-static void sum_square_butterfly(AC3EncodeContext *s, float sum[4],
-                                 const float *coef0, const float *coef1,
-                                 int len)
-{
-    s->ac3dsp.sum_square_butterfly_float(sum, coef0, coef1, len);
-}
-
-/*
- * Clip MDCT coefficients to allowable range.
- */
-static void clip_coefficients(AudioDSPContext *adsp, float *coef,
-                              unsigned int len)
-{
-    adsp->vector_clipf(coef, coef, len, COEF_MIN, COEF_MAX);
-}
-
-
-/*
- * Calculate a single coupling coordinate.
- */
-static CoefType calc_cpl_coord(CoefSumType energy_ch, CoefSumType energy_cpl)
-{
-    float coord = 0.125;
-    if (energy_cpl > 0)
-        coord *= sqrtf(energy_ch / energy_cpl);
-    return FFMIN(coord, COEF_MAX);
-}
-
 av_cold int ff_ac3_float_encode_init(AVCodecContext *avctx)
 {
     AC3EncodeContext *s = avctx->priv_data;
diff --git a/libavcodec/ac3enc_template.c b/libavcodec/ac3enc_template.c
index 0b23b96..be65987 100644
--- a/libavcodec/ac3enc_template.c
+++ b/libavcodec/ac3enc_template.c
@@ -36,18 +36,6 @@
 #include "ac3enc.h"
 #include "eac3enc.h"
 
-/* prototypes for static functions in ac3enc_fixed.c and ac3enc_float.c */
-
-static void scale_coefficients(AC3EncodeContext *s);
-
-static void clip_coefficients(AudioDSPContext *adsp, CoefType *coef,
-                              unsigned int len);
-
-static CoefType calc_cpl_coord(CoefSumType energy_ch, CoefSumType energy_cpl);
-
-static void sum_square_butterfly(AC3EncodeContext *s, CoefSumType sum[4],
-                                 const CoefType *coef0, const CoefType *coef1,
-                                 int len);
 
 int AC3_NAME(allocate_sample_buffers)(AC3EncodeContext *s)
 {


======================================================================

diff --cc libavcodec/ac3enc_fixed.c
index f10c3b5,c1cf825..5e4250a
--- a/libavcodec/ac3enc_fixed.c
+++ b/libavcodec/ac3enc_fixed.c
@@@ -35,44 -35,9 +35,14 @@@
  
  #define AC3ENC_TYPE AC3ENC_TYPE_AC3_FIXED
  #include "ac3enc_opts_template.c"
 -static const AVClass ac3enc_class = { "Fixed-Point AC-3 Encoder", av_default_item_name,
 -                                      ac3_options, LIBAVUTIL_VERSION_INT };
 +
 +static const AVClass ac3enc_class = {
 +    .class_name = "Fixed-Point AC-3 Encoder",
 +    .item_name  = av_default_item_name,
 +    .option     = ac3_options,
 +    .version    = LIBAVUTIL_VERSION_INT,
 +};
  
- static int normalize_samples(AC3EncodeContext *s);
- 
- #include "ac3enc_template.c"
- 
- 
- /**
-  * Finalize MDCT and free allocated memory.
-  *
-  * @param s  AC-3 encoder private context
-  */
- av_cold void AC3_NAME(mdct_end)(AC3EncodeContext *s)
- {
-     ff_mdct_end(&s->mdct);
- }
- 
- 
- /**
-  * Initialize MDCT tables.
-  *
-  * @param s  AC-3 encoder private context
-  * @return   0 on success, negative error code on failure
-  */
- av_cold int AC3_NAME(mdct_init)(AC3EncodeContext *s)
- {
-     int ret = ff_mdct_init(&s->mdct, 9, 0, -1.0);
-     s->mdct_window = ff_ac3_window;
-     return ret;
- }
- 
- 
  /*
   * Normalize the input samples to use the maximum available precision.
   * This assumes signed 16-bit input samples.
diff --cc libavcodec/ac3enc_float.c
index 79839df,249f9ed..d6e658b
--- a/libavcodec/ac3enc_float.c
+++ b/libavcodec/ac3enc_float.c
@@@ -36,13 -36,45 +36,56 @@@
  
  #define AC3ENC_TYPE AC3ENC_TYPE_AC3
  #include "ac3enc_opts_template.c"
 -static const AVClass ac3enc_class = { "AC-3 Encoder", av_default_item_name,
 -                                      ac3_options, LIBAVUTIL_VERSION_INT };
 +static const AVClass ac3enc_class = {
 +    .class_name = "AC-3 Encoder",
 +    .item_name  = av_default_item_name,
 +    .option     = ac3_options,
 +    .version    = LIBAVUTIL_VERSION_INT,
 +};
  
+ 
+ /*
+  * Scale MDCT coefficients from float to 24-bit fixed-point.
+  */
+ static void scale_coefficients(AC3EncodeContext *s)
+ {
+     int chan_size = AC3_MAX_COEFS * s->num_blocks;
+     int cpl       = s->cpl_on;
+     s->ac3dsp.float_to_fixed24(s->fixed_coef_buffer + (chan_size * !cpl),
+                                s->mdct_coef_buffer  + (chan_size * !cpl),
+                                chan_size * (s->channels + cpl));
+ }
+ 
+ 
+ /*
+  * Clip MDCT coefficients to allowable range.
+  */
+ static void clip_coefficients(AudioDSPContext *adsp, float *coef,
+                               unsigned int len)
+ {
+     adsp->vector_clipf(coef, coef, len, COEF_MIN, COEF_MAX);
+ }
+ 
+ 
+ /*
+  * Calculate a single coupling coordinate.
+  */
+ static CoefType calc_cpl_coord(CoefSumType energy_ch, CoefSumType energy_cpl)
+ {
+     float coord = 0.125;
+     if (energy_cpl > 0)
+         coord *= sqrtf(energy_ch / energy_cpl);
+     return FFMIN(coord, COEF_MAX);
+ }
+ 
++static void sum_square_butterfly(AC3EncodeContext *s, float sum[4],
++                                 const float *coef0, const float *coef1,
++                                 int len)
++{
++    s->ac3dsp.sum_square_butterfly_float(sum, coef0, coef1, len);
++}
++
+ 
  #include "ac3enc_template.c"
  
  



More information about the ffmpeg-cvslog mailing list