summaryrefslogtreecommitdiff
path: root/libavcodec/fft-internal.h
diff options
context:
space:
mode:
authorNedeljko Babic <nbabic@mips.com>2013-06-03 16:11:12 +0200
committerMichael Niedermayer <michaelni@gmx.at>2013-08-04 14:01:41 +0200
commit18d7074b4e5a1112cfa6a53dde0faa25d2bd0b15 (patch)
tree0d23cbed3eb59d91ba5c734a7222a6ae02c72cba /libavcodec/fft-internal.h
parent27cc3e72f8502d6239dcd0f1dd3fe73f1c85355d (diff)
downloadffmpeg-18d7074b4e5a1112cfa6a53dde0faa25d2bd0b15.tar.gz
libavcodec: Implementation of 32 bit fixed point FFT
Iterative implementation of 32 bit fixed point split-radix FFT. Max FFT that can be calculated currently is 2^12. Signed-off-by: Nedeljko Babic <nbabic@mips.com> Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/fft-internal.h')
-rw-r--r--libavcodec/fft-internal.h21
1 files changed, 20 insertions, 1 deletions
diff --git a/libavcodec/fft-internal.h b/libavcodec/fft-internal.h
index d66731fb48..065eeccef1 100644
--- a/libavcodec/fft-internal.h
+++ b/libavcodec/fft-internal.h
@@ -36,12 +36,29 @@
#else
+#define SCALE_FLOAT(a, bits) lrint((a) * (double)(1 << (bits)))
+
+#if CONFIG_FFT_FIXED_32
+
+#define CMUL(dre, dim, are, aim, bre, bim) do { \
+ int64_t accu; \
+ (accu) = (int64_t)(bre) * (are); \
+ (accu) -= (int64_t)(bim) * (aim); \
+ (dre) = (int)(((accu) + 0x40000000) >> 31); \
+ (accu) = (int64_t)(bre) * (aim); \
+ (accu) += (int64_t)(bim) * (are); \
+ (dim) = (int)(((accu) + 0x40000000) >> 31); \
+ } while (0)
+
+#define FIX15(a) av_clip(SCALE_FLOAT(a, 31), -2147483647, 2147483647)
+
+#else /* CONFIG_FFT_FIXED_32 */
+
#include "fft.h"
#include "mathops.h"
void ff_mdct_calcw_c(FFTContext *s, FFTDouble *output, const FFTSample *input);
-#define SCALE_FLOAT(a, bits) lrint((a) * (double)(1 << (bits)))
#define FIX15(a) av_clip(SCALE_FLOAT(a, 15), -32767, 32767)
#define sqrthalf ((int16_t)((1<<15)*M_SQRT1_2))
@@ -62,6 +79,8 @@ void ff_mdct_calcw_c(FFTContext *s, FFTDouble *output, const FFTSample *input);
#define CMULL(dre, dim, are, aim, bre, bim) \
CMULS(dre, dim, are, aim, bre, bim, 0)
+#endif /* CONFIG_FFT_FIXED_32 */
+
#endif /* CONFIG_FFT_FLOAT */
#define ff_imdct_calc_c FFT_NAME(ff_imdct_calc_c)