aboutsummaryrefslogtreecommitdiffstats
path: root/libswresample/dither.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-04-10 21:10:14 +0200
committerMichael Niedermayer <michaelni@gmx.at>2012-04-10 21:18:33 +0200
commitb1ef4dc406e8a0bd9acea40d880aa4e74412075b (patch)
treef27a7122240b7b2b28f6c151f1edbb9c03259aca /libswresample/dither.c
parent0cff3e130bfe0471d58ca55655a9d2b73a2873f5 (diff)
downloadffmpeg-b1ef4dc406e8a0bd9acea40d880aa4e74412075b.tar.gz
swr: add triangular dither support
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libswresample/dither.c')
-rw-r--r--libswresample/dither.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/libswresample/dither.c b/libswresample/dither.c
index 4e39cceb0d..663e2007ba 100644
--- a/libswresample/dither.c
+++ b/libswresample/dither.c
@@ -40,6 +40,11 @@ void swri_get_dither(void *dst, int len, unsigned seed, enum AVSampleFormat out_
switch(method){
case SWR_DITHER_RECTANGULAR: v= ((double)seed) / UINT_MAX - 0.5; break;
+ case SWR_DITHER_TRIANGULAR :
+ v = ((double)seed) / UINT_MAX;
+ seed = seed*1664525 + 1013904223;
+ v-= ((double)seed) / UINT_MAX;
+ break;
default: av_assert0(0);
}