Mercurial > libavcodec.hg
comparison ac3dec.c @ 5325:0d963101e0d7 libavcodec
AC-3 decoder, soc revision 402, Jul 14 13:45:14 2007 UTC by jbr
merge ac3_decoder.h into ac3_decoder.c
author | jbr |
---|---|
date | Sat, 14 Jul 2007 16:06:14 +0000 |
parents | 33e13333dc4d |
children | 923aacd40ee8 |
comparison
equal
deleted
inserted
replaced
5324:33e13333dc4d | 5325:0d963101e0d7 |
---|---|
38 | 38 |
39 #define ALT_BITSTREAM_READER | 39 #define ALT_BITSTREAM_READER |
40 | 40 |
41 #include "avcodec.h" | 41 #include "avcodec.h" |
42 #include "ac3tab.h" | 42 #include "ac3tab.h" |
43 #include "ac3_decoder.h" | |
44 #include "bitstream.h" | 43 #include "bitstream.h" |
45 #include "dsputil.h" | 44 #include "dsputil.h" |
45 | |
46 static const int nfchans_tbl[8] = { 2, 1, 2, 3, 3, 4, 4, 5 }; | |
47 | |
48 /* table for exponent to scale_factor mapping | |
49 * scale_factor[i] = 2 ^ -(i + 15) | |
50 */ | |
51 static float scale_factors[25]; | |
52 | |
53 static int16_t psdtab[25]; | |
54 | |
55 static int8_t exp_1[128]; | |
56 static int8_t exp_2[128]; | |
57 static int8_t exp_3[128]; | |
58 | |
59 static int16_t l3_quantizers_1[32]; | |
60 static int16_t l3_quantizers_2[32]; | |
61 static int16_t l3_quantizers_3[32]; | |
62 | |
63 static int16_t l5_quantizers_1[128]; | |
64 static int16_t l5_quantizers_2[128]; | |
65 static int16_t l5_quantizers_3[128]; | |
66 | |
67 static int16_t l7_quantizers[7]; | |
68 | |
69 static int16_t l11_quantizers_1[128]; | |
70 static int16_t l11_quantizers_2[128]; | |
71 | |
72 static int16_t l15_quantizers[15]; | |
73 | |
74 static const uint8_t qntztab[16] = { 0, 5, 7, 3, 7, 4, 5, 6, 7, 8, 9, 10, 11, 12, 14, 16 }; | |
75 | |
76 /* Adjustmens in dB gain */ | |
77 #define LEVEL_MINUS_3DB 0.7071067811865476 | |
78 #define LEVEL_MINUS_4POINT5DB 0.5946035575013605 | |
79 #define LEVEL_MINUS_6DB 0.5000000000000000 | |
80 #define LEVEL_PLUS_3DB 1.4142135623730951 | |
81 #define LEVEL_PLUS_6DB 2.0000000000000000 | |
82 #define LEVEL_ZERO 0.0000000000000000 | |
83 | |
84 static const float clevs[4] = { LEVEL_MINUS_3DB, LEVEL_MINUS_4POINT5DB, | |
85 LEVEL_MINUS_6DB, LEVEL_MINUS_4POINT5DB }; | |
86 | |
87 static const float slevs[4] = { LEVEL_MINUS_3DB, LEVEL_MINUS_6DB, LEVEL_ZERO, LEVEL_MINUS_6DB }; | |
46 | 88 |
47 #define N 512 /* constant for IMDCT Block size */ | 89 #define N 512 /* constant for IMDCT Block size */ |
48 | 90 |
49 #define MAX_CHANNELS 6 | 91 #define MAX_CHANNELS 6 |
50 #define BLOCK_SIZE 256 | 92 #define BLOCK_SIZE 256 |