---
 libavcodec/ac3enc_fixed.c    |    9 +++++++++
 libavcodec/ac3enc_float.c    |   12 ++++++++++++
 libavcodec/ac3enc_template.c |   18 ++----------------
 3 files changed, 23 insertions(+), 16 deletions(-)

diff --git a/libavcodec/ac3enc_fixed.c b/libavcodec/ac3enc_fixed.c
index f1dc98b..26bba0f 100644
--- a/libavcodec/ac3enc_fixed.c
+++ b/libavcodec/ac3enc_fixed.c
@@ -113,6 +113,15 @@ static void clip_coefficients(DSPContext *dsp, int32_t 
*coef, unsigned int len)
 }
 
 
+/**
+ * Calculate a single coupling coordinate.
+ */
+static CoefType calc_cpl_coord(CoefSumType energy_ch, CoefSumType energy_cpl)
+{
+    return 1048576;
+}
+
+
 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 32ec558..598c69d 100644
--- a/libavcodec/ac3enc_float.c
+++ b/libavcodec/ac3enc_float.c
@@ -120,6 +120,18 @@ static void clip_coefficients(DSPContext *dsp, float 
*coef, unsigned int len)
 }
 
 
+/**
+ * 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);
+}
+
+
 #if CONFIG_AC3_ENCODER
 AVCodec ff_ac3_encoder = {
     .name           = "ac3",
diff --git a/libavcodec/ac3enc_template.c b/libavcodec/ac3enc_template.c
index deecba7..c125db3 100644
--- a/libavcodec/ac3enc_template.c
+++ b/libavcodec/ac3enc_template.c
@@ -41,6 +41,8 @@ static int normalize_samples(AC3EncodeContext *s);
 
 static void clip_coefficients(DSPContext *dsp, CoefType *coef, unsigned int 
len);
 
+static CoefType calc_cpl_coord(CoefSumType energy_ch, CoefSumType energy_cpl);
+
 
 int AC3_NAME(allocate_sample_buffers)(AC3EncodeContext *s)
 {
@@ -119,22 +121,6 @@ static void apply_mdct(AC3EncodeContext *s)
 
 
 /**
- * Calculate a single coupling coordinate.
- */
-static inline CoefType calc_cpl_coord(CoefSumType energy_ch, CoefSumType 
energy_cpl)
-{
-#if CONFIG_AC3ENC_FLOAT
-    float coord = 0.125;
-    if (energy_cpl > 0)
-        coord *= sqrtf(energy_ch / energy_cpl);
-    return FFMIN(coord, COEF_MAX);
-#else
-    return 1048576;
-#endif
-}
-
-
-/**
  * Calculate coupling channel and coupling coordinates.
  * TODO: Currently this is only used for the floating-point encoder. I was
  *       able to make it work for the fixed-point encoder, but quality was
-- 
1.7.1

_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to