diff mbox

[FFmpeg-devel] swresample/options: enable linear_interp and exact_rational by default

Message ID 20170310021938.5195-1-mfcc64@gmail.com
State Superseded
Headers show

Commit Message

Muhammad Faiz March 10, 2017, 2:19 a.m. UTC
for higher quality resampling

Signed-off-by: Muhammad Faiz <mfcc64@gmail.com>
---
 doc/resampler.texi           |   5 +-
 libswresample/options.c      |   4 +-
 tests/fate/libswresample.mak | 189 ++++++++++++++++++++++++++++++++++++++++---
 tests/ref/acodec/s302m       |   6 +-
 tests/ref/lavf/dv_fmt        |   8 +-
 tests/ref/lavf/gxf           |   8 +-
 tests/ref/lavf/mxf           |  12 +--
 7 files changed, 201 insertions(+), 31 deletions(-)

Comments

Marton Balint March 10, 2017, 3:04 a.m. UTC | #1
On Fri, 10 Mar 2017, Muhammad Faiz wrote:

> for higher quality resampling

How much slower is it?

Thanks,
Marton

>
> Signed-off-by: Muhammad Faiz <mfcc64@gmail.com>
> ---
> doc/resampler.texi           |   5 +-
> libswresample/options.c      |   4 +-
> tests/fate/libswresample.mak | 189 ++++++++++++++++++++++++++++++++++++++++---
> tests/ref/acodec/s302m       |   6 +-
> tests/ref/lavf/dv_fmt        |   8 +-
> tests/ref/lavf/gxf           |   8 +-
> tests/ref/lavf/mxf           |  12 +--
> 7 files changed, 201 insertions(+), 31 deletions(-)
>
> diff --git a/doc/resampler.texi b/doc/resampler.texi
> index d72677c..5ed3f43 100644
> --- a/doc/resampler.texi
> +++ b/doc/resampler.texi
> @@ -132,12 +132,13 @@ For swr only, set resampling phase shift, default value is 10, and must be in
> the interval [0,30].
> 
> @item linear_interp
> -Use linear interpolation if set to 1, default value is 0.
> +Use linear interpolation when enabled (the default). Disable it if you want
> +to preserve speed instead of quality when exact_rational fails.
> 
> @item exact_rational
> For swr only, when enabled, try to use exact phase_count based on input and
> output sample rate. However, if it is larger than @code{1 << phase_shift},
> -the phase_count will be @code{1 << phase_shift} as fallback. Default is disabled.
> +the phase_count will be @code{1 << phase_shift} as fallback. Default is enabled.
> 
> @item cutoff
> Set cutoff frequency (swr: 6dB point; soxr: 0dB point) ratio; must be a float
> diff --git a/libswresample/options.c b/libswresample/options.c
> index 4abf5e0..00d4f7c 100644
> --- a/libswresample/options.c
> +++ b/libswresample/options.c
> @@ -84,8 +84,8 @@ static const AVOption options[]={
> 
> {"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      , 24        , PARAM },
> -{"linear_interp"        , "enable linear interpolation" , OFFSET(linear_interp)  , AV_OPT_TYPE_BOOL , {.i64=0                     }, 0      , 1         , PARAM },
> -{"exact_rational"       , "enable exact rational"       , OFFSET(exact_rational) , AV_OPT_TYPE_BOOL , {.i64=0                     }, 0      , 1         , PARAM },
> +{"linear_interp"        , "enable linear interpolation" , OFFSET(linear_interp)  , AV_OPT_TYPE_BOOL , {.i64=1                     }, 0      , 1         , PARAM },
> +{"exact_rational"       , "enable exact rational"       , OFFSET(exact_rational) , AV_OPT_TYPE_BOOL , {.i64=1                     }, 0      , 1         , PARAM },
> {"cutoff"               , "set cutoff frequency ratio"  , OFFSET(cutoff)         , AV_OPT_TYPE_DOUBLE,{.dbl=0.                    }, 0      , 1         , PARAM },
> 
> /* duplicate option in order to work with avconv */
> diff --git a/tests/fate/libswresample.mak b/tests/fate/libswresample.mak
> index 78dbde7..13d7dba 100644
> --- a/tests/fate/libswresample.mak
> +++ b/tests/fate/libswresample.mak
> @@ -11,10 +11,11 @@ SAMPLERATES_LITE = 8000 44100 48000
> 
> SAMPLERATES_NN = 8000 44100
> 
> +#note that the default is ARESAMPLE_EXACT_LIN
> define ARESAMPLE
> FATE_SWR_RESAMPLE += fate-swr-resample-$(3)-$(1)-$(2)
> fate-swr-resample-$(3)-$(1)-$(2): tests/data/asynth-$(1)-1.wav
> -fate-swr-resample-$(3)-$(1)-$(2): CMD = ffmpeg -i $(TARGET_PATH)/tests/data/asynth-$(1)-1.wav -af atrim=end_sample=10240,aresample=$(2):internal_sample_fmt=$(3),aformat=$(3),aresample=$(1):internal_sample_fmt=$(3) -f wav -acodec pcm_s16le -
> +fate-swr-resample-$(3)-$(1)-$(2): CMD = ffmpeg -i $(TARGET_PATH)/tests/data/asynth-$(1)-1.wav -af atrim=end_sample=10240,aresample=$(2):internal_sample_fmt=$(3):exact_rational=0:linear_interp=0,aformat=$(3),aresample=$(1):internal_sample_fmt=$(3):exact_rational=0:linear_interp=0 -f wav -acodec pcm_s16le -
> 
> fate-swr-resample-$(3)-$(1)-$(2): CMP = stddev
> fate-swr-resample-$(3)-$(1)-$(2): CMP_UNIT = $(5)
> @@ -270,7 +271,7 @@ fate-swr-resample-s32p-96000-8000: SIZE_TOLERANCE = 1152000 - 20496
> define ARESAMPLE_LIN
> FATE_SWR_RESAMPLE += fate-swr-resample_lin-$(3)-$(1)-$(2)
> fate-swr-resample_lin-$(3)-$(1)-$(2): tests/data/asynth-$(1)-1.wav
> -fate-swr-resample_lin-$(3)-$(1)-$(2): CMD = ffmpeg -i $(TARGET_PATH)/tests/data/asynth-$(1)-1.wav -af atrim=end_sample=10240,aresample=$(2):linear_interp=1:internal_sample_fmt=$(3),aformat=$(3),aresample=$(1):linear_interp=1:internal_sample_fmt=$(3) -f wav -acodec pcm_s16le -
> +fate-swr-resample_lin-$(3)-$(1)-$(2): CMD = ffmpeg -i $(TARGET_PATH)/tests/data/asynth-$(1)-1.wav -af atrim=end_sample=10240,aresample=$(2):linear_interp=1:exact_rational=0:internal_sample_fmt=$(3),aformat=$(3),aresample=$(1):linear_interp=1:exact_rational=0:internal_sample_fmt=$(3) -f wav -acodec pcm_s16le -
> 
> fate-swr-resample_lin-$(3)-$(1)-$(2): CMP = stddev
> fate-swr-resample_lin-$(3)-$(1)-$(2): CMP_UNIT = $(5)
> @@ -335,7 +336,7 @@ fate-swr-resample_lin-dblp-48000-44100: SIZE_TOLERANCE = 576000 - 20480
> define ARESAMPLE_NN
> FATE_SWR_RESAMPLE += fate-swr-resample_nn-$(3)-$(1)-$(2)
> fate-swr-resample_nn-$(3)-$(1)-$(2): tests/data/asynth-$(1)-1.wav
> -fate-swr-resample_nn-$(3)-$(1)-$(2): CMD = ffmpeg -i $(TARGET_PATH)/tests/data/asynth-$(1)-1.wav -af atrim=end_sample=10240,aresample=$(2):filter_size=1:phase_shift=0:internal_sample_fmt=$(3),aformat=$(3),aresample=$(1):internal_sample_fmt=$(3) -f wav -acodec pcm_s16le -
> +fate-swr-resample_nn-$(3)-$(1)-$(2): CMD = ffmpeg -i $(TARGET_PATH)/tests/data/asynth-$(1)-1.wav -af atrim=end_sample=10240,aresample=$(2):filter_size=1:phase_shift=0:linear_interp=0:internal_sample_fmt=$(3),aformat=$(3),aresample=$(1):linear_interp=0:exact_rational=0:internal_sample_fmt=$(3) -f wav -acodec pcm_s16le -
> 
> fate-swr-resample_nn-$(3)-$(1)-$(2): CMP = stddev
> fate-swr-resample_nn-$(3)-$(1)-$(2): CMP_UNIT = $(5)
> @@ -358,7 +359,7 @@ fate-swr-resample_nn-s16p-8000-44100: SIZE_TOLERANCE = 96000 - 20480
> define ARESAMPLE_ASYNC
> FATE_SWR_RESAMPLE += fate-swr-resample_async-$(3)-$(1)-$(2)
> fate-swr-resample_async-$(3)-$(1)-$(2): tests/data/asynth-$(1)-1.wav
> -fate-swr-resample_async-$(3)-$(1)-$(2): CMD = ffmpeg -i $(TARGET_PATH)/tests/data/asynth-$(1)-1.wav -af atrim=end_sample=10240,asetpts=PTS+random\(0\)*200-100,aresample=$(2):async=50:min_hard_comp=0.100000:first_pts=0:internal_sample_fmt=$(3),aformat=$(3),aresample=$(1):internal_sample_fmt=$(3) -f wav -acodec pcm_s16le -
> +fate-swr-resample_async-$(3)-$(1)-$(2): CMD = ffmpeg -i $(TARGET_PATH)/tests/data/asynth-$(1)-1.wav -af atrim=end_sample=10240,asetpts=PTS+random\(0\)*200-100,aresample=$(2):async=50:min_hard_comp=0.100000:first_pts=0:linear_interp=0:exact_rational=0:internal_sample_fmt=$(3),aformat=$(3),aresample=$(1):linear_interp=0:exact_rational=0:internal_sample_fmt=$(3) -f wav -acodec pcm_s16le -
> 
> fate-swr-resample_async-$(3)-$(1)-$(2): CMP = stddev
> fate-swr-resample_async-$(3)-$(1)-$(2): CMP_UNIT = $(5)
> @@ -381,7 +382,7 @@ fate-swr-resample_async-s16p-8000-44100: SIZE_TOLERANCE = 96000 - 20344
> define ARESAMPLE_EXACT
> FATE_SWR_RESAMPLE += fate-swr-resample_exact-$(3)-$(1)-$(2)
> fate-swr-resample_exact-$(3)-$(1)-$(2): tests/data/asynth-$(1)-1.wav
> -fate-swr-resample_exact-$(3)-$(1)-$(2): CMD = ffmpeg -i $(TARGET_PATH)/tests/data/asynth-$(1)-1.wav -af atrim=end_sample=10240,aresample=$(2):internal_sample_fmt=$(3):exact_rational=on,aformat=$(3),aresample=$(1):internal_sample_fmt=$(3):exact_rational=on -f wav -acodec pcm_s16le -
> +fate-swr-resample_exact-$(3)-$(1)-$(2): CMD = ffmpeg -i $(TARGET_PATH)/tests/data/asynth-$(1)-1.wav -af atrim=end_sample=10240,aresample=$(2):internal_sample_fmt=$(3):exact_rational=on:linear_interp=0,aformat=$(3),aresample=$(1):internal_sample_fmt=$(3):exact_rational=on:linear_interp=0 -f wav -acodec pcm_s16le -
> 
> fate-swr-resample_exact-$(3)-$(1)-$(2): CMP = stddev
> fate-swr-resample_exact-$(3)-$(1)-$(2): CMP_UNIT = $(5)
> @@ -632,7 +633,7 @@ fate-swr-resample_exact-s32p-96000-8000: SIZE_TOLERANCE = 1152000 - 20496
> define ARESAMPLE_EXACT_ASYNC
> FATE_SWR_RESAMPLE += fate-swr-resample_exact_async-$(3)-$(1)-$(2)
> fate-swr-resample_exact_async-$(3)-$(1)-$(2): tests/data/asynth-$(1)-1.wav
> -fate-swr-resample_exact_async-$(3)-$(1)-$(2): CMD = ffmpeg -i $(TARGET_PATH)/tests/data/asynth-$(1)-1.wav -af atrim=end_sample=10240,asetpts=PTS+random\(0\)*200-100,aresample=$(2):async=50:min_hard_comp=0.100000:first_pts=0:internal_sample_fmt=$(3):exact_rational=on,aformat=$(3),aresample=$(1):internal_sample_fmt=$(3):exact_rational=on -f wav -acodec pcm_s16le -
> +fate-swr-resample_exact_async-$(3)-$(1)-$(2): CMD = ffmpeg -i $(TARGET_PATH)/tests/data/asynth-$(1)-1.wav -af atrim=end_sample=10240,asetpts=PTS+random\(0\)*200-100,aresample=$(2):async=50:min_hard_comp=0.100000:first_pts=0:internal_sample_fmt=$(3):exact_rational=on:linear_interp=0,aformat=$(3),aresample=$(1):internal_sample_fmt=$(3):exact_rational=on:linear_interp=0 -f wav -acodec pcm_s16le -
> 
> fate-swr-resample_exact_async-$(3)-$(1)-$(2): CMP = stddev
> fate-swr-resample_exact_async-$(3)-$(1)-$(2): CMP_UNIT = $(5)
> @@ -795,6 +796,174 @@ fate-swr-resample_exact_lin-s32p-8000-44100: SIZE_TOLERANCE = 96000 - 20480
> fate-swr-resample_exact_lin-s32p-8000-48000: CMP_TARGET = 14.50
> fate-swr-resample_exact_lin-s32p-8000-48000: SIZE_TOLERANCE = 96000 - 20480
> 
> +fate-swr-resample_exact_lin-dblp-2626-44100: CMP_TARGET = 1352.60
> +fate-swr-resample_exact_lin-dblp-2626-44100: SIZE_TOLERANCE = 31512 - 20480
> +
> +fate-swr-resample_exact_lin-dblp-2626-48000: CMP_TARGET = 1352.62
> +fate-swr-resample_exact_lin-dblp-2626-48000: SIZE_TOLERANCE = 31512 - 20480
> +
> +fate-swr-resample_exact_lin-dblp-2626-8000: CMP_TARGET = 1352.49
> +fate-swr-resample_exact_lin-dblp-2626-8000: SIZE_TOLERANCE = 31512 - 20480
> +
> +fate-swr-resample_exact_lin-dblp-2626-96000: CMP_TARGET = 1352.62
> +fate-swr-resample_exact_lin-dblp-2626-96000: SIZE_TOLERANCE = 31512 - 20480
> +
> +fate-swr-resample_exact_lin-dblp-44100-2626: CMP_TARGET = 185.49
> +fate-swr-resample_exact_lin-dblp-44100-2626: SIZE_TOLERANCE = 529200 - 20490
> +
> +fate-swr-resample_exact_lin-dblp-44100-96000: CMP_TARGET = 11.45
> +fate-swr-resample_exact_lin-dblp-44100-96000: SIZE_TOLERANCE = 529200 - 20482
> +
> +fate-swr-resample_exact_lin-dblp-48000-2626: CMP_TARGET = 456.50
> +fate-swr-resample_exact_lin-dblp-48000-2626: SIZE_TOLERANCE = 576000 - 20510
> +
> +fate-swr-resample_exact_lin-dblp-48000-96000: CMP_TARGET = 0.47
> +fate-swr-resample_exact_lin-dblp-48000-96000: SIZE_TOLERANCE = 576000 - 20480
> +
> +fate-swr-resample_exact_lin-dblp-8000-2626: CMP_TARGET = 2503.28
> +fate-swr-resample_exact_lin-dblp-8000-2626: SIZE_TOLERANCE = 96000 - 20480
> +
> +fate-swr-resample_exact_lin-dblp-8000-96000: CMP_TARGET = 13.62
> +fate-swr-resample_exact_lin-dblp-8000-96000: SIZE_TOLERANCE = 96000 - 20480
> +
> +fate-swr-resample_exact_lin-dblp-96000-2626: CMP_TARGET = 675.02
> +fate-swr-resample_exact_lin-dblp-96000-2626: SIZE_TOLERANCE = 1152000 - 20474
> +
> +fate-swr-resample_exact_lin-dblp-96000-44100: CMP_TARGET = 1.23
> +fate-swr-resample_exact_lin-dblp-96000-44100: SIZE_TOLERANCE = 1152000 - 20480
> +
> +fate-swr-resample_exact_lin-dblp-96000-48000: CMP_TARGET = 0.99
> +fate-swr-resample_exact_lin-dblp-96000-48000: SIZE_TOLERANCE = 1152000 - 20480
> +
> +fate-swr-resample_exact_lin-dblp-96000-8000: CMP_TARGET = 58.52
> +fate-swr-resample_exact_lin-dblp-96000-8000: SIZE_TOLERANCE = 1152000 - 20496
> +
> +fate-swr-resample_exact_lin-fltp-2626-44100: CMP_TARGET = 1352.60
> +fate-swr-resample_exact_lin-fltp-2626-44100: SIZE_TOLERANCE = 31512 - 20480
> +
> +fate-swr-resample_exact_lin-fltp-2626-48000: CMP_TARGET = 1352.62
> +fate-swr-resample_exact_lin-fltp-2626-48000: SIZE_TOLERANCE = 31512 - 20480
> +
> +fate-swr-resample_exact_lin-fltp-2626-8000: CMP_TARGET = 1352.49
> +fate-swr-resample_exact_lin-fltp-2626-8000: SIZE_TOLERANCE = 31512 - 20480
> +
> +fate-swr-resample_exact_lin-fltp-2626-96000: CMP_TARGET = 1352.62
> +fate-swr-resample_exact_lin-fltp-2626-96000: SIZE_TOLERANCE = 31512 - 20480
> +
> +fate-swr-resample_exact_lin-fltp-44100-2626: CMP_TARGET = 185.49
> +fate-swr-resample_exact_lin-fltp-44100-2626: SIZE_TOLERANCE = 529200 - 20490
> +
> +fate-swr-resample_exact_lin-fltp-44100-96000: CMP_TARGET = 11.45
> +fate-swr-resample_exact_lin-fltp-44100-96000: SIZE_TOLERANCE = 529200 - 20482
> +
> +fate-swr-resample_exact_lin-fltp-48000-2626: CMP_TARGET = 456.50
> +fate-swr-resample_exact_lin-fltp-48000-2626: SIZE_TOLERANCE = 576000 - 20510
> +
> +fate-swr-resample_exact_lin-fltp-48000-96000: CMP_TARGET = 0.47
> +fate-swr-resample_exact_lin-fltp-48000-96000: SIZE_TOLERANCE = 576000 - 20480
> +
> +fate-swr-resample_exact_lin-fltp-8000-2626: CMP_TARGET = 2503.28
> +fate-swr-resample_exact_lin-fltp-8000-2626: SIZE_TOLERANCE = 96000 - 20480
> +
> +fate-swr-resample_exact_lin-fltp-8000-96000: CMP_TARGET = 13.62
> +fate-swr-resample_exact_lin-fltp-8000-96000: SIZE_TOLERANCE = 96000 - 20480
> +
> +fate-swr-resample_exact_lin-fltp-96000-2626: CMP_TARGET = 675.02
> +fate-swr-resample_exact_lin-fltp-96000-2626: SIZE_TOLERANCE = 1152000 - 20474
> +
> +fate-swr-resample_exact_lin-fltp-96000-44100: CMP_TARGET = 1.23
> +fate-swr-resample_exact_lin-fltp-96000-44100: SIZE_TOLERANCE = 1152000 - 20480
> +
> +fate-swr-resample_exact_lin-fltp-96000-48000: CMP_TARGET = 0.99
> +fate-swr-resample_exact_lin-fltp-96000-48000: SIZE_TOLERANCE = 1152000 - 20480
> +
> +fate-swr-resample_exact_lin-fltp-96000-8000: CMP_TARGET = 58.52
> +fate-swr-resample_exact_lin-fltp-96000-8000: SIZE_TOLERANCE = 1152000 - 20496
> +
> +fate-swr-resample_exact_lin-s16p-2626-44100: CMP_TARGET = 1392.93
> +fate-swr-resample_exact_lin-s16p-2626-44100: SIZE_TOLERANCE = 31512 - 20480
> +
> +fate-swr-resample_exact_lin-s16p-2626-48000: CMP_TARGET = 1392.97
> +fate-swr-resample_exact_lin-s16p-2626-48000: SIZE_TOLERANCE = 31512 - 20480
> +
> +fate-swr-resample_exact_lin-s16p-2626-8000: CMP_TARGET = 1393.28
> +fate-swr-resample_exact_lin-s16p-2626-8000: SIZE_TOLERANCE = 31512 - 20480
> +
> +fate-swr-resample_exact_lin-s16p-2626-96000: CMP_TARGET = 1393.04
> +fate-swr-resample_exact_lin-s16p-2626-96000: SIZE_TOLERANCE = 31512 - 20480
> +
> +fate-swr-resample_exact_lin-s16p-44100-2626: CMP_TARGET = 185.51
> +fate-swr-resample_exact_lin-s16p-44100-2626: SIZE_TOLERANCE = 529200 - 20490
> +
> +fate-swr-resample_exact_lin-s16p-44100-96000: CMP_TARGET = 11.46
> +fate-swr-resample_exact_lin-s16p-44100-96000: SIZE_TOLERANCE = 529200 - 20482
> +
> +fate-swr-resample_exact_lin-s16p-48000-2626: CMP_TARGET = 456.56
> +fate-swr-resample_exact_lin-s16p-48000-2626: SIZE_TOLERANCE = 576000 - 20510
> +
> +fate-swr-resample_exact_lin-s16p-48000-96000: CMP_TARGET = 0.73
> +fate-swr-resample_exact_lin-s16p-48000-96000: SIZE_TOLERANCE = 576000 - 20480
> +
> +fate-swr-resample_exact_lin-s16p-8000-2626: CMP_TARGET = 2503.28
> +fate-swr-resample_exact_lin-s16p-8000-2626: SIZE_TOLERANCE = 96000 - 20480
> +
> +fate-swr-resample_exact_lin-s16p-8000-96000: CMP_TARGET = 13.65
> +fate-swr-resample_exact_lin-s16p-8000-96000: SIZE_TOLERANCE = 96000 - 20480
> +
> +fate-swr-resample_exact_lin-s16p-96000-2626: CMP_TARGET = 675.07
> +fate-swr-resample_exact_lin-s16p-96000-2626: SIZE_TOLERANCE = 1152000 - 20474
> +
> +fate-swr-resample_exact_lin-s16p-96000-44100: CMP_TARGET = 1.44
> +fate-swr-resample_exact_lin-s16p-96000-44100: SIZE_TOLERANCE = 1152000 - 20480
> +
> +fate-swr-resample_exact_lin-s16p-96000-48000: CMP_TARGET = 1.12
> +fate-swr-resample_exact_lin-s16p-96000-48000: SIZE_TOLERANCE = 1152000 - 20480
> +
> +fate-swr-resample_exact_lin-s16p-96000-8000: CMP_TARGET = 58.56
> +fate-swr-resample_exact_lin-s16p-96000-8000: SIZE_TOLERANCE = 1152000 - 20496
> +
> +fate-swr-resample_exact_lin-s32p-2626-44100: CMP_TARGET = 1392.94
> +fate-swr-resample_exact_lin-s32p-2626-44100: SIZE_TOLERANCE = 31512 - 20480
> +
> +fate-swr-resample_exact_lin-s32p-2626-48000: CMP_TARGET = 1392.97
> +fate-swr-resample_exact_lin-s32p-2626-48000: SIZE_TOLERANCE = 31512 - 20480
> +
> +fate-swr-resample_exact_lin-s32p-2626-8000: CMP_TARGET = 1393.28
> +fate-swr-resample_exact_lin-s32p-2626-8000: SIZE_TOLERANCE = 31512 - 20480
> +
> +fate-swr-resample_exact_lin-s32p-2626-96000: CMP_TARGET = 1392.97
> +fate-swr-resample_exact_lin-s32p-2626-96000: SIZE_TOLERANCE = 31512 - 20480
> +
> +fate-swr-resample_exact_lin-s32p-44100-2626: CMP_TARGET = 185.49
> +fate-swr-resample_exact_lin-s32p-44100-2626: SIZE_TOLERANCE = 529200 - 20490
> +
> +fate-swr-resample_exact_lin-s32p-44100-96000: CMP_TARGET = 11.45
> +fate-swr-resample_exact_lin-s32p-44100-96000: SIZE_TOLERANCE = 529200 - 20482
> +
> +fate-swr-resample_exact_lin-s32p-48000-2626: CMP_TARGET = 456.50
> +fate-swr-resample_exact_lin-s32p-48000-2626: SIZE_TOLERANCE = 576000 - 20510
> +
> +fate-swr-resample_exact_lin-s32p-48000-96000: CMP_TARGET = 0.47
> +fate-swr-resample_exact_lin-s32p-48000-96000: SIZE_TOLERANCE = 576000 - 20480
> +
> +fate-swr-resample_exact_lin-s32p-8000-2626: CMP_TARGET = 2503.28
> +fate-swr-resample_exact_lin-s32p-8000-2626: SIZE_TOLERANCE = 96000 - 20480
> +
> +fate-swr-resample_exact_lin-s32p-8000-96000: CMP_TARGET = 13.62
> +fate-swr-resample_exact_lin-s32p-8000-96000: SIZE_TOLERANCE = 96000 - 20480
> +
> +fate-swr-resample_exact_lin-s32p-96000-2626: CMP_TARGET = 675.02
> +fate-swr-resample_exact_lin-s32p-96000-2626: SIZE_TOLERANCE = 1152000 - 20474
> +
> +fate-swr-resample_exact_lin-s32p-96000-44100: CMP_TARGET = 1.23
> +fate-swr-resample_exact_lin-s32p-96000-44100: SIZE_TOLERANCE = 1152000 - 20480
> +
> +fate-swr-resample_exact_lin-s32p-96000-48000: CMP_TARGET = 0.99
> +fate-swr-resample_exact_lin-s32p-96000-48000: SIZE_TOLERANCE = 1152000 - 20480
> +
> +fate-swr-resample_exact_lin-s32p-96000-8000: CMP_TARGET = 58.52
> +fate-swr-resample_exact_lin-s32p-96000-8000: SIZE_TOLERANCE = 1152000 - 20496
> +
> define ARESAMPLE_EXACT_LIN_ASYNC
> FATE_SWR_RESAMPLE += fate-swr-resample_exact_lin_async-$(3)-$(1)-$(2)
> fate-swr-resample_exact_lin_async-$(3)-$(1)-$(2): tests/data/asynth-$(1)-1.wav
> @@ -903,10 +1072,10 @@ $(call CROSS_TEST,$(SAMPLERATES_LITE),ARESAMPLE_EXACT_ASYNC,s32p,s32le,s16)
> $(call CROSS_TEST,$(SAMPLERATES_LITE),ARESAMPLE_EXACT_ASYNC,fltp,f32le,s16)
> $(call CROSS_TEST,$(SAMPLERATES_LITE),ARESAMPLE_EXACT_ASYNC,dblp,f64le,s16)
> 
> -$(call CROSS_TEST,$(SAMPLERATES_LITE),ARESAMPLE_EXACT_LIN,s16p,s16le,s16)
> -$(call CROSS_TEST,$(SAMPLERATES_LITE),ARESAMPLE_EXACT_LIN,s32p,s32le,s16)
> -$(call CROSS_TEST,$(SAMPLERATES_LITE),ARESAMPLE_EXACT_LIN,fltp,f32le,s16)
> -$(call CROSS_TEST,$(SAMPLERATES_LITE),ARESAMPLE_EXACT_LIN,dblp,f64le,s16)
> +$(call CROSS_TEST,$(SAMPLERATES),ARESAMPLE_EXACT_LIN,s16p,s16le,s16)
> +$(call CROSS_TEST,$(SAMPLERATES),ARESAMPLE_EXACT_LIN,s32p,s32le,s16)
> +$(call CROSS_TEST,$(SAMPLERATES),ARESAMPLE_EXACT_LIN,fltp,f32le,s16)
> +$(call CROSS_TEST,$(SAMPLERATES),ARESAMPLE_EXACT_LIN,dblp,f64le,s16)
> 
> $(call CROSS_TEST,$(SAMPLERATES_LITE),ARESAMPLE_EXACT_LIN_ASYNC,s16p,s16le,s16)
> $(call CROSS_TEST,$(SAMPLERATES_LITE),ARESAMPLE_EXACT_LIN_ASYNC,s32p,s32le,s16)
> diff --git a/tests/ref/acodec/s302m b/tests/ref/acodec/s302m
> index 7e41abb..63e39ed 100644
> --- a/tests/ref/acodec/s302m
> +++ b/tests/ref/acodec/s302m
> @@ -1,4 +1,4 @@
> -a69563c4c5db97d1b313c2fd7a193dd4 *tests/data/fate/acodec-s302m.mpegts
> +165d022ab86306d069797acff0c1e295 *tests/data/fate/acodec-s302m.mpegts
> 1589164 tests/data/fate/acodec-s302m.mpegts
> -2c033ed1d9029ed03e08c1d01dcefd99 *tests/data/fate/acodec-s302m.out.wav
> -stddev:  986.98 PSNR: 36.44 MAXDIFF:18642 bytes:  1058400/  1056708
> +31f25a0020fd9017de9c3c608316854b *tests/data/fate/acodec-s302m.out.wav
> +stddev:  986.94 PSNR: 36.44 MAXDIFF:18571 bytes:  1058400/  1056708
> diff --git a/tests/ref/lavf/dv_fmt b/tests/ref/lavf/dv_fmt
> index c8e4b11..dac43b6 100644
> --- a/tests/ref/lavf/dv_fmt
> +++ b/tests/ref/lavf/dv_fmt
> @@ -1,9 +1,9 @@
> -3bcb02ee889b8b2da19cae79d0f1c27d *./tests/data/lavf/lavf.dv
> +5a622e1ae4fd16bec59cd514380d7882 *./tests/data/lavf/lavf.dv
> 3600000 ./tests/data/lavf/lavf.dv
> -./tests/data/lavf/lavf.dv CRC=0x5a36cc70
> -f827583ae54e590d753c37709738fd54 *./tests/data/lavf/lavf.dv
> +./tests/data/lavf/lavf.dv CRC=0x0a6edbd8
> +155e8fd4ea1196edd56ae9ff09edcf85 *./tests/data/lavf/lavf.dv
> 3480000 ./tests/data/lavf/lavf.dv
> -./tests/data/lavf/lavf.dv CRC=0x8f8074be
> +./tests/data/lavf/lavf.dv CRC=0x3e5583fa
> 87d3b20f656235671383a7eaa2f66330 *./tests/data/lavf/lavf.dv
> 3600000 ./tests/data/lavf/lavf.dv
> ./tests/data/lavf/lavf.dv CRC=0xf3e6873c
> diff --git a/tests/ref/lavf/gxf b/tests/ref/lavf/gxf
> index 9b9831b..4dd463c 100644
> --- a/tests/ref/lavf/gxf
> +++ b/tests/ref/lavf/gxf
> @@ -1,9 +1,9 @@
> -1b384e20293a84b274739c147e2b290a *./tests/data/lavf/lavf.gxf
> +6ef34e8bedf699cd1601022c4a0a4910 *./tests/data/lavf/lavf.gxf
> 795876 ./tests/data/lavf/lavf.gxf
> -./tests/data/lavf/lavf.gxf CRC=0x55b3ec1d
> -411f109b5867e5cb81bc876d3cc5702b *./tests/data/lavf/lavf.gxf
> +./tests/data/lavf/lavf.gxf CRC=0x1dbfef76
> +7780c428dde2c93a9ff04794f7168440 *./tests/data/lavf/lavf.gxf
> 794656 ./tests/data/lavf/lavf.gxf
> -./tests/data/lavf/lavf.gxf CRC=0x0d7e90ea
> +./tests/data/lavf/lavf.gxf CRC=0xdcd39443
> 0638c4d073ac224608baaba16732b68f *./tests/data/lavf/lavf.gxf
> 795876 ./tests/data/lavf/lavf.gxf
> ./tests/data/lavf/lavf.gxf CRC=0x5ade0285
> diff --git a/tests/ref/lavf/mxf b/tests/ref/lavf/mxf
> index aea9c02..48fe95a 100644
> --- a/tests/ref/lavf/mxf
> +++ b/tests/ref/lavf/mxf
> @@ -1,9 +1,9 @@
> -2fd59c174dfb213d35e86dea63c0fb13 *./tests/data/lavf/lavf.mxf
> +eaac3125ac1a61fe5f968c7af83fa71e *./tests/data/lavf/lavf.mxf
> 525369 ./tests/data/lavf/lavf.mxf
> -./tests/data/lavf/lavf.mxf CRC=0x9fd3f752
> -edb3b610c301362d7b4c12f06f8d2782 *./tests/data/lavf/lavf.mxf
> +./tests/data/lavf/lavf.mxf CRC=0x8dddfaab
> +1562530330b13e9e70f522fe20265632 *./tests/data/lavf/lavf.mxf
> 560697 ./tests/data/lavf/lavf.mxf
> -./tests/data/lavf/lavf.mxf CRC=0xc51717ef
> -a6ba421f38ee5ec46e181225c632fee4 *./tests/data/lavf/lavf.mxf
> +./tests/data/lavf/lavf.mxf CRC=0xf21b1b48
> +e07858715997313ae66a1cdd6fde5f66 *./tests/data/lavf/lavf.mxf
> 525369 ./tests/data/lavf/lavf.mxf
> -./tests/data/lavf/lavf.mxf CRC=0x9fd3f752
> +./tests/data/lavf/lavf.mxf CRC=0x8dddfaab
> -- 
> 2.9.3
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Michael Niedermayer March 10, 2017, 3:44 a.m. UTC | #2
On Fri, Mar 10, 2017 at 09:19:38AM +0700, Muhammad Faiz wrote:
> for higher quality resampling

can you hear the difference ?

[...]
Muhammad Faiz March 10, 2017, 4:09 a.m. UTC | #3
On Fri, Mar 10, 2017 at 10:04 AM, Marton Balint <cus@passwd.hu> wrote:
>
> On Fri, 10 Mar 2017, Muhammad Faiz wrote:
>
>> for higher quality resampling
>
>
> How much slower is it?

Not slower when exact_rational doesn't fail, because it doesn't trigger
linear interpolation (even when linear_interp is enabled).
For example 44100 -> 48000 (147:160) so phase_count = 160 <= 1024

But if exact_rational fails, it will be slower because it triggers
linear interpolation.
For example 11025 -> 96000 (147:1280) so phase_count = 1280 > 1024
ans phase_count wil set to 1024 instead.
This will trigger slower linear interpolation.
I mention this in linear_interp doc entry.

Thank's
Muhammad Faiz March 10, 2017, 4:11 a.m. UTC | #4
On Fri, Mar 10, 2017 at 10:44 AM, Michael Niedermayer
<michael@niedermayer.cc> wrote:
> On Fri, Mar 10, 2017 at 09:19:38AM +0700, Muhammad Faiz wrote:
>> for higher quality resampling
>
> can you hear the difference ?

Yes, but it is sinesweep test audio, not real music audio.

Thank's
Michael Niedermayer March 10, 2017, 10:44 a.m. UTC | #5
On Fri, Mar 10, 2017 at 11:11:05AM +0700, Muhammad Faiz wrote:
> On Fri, Mar 10, 2017 at 10:44 AM, Michael Niedermayer
> <michael@niedermayer.cc> wrote:
> > On Fri, Mar 10, 2017 at 09:19:38AM +0700, Muhammad Faiz wrote:
> >> for higher quality resampling
> >
> > can you hear the difference ?
> 
> Yes, but it is sinesweep test audio, not real music audio.

my question was meant to be, can you hear the difference on real
world audio ?


[...]
Paul B Mahol March 10, 2017, 12:49 p.m. UTC | #6
On 3/10/17, Michael Niedermayer <michael@niedermayer.cc> wrote:
> On Fri, Mar 10, 2017 at 11:11:05AM +0700, Muhammad Faiz wrote:
>> On Fri, Mar 10, 2017 at 10:44 AM, Michael Niedermayer
>> <michael@niedermayer.cc> wrote:
>> > On Fri, Mar 10, 2017 at 09:19:38AM +0700, Muhammad Faiz wrote:
>> >> for higher quality resampling
>> >
>> > can you hear the difference ?
>>
>> Yes, but it is sinesweep test audio, not real music audio.
>
> my question was meant to be, can you hear the difference on real
> world audio ?
>

Yes I can hear it. I made blind test.
Michael Niedermayer March 10, 2017, 12:55 p.m. UTC | #7
On Fri, Mar 10, 2017 at 01:49:41PM +0100, Paul B Mahol wrote:
> On 3/10/17, Michael Niedermayer <michael@niedermayer.cc> wrote:
> > On Fri, Mar 10, 2017 at 11:11:05AM +0700, Muhammad Faiz wrote:
> >> On Fri, Mar 10, 2017 at 10:44 AM, Michael Niedermayer
> >> <michael@niedermayer.cc> wrote:
> >> > On Fri, Mar 10, 2017 at 09:19:38AM +0700, Muhammad Faiz wrote:
> >> >> for higher quality resampling
> >> >
> >> > can you hear the difference ?
> >>
> >> Yes, but it is sinesweep test audio, not real music audio.
> >
> > my question was meant to be, can you hear the difference on real
> > world audio ?
> >
> 
> Yes I can hear it. I made blind test.

iam surprised, i didnt expect this to be audible with real world audio
what audio/music is this audible with ?

[...]
Muhammad Faiz March 10, 2017, 2:43 p.m. UTC | #8
On Fri, Mar 10, 2017 at 5:44 PM, Michael Niedermayer
<michael@niedermayer.cc> wrote:
> On Fri, Mar 10, 2017 at 11:11:05AM +0700, Muhammad Faiz wrote:
>> On Fri, Mar 10, 2017 at 10:44 AM, Michael Niedermayer
>> <michael@niedermayer.cc> wrote:
>> > On Fri, Mar 10, 2017 at 09:19:38AM +0700, Muhammad Faiz wrote:
>> >> for higher quality resampling
>> >
>> > can you hear the difference ?
>>
>> Yes, but it is sinesweep test audio, not real music audio.
>
> my question was meant to be, can you hear the difference on real
> world audio ?

No, I can not. I'm untrained for that. Because real world audio is complex,
it is difficult for me to judge the difference. Other people may hear it.

is sinesweep test not enough for this?
exact_rational won't hurt speed at all.

Thank's
Muhammad Faiz March 13, 2017, 1:40 p.m. UTC | #9
On Fri, Mar 10, 2017 at 9:43 PM, Muhammad Faiz <mfcc64@gmail.com> wrote:
> On Fri, Mar 10, 2017 at 5:44 PM, Michael Niedermayer
> <michael@niedermayer.cc> wrote:
>> On Fri, Mar 10, 2017 at 11:11:05AM +0700, Muhammad Faiz wrote:
>>> On Fri, Mar 10, 2017 at 10:44 AM, Michael Niedermayer
>>> <michael@niedermayer.cc> wrote:
>>> > On Fri, Mar 10, 2017 at 09:19:38AM +0700, Muhammad Faiz wrote:
>>> >> for higher quality resampling
>>> >
>>> > can you hear the difference ?
>>>
>>> Yes, but it is sinesweep test audio, not real music audio.
>>
>> my question was meant to be, can you hear the difference on real
>> world audio ?
>
> No, I can not. I'm untrained for that. Because real world audio is complex,
> it is difficult for me to judge the difference. Other people may hear it.
>
> is sinesweep test not enough for this?
> exact_rational won't hurt speed at all.
>
> Thank's

fate was changed on '6c7a0876fefdd3c919afcabf493492cb4946ca6a',
so will repost with changed fate

thx
wm4 March 17, 2017, 12:09 a.m. UTC | #10
On Fri, 10 Mar 2017 09:19:38 +0700
Muhammad Faiz <mfcc64@gmail.com> wrote:

> for higher quality resampling
> 
> Signed-off-by: Muhammad Faiz <mfcc64@gmail.com>
> ---

This patch triggers this assertion:

Assertion !c->frac && !c->dst_incr_mod && !c->compensation_distance failed at libswresample/resample.c:391

when I use avresample_set_compensation(). Setting exact_rational=0
seems to avoid this.
Muhammad Faiz March 17, 2017, 1:03 a.m. UTC | #11
On Fri, Mar 17, 2017 at 7:09 AM, wm4 <nfxjfg@googlemail.com> wrote:
> On Fri, 10 Mar 2017 09:19:38 +0700
> Muhammad Faiz <mfcc64@gmail.com> wrote:
>
>> for higher quality resampling
>>
>> Signed-off-by: Muhammad Faiz <mfcc64@gmail.com>
>> ---
>
> This patch triggers this assertion:
>
> Assertion !c->frac && !c->dst_incr_mod && !c->compensation_distance failed at libswresample/resample.c:391
>
> when I use avresample_set_compensation(). Setting exact_rational=0
> seems to avoid this.

I've posted a patch to fix it

Thank's
diff mbox

Patch

diff --git a/doc/resampler.texi b/doc/resampler.texi
index d72677c..5ed3f43 100644
--- a/doc/resampler.texi
+++ b/doc/resampler.texi
@@ -132,12 +132,13 @@  For swr only, set resampling phase shift, default value is 10, and must be in
 the interval [0,30].
 
 @item linear_interp
-Use linear interpolation if set to 1, default value is 0.
+Use linear interpolation when enabled (the default). Disable it if you want
+to preserve speed instead of quality when exact_rational fails.
 
 @item exact_rational
 For swr only, when enabled, try to use exact phase_count based on input and
 output sample rate. However, if it is larger than @code{1 << phase_shift},
-the phase_count will be @code{1 << phase_shift} as fallback. Default is disabled.
+the phase_count will be @code{1 << phase_shift} as fallback. Default is enabled.
 
 @item cutoff
 Set cutoff frequency (swr: 6dB point; soxr: 0dB point) ratio; must be a float
diff --git a/libswresample/options.c b/libswresample/options.c
index 4abf5e0..00d4f7c 100644
--- a/libswresample/options.c
+++ b/libswresample/options.c
@@ -84,8 +84,8 @@  static const AVOption options[]={
 
 {"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      , 24        , PARAM },
-{"linear_interp"        , "enable linear interpolation" , OFFSET(linear_interp)  , AV_OPT_TYPE_BOOL , {.i64=0                     }, 0      , 1         , PARAM },
-{"exact_rational"       , "enable exact rational"       , OFFSET(exact_rational) , AV_OPT_TYPE_BOOL , {.i64=0                     }, 0      , 1         , PARAM },
+{"linear_interp"        , "enable linear interpolation" , OFFSET(linear_interp)  , AV_OPT_TYPE_BOOL , {.i64=1                     }, 0      , 1         , PARAM },
+{"exact_rational"       , "enable exact rational"       , OFFSET(exact_rational) , AV_OPT_TYPE_BOOL , {.i64=1                     }, 0      , 1         , PARAM },
 {"cutoff"               , "set cutoff frequency ratio"  , OFFSET(cutoff)         , AV_OPT_TYPE_DOUBLE,{.dbl=0.                    }, 0      , 1         , PARAM },
 
 /* duplicate option in order to work with avconv */
diff --git a/tests/fate/libswresample.mak b/tests/fate/libswresample.mak
index 78dbde7..13d7dba 100644
--- a/tests/fate/libswresample.mak
+++ b/tests/fate/libswresample.mak
@@ -11,10 +11,11 @@  SAMPLERATES_LITE = 8000 44100 48000
 
 SAMPLERATES_NN = 8000 44100
 
+#note that the default is ARESAMPLE_EXACT_LIN
 define ARESAMPLE
 FATE_SWR_RESAMPLE += fate-swr-resample-$(3)-$(1)-$(2)
 fate-swr-resample-$(3)-$(1)-$(2): tests/data/asynth-$(1)-1.wav
-fate-swr-resample-$(3)-$(1)-$(2): CMD = ffmpeg -i $(TARGET_PATH)/tests/data/asynth-$(1)-1.wav -af atrim=end_sample=10240,aresample=$(2):internal_sample_fmt=$(3),aformat=$(3),aresample=$(1):internal_sample_fmt=$(3) -f wav -acodec pcm_s16le -
+fate-swr-resample-$(3)-$(1)-$(2): CMD = ffmpeg -i $(TARGET_PATH)/tests/data/asynth-$(1)-1.wav -af atrim=end_sample=10240,aresample=$(2):internal_sample_fmt=$(3):exact_rational=0:linear_interp=0,aformat=$(3),aresample=$(1):internal_sample_fmt=$(3):exact_rational=0:linear_interp=0 -f wav -acodec pcm_s16le -
 
 fate-swr-resample-$(3)-$(1)-$(2): CMP = stddev
 fate-swr-resample-$(3)-$(1)-$(2): CMP_UNIT = $(5)
@@ -270,7 +271,7 @@  fate-swr-resample-s32p-96000-8000: SIZE_TOLERANCE = 1152000 - 20496
 define ARESAMPLE_LIN
 FATE_SWR_RESAMPLE += fate-swr-resample_lin-$(3)-$(1)-$(2)
 fate-swr-resample_lin-$(3)-$(1)-$(2): tests/data/asynth-$(1)-1.wav
-fate-swr-resample_lin-$(3)-$(1)-$(2): CMD = ffmpeg -i $(TARGET_PATH)/tests/data/asynth-$(1)-1.wav -af atrim=end_sample=10240,aresample=$(2):linear_interp=1:internal_sample_fmt=$(3),aformat=$(3),aresample=$(1):linear_interp=1:internal_sample_fmt=$(3) -f wav -acodec pcm_s16le -
+fate-swr-resample_lin-$(3)-$(1)-$(2): CMD = ffmpeg -i $(TARGET_PATH)/tests/data/asynth-$(1)-1.wav -af atrim=end_sample=10240,aresample=$(2):linear_interp=1:exact_rational=0:internal_sample_fmt=$(3),aformat=$(3),aresample=$(1):linear_interp=1:exact_rational=0:internal_sample_fmt=$(3) -f wav -acodec pcm_s16le -
 
 fate-swr-resample_lin-$(3)-$(1)-$(2): CMP = stddev
 fate-swr-resample_lin-$(3)-$(1)-$(2): CMP_UNIT = $(5)
@@ -335,7 +336,7 @@  fate-swr-resample_lin-dblp-48000-44100: SIZE_TOLERANCE = 576000 - 20480
 define ARESAMPLE_NN
 FATE_SWR_RESAMPLE += fate-swr-resample_nn-$(3)-$(1)-$(2)
 fate-swr-resample_nn-$(3)-$(1)-$(2): tests/data/asynth-$(1)-1.wav
-fate-swr-resample_nn-$(3)-$(1)-$(2): CMD = ffmpeg -i $(TARGET_PATH)/tests/data/asynth-$(1)-1.wav -af atrim=end_sample=10240,aresample=$(2):filter_size=1:phase_shift=0:internal_sample_fmt=$(3),aformat=$(3),aresample=$(1):internal_sample_fmt=$(3) -f wav -acodec pcm_s16le -
+fate-swr-resample_nn-$(3)-$(1)-$(2): CMD = ffmpeg -i $(TARGET_PATH)/tests/data/asynth-$(1)-1.wav -af atrim=end_sample=10240,aresample=$(2):filter_size=1:phase_shift=0:linear_interp=0:internal_sample_fmt=$(3),aformat=$(3),aresample=$(1):linear_interp=0:exact_rational=0:internal_sample_fmt=$(3) -f wav -acodec pcm_s16le -
 
 fate-swr-resample_nn-$(3)-$(1)-$(2): CMP = stddev
 fate-swr-resample_nn-$(3)-$(1)-$(2): CMP_UNIT = $(5)
@@ -358,7 +359,7 @@  fate-swr-resample_nn-s16p-8000-44100: SIZE_TOLERANCE = 96000 - 20480
 define ARESAMPLE_ASYNC
 FATE_SWR_RESAMPLE += fate-swr-resample_async-$(3)-$(1)-$(2)
 fate-swr-resample_async-$(3)-$(1)-$(2): tests/data/asynth-$(1)-1.wav
-fate-swr-resample_async-$(3)-$(1)-$(2): CMD = ffmpeg -i $(TARGET_PATH)/tests/data/asynth-$(1)-1.wav -af atrim=end_sample=10240,asetpts=PTS+random\(0\)*200-100,aresample=$(2):async=50:min_hard_comp=0.100000:first_pts=0:internal_sample_fmt=$(3),aformat=$(3),aresample=$(1):internal_sample_fmt=$(3) -f wav -acodec pcm_s16le -
+fate-swr-resample_async-$(3)-$(1)-$(2): CMD = ffmpeg -i $(TARGET_PATH)/tests/data/asynth-$(1)-1.wav -af atrim=end_sample=10240,asetpts=PTS+random\(0\)*200-100,aresample=$(2):async=50:min_hard_comp=0.100000:first_pts=0:linear_interp=0:exact_rational=0:internal_sample_fmt=$(3),aformat=$(3),aresample=$(1):linear_interp=0:exact_rational=0:internal_sample_fmt=$(3) -f wav -acodec pcm_s16le -
 
 fate-swr-resample_async-$(3)-$(1)-$(2): CMP = stddev
 fate-swr-resample_async-$(3)-$(1)-$(2): CMP_UNIT = $(5)
@@ -381,7 +382,7 @@  fate-swr-resample_async-s16p-8000-44100: SIZE_TOLERANCE = 96000 - 20344
 define ARESAMPLE_EXACT
 FATE_SWR_RESAMPLE += fate-swr-resample_exact-$(3)-$(1)-$(2)
 fate-swr-resample_exact-$(3)-$(1)-$(2): tests/data/asynth-$(1)-1.wav
-fate-swr-resample_exact-$(3)-$(1)-$(2): CMD = ffmpeg -i $(TARGET_PATH)/tests/data/asynth-$(1)-1.wav -af atrim=end_sample=10240,aresample=$(2):internal_sample_fmt=$(3):exact_rational=on,aformat=$(3),aresample=$(1):internal_sample_fmt=$(3):exact_rational=on -f wav -acodec pcm_s16le -
+fate-swr-resample_exact-$(3)-$(1)-$(2): CMD = ffmpeg -i $(TARGET_PATH)/tests/data/asynth-$(1)-1.wav -af atrim=end_sample=10240,aresample=$(2):internal_sample_fmt=$(3):exact_rational=on:linear_interp=0,aformat=$(3),aresample=$(1):internal_sample_fmt=$(3):exact_rational=on:linear_interp=0 -f wav -acodec pcm_s16le -
 
 fate-swr-resample_exact-$(3)-$(1)-$(2): CMP = stddev
 fate-swr-resample_exact-$(3)-$(1)-$(2): CMP_UNIT = $(5)
@@ -632,7 +633,7 @@  fate-swr-resample_exact-s32p-96000-8000: SIZE_TOLERANCE = 1152000 - 20496
 define ARESAMPLE_EXACT_ASYNC
 FATE_SWR_RESAMPLE += fate-swr-resample_exact_async-$(3)-$(1)-$(2)
 fate-swr-resample_exact_async-$(3)-$(1)-$(2): tests/data/asynth-$(1)-1.wav
-fate-swr-resample_exact_async-$(3)-$(1)-$(2): CMD = ffmpeg -i $(TARGET_PATH)/tests/data/asynth-$(1)-1.wav -af atrim=end_sample=10240,asetpts=PTS+random\(0\)*200-100,aresample=$(2):async=50:min_hard_comp=0.100000:first_pts=0:internal_sample_fmt=$(3):exact_rational=on,aformat=$(3),aresample=$(1):internal_sample_fmt=$(3):exact_rational=on -f wav -acodec pcm_s16le -
+fate-swr-resample_exact_async-$(3)-$(1)-$(2): CMD = ffmpeg -i $(TARGET_PATH)/tests/data/asynth-$(1)-1.wav -af atrim=end_sample=10240,asetpts=PTS+random\(0\)*200-100,aresample=$(2):async=50:min_hard_comp=0.100000:first_pts=0:internal_sample_fmt=$(3):exact_rational=on:linear_interp=0,aformat=$(3),aresample=$(1):internal_sample_fmt=$(3):exact_rational=on:linear_interp=0 -f wav -acodec pcm_s16le -
 
 fate-swr-resample_exact_async-$(3)-$(1)-$(2): CMP = stddev
 fate-swr-resample_exact_async-$(3)-$(1)-$(2): CMP_UNIT = $(5)
@@ -795,6 +796,174 @@  fate-swr-resample_exact_lin-s32p-8000-44100: SIZE_TOLERANCE = 96000 - 20480
 fate-swr-resample_exact_lin-s32p-8000-48000: CMP_TARGET = 14.50
 fate-swr-resample_exact_lin-s32p-8000-48000: SIZE_TOLERANCE = 96000 - 20480
 
+fate-swr-resample_exact_lin-dblp-2626-44100: CMP_TARGET = 1352.60
+fate-swr-resample_exact_lin-dblp-2626-44100: SIZE_TOLERANCE = 31512 - 20480
+
+fate-swr-resample_exact_lin-dblp-2626-48000: CMP_TARGET = 1352.62
+fate-swr-resample_exact_lin-dblp-2626-48000: SIZE_TOLERANCE = 31512 - 20480
+
+fate-swr-resample_exact_lin-dblp-2626-8000: CMP_TARGET = 1352.49
+fate-swr-resample_exact_lin-dblp-2626-8000: SIZE_TOLERANCE = 31512 - 20480
+
+fate-swr-resample_exact_lin-dblp-2626-96000: CMP_TARGET = 1352.62
+fate-swr-resample_exact_lin-dblp-2626-96000: SIZE_TOLERANCE = 31512 - 20480
+
+fate-swr-resample_exact_lin-dblp-44100-2626: CMP_TARGET = 185.49
+fate-swr-resample_exact_lin-dblp-44100-2626: SIZE_TOLERANCE = 529200 - 20490
+
+fate-swr-resample_exact_lin-dblp-44100-96000: CMP_TARGET = 11.45
+fate-swr-resample_exact_lin-dblp-44100-96000: SIZE_TOLERANCE = 529200 - 20482
+
+fate-swr-resample_exact_lin-dblp-48000-2626: CMP_TARGET = 456.50
+fate-swr-resample_exact_lin-dblp-48000-2626: SIZE_TOLERANCE = 576000 - 20510
+
+fate-swr-resample_exact_lin-dblp-48000-96000: CMP_TARGET = 0.47
+fate-swr-resample_exact_lin-dblp-48000-96000: SIZE_TOLERANCE = 576000 - 20480
+
+fate-swr-resample_exact_lin-dblp-8000-2626: CMP_TARGET = 2503.28
+fate-swr-resample_exact_lin-dblp-8000-2626: SIZE_TOLERANCE = 96000 - 20480
+
+fate-swr-resample_exact_lin-dblp-8000-96000: CMP_TARGET = 13.62
+fate-swr-resample_exact_lin-dblp-8000-96000: SIZE_TOLERANCE = 96000 - 20480
+
+fate-swr-resample_exact_lin-dblp-96000-2626: CMP_TARGET = 675.02
+fate-swr-resample_exact_lin-dblp-96000-2626: SIZE_TOLERANCE = 1152000 - 20474
+
+fate-swr-resample_exact_lin-dblp-96000-44100: CMP_TARGET = 1.23
+fate-swr-resample_exact_lin-dblp-96000-44100: SIZE_TOLERANCE = 1152000 - 20480
+
+fate-swr-resample_exact_lin-dblp-96000-48000: CMP_TARGET = 0.99
+fate-swr-resample_exact_lin-dblp-96000-48000: SIZE_TOLERANCE = 1152000 - 20480
+
+fate-swr-resample_exact_lin-dblp-96000-8000: CMP_TARGET = 58.52
+fate-swr-resample_exact_lin-dblp-96000-8000: SIZE_TOLERANCE = 1152000 - 20496
+
+fate-swr-resample_exact_lin-fltp-2626-44100: CMP_TARGET = 1352.60
+fate-swr-resample_exact_lin-fltp-2626-44100: SIZE_TOLERANCE = 31512 - 20480
+
+fate-swr-resample_exact_lin-fltp-2626-48000: CMP_TARGET = 1352.62
+fate-swr-resample_exact_lin-fltp-2626-48000: SIZE_TOLERANCE = 31512 - 20480
+
+fate-swr-resample_exact_lin-fltp-2626-8000: CMP_TARGET = 1352.49
+fate-swr-resample_exact_lin-fltp-2626-8000: SIZE_TOLERANCE = 31512 - 20480
+
+fate-swr-resample_exact_lin-fltp-2626-96000: CMP_TARGET = 1352.62
+fate-swr-resample_exact_lin-fltp-2626-96000: SIZE_TOLERANCE = 31512 - 20480
+
+fate-swr-resample_exact_lin-fltp-44100-2626: CMP_TARGET = 185.49
+fate-swr-resample_exact_lin-fltp-44100-2626: SIZE_TOLERANCE = 529200 - 20490
+
+fate-swr-resample_exact_lin-fltp-44100-96000: CMP_TARGET = 11.45
+fate-swr-resample_exact_lin-fltp-44100-96000: SIZE_TOLERANCE = 529200 - 20482
+
+fate-swr-resample_exact_lin-fltp-48000-2626: CMP_TARGET = 456.50
+fate-swr-resample_exact_lin-fltp-48000-2626: SIZE_TOLERANCE = 576000 - 20510
+
+fate-swr-resample_exact_lin-fltp-48000-96000: CMP_TARGET = 0.47
+fate-swr-resample_exact_lin-fltp-48000-96000: SIZE_TOLERANCE = 576000 - 20480
+
+fate-swr-resample_exact_lin-fltp-8000-2626: CMP_TARGET = 2503.28
+fate-swr-resample_exact_lin-fltp-8000-2626: SIZE_TOLERANCE = 96000 - 20480
+
+fate-swr-resample_exact_lin-fltp-8000-96000: CMP_TARGET = 13.62
+fate-swr-resample_exact_lin-fltp-8000-96000: SIZE_TOLERANCE = 96000 - 20480
+
+fate-swr-resample_exact_lin-fltp-96000-2626: CMP_TARGET = 675.02
+fate-swr-resample_exact_lin-fltp-96000-2626: SIZE_TOLERANCE = 1152000 - 20474
+
+fate-swr-resample_exact_lin-fltp-96000-44100: CMP_TARGET = 1.23
+fate-swr-resample_exact_lin-fltp-96000-44100: SIZE_TOLERANCE = 1152000 - 20480
+
+fate-swr-resample_exact_lin-fltp-96000-48000: CMP_TARGET = 0.99
+fate-swr-resample_exact_lin-fltp-96000-48000: SIZE_TOLERANCE = 1152000 - 20480
+
+fate-swr-resample_exact_lin-fltp-96000-8000: CMP_TARGET = 58.52
+fate-swr-resample_exact_lin-fltp-96000-8000: SIZE_TOLERANCE = 1152000 - 20496
+
+fate-swr-resample_exact_lin-s16p-2626-44100: CMP_TARGET = 1392.93
+fate-swr-resample_exact_lin-s16p-2626-44100: SIZE_TOLERANCE = 31512 - 20480
+
+fate-swr-resample_exact_lin-s16p-2626-48000: CMP_TARGET = 1392.97
+fate-swr-resample_exact_lin-s16p-2626-48000: SIZE_TOLERANCE = 31512 - 20480
+
+fate-swr-resample_exact_lin-s16p-2626-8000: CMP_TARGET = 1393.28
+fate-swr-resample_exact_lin-s16p-2626-8000: SIZE_TOLERANCE = 31512 - 20480
+
+fate-swr-resample_exact_lin-s16p-2626-96000: CMP_TARGET = 1393.04
+fate-swr-resample_exact_lin-s16p-2626-96000: SIZE_TOLERANCE = 31512 - 20480
+
+fate-swr-resample_exact_lin-s16p-44100-2626: CMP_TARGET = 185.51
+fate-swr-resample_exact_lin-s16p-44100-2626: SIZE_TOLERANCE = 529200 - 20490
+
+fate-swr-resample_exact_lin-s16p-44100-96000: CMP_TARGET = 11.46
+fate-swr-resample_exact_lin-s16p-44100-96000: SIZE_TOLERANCE = 529200 - 20482
+
+fate-swr-resample_exact_lin-s16p-48000-2626: CMP_TARGET = 456.56
+fate-swr-resample_exact_lin-s16p-48000-2626: SIZE_TOLERANCE = 576000 - 20510
+
+fate-swr-resample_exact_lin-s16p-48000-96000: CMP_TARGET = 0.73
+fate-swr-resample_exact_lin-s16p-48000-96000: SIZE_TOLERANCE = 576000 - 20480
+
+fate-swr-resample_exact_lin-s16p-8000-2626: CMP_TARGET = 2503.28
+fate-swr-resample_exact_lin-s16p-8000-2626: SIZE_TOLERANCE = 96000 - 20480
+
+fate-swr-resample_exact_lin-s16p-8000-96000: CMP_TARGET = 13.65
+fate-swr-resample_exact_lin-s16p-8000-96000: SIZE_TOLERANCE = 96000 - 20480
+
+fate-swr-resample_exact_lin-s16p-96000-2626: CMP_TARGET = 675.07
+fate-swr-resample_exact_lin-s16p-96000-2626: SIZE_TOLERANCE = 1152000 - 20474
+
+fate-swr-resample_exact_lin-s16p-96000-44100: CMP_TARGET = 1.44
+fate-swr-resample_exact_lin-s16p-96000-44100: SIZE_TOLERANCE = 1152000 - 20480
+
+fate-swr-resample_exact_lin-s16p-96000-48000: CMP_TARGET = 1.12
+fate-swr-resample_exact_lin-s16p-96000-48000: SIZE_TOLERANCE = 1152000 - 20480
+
+fate-swr-resample_exact_lin-s16p-96000-8000: CMP_TARGET = 58.56
+fate-swr-resample_exact_lin-s16p-96000-8000: SIZE_TOLERANCE = 1152000 - 20496
+
+fate-swr-resample_exact_lin-s32p-2626-44100: CMP_TARGET = 1392.94
+fate-swr-resample_exact_lin-s32p-2626-44100: SIZE_TOLERANCE = 31512 - 20480
+
+fate-swr-resample_exact_lin-s32p-2626-48000: CMP_TARGET = 1392.97
+fate-swr-resample_exact_lin-s32p-2626-48000: SIZE_TOLERANCE = 31512 - 20480
+
+fate-swr-resample_exact_lin-s32p-2626-8000: CMP_TARGET = 1393.28
+fate-swr-resample_exact_lin-s32p-2626-8000: SIZE_TOLERANCE = 31512 - 20480
+
+fate-swr-resample_exact_lin-s32p-2626-96000: CMP_TARGET = 1392.97
+fate-swr-resample_exact_lin-s32p-2626-96000: SIZE_TOLERANCE = 31512 - 20480
+
+fate-swr-resample_exact_lin-s32p-44100-2626: CMP_TARGET = 185.49
+fate-swr-resample_exact_lin-s32p-44100-2626: SIZE_TOLERANCE = 529200 - 20490
+
+fate-swr-resample_exact_lin-s32p-44100-96000: CMP_TARGET = 11.45
+fate-swr-resample_exact_lin-s32p-44100-96000: SIZE_TOLERANCE = 529200 - 20482
+
+fate-swr-resample_exact_lin-s32p-48000-2626: CMP_TARGET = 456.50
+fate-swr-resample_exact_lin-s32p-48000-2626: SIZE_TOLERANCE = 576000 - 20510
+
+fate-swr-resample_exact_lin-s32p-48000-96000: CMP_TARGET = 0.47
+fate-swr-resample_exact_lin-s32p-48000-96000: SIZE_TOLERANCE = 576000 - 20480
+
+fate-swr-resample_exact_lin-s32p-8000-2626: CMP_TARGET = 2503.28
+fate-swr-resample_exact_lin-s32p-8000-2626: SIZE_TOLERANCE = 96000 - 20480
+
+fate-swr-resample_exact_lin-s32p-8000-96000: CMP_TARGET = 13.62
+fate-swr-resample_exact_lin-s32p-8000-96000: SIZE_TOLERANCE = 96000 - 20480
+
+fate-swr-resample_exact_lin-s32p-96000-2626: CMP_TARGET = 675.02
+fate-swr-resample_exact_lin-s32p-96000-2626: SIZE_TOLERANCE = 1152000 - 20474
+
+fate-swr-resample_exact_lin-s32p-96000-44100: CMP_TARGET = 1.23
+fate-swr-resample_exact_lin-s32p-96000-44100: SIZE_TOLERANCE = 1152000 - 20480
+
+fate-swr-resample_exact_lin-s32p-96000-48000: CMP_TARGET = 0.99
+fate-swr-resample_exact_lin-s32p-96000-48000: SIZE_TOLERANCE = 1152000 - 20480
+
+fate-swr-resample_exact_lin-s32p-96000-8000: CMP_TARGET = 58.52
+fate-swr-resample_exact_lin-s32p-96000-8000: SIZE_TOLERANCE = 1152000 - 20496
+
 define ARESAMPLE_EXACT_LIN_ASYNC
 FATE_SWR_RESAMPLE += fate-swr-resample_exact_lin_async-$(3)-$(1)-$(2)
 fate-swr-resample_exact_lin_async-$(3)-$(1)-$(2): tests/data/asynth-$(1)-1.wav
@@ -903,10 +1072,10 @@  $(call CROSS_TEST,$(SAMPLERATES_LITE),ARESAMPLE_EXACT_ASYNC,s32p,s32le,s16)
 $(call CROSS_TEST,$(SAMPLERATES_LITE),ARESAMPLE_EXACT_ASYNC,fltp,f32le,s16)
 $(call CROSS_TEST,$(SAMPLERATES_LITE),ARESAMPLE_EXACT_ASYNC,dblp,f64le,s16)
 
-$(call CROSS_TEST,$(SAMPLERATES_LITE),ARESAMPLE_EXACT_LIN,s16p,s16le,s16)
-$(call CROSS_TEST,$(SAMPLERATES_LITE),ARESAMPLE_EXACT_LIN,s32p,s32le,s16)
-$(call CROSS_TEST,$(SAMPLERATES_LITE),ARESAMPLE_EXACT_LIN,fltp,f32le,s16)
-$(call CROSS_TEST,$(SAMPLERATES_LITE),ARESAMPLE_EXACT_LIN,dblp,f64le,s16)
+$(call CROSS_TEST,$(SAMPLERATES),ARESAMPLE_EXACT_LIN,s16p,s16le,s16)
+$(call CROSS_TEST,$(SAMPLERATES),ARESAMPLE_EXACT_LIN,s32p,s32le,s16)
+$(call CROSS_TEST,$(SAMPLERATES),ARESAMPLE_EXACT_LIN,fltp,f32le,s16)
+$(call CROSS_TEST,$(SAMPLERATES),ARESAMPLE_EXACT_LIN,dblp,f64le,s16)
 
 $(call CROSS_TEST,$(SAMPLERATES_LITE),ARESAMPLE_EXACT_LIN_ASYNC,s16p,s16le,s16)
 $(call CROSS_TEST,$(SAMPLERATES_LITE),ARESAMPLE_EXACT_LIN_ASYNC,s32p,s32le,s16)
diff --git a/tests/ref/acodec/s302m b/tests/ref/acodec/s302m
index 7e41abb..63e39ed 100644
--- a/tests/ref/acodec/s302m
+++ b/tests/ref/acodec/s302m
@@ -1,4 +1,4 @@ 
-a69563c4c5db97d1b313c2fd7a193dd4 *tests/data/fate/acodec-s302m.mpegts
+165d022ab86306d069797acff0c1e295 *tests/data/fate/acodec-s302m.mpegts
 1589164 tests/data/fate/acodec-s302m.mpegts
-2c033ed1d9029ed03e08c1d01dcefd99 *tests/data/fate/acodec-s302m.out.wav
-stddev:  986.98 PSNR: 36.44 MAXDIFF:18642 bytes:  1058400/  1056708
+31f25a0020fd9017de9c3c608316854b *tests/data/fate/acodec-s302m.out.wav
+stddev:  986.94 PSNR: 36.44 MAXDIFF:18571 bytes:  1058400/  1056708
diff --git a/tests/ref/lavf/dv_fmt b/tests/ref/lavf/dv_fmt
index c8e4b11..dac43b6 100644
--- a/tests/ref/lavf/dv_fmt
+++ b/tests/ref/lavf/dv_fmt
@@ -1,9 +1,9 @@ 
-3bcb02ee889b8b2da19cae79d0f1c27d *./tests/data/lavf/lavf.dv
+5a622e1ae4fd16bec59cd514380d7882 *./tests/data/lavf/lavf.dv
 3600000 ./tests/data/lavf/lavf.dv
-./tests/data/lavf/lavf.dv CRC=0x5a36cc70
-f827583ae54e590d753c37709738fd54 *./tests/data/lavf/lavf.dv
+./tests/data/lavf/lavf.dv CRC=0x0a6edbd8
+155e8fd4ea1196edd56ae9ff09edcf85 *./tests/data/lavf/lavf.dv
 3480000 ./tests/data/lavf/lavf.dv
-./tests/data/lavf/lavf.dv CRC=0x8f8074be
+./tests/data/lavf/lavf.dv CRC=0x3e5583fa
 87d3b20f656235671383a7eaa2f66330 *./tests/data/lavf/lavf.dv
 3600000 ./tests/data/lavf/lavf.dv
 ./tests/data/lavf/lavf.dv CRC=0xf3e6873c
diff --git a/tests/ref/lavf/gxf b/tests/ref/lavf/gxf
index 9b9831b..4dd463c 100644
--- a/tests/ref/lavf/gxf
+++ b/tests/ref/lavf/gxf
@@ -1,9 +1,9 @@ 
-1b384e20293a84b274739c147e2b290a *./tests/data/lavf/lavf.gxf
+6ef34e8bedf699cd1601022c4a0a4910 *./tests/data/lavf/lavf.gxf
 795876 ./tests/data/lavf/lavf.gxf
-./tests/data/lavf/lavf.gxf CRC=0x55b3ec1d
-411f109b5867e5cb81bc876d3cc5702b *./tests/data/lavf/lavf.gxf
+./tests/data/lavf/lavf.gxf CRC=0x1dbfef76
+7780c428dde2c93a9ff04794f7168440 *./tests/data/lavf/lavf.gxf
 794656 ./tests/data/lavf/lavf.gxf
-./tests/data/lavf/lavf.gxf CRC=0x0d7e90ea
+./tests/data/lavf/lavf.gxf CRC=0xdcd39443
 0638c4d073ac224608baaba16732b68f *./tests/data/lavf/lavf.gxf
 795876 ./tests/data/lavf/lavf.gxf
 ./tests/data/lavf/lavf.gxf CRC=0x5ade0285
diff --git a/tests/ref/lavf/mxf b/tests/ref/lavf/mxf
index aea9c02..48fe95a 100644
--- a/tests/ref/lavf/mxf
+++ b/tests/ref/lavf/mxf
@@ -1,9 +1,9 @@ 
-2fd59c174dfb213d35e86dea63c0fb13 *./tests/data/lavf/lavf.mxf
+eaac3125ac1a61fe5f968c7af83fa71e *./tests/data/lavf/lavf.mxf
 525369 ./tests/data/lavf/lavf.mxf
-./tests/data/lavf/lavf.mxf CRC=0x9fd3f752
-edb3b610c301362d7b4c12f06f8d2782 *./tests/data/lavf/lavf.mxf
+./tests/data/lavf/lavf.mxf CRC=0x8dddfaab
+1562530330b13e9e70f522fe20265632 *./tests/data/lavf/lavf.mxf
 560697 ./tests/data/lavf/lavf.mxf
-./tests/data/lavf/lavf.mxf CRC=0xc51717ef
-a6ba421f38ee5ec46e181225c632fee4 *./tests/data/lavf/lavf.mxf
+./tests/data/lavf/lavf.mxf CRC=0xf21b1b48
+e07858715997313ae66a1cdd6fde5f66 *./tests/data/lavf/lavf.mxf
 525369 ./tests/data/lavf/lavf.mxf
-./tests/data/lavf/lavf.mxf CRC=0x9fd3f752
+./tests/data/lavf/lavf.mxf CRC=0x8dddfaab