---
 libavcodec/ac3enc.c       |   17 -----------------
 libavcodec/ac3enc_fixed.c |   17 +++++++++++++++++
 libavcodec/ac3enc_fixed.h |    5 +++--
 libavcodec/ac3enc_float.c |   17 +++++++++++++++++
 libavcodec/ac3enc_float.h |    4 ++--
 5 files changed, 39 insertions(+), 21 deletions(-)

diff --git libavcodec/ac3enc.c libavcodec/ac3enc.c
index e186b21..4003336 100644
--- libavcodec/ac3enc.c
+++ libavcodec/ac3enc.c
@@ -242,23 +242,6 @@ int exponent_group_tab[3][256];
 #include "ac3enc_fixed.c"
 #endif
 
-static void apply_window(SampleType *output, const SampleType *input,
-                         const SampleType *window, int n)
-{
-    int i;
-    int n2 = n >> 1;
-
-    window += n2;
-    input  += n2;
-    output += n2;
-
-    for (i = 0; i < n2; i++) {
-        SampleType w    = window[-i-1];
-        output[-i-1] = FIX_SHIFT(MULFUNC(input[-i-1], w));
-        output[ i  ] = FIX_SHIFT(MULFUNC(input[ i  ], w));
-    }
-}
-
 static void apply_mdct(AC3EncodeContext *s)
 {
     int blk, ch;
diff --git libavcodec/ac3enc_fixed.c libavcodec/ac3enc_fixed.c
index a928a11..a686703 100644
--- libavcodec/ac3enc_fixed.c
+++ libavcodec/ac3enc_fixed.c
@@ -264,3 +264,20 @@ static int normalize_samples(AC3EncodeContext *s)
     lshift_tab(s->windowed_samples, AC3_WINDOW_SIZE, v);
     return v - 9;
 }
+
+static void apply_window(SampleType *output, const SampleType *input,
+                         const SampleType *window, int n)
+{
+    int i;
+    int n2 = n >> 1;
+
+    window += n2;
+    input  += n2;
+    output += n2;
+
+    for (i = 0; i < n2; i++) {
+        SampleType w    = window[-i-1];
+        output[-i-1] = MUL16(input[-i-1], w) >> 15;
+        output[ i  ] = MUL16(input[ i  ], w) >> 15;
+    }
+}
diff --git libavcodec/ac3enc_fixed.h libavcodec/ac3enc_fixed.h
index 1e5c2a4..ca8d872 100644
--- libavcodec/ac3enc_fixed.h
+++ libavcodec/ac3enc_fixed.h
@@ -31,10 +31,11 @@
 
 typedef int16_t SampleType;
 typedef int32_t CoefType;
+
 #define FIX15(a) (av_clip_int16(SCALE_FLOAT(a, 15)))
-#define MULFUNC MUL16
-#define FIX_SHIFT(a) ((a) >> 15)
+
 #define SCALE_COEF(a) (a)
+
 #define INPUT_SAMPLE_FMT SAMPLE_FMT_S16
 
 typedef struct IComplex {
diff --git libavcodec/ac3enc_float.c libavcodec/ac3enc_float.c
index e08310e..c9985c3 100644
--- libavcodec/ac3enc_float.c
+++ libavcodec/ac3enc_float.c
@@ -59,3 +59,20 @@ static int normalize_samples(AC3EncodeContext *s)
 {
     return 0;
 }
+
+static void apply_window(SampleType *output, const SampleType *input,
+                         const SampleType *window, int n)
+{
+    int i;
+    int n2 = n >> 1;
+
+    window += n2;
+    input  += n2;
+    output += n2;
+
+    for (i = 0; i < n2; i++) {
+        SampleType w    = window[-i-1];
+        output[-i-1] = input[-i-1] * w;
+        output[ i  ] = input[ i  ] * w;
+    }
+}
diff --git libavcodec/ac3enc_float.h libavcodec/ac3enc_float.h
index 98eba3a..d5d1949 100644
--- libavcodec/ac3enc_float.h
+++ libavcodec/ac3enc_float.h
@@ -33,9 +33,9 @@
 
 typedef float SampleType;
 typedef float CoefType;
-#define MULFUNC(a, b) ((a) * (b))
-#define FIX_SHIFT(a) (a)
+
 #define SCALE_COEF(a) SCALE_FLOAT((a), 24)
+
 #define INPUT_SAMPLE_FMT SAMPLE_FMT_FLT
 
 typedef struct AC3MDCTContext {
_______________________________________________
FFmpeg-soc mailing list
[email protected]
https://lists.mplayerhq.hu/mailman/listinfo/ffmpeg-soc

Reply via email to