• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * This file is part of FFmpeg.
3  *
4  * FFmpeg is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * FFmpeg is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with FFmpeg; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17  */
18 
19 #ifndef AVCODEC_FFT_INTERNAL_H
20 #define AVCODEC_FFT_INTERNAL_H
21 
22 #if FFT_FLOAT
23 
24 #define FIX15(v) (v)
25 #define sqrthalf (float)M_SQRT1_2
26 
27 #define BF(x, y, a, b) do {                     \
28         x = a - b;                              \
29         y = a + b;                              \
30     } while (0)
31 
32 #define CMUL(dre, dim, are, aim, bre, bim) do { \
33         (dre) = (are) * (bre) - (aim) * (bim);  \
34         (dim) = (are) * (bim) + (aim) * (bre);  \
35     } while (0)
36 
37 #else /* FFT_FLOAT */
38 
39 #define SCALE_FLOAT(a, bits) lrint((a) * (double)(1 << (bits)))
40 
41 #if FFT_FIXED_32
42 
43 #define CMUL(dre, dim, are, aim, bre, bim) do {             \
44         int64_t accu;                                     \
45         (accu)  = (int64_t)(bre) * (are);                 \
46         (accu) -= (int64_t)(bim) * (aim);                 \
47         (dre)   = (int)(((accu) + 0x40000000) >> 31);       \
48         (accu)  = (int64_t)(bre) * (aim);                 \
49         (accu) += (int64_t)(bim) * (are);                 \
50         (dim)   = (int)(((accu) + 0x40000000) >> 31);       \
51     } while (0)
52 
53 #define FIX15(a) av_clip(SCALE_FLOAT(a, 31), -2147483647, 2147483647)
54 
55 #endif /* FFT_FIXED_32 */
56 
57 #endif /* FFT_FLOAT */
58 
59 #define ff_imdct_calc_c FFT_NAME(ff_imdct_calc_c)
60 #define ff_imdct_half_c FFT_NAME(ff_imdct_half_c)
61 #define ff_mdct_calc_c  FFT_NAME(ff_mdct_calc_c)
62 
63 void ff_imdct_calc_c(FFTContext *s, FFTSample *output, const FFTSample *input);
64 void ff_imdct_half_c(FFTContext *s, FFTSample *output, const FFTSample *input);
65 void ff_mdct_calc_c(FFTContext *s, FFTSample *output, const FFTSample *input);
66 
67 #endif /* AVCODEC_FFT_INTERNAL_H */
68