]> git.sesse.net Git - ffmpeg/blob - libavcodec/aac_defines.h
Merge commit 'd6006dd9f0d4d01023359230212f1f9fa4800e5b'
[ffmpeg] / libavcodec / aac_defines.h
1 /*
2  * AAC defines
3  *
4  * This file is part of FFmpeg.
5  *
6  * FFmpeg is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * FFmpeg is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with FFmpeg; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19  */
20
21 #ifndef AVCODEC_AAC_DEFINES_H
22 #define AVCODEC_AAC_DEFINES_H
23
24 #ifndef USE_FIXED
25 #define USE_FIXED 0
26 #endif
27
28 #if USE_FIXED
29
30 #include "libavutil/softfloat.h"
31
32 #define FFT_FLOAT    0
33 #define FFT_FIXED_32 1
34
35 #define AAC_RENAME(x)       x ## _fixed
36 #define AAC_RENAME_32(x)    x ## _fixed_32
37 #define INTFLOAT int
38 #define SHORTFLOAT int16_t
39 #define AAC_FLOAT SoftFloat
40 #define AAC_SIGNE           int
41 #define FIXR(a)             ((int)((a) * 1 + 0.5))
42 #define FIXR10(a)           ((int)((a) * 1024.0 + 0.5))
43 #define Q23(a)              (int)((a) * 8388608.0 + 0.5)
44 #define Q30(x)              (int)((x)*1073741824.0 + 0.5)
45 #define Q31(x)              (int)((x)*2147483648.0 + 0.5)
46 #define RANGE15(x)          x
47 #define GET_GAIN(x, y)      (-(y) << (x)) + 1024
48 #define AAC_MUL26(x, y)     (int)(((int64_t)(x) * (y) + 0x2000000) >> 26)
49 #define AAC_MUL30(x, y)     (int)(((int64_t)(x) * (y) + 0x20000000) >> 30)
50 #define AAC_MUL31(x, y)     (int)(((int64_t)(x) * (y) + 0x40000000) >> 31)
51 #define AAC_SRA_R(x, y)     (int)(((x) + (1 << ((y) - 1))) >> (y))
52
53 #else
54
55 #define FFT_FLOAT    1
56 #define FFT_FIXED_32 0
57
58 #define AAC_RENAME(x)       x
59 #define AAC_RENAME_32(x)    x
60 #define INTFLOAT float
61 #define SHORTFLOAT float
62 #define AAC_FLOAT float
63 #define AAC_SIGNE           unsigned
64 #define FIXR(x)             ((float)(x))
65 #define FIXR10(x)           ((float)(x))
66 #define Q23(x)              x
67 #define Q30(x)              x
68 #define Q31(x)              x
69 #define RANGE15(x)          (32768.0 * (x))
70 #define GET_GAIN(x, y)      powf((x), -(y))
71 #define AAC_MUL26(x, y)     ((x) * (y))
72 #define AAC_MUL30(x, y)     ((x) * (y))
73 #define AAC_MUL31(x, y)     ((x) * (y))
74 #define AAC_SRA_R(x, y)     (x)
75
76 #endif /* USE_FIXED */
77
78 #endif /* AVCODEC_AAC_DEFINES_H */