From 696e34a6e15d9d9d655191a953779d06dc3b5897 Mon Sep 17 00:00:00 2001 From: Nedeljko Babic Date: Tue, 1 Apr 2014 16:31:08 +0200 Subject: libavcodec: Implementation of AC3 fixedpoint decoder Signed-off-by: Nedeljko Babic Signed-off-by: Michael Niedermayer --- libavcodec/ac3.h | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) (limited to 'libavcodec/ac3.h') 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 -- cgit v1.2.1