summaryrefslogtreecommitdiff
path: root/libavcodec/ac3dec.c
diff options
context:
space:
mode:
authorMathias Rauen <madshi@gmail.com>2013-01-05 11:30:31 -0500
committerJustin Ruggles <justin.ruggles@gmail.com>2013-01-20 14:20:47 -0500
commit04ea5491a83e7d123faae5f9aff054838d95bbcb (patch)
tree9a502425518f36e62ef37f2fabee838bdbf205ec /libavcodec/ac3dec.c
parentd9bf716945046333c24580d538f450b516f15710 (diff)
ac3dec: fix non-optimal dithering of zero bit mantissas
Use a noise range of -0.707 to 0.707 instead of -0.5 to 0.5 Signed-off-by: Justin Ruggles <justin.ruggles@gmail.com>
Diffstat (limited to 'libavcodec/ac3dec.c')
-rw-r--r--libavcodec/ac3dec.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/libavcodec/ac3dec.c b/libavcodec/ac3dec.c
index 3c5147229f..82ae61857d 100644
--- a/libavcodec/ac3dec.c
+++ b/libavcodec/ac3dec.c
@@ -442,8 +442,9 @@ static void ac3_decode_transform_coeffs_ch(AC3DecodeContext *s, int ch_index, ma
int mantissa;
switch (bap) {
case 0:
+ /* random noise with approximate range of -0.707 to 0.707 */
if (dither)
- mantissa = (av_lfg_get(&s->dith_state) & 0x7FFFFF) - 0x400000;
+ mantissa = (av_lfg_get(&s->dith_state) / 362) - 5932275;
else
mantissa = 0;
break;