summaryrefslogtreecommitdiffstats
path: root/libavcodec/ac3enc_float.c
diff options
context:
space:
mode:
authorJames Almer <jamrial@gmail.com>2017-04-07 00:14:52 -0300
committerJames Almer <jamrial@gmail.com>2017-04-07 00:19:32 -0300
commite7ec8c181fe4b78ba66cc37911e707a1fb4ec0df (patch)
tree079ff98dbd306ed413db84ba844abdc3331a2b83 /libavcodec/ac3enc_float.c
parentc37e8c0b7fd4a68604102eb4c9d9c9f347c57ad2 (diff)
parentf0d3e43bd77b3194a28d75884cf83083b188bf30 (diff)
downloadffmpeg-streaming-e7ec8c181fe4b78ba66cc37911e707a1fb4ec0df.zip
ffmpeg-streaming-e7ec8c181fe4b78ba66cc37911e707a1fb4ec0df.tar.gz
Merge commit 'f0d3e43bd77b3194a28d75884cf83083b188bf30'
* commit 'f0d3e43bd77b3194a28d75884cf83083b188bf30': ac3enc: Reshuffle functions to avoid forward declarations Merged-by: James Almer <jamrial@gmail.com>
Diffstat (limited to 'libavcodec/ac3enc_float.c')
-rw-r--r--libavcodec/ac3enc_float.c83
1 files changed, 43 insertions, 40 deletions
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;
OpenPOWER on IntegriCloud