summaryrefslogtreecommitdiff
path: root/libswresample
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-01-10 01:28:24 +0100
committerMichael Niedermayer <michaelni@gmx.at>2013-01-10 01:44:15 +0100
commit2672b2c1d2d48af94c59c198287fae1c7a785710 (patch)
tree5865dc42359eb45f367d9b967ae9597ec8b23790 /libswresample
parent0b60fc94aab63b80b3a898c744da50758215bc9c (diff)
downloadffmpeg-2672b2c1d2d48af94c59c198287fae1c7a785710.tar.gz
swr: scale data down in noise shaping to avoid cliping
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libswresample')
-rw-r--r--libswresample/dither.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/libswresample/dither.c b/libswresample/dither.c
index 66bf184310..d7a5b6b558 100644
--- a/libswresample/dither.c
+++ b/libswresample/dither.c
@@ -106,6 +106,7 @@ int swri_dither_init(SwrContext *s, enum AVSampleFormat out_fmt, enum AVSampleFo
s->dither.ns_taps = f->len;
for (j=0; j<f->len; j++)
s->dither.ns_coeffs[j] = f->coefs[j];
+ s->dither.ns_scale_1 *= 1 - exp(f->gain_cB * M_LN10 * 0.005) * 2 / (1<<(8*av_get_bytes_per_sample(out_fmt)));
break;
}
}