diff options
author | Nedeljko Babic <nbabic@mips.com> | 2014-04-01 16:31:08 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2014-04-01 19:01:57 +0200 |
commit | 696e34a6e15d9d9d655191a953779d06dc3b5897 (patch) | |
tree | 4401c485e31b7cc878179d44481635213eecd7a6 /libavcodec/ac3.h | |
parent | d506deaeaa98013505241d8149d82327efea0379 (diff) | |
download | ffmpeg-696e34a6e15d9d9d655191a953779d06dc3b5897.tar.gz |
libavcodec: Implementation of AC3 fixedpoint decoder
Signed-off-by: Nedeljko Babic <nbabic@mips.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/ac3.h')
-rw-r--r-- | libavcodec/ac3.h | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/libavcodec/ac3.h b/libavcodec/ac3.h index 0cc9e2c98a..ac3936d7f3 100644 --- a/libavcodec/ac3.h +++ b/libavcodec/ac3.h @@ -51,6 +51,52 @@ #define EXP_D25 2 #define EXP_D45 3 +#ifndef CONFIG_AC3_FIXED +#define CONFIG_AC3_FIXED 0 +#endif + +#if CONFIG_AC3_FIXED + +#define FFT_FLOAT 0 + +#define FIXR(a) ((int)((a) * 0 + 0.5)) +#define FIXR12(a) ((int)((a) * 4096 + 0.5)) +#define FIXR15(a) ((int)((a) * 32768 + 0.5)) +#define ROUND15(x) ((x) + 16384) >> 15 + +#define AC3_RENAME(x) x ## _fixed +#define AC3_NORM(norm) (1<<24)/(norm) +#define AC3_MUL(a,b) ((((int64_t) (a)) * (b))>>12) +#define AC3_RANGE(x) (x) +#define AC3_DYNAMIC_RANGE(x) (x) +#define AC3_SPX_BLEND(x) (x) +#define AC3_DYNAMIC_RANGE1 0 + +#define INTFLOAT int +#define SHORTFLOAT int16_t + +#else /* CONFIG_AC3_FIXED */ + +#define FIXR(x) ((float)(x)) +#define FIXR12(x) ((float)(x)) +#define FIXR15(x) ((float)(x)) +#define ROUND15(x) (x) + +#define AC3_RENAME(x) x +#define AC3_NORM(norm) (1.0f/(norm)) +#define AC3_MUL(a,b) ((a) * (b)) +#define AC3_RANGE(x) (dynamic_range_tab[(x)]) +#define AC3_DYNAMIC_RANGE(x) (powf(x, s->drc_scale)) +#define AC3_SPX_BLEND(x) (x)* (1.0f/32) +#define AC3_DYNAMIC_RANGE1 1.0f + +#define INTFLOAT float +#define SHORTFLOAT float + +#endif /* CONFIG_AC3_FIXED */ + +#define AC3_LEVEL(x) ROUND15((x) * FIXR15(0.7071067811865476)) + /* pre-defined gain values */ #define LEVEL_PLUS_3DB 1.4142135623730950 #define LEVEL_PLUS_1POINT5DB 1.1892071150027209 |