summaryrefslogtreecommitdiff
path: root/libswresample/dither.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2013-02-24 19:05:54 +0100
committerMichael Niedermayer <michaelni@gmx.at>2013-02-24 20:31:56 +0100
commit8b3affda87e45165bd7d968a8cad82fe700f60b7 (patch)
treecc4dc3a3a0045ed097d310b5099a470768335c1b /libswresample/dither.c
parentc4c702b6d3b42b5ae25d96982f283b4028a83574 (diff)
swr: support a seperate output sample bits.
This avoids user apps having to mangle dither scale. for pcm24 Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libswresample/dither.c')
-rw-r--r--libswresample/dither.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/libswresample/dither.c b/libswresample/dither.c
index d70505c27e..d0193dda46 100644
--- a/libswresample/dither.c
+++ b/libswresample/dither.c
@@ -94,6 +94,9 @@ int swri_dither_init(SwrContext *s, enum AVSampleFormat out_fmt, enum AVSampleFo
scale *= s->dither.scale;
+ if (out_fmt == AV_SAMPLE_FMT_S32 && s->dither.output_sample_bits)
+ scale *= 1<<(32-s->dither.output_sample_bits);
+
s->dither.ns_pos = 0;
s->dither.noise_scale= scale;
s->dither.ns_scale = scale;