[FFmpeg-devel] [PATCH] lswr: Improve default resampler's default parameters

Alexander Strasser eclipse7 at gmx.net
Wed Dec 26 00:06:04 CET 2012


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 <eclipse7 at gmx.net>
---
 libswresample/resample.c   | 2 +-
 libswresample/swresample.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/libswresample/resample.c b/libswresample/resample.c
index 60ba0e9..6cd2b8c 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<<phase_shift;
 
diff --git a/libswresample/swresample.c b/libswresample/swresample.c
index 5caab40..cc34323 100644
--- a/libswresample/swresample.c
+++ b/libswresample/swresample.c
@@ -80,7 +80,7 @@ static const AVOption options[]={
 {"triangular"           , "select triangular dither"    , 0                      , AV_OPT_TYPE_CONST, {.i64=SWR_DITHER_TRIANGULAR }, INT_MIN, INT_MAX   , PARAM, "dither_method"},
 {"triangular_hp"        , "select triangular dither with high pass" , 0                 , AV_OPT_TYPE_CONST, {.i64=SWR_DITHER_TRIANGULAR_HIGHPASS }, INT_MIN, INT_MAX, PARAM, "dither_method"},
 
-{"filter_size"          , "set resampling filter size"  , OFFSET(filter_size)    , AV_OPT_TYPE_INT  , {.i64=16                    }, 0      , INT_MAX   , PARAM },
+{"filter_size"          , "set resampling filter size"  , OFFSET(filter_size)    , AV_OPT_TYPE_INT  , {.i64=32                    }, 0      , INT_MAX   , PARAM },
 {"phase_shift"          , "set resampling phase shift"  , OFFSET(phase_shift)    , AV_OPT_TYPE_INT  , {.i64=10                    }, 0      , 30        , PARAM },
 {"linear_interp"        , "enable linear interpolation" , OFFSET(linear_interp)  , AV_OPT_TYPE_INT  , {.i64=0                     }, 0      , 1         , PARAM },
 {"cutoff"               , "set cutoff frequency ratio"  , OFFSET(cutoff)         , AV_OPT_TYPE_DOUBLE,{.dbl=0.                    }, 0      , 1         , PARAM },
-- 
1.7.10.2.552.gaa3bb87


More information about the ffmpeg-devel mailing list