aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Strasser <eclipse7@gmx.net>2012-12-25 23:14:09 +0100
committerAlexander Strasser <eclipse7@gmx.net>2013-01-04 16:47:57 +0100
commitac25b31ede03ef4f89175cb3c293ff6b5609e6c2 (patch)
treef6e60c471b2dcee274deecf1b6384bed9d87428e
parenta08194b4c51ebc7024f50eed0f09aa74058e15bb (diff)
downloadffmpeg-ac25b31ede03ef4f89175cb3c293ff6b5609e6c2.tar.gz
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 <eclipse7@gmx.net>
-rw-r--r--doc/ffmpeg-resampler.texi4
-rw-r--r--libswresample/resample.c2
-rw-r--r--libswresample/swresample.c2
-rw-r--r--tests/ref/acodec/roqaudio6
-rw-r--r--tests/ref/lavf/dv_fmt8
-rw-r--r--tests/ref/lavf/gxf8
-rw-r--r--tests/ref/lavf/mxf12
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<<phase_shift;
diff --git a/libswresample/swresample.c b/libswresample/swresample.c
index 2477847388..f01927f293 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 swr resampling filter size", OFFSET(filter_size) , AV_OPT_TYPE_INT , {.i64=16 }, 0 , INT_MAX , PARAM },
+{"filter_size" , "set swr resampling filter size", OFFSET(filter_size) , AV_OPT_TYPE_INT , {.i64=32 }, 0 , INT_MAX , PARAM },
{"phase_shift" , "set swr 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 },
diff --git a/tests/ref/acodec/roqaudio b/tests/ref/acodec/roqaudio
index ec28668983..863250478b 100644
--- a/tests/ref/acodec/roqaudio
+++ b/tests/ref/acodec/roqaudio
@@ -1,4 +1,4 @@
-c8ff13cf7ebece23af76502f5785202e *tests/data/fate/acodec-roqaudio.roq
+75859976d7098588aeaebbc5551484a9 *tests/data/fate/acodec-roqaudio.roq
265992 tests/data/fate/acodec-roqaudio.roq
-709fd60aea880c73b375094ab5307c77 *tests/data/fate/acodec-roqaudio.out.wav
-stddev: 4610.71 PSNR: 23.05 MAXDIFF:43883 bytes: 1058400/ 1058400
+be6d954adaf984f2dc65a3ff50b55f26 *tests/data/fate/acodec-roqaudio.out.wav
+stddev: 4481.70 PSNR: 23.30 MAXDIFF:46250 bytes: 1058400/ 1058400
diff --git a/tests/ref/lavf/dv_fmt b/tests/ref/lavf/dv_fmt
index e8720afc54..92092a62bd 100644
--- a/tests/ref/lavf/dv_fmt
+++ b/tests/ref/lavf/dv_fmt
@@ -1,9 +1,9 @@
-6f9cfff48f536fa727696f2f9fb3ac08 *./tests/data/lavf/lavf.dv
+11be3e5caa2892236b3475c3f7807b76 *./tests/data/lavf/lavf.dv
3600000 ./tests/data/lavf/lavf.dv
-./tests/data/lavf/lavf.dv CRC=0x5ce4e5e4
-2e8989478f05f6d4eaf1921fdfac4799 *./tests/data/lavf/lavf.dv
+./tests/data/lavf/lavf.dv CRC=0x25bdd732
+7c789e3559b5102de9459211ae4acf06 *./tests/data/lavf/lavf.dv
3600000 ./tests/data/lavf/lavf.dv
-./tests/data/lavf/lavf.dv CRC=0x747caf33
+./tests/data/lavf/lavf.dv CRC=0x3f43a4f5
87d3b20f656235671383a7eaa2f66330 *./tests/data/lavf/lavf.dv
3600000 ./tests/data/lavf/lavf.dv
./tests/data/lavf/lavf.dv CRC=0x0e868a82
diff --git a/tests/ref/lavf/gxf b/tests/ref/lavf/gxf
index b2428759f9..6238a3187c 100644
--- a/tests/ref/lavf/gxf
+++ b/tests/ref/lavf/gxf
@@ -1,9 +1,9 @@
-72e150dc3430a6a78656790658eb9a09 *./tests/data/lavf/lavf.gxf
+c8b3a8e3ba0185ce39122ac150c12bc3 *./tests/data/lavf/lavf.gxf
795876 ./tests/data/lavf/lavf.gxf
-./tests/data/lavf/lavf.gxf CRC=0xaee412d1
-cb6b1f522a9a8df145f55905c63a65b6 *./tests/data/lavf/lavf.gxf
+./tests/data/lavf/lavf.gxf CRC=0x147ff044
+4c6594c58da57af745eb511bdd65bca7 *./tests/data/lavf/lavf.gxf
816752 ./tests/data/lavf/lavf.gxf
-./tests/data/lavf/lavf.gxf CRC=0xb73759d8
+./tests/data/lavf/lavf.gxf CRC=0xfa7c375a
e4721383461d7a9feae41435567c9257 *./tests/data/lavf/lavf.gxf
795876 ./tests/data/lavf/lavf.gxf
./tests/data/lavf/lavf.gxf CRC=0xd9d58865
diff --git a/tests/ref/lavf/mxf b/tests/ref/lavf/mxf
index b48916276d..6ca82c81d1 100644
--- a/tests/ref/lavf/mxf
+++ b/tests/ref/lavf/mxf
@@ -1,9 +1,9 @@
-c53c9f7ee2091405fbe50374f9055679 *./tests/data/lavf/lavf.mxf
+967f6ee9223c865328f4891465191108 *./tests/data/lavf/lavf.mxf
525369 ./tests/data/lavf/lavf.mxf
-./tests/data/lavf/lavf.mxf CRC=0x17ce1069
-14d0ac1513840b670a785daf4331aca8 *./tests/data/lavf/lavf.mxf
+./tests/data/lavf/lavf.mxf CRC=0xdbfff6f1
+ec951485333c0b320d2ede8692c602ae *./tests/data/lavf/lavf.mxf
554553 ./tests/data/lavf/lavf.mxf
-./tests/data/lavf/lavf.mxf CRC=0x468cdbc4
-5636cee18b0f34a5acb33a8efb9f80c6 *./tests/data/lavf/lavf.mxf
+./tests/data/lavf/lavf.mxf CRC=0xfbaac0b0
+ce535b606423d117675213b16275206a *./tests/data/lavf/lavf.mxf
525369 ./tests/data/lavf/lavf.mxf
-./tests/data/lavf/lavf.mxf CRC=0x17ce1069
+./tests/data/lavf/lavf.mxf CRC=0xdbfff6f1