aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/ac3dec.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-02-02 22:27:27 -0500
committerAlex Converse <alex.converse@gmail.com>2012-02-09 16:36:02 -0800
commite6d9fa66f12cf5a3024c9bc7c4c608f7fc59207e (patch)
treef31cc3a09c130d6ef237450eadc8b88629125bb2 /libavcodec/ac3dec.c
parent7b05025856706ccc5da2e43f4f05c319907b3b16 (diff)
downloadffmpeg-e6d9fa66f12cf5a3024c9bc7c4c608f7fc59207e.tar.gz
ac3dec: Move center and surround mix level tables to the parser.
That way all mix levels as exported by avpriv_ac3_parse_header() will have the same meaning. Previously the 3-bit center mix level for E-AC-3 was used to index in a 4-entry table, leading to out-of-array reads. Signed-off-by: Michael Niedermayer <michaelni@gmx.at> Signed-off-by: Justin Ruggles <justin.ruggles@gmail.com> Signed-off-by: Alex Converse <alex.converse@gmail.com>
Diffstat (limited to 'libavcodec/ac3dec.c')
-rw-r--r--libavcodec/ac3dec.c16
1 files changed, 2 insertions, 14 deletions
diff --git a/libavcodec/ac3dec.c b/libavcodec/ac3dec.c
index b50ec2abe6..66a9ea6299 100644
--- a/libavcodec/ac3dec.c
+++ b/libavcodec/ac3dec.c
@@ -77,18 +77,6 @@ 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
*/
@@ -315,8 +303,8 @@ static int parse_frame_header(AC3DecodeContext *s)
static void set_downmix_coeffs(AC3DecodeContext *s)
{
int i;
- float cmix = gain_levels[center_levels[s->center_mix_level]];
- float smix = gain_levels[surround_levels[s->surround_mix_level]];
+ float cmix = gain_levels[s-> center_mix_level];
+ float smix = gain_levels[s->surround_mix_level];
float norm0, norm1;
for (i = 0; i < s->fbw_channels; i++) {