No longer needed now that the floating-point path uses the lavc MDCT.
---
libavcodec/ac3enc_fixed.c | 33 ++++++++++++++++-----------------
libavcodec/ac3enc_fixed.h | 3 +--
libavcodec/ac3enc_float.h | 2 --
3 files changed, 17 insertions(+), 21 deletions(-)
diff --git libavcodec/ac3enc_fixed.c libavcodec/ac3enc_fixed.c
index 6d0cd1b..a928a11 100644
--- libavcodec/ac3enc_fixed.c
+++ libavcodec/ac3enc_fixed.c
@@ -52,8 +52,8 @@ static av_cold int fft_init(AC3MDCTContext *mdct, int ln)
for (i = 0; i < n2; i++) {
alpha = 2 * M_PI * (float)i / (float)n;
- mdct->costab[i] = FIX(cos(alpha));
- mdct->sintab[i] = FIX(sin(alpha));
+ mdct->costab[i] = FIX15(cos(alpha));
+ mdct->sintab[i] = FIX15(sin(alpha));
}
return 0;
@@ -91,8 +91,8 @@ static av_cold int mdct_init(AC3MDCTContext *mdct, int nbits)
for (i = 0; i < n4; i++) {
float alpha = 2.0 * M_PI * (i + 1.0 / 8.0) / n;
- mdct->xcos1[i] = FIX(-cos(alpha));
- mdct->xsin1[i] = FIX(-sin(alpha));
+ mdct->xcos1[i] = FIX15(-cos(alpha));
+ mdct->xsin1[i] = FIX15(-sin(alpha));
}
return 0;
@@ -105,21 +105,21 @@ mdct_alloc_fail:
/* butter fly op */
#define BF(pre, pim, qre, qim, pre1, pim1, qre1, qim1) \
{\
- CoefType ax, ay, bx, by;\
+ int ax, ay, bx, by;\
bx = pre1;\
by = pim1;\
ax = qre1;\
ay = qim1;\
- pre = RSHIFT1(bx + ax);\
- pim = RSHIFT1(by + ay);\
- qre = RSHIFT1(bx - ax);\
- qim = RSHIFT1(by - ay);\
+ pre = (bx + ax) >> 1;\
+ pim = (by + ay) >> 1;\
+ qre = (bx - ax) >> 1;\
+ qim = (by - ay) >> 1;\
}
#define CMUL(pre, pim, are, aim, bre, bim) \
{\
- pre = FIX_SHIFT(MULFUNC(are, bre) - MULFUNC(aim, bim));\
- pim = FIX_SHIFT(MULFUNC(are, bim) + MULFUNC(bre, aim));\
+ pre = (MUL16(are, bre) - MUL16(aim, bim)) >> 15;\
+ pim = (MUL16(are, bim) + MUL16(bre, aim)) >> 15;\
}
@@ -129,7 +129,7 @@ static void calc_fft(AC3MDCTContext *mdct, IComplex *z, int ln)
int j, l, np, np2;
int nblocks, nloops;
register IComplex *p,*q;
- CoefType tmp_re, tmp_im;
+ int tmp_re, tmp_im;
np = 1 << ln;
@@ -194,10 +194,9 @@ static void calc_fft(AC3MDCTContext *mdct, IComplex *z, int ln)
/* do a 512 point mdct */
static void calc_mdct(AC3MDCTContext *mdct, CoefType *out, SampleType *in)
{
- int i;
- CoefType re, im;
+ int i, re, im;
int n, n2, n4;
- SampleType *rot = mdct->rot_tmp;
+ int16_t *rot = mdct->rot_tmp;
IComplex *x = mdct->cplx_tmp;
n = 1 << mdct->nbits;
@@ -211,8 +210,8 @@ static void calc_mdct(AC3MDCTContext *mdct, CoefType *out, SampleType *in)
/* pre rotation */
for (i = 0; i < n4; i++) {
- re = RSHIFT1( ((CoefType)rot[ 2*i] - (CoefType)rot[ n-1-2*i]));
- im = RSHIFT1(-((CoefType)rot[n2+2*i] - (CoefType)rot[n2-1-2*i]));
+ re = ((int)rot[ 2*i] - (int)rot[ n-1-2*i]) >> 1;
+ im = -((int)rot[n2+2*i] - (int)rot[n2-1-2*i]) >> 1;
CMUL(x[i].re, x[i].im, re, im, -mdct->xcos1[i], mdct->xsin1[i]);
}
diff --git libavcodec/ac3enc_fixed.h libavcodec/ac3enc_fixed.h
index 0d1fc26..1e5c2a4 100644
--- libavcodec/ac3enc_fixed.h
+++ libavcodec/ac3enc_fixed.h
@@ -31,10 +31,9 @@
typedef int16_t SampleType;
typedef int32_t CoefType;
-#define FIX(a) (av_clip_int16(SCALE_FLOAT(a, 15)))
+#define FIX15(a) (av_clip_int16(SCALE_FLOAT(a, 15)))
#define MULFUNC MUL16
#define FIX_SHIFT(a) ((a) >> 15)
-#define RSHIFT1(a) ((a) >> 1)
#define SCALE_COEF(a) (a)
#define INPUT_SAMPLE_FMT SAMPLE_FMT_S16
diff --git libavcodec/ac3enc_float.h libavcodec/ac3enc_float.h
index c42044f..98eba3a 100644
--- libavcodec/ac3enc_float.h
+++ libavcodec/ac3enc_float.h
@@ -33,10 +33,8 @@
typedef float SampleType;
typedef float CoefType;
-#define FIX(a) (a)
#define MULFUNC(a, b) ((a) * (b))
#define FIX_SHIFT(a) (a)
-#define RSHIFT1(a) ((a) * 0.5f)
#define SCALE_COEF(a) SCALE_FLOAT((a), 24)
#define INPUT_SAMPLE_FMT SAMPLE_FMT_FLT
_______________________________________________
FFmpeg-soc mailing list
[email protected]
https://lists.mplayerhq.hu/mailman/listinfo/ffmpeg-soc