summaryrefslogtreecommitdiff
path: root/libavcodec
diff options
context:
space:
mode:
authorJustin Ruggles <justin.ruggles@gmail.com>2007-07-14 16:06:14 +0000
committerJustin Ruggles <justin.ruggles@gmail.com>2007-07-14 16:06:14 +0000
commit967d397a6c6e9d5c080e199684127cc5d7216992 (patch)
tree50e8e940596202e8aa589de3d89b350e3f6cec1f /libavcodec
parentafb46fc092d68e1b6ac5ba438d075f405e453b22 (diff)
AC-3 decoder, soc revision 402, Jul 14 13:45:14 2007 UTC by jbr
merge ac3_decoder.h into ac3_decoder.c Originally committed as revision 9673 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/ac3dec.c44
1 files changed, 43 insertions, 1 deletions
diff --git a/libavcodec/ac3dec.c b/libavcodec/ac3dec.c
index 1b3d6059ef..c8a8a92c3f 100644
--- a/libavcodec/ac3dec.c
+++ b/libavcodec/ac3dec.c
@@ -40,10 +40,52 @@
#include "avcodec.h"
#include "ac3tab.h"
-#include "ac3_decoder.h"
#include "bitstream.h"
#include "dsputil.h"
+static const int nfchans_tbl[8] = { 2, 1, 2, 3, 3, 4, 4, 5 };
+
+/* table for exponent to scale_factor mapping
+ * scale_factor[i] = 2 ^ -(i + 15)
+ */
+static float scale_factors[25];
+
+static int16_t psdtab[25];
+
+static int8_t exp_1[128];
+static int8_t exp_2[128];
+static int8_t exp_3[128];
+
+static int16_t l3_quantizers_1[32];
+static int16_t l3_quantizers_2[32];
+static int16_t l3_quantizers_3[32];
+
+static int16_t l5_quantizers_1[128];
+static int16_t l5_quantizers_2[128];
+static int16_t l5_quantizers_3[128];
+
+static int16_t l7_quantizers[7];
+
+static int16_t l11_quantizers_1[128];
+static int16_t l11_quantizers_2[128];
+
+static int16_t l15_quantizers[15];
+
+static const uint8_t qntztab[16] = { 0, 5, 7, 3, 7, 4, 5, 6, 7, 8, 9, 10, 11, 12, 14, 16 };
+
+/* Adjustmens in dB gain */
+#define LEVEL_MINUS_3DB 0.7071067811865476
+#define LEVEL_MINUS_4POINT5DB 0.5946035575013605
+#define LEVEL_MINUS_6DB 0.5000000000000000
+#define LEVEL_PLUS_3DB 1.4142135623730951
+#define LEVEL_PLUS_6DB 2.0000000000000000
+#define LEVEL_ZERO 0.0000000000000000
+
+static const float clevs[4] = { LEVEL_MINUS_3DB, LEVEL_MINUS_4POINT5DB,
+ LEVEL_MINUS_6DB, LEVEL_MINUS_4POINT5DB };
+
+static const float slevs[4] = { LEVEL_MINUS_3DB, LEVEL_MINUS_6DB, LEVEL_ZERO, LEVEL_MINUS_6DB };
+
#define N 512 /* constant for IMDCT Block size */
#define MAX_CHANNELS 6