aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTim Walker <tdskywalker@gmail.com>2014-01-17 16:06:34 +0100
committerTim Walker <tdskywalker@gmail.com>2014-01-19 19:12:52 +0100
commitade75fb811500f3e3f284737f123938d83be728f (patch)
treef02cd679ccadb318d23846ec97200179b7303807
parentc229f571fd3c7d7b567c27c87b2bbcdaee1b0e9f (diff)
downloadffmpeg-ade75fb811500f3e3f284737f123938d83be728f.tar.gz
(e)ac3: clip surround mix level indexes.
Values 0-2 are reserved, 3 (-1.5dB) should be used instead.
-rw-r--r--libavcodec/ac3dec.c4
-rw-r--r--libavcodec/eac3dec.c4
2 files changed, 4 insertions, 4 deletions
diff --git a/libavcodec/ac3dec.c b/libavcodec/ac3dec.c
index b6ee401485..2cceadc878 100644
--- a/libavcodec/ac3dec.c
+++ b/libavcodec/ac3dec.c
@@ -237,9 +237,9 @@ static int ac3_parse_header(AC3DecodeContext *s)
if (get_bits1(gbc)) {
s->preferred_downmix = get_bits(gbc, 2);
s->center_mix_level_ltrt = get_bits(gbc, 3);
- s->surround_mix_level_ltrt = get_bits(gbc, 3);
+ s->surround_mix_level_ltrt = av_clip(get_bits(gbc, 3), 3, 7);
s->center_mix_level = get_bits(gbc, 3);
- s->surround_mix_level = get_bits(gbc, 3);
+ s->surround_mix_level = av_clip(get_bits(gbc, 3), 3, 7);
}
if (get_bits1(gbc)) {
s->dolby_surround_ex_mode = get_bits(gbc, 2);
diff --git a/libavcodec/eac3dec.c b/libavcodec/eac3dec.c
index dfd78c6ad7..95ee33f823 100644
--- a/libavcodec/eac3dec.c
+++ b/libavcodec/eac3dec.c
@@ -353,8 +353,8 @@ int ff_eac3_parse_header(AC3DecodeContext *s)
}
if (s->channel_mode & 4) {
/* if a surround channel exists */
- s->surround_mix_level_ltrt = get_bits(gbc, 3);
- s->surround_mix_level = get_bits(gbc, 3);
+ s->surround_mix_level_ltrt = av_clip(get_bits(gbc, 3), 3, 7);
+ s->surround_mix_level = av_clip(get_bits(gbc, 3), 3, 7);
}
}