From f7813a5324be39d13ab536c245d15dfc602a7849 Mon Sep 17 00:00:00 2001 From: Tim Redfern Date: Sun, 29 Dec 2013 12:19:38 +0000 Subject: basic type mechanism working --- ffmpeg/libavcodec/fft-internal.h | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'ffmpeg/libavcodec/fft-internal.h') diff --git a/ffmpeg/libavcodec/fft-internal.h b/ffmpeg/libavcodec/fft-internal.h index d66731f..065eecc 100644 --- a/ffmpeg/libavcodec/fft-internal.h +++ b/ffmpeg/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) -- cgit v1.2.3