From ac25b31ede03ef4f89175cb3c293ff6b5609e6c2 Mon Sep 17 00:00:00 2001 From: Alexander Strasser Date: Tue, 25 Dec 2012 23:14:09 +0100 Subject: [PATCH] lswr: Improve default resampler's default parameters After making some blind tests on a small collection of music samples for home usage. It turned out that the default cutoff was too low. The impact of filter_size was not clearly distinguishable (the results were on the edge) with the music samples but turned out to be clearly audible in some synthetic samples. Thanks to Daniel for helping out with the listening tests. Signed-off-by: Alexander Strasser --- doc/ffmpeg-resampler.texi | 4 ++-- libswresample/resample.c | 2 +- libswresample/swresample.c | 2 +- tests/ref/acodec/roqaudio | 6 +++--- tests/ref/lavf/dv_fmt | 8 ++++---- tests/ref/lavf/gxf | 8 ++++---- tests/ref/lavf/mxf | 12 ++++++------ 7 files changed, 21 insertions(+), 21 deletions(-) diff --git a/doc/ffmpeg-resampler.texi b/doc/ffmpeg-resampler.texi index 45e42f9255..92588131b3 100644 --- a/doc/ffmpeg-resampler.texi +++ b/doc/ffmpeg-resampler.texi @@ -121,7 +121,7 @@ case. @end table @item filter_size -For swr only, set resampling filter size, default value is 16. +For swr only, set resampling filter size, default value is 32. @item phase_shift For swr only, set resampling phase shift, default value is 10, must be included @@ -132,7 +132,7 @@ Use Linear Interpolation if set to 1, default value is 0. @item cutoff Set cutoff frequency (swr: 6dB point; soxr: 0dB point) ratio; must be a float -value between 0 and 1. Default value is 0.8 with swr, and 0.91 with soxr +value between 0 and 1. Default value is 0.97 with swr, and 0.91 with soxr (which, with a sample-rate of 44100, preserves the entire audio band to 20kHz). @item precision diff --git a/libswresample/resample.c b/libswresample/resample.c index 60ba0e9bd0..6cd2b8cbcb 100644 --- a/libswresample/resample.c +++ b/libswresample/resample.c @@ -198,7 +198,7 @@ static int build_filter(ResampleContext *c, void *filter, double factor, int tap static ResampleContext *resample_init(ResampleContext *c, int out_rate, int in_rate, int filter_size, int phase_shift, int linear, double cutoff0, enum AVSampleFormat format, enum SwrFilterType filter_type, int kaiser_beta, double precision, int cheby){ - double cutoff = cutoff0? cutoff0 : 0.8; + double cutoff = cutoff0? cutoff0 : 0.97; double factor= FFMIN(out_rate * cutoff / in_rate, 1.0); int phase_count= 1<