summaryrefslogtreecommitdiff
path: root/libavcodec/ac3dec.c
diff options
context:
space:
mode:
authorJustin Ruggles <justin.ruggles@gmail.com>2008-06-07 22:30:09 +0000
committerJustin Ruggles <justin.ruggles@gmail.com>2008-06-07 22:30:09 +0000
commit30f71adc46685f2a95d6a71d327a3dab5a6a5940 (patch)
treee10ec3f35be77b9f6f8cb3c0cf0df3850dbbac5c /libavcodec/ac3dec.c
parentcaf0fbc8894e06694d6d79193ffcf022abd25119 (diff)
move mix level tables from parser to decoder. have parser read bitstream value instead of using an index to a table in the decoder.
Originally committed as revision 13696 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/ac3dec.c')
-rw-r--r--libavcodec/ac3dec.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/libavcodec/ac3dec.c b/libavcodec/ac3dec.c
index 74f34f8e14..ad1bb938f8 100644
--- a/libavcodec/ac3dec.c
+++ b/libavcodec/ac3dec.c
@@ -95,6 +95,18 @@ static const float gain_levels[9] = {
};
/**
+ * Table for center mix levels
+ * reference: Section 5.4.2.4 cmixlev
+ */
+static const uint8_t center_levels[4] = { 4, 5, 6, 5 };
+
+/**
+ * Table for surround mix levels
+ * reference: Section 5.4.2.5 surmixlev
+ */
+static const uint8_t surround_levels[4] = { 4, 6, 7, 6 };
+
+/**
* Table for default stereo downmixing coefficients
* reference: Section 7.8.2 Downmixing Into Two Channels
*/
@@ -383,8 +395,8 @@ static int ac3_parse_header(AC3DecodeContext *s)
static void set_downmix_coeffs(AC3DecodeContext *s)
{
int i;
- float cmix = gain_levels[s->center_mix_level];
- float smix = gain_levels[s->surround_mix_level];
+ float cmix = gain_levels[center_levels[s->center_mix_level]];
+ float smix = gain_levels[surround_levels[s->surround_mix_level]];
for(i=0; i<s->fbw_channels; i++) {
s->downmix_coeffs[i][0] = gain_levels[ac3_default_coeffs[s->channel_mode][i][0]];