[FFmpeg-devel] lswr: remove support for libsoxr resampling

Submitted by Rostislav Pehlivanov on March 6, 2017, 3:19 a.m.

Details

Message ID 20170306031948.20033-1-atomnuker@gmail.com
State New
Headers show

Commit Message

Rostislav Pehlivanov March 6, 2017, 3:19 a.m.
The soxr resampler is slower and worse than the swr resampler,
hence drop the former.

Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
---
 Changelog                           |   1 +
 MAINTAINERS                         |   1 -
 configure                           |   5 +-
 doc/resampler.texi                  |  53 ++++-----------
 libswresample/Makefile              |   1 -
 libswresample/options.c             |   7 --
 libswresample/resample.c            |   2 +-
 libswresample/soxr_resample.c       | 130 ------------------------------------
 libswresample/swresample.c          |  18 +----
 libswresample/swresample.h          |   7 --
 libswresample/swresample_internal.h |   9 +--
 11 files changed, 21 insertions(+), 213 deletions(-)
 delete mode 100644 libswresample/soxr_resample.c

Comments

Lou Logan March 6, 2017, 4:41 a.m.
On Sun, Mar 5, 2017, at 06:19 PM, Rostislav Pehlivanov wrote:
> The soxr resampler is slower and worse than the swr resampler,
> hence drop the former.

Can you explain what you mean by "worse"? Not that I don't trust your
judgment, but I'm just curious.
James Almer March 6, 2017, 5:15 a.m.
On 3/6/2017 12:19 AM, Rostislav Pehlivanov wrote:
> The soxr resampler is slower and worse than the swr resampler,
> hence drop the former.
> 
> Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
> ---
>  Changelog                           |   1 +
>  MAINTAINERS                         |   1 -
>  configure                           |   5 +-
>  doc/resampler.texi                  |  53 ++++-----------
>  libswresample/Makefile              |   1 -
>  libswresample/options.c             |   7 --
>  libswresample/resample.c            |   2 +-
>  libswresample/soxr_resample.c       | 130 ------------------------------------
>  libswresample/swresample.c          |  18 +----
>  libswresample/swresample.h          |   7 --
>  libswresample/swresample_internal.h |   9 +--
>  11 files changed, 21 insertions(+), 213 deletions(-)
>  delete mode 100644 libswresample/soxr_resample.c
> 

Crashes doing about anything with libswr, like for example "make fate-swr"

[...]

> diff --git a/libswresample/options.c b/libswresample/options.c
> index 4abf5e0518..b450d28475 100644
> --- a/libswresample/options.c
> +++ b/libswresample/options.c
> @@ -91,13 +91,6 @@ static const AVOption options[]={
>  /* duplicate option in order to work with avconv */
>  {"resample_cutoff"      , "set cutoff frequency ratio"  , OFFSET(cutoff)         , AV_OPT_TYPE_DOUBLE,{.dbl=0.                    }, 0      , 1         , PARAM },
>  
> -{"resampler"            , "set resampling Engine"       , OFFSET(engine)         , AV_OPT_TYPE_INT  , {.i64=0                     }, 0      , SWR_ENGINE_NB-1, PARAM, "resampler"},
> -{"swr"                  , "select SW Resampler"         , 0                      , AV_OPT_TYPE_CONST, {.i64=SWR_ENGINE_SWR        }, INT_MIN, INT_MAX   , PARAM, "resampler"},
> -{"soxr"                 , "select SoX Resampler"        , 0                      , AV_OPT_TYPE_CONST, {.i64=SWR_ENGINE_SOXR       }, INT_MIN, INT_MAX   , PARAM, "resampler"},
> -{"precision"            , "set soxr resampling precision (in bits)"
> -                                                        , OFFSET(precision)      , AV_OPT_TYPE_DOUBLE,{.dbl=20.0                  }, 15.0   , 33.0      , PARAM },
> -{"cheby"                , "enable soxr Chebyshev passband & higher-precision irrational ratio approximation"
> -                                                        , OFFSET(cheby)          , AV_OPT_TYPE_BOOL , {.i64=0                     }, 0      , 1         , PARAM },

Public options, need to be deprecated before removal.

> diff --git a/libswresample/swresample.c b/libswresample/swresample.c
> index dea61391ac..de46118d86 100644
> --- a/libswresample/swresample.c
> +++ b/libswresample/swresample.c
> @@ -133,7 +133,6 @@ static void clear_context(SwrContext *s){
>      swri_audio_convert_free(&s->full_convert);
>      swri_rematrix_free(s);
>  
> -    s->delayed_samples_fixup = 0;
>      s->flushed = 0;
>  }
>  
> @@ -188,16 +187,6 @@ av_cold int swr_init(struct SwrContext *s){
>          s->out_ch_layout = 0;
>      }
>  
> -    switch(s->engine){
> -#if CONFIG_LIBSOXR
> -        case SWR_ENGINE_SOXR: s->resampler = &swri_soxr_resampler; break;
> -#endif
> -        case SWR_ENGINE_SWR : s->resampler = &swri_resampler; break;
> -        default:
> -            av_log(s, AV_LOG_ERROR, "Requested resampling engine is unavailable\n");
> -            return AVERROR(EINVAL);
> -    }
> -
>      if(!s->used_ch_count)
>          s->used_ch_count= s->in.ch_count;
>  
> @@ -225,8 +214,7 @@ av_cold int swr_init(struct SwrContext *s){
>              s->int_sample_fmt= AV_SAMPLE_FMT_S16P;
>          }else if(   av_get_planar_sample_fmt(s-> in_sample_fmt) == AV_SAMPLE_FMT_S32P
>                   && av_get_planar_sample_fmt(s->out_sample_fmt) == AV_SAMPLE_FMT_S32P
> -                 && !s->rematrix
> -                 && s->engine != SWR_ENGINE_SOXR){
> +                 && !s->rematrix){
>              s->int_sample_fmt= AV_SAMPLE_FMT_S32P;
>          }else if(av_get_bytes_per_sample(s->in_sample_fmt) <= 4){
>              s->int_sample_fmt= AV_SAMPLE_FMT_FLTP;
> @@ -265,7 +253,7 @@ av_cold int swr_init(struct SwrContext *s){
>      }
>  
>      if (s->out_sample_rate!=s->in_sample_rate || (s->flags & SWR_FLAG_RESAMPLE)){
> -        s->resample = s->resampler->init(s->resample, s->out_sample_rate, s->in_sample_rate, s->filter_size, s->phase_shift, s->linear_interp, s->cutoff, s->int_sample_fmt, s->filter_type, s->kaiser_beta, s->precision, s->cheby, s->exact_rational);
> +        s->resample = s->resampler->init(s->resample, s->out_sample_rate, s->in_sample_rate, s->filter_size, s->phase_shift, s->linear_interp, s->cutoff, s->int_sample_fmt, s->filter_type, s->kaiser_beta, s->exact_rational);

s->resampler is NULL here after the chunk removed above. Most assuredly
the source of the crashes.

>          if (!s->resample) {
>              av_log(s, AV_LOG_ERROR, "Failed to initialize resampler\n");
>              return AVERROR(ENOMEM);
> @@ -482,7 +470,7 @@ static int resample(SwrContext *s, AudioData *out_param, int out_count,
>      AudioData in, out, tmp;
>      int ret_sum=0;
>      int border=0;
> -    int padless = ARCH_X86 && s->engine == SWR_ENGINE_SWR ? 7 : 0;
> +    int padless = ARCH_X86 && 7;

ARCH_X86 ? 7 : 0; is more readable.

>  
>      av_assert1(s->in_buffer.ch_count == in_param->ch_count);
>      av_assert1(s->in_buffer.planar   == in_param->planar);
> diff --git a/libswresample/swresample.h b/libswresample/swresample.h
> index a8db5c2490..f63e3aea85 100644
> --- a/libswresample/swresample.h
> +++ b/libswresample/swresample.h
> @@ -159,13 +159,6 @@ enum SwrDitherType {
>      SWR_DITHER_NB,              ///< not part of API/ABI
>  };
>  
> -/** Resampling Engines */
> -enum SwrEngine {
> -    SWR_ENGINE_SWR,             /**< SW Resampler */
> -    SWR_ENGINE_SOXR,            /**< SoX Resampler */
> -    SWR_ENGINE_NB,              ///< not part of API/ABI
> -};

This is a public header, you can't remove this without a deprecation
period.

Keep the public facing enums and options, but remove all the internal
changes introduced to accommodate soxr (struct Resampler and related
function pointers, etc).
Choosing SWR_ENGINE_SOXR should still give an error and bail out.

> -
>  /** Resampling Filter Types */
>  enum SwrFilterType {
>      SWR_FILTER_TYPE_CUBIC,              /**< Cubic */
> diff --git a/libswresample/swresample_internal.h b/libswresample/swresample_internal.h
> index f2ea5a226d..7296d2b9fe 100644
> --- a/libswresample/swresample_internal.h
> +++ b/libswresample/swresample_internal.h
> @@ -69,7 +69,7 @@ struct DitherContext {
>  };
>  
>  typedef struct ResampleContext * (* resample_init_func)(struct ResampleContext *c, int out_rate, int in_rate, int filter_size, int phase_shift, int linear,
> -                                    double cutoff, enum AVSampleFormat format, enum SwrFilterType filter_type, double kaiser_beta, double precision, int cheby, int exact_rational);
> +                                    double cutoff, enum AVSampleFormat format, enum SwrFilterType filter_type, double kaiser_beta, int exact_rational);
>  typedef void    (* resample_free_func)(struct ResampleContext **c);
>  typedef int     (* multiple_resample_func)(struct ResampleContext *c, AudioData *dst, int dst_size, AudioData *src, int src_size, int *consumed);
>  typedef int     (* resample_flush_func)(struct SwrContext *c);
> @@ -89,9 +89,6 @@ struct Resampler {
>    get_out_samples_func          get_out_samples;
>  };
>  
> -extern struct Resampler const swri_resampler;
> -extern struct Resampler const swri_soxr_resampler;
> -
>  struct SwrContext {
>      const AVClass *av_class;                        ///< AVClass used for AVOption and av_log()
>      int log_level_offset;                           ///< logging level offset
> @@ -112,7 +109,6 @@ struct SwrContext {
>      int matrix_encoding;                            /**< matrixed stereo encoding */
>      const int *channel_map;                         ///< channel index (or -1 if muted channel) map
>      int used_ch_count;                              ///< number of used input channels (mapped channel count if channel_map, otherwise in.ch_count)
> -    int engine;
>  
>      int user_in_ch_count;                           ///< User set input channel count
>      int user_out_ch_count;                          ///< User set output channel count
> @@ -131,8 +127,6 @@ struct SwrContext {
>      double cutoff;                                  /**< resampling cutoff frequency (swr: 6dB point; soxr: 0dB point). 1.0 corresponds to half the output sample rate */
>      int filter_type;                                /**< swr resampling filter type */
>      double kaiser_beta;                                /**< swr beta value for Kaiser window (only applicable if filter_type == AV_FILTER_TYPE_KAISER) */
> -    double precision;                               /**< soxr resampling precision (in bits) */
> -    int cheby;                                      /**< soxr: if 1 then passband rolloff will be none (Chebyshev) & irrational ratio approximation precision will be higher */
>  
>      float min_compensation;                         ///< swr minimum below which no compensation will happen
>      float min_hard_compensation;                    ///< swr minimum below which no silence inject / sample drop will happen
> @@ -160,7 +154,6 @@ struct SwrContext {
>      int64_t outpts;                                 ///< output PTS
>      int64_t firstpts;                               ///< first PTS
>      int drop_output;                                ///< number of output samples to drop
> -    double delayed_samples_fixup;                   ///< soxr 0.1.1: needed to fixup delayed_samples after flush has been called.
>  
>      struct AudioConvert *in_convert;                ///< input conversion context
>      struct AudioConvert *out_convert;               ///< output conversion context
>
Paul B Mahol March 6, 2017, 9:23 a.m.
On 3/6/17, Rostislav Pehlivanov <atomnuker@gmail.com> wrote:
> The soxr resampler is slower and worse than the swr resampler,
> hence drop the former.

Why you think its worse? There are some popular tests with all
resampleres being tested and I can confirm that swr defaults are
hardly better than soxr defaults.
Michael Niedermayer March 6, 2017, 12:55 p.m.
On Mon, Mar 06, 2017 at 03:19:48AM +0000, Rostislav Pehlivanov wrote:
> The soxr resampler is slower and worse than the swr resampler,
> hence drop the former.
> 
> Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
> ---
>  Changelog                           |   1 +
>  MAINTAINERS                         |   1 -
>  configure                           |   5 +-
>  doc/resampler.texi                  |  53 ++++-----------
>  libswresample/Makefile              |   1 -
>  libswresample/options.c             |   7 --
>  libswresample/resample.c            |   2 +-
>  libswresample/soxr_resample.c       | 130 ------------------------------------
>  libswresample/swresample.c          |  18 +----
>  libswresample/swresample.h          |   7 --
>  libswresample/swresample_internal.h |   9 +--
>  11 files changed, 21 insertions(+), 213 deletions(-)
>  delete mode 100644 libswresample/soxr_resample.c

the way soxr resamples is different from how swr implements it, that
could result in different advantages and disadvantages.
I would expect "which is better" to depend on what is meassured

i also think this should be CC-ed to rob, thus adding him to CC

[...]
Rob Sykes March 6, 2017, 3:52 p.m.
On Mon, Mar 06, 2017 at 03:19:48AM +0000, Rostislav Pehlivanov wrote:


> The soxr resampler is slower and worse than the swr resampler,
> hence drop the former.
With git master of ffmpeg and libsoxr 0.1.1, using default parameters, on x86, soxr is indeed a little slower than swr; however many would consider soxr’s quality (w.r.t. aliasing artefacts etc.) to be much higher—see attached image.   IIRC, when resampling with other options (such as using a ‘steep’ filter), soxr (0.1.1) is faster than swr.
These relative merits formed the basis for including soxr originally and are unchanged AFAIK.
Btw, testing using git master of libsoxr shows soxr to be faster than swr even with default parameters.

Patch hide | download patch | download mbox

diff --git a/Changelog b/Changelog
index 88e188bacb..e90c58b2b2 100644
--- a/Changelog
+++ b/Changelog
@@ -2,6 +2,7 @@  Entries are sorted chronologically from oldest to youngest within each release,
 releases are sorted from youngest to oldest.
 
 version <next>:
+- Removed the soxr support for libswresample (the swr engine is better)
 - Removed asyncts filter (use af_aresample instead)
 - CrystalHD decoder moved to new decode API
 - add internal ebur128 library, remove external libebur128 dependency
diff --git a/MAINTAINERS b/MAINTAINERS
index 6b17b13187..c33a976411 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -510,7 +510,6 @@  Generic parts:
 
 Resamplers:
   resample*.c                           Michael Niedermayer
-  soxr_resample.c                       Rob Sykes
 
 
 Operating systems / CPU architectures
diff --git a/configure b/configure
index a307ed81b6..97570048c8 100755
--- a/configure
+++ b/configure
@@ -250,7 +250,6 @@  External library support:
   --enable-libshine        enable fixed-point MP3 encoding via libshine [no]
   --enable-libsmbclient    enable Samba protocol via libsmbclient [no]
   --enable-libsnappy       enable Snappy compression, needed for hap encoding [no]
-  --enable-libsoxr         enable Include libsoxr resampling [no]
   --enable-libspeex        enable Speex de/encoding via libspeex [no]
   --enable-libssh          enable SFTP protocol via libssh [no]
   --enable-libtesseract    enable Tesseract, needed for ocr filter [no]
@@ -1557,7 +1556,6 @@  EXTERNAL_LIBRARY_LIST="
     libshine
     libsmbclient
     libsnappy
-    libsoxr
     libspeex
     libssh
     libtesseract
@@ -5796,7 +5794,6 @@  enabled libshine          && require_pkg_config shine shine/layer3.h shine_encod
 enabled libsmbclient      && { use_pkg_config smbclient libsmbclient.h smbc_init ||
                                require smbclient libsmbclient.h smbc_init -lsmbclient; }
 enabled libsnappy         && require snappy snappy-c.h snappy_compress -lsnappy
-enabled libsoxr           && require libsoxr soxr.h soxr_create -lsoxr && LIBSOXR="-lsoxr"
 enabled libssh            && require_pkg_config libssh libssh/sftp.h sftp_init
 enabled libspeex          && require_pkg_config speex speex/speex.h speex_decoder_init -lspeex
 enabled libtesseract      && require_pkg_config tesseract tesseract/capi.h TessBaseAPICreate
@@ -6926,4 +6923,4 @@  pkgconfig_generate libavfilter   "FFmpeg audio/video filtering library" "$LIBAVF
 pkgconfig_generate libpostproc   "FFmpeg postprocessing library"        "$LIBPOSTPROC_VERSION"   ""
 pkgconfig_generate libavresample "Libav audio resampling library"       "$LIBAVRESAMPLE_VERSION" "$LIBM"
 pkgconfig_generate libswscale    "FFmpeg image rescaling library"       "$LIBSWSCALE_VERSION"    "$LIBM"
-pkgconfig_generate libswresample "FFmpeg audio resampling library"      "$LIBSWRESAMPLE_VERSION" "$LIBM $LIBSOXR"
+pkgconfig_generate libswresample "FFmpeg audio resampling library"      "$LIBSWRESAMPLE_VERSION" "$LIBM"
diff --git a/doc/resampler.texi b/doc/resampler.texi
index d72677c915..3038cd3d04 100644
--- a/doc/resampler.texi
+++ b/doc/resampler.texi
@@ -110,52 +110,27 @@  select improved-e-weighted noise shaping dither
 
 @end table
 
-@item resampler
-Set resampling engine. Default value is swr.
-
-Supported values:
-@table @samp
-@item swr
-select the native SW Resampler; filter options precision and cheby are not
-applicable in this case.
-@item soxr
-select the SoX Resampler (where available); compensation, and filter options
-filter_size, phase_shift, exact_rational, filter_type & kaiser_beta, are not
-applicable in this case.
-@end table
-
 @item filter_size
-For swr only, set resampling filter size, default value is 32.
+Set resampling filter size, default value is 32.
 
 @item phase_shift
-For swr only, set resampling phase shift, default value is 10, and must be in
+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.
 
 @item exact_rational
-For swr only, when enabled, try to use exact phase_count based on input and
+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.
 
 @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.97 with swr, and 0.91 with soxr
-(which, with a sample-rate of 44100, preserves the entire audio band to 20kHz).
-
-@item precision
-For soxr only, the precision in bits to which the resampled signal will be
-calculated.  The default value of 20 (which, with suitable dithering, is
-appropriate for a destination bit-depth of 16) gives SoX's 'High Quality'; a
-value of 28 gives SoX's 'Very High Quality'.
-
-@item cheby
-For soxr only, selects passband rolloff none (Chebyshev) & higher-precision
-approximation for 'irrational' ratios. Default value is 0.
+Set cutoff frequency (6dB point) ratio; must be a float value between 0 and 1.
+Default value is 0.97.
 
 @item async
-For swr only, simple 1 parameter audio sync to timestamps using stretching,
+Simple 1 parameter audio sync to timestamps using stretching,
 squeezing, filling and trimming. Setting this to 1 will enable filling and
 trimming, larger values represent the maximum amount in samples that the data
 may be stretched or squeezed for each second.
@@ -163,7 +138,7 @@  Default value is 0, thus no compensation is applied to make the samples match
 the audio timestamps.
 
 @item first_pts
-For swr only, assume the first pts should be this value. The time unit is 1 / sample rate.
+Assume the first pts should be this value. The time unit is 1 / sample rate.
 This allows for padding/trimming at the start of stream. By default, no
 assumption is made about the first frame's expected pts, so no padding or
 trimming is done. For example, this could be set to 0 to pad the beginning with
@@ -171,14 +146,14 @@  silence if an audio stream starts after the video stream or to trim any samples
 with a negative pts due to encoder delay.
 
 @item min_comp
-For swr only, set the minimum difference between timestamps and audio data (in
+Set the minimum difference between timestamps and audio data (in
 seconds) to trigger stretching/squeezing/filling or trimming of the
 data to make it match the timestamps. The default is that
 stretching/squeezing/filling and trimming is disabled
 (@option{min_comp} = @code{FLT_MAX}).
 
 @item min_hard_comp
-For swr only, set the minimum difference between timestamps and audio data (in
+Set the minimum difference between timestamps and audio data (in
 seconds) to trigger adding/dropping samples to make it match the
 timestamps.  This option effectively is a threshold to select between
 hard (trim/fill) and soft (squeeze/stretch) compensation. Note that
@@ -186,12 +161,12 @@  all compensation is by default disabled through @option{min_comp}.
 The default is 0.1.
 
 @item comp_duration
-For swr only, set duration (in seconds) over which data is stretched/squeezed
+Set duration (in seconds) over which data is stretched/squeezed
 to make it match the timestamps. Must be a non-negative double float value,
 default value is 1.0.
 
 @item max_soft_comp
-For swr only, set maximum factor by which data is stretched/squeezed to make it
+Set maximum factor by which data is stretched/squeezed to make it
 match the timestamps. Must be a non-negative double float value, default value
 is 0.
 
@@ -211,7 +186,7 @@  select Dolby Pro Logic II
 Default value is @code{none}.
 
 @item filter_type
-For swr only, select resampling filter type. This only affects resampling
+Select resampling filter type. This only affects resampling
 operations.
 
 It accepts the following values:
@@ -225,11 +200,11 @@  select Kaiser windowed sinc
 @end table
 
 @item kaiser_beta
-For swr only, set Kaiser window beta value. Must be a double float value in the
+Set Kaiser window beta value. Must be a double float value in the
 interval [2,16], default value is 9.
 
 @item output_sample_bits
-For swr only, set number of used output sample bits for dithering. Must be an integer in the
+Set number of used output sample bits for dithering. Must be an integer in the
 interval [0,64], default value is 0, which means it's not used.
 
 @end table
diff --git a/libswresample/Makefile b/libswresample/Makefile
index 120ee3385d..83840cb32f 100644
--- a/libswresample/Makefile
+++ b/libswresample/Makefile
@@ -15,7 +15,6 @@  OBJS = audioconvert.o                        \
        swresample.o                          \
        swresample_frame.o                    \
 
-OBJS-$(CONFIG_LIBSOXR) += soxr_resample.o
 OBJS-$(CONFIG_SHARED)  += log2_tab.o
 
 # Windows resource file
diff --git a/libswresample/options.c b/libswresample/options.c
index 4abf5e0518..b450d28475 100644
--- a/libswresample/options.c
+++ b/libswresample/options.c
@@ -91,13 +91,6 @@  static const AVOption options[]={
 /* duplicate option in order to work with avconv */
 {"resample_cutoff"      , "set cutoff frequency ratio"  , OFFSET(cutoff)         , AV_OPT_TYPE_DOUBLE,{.dbl=0.                    }, 0      , 1         , PARAM },
 
-{"resampler"            , "set resampling Engine"       , OFFSET(engine)         , AV_OPT_TYPE_INT  , {.i64=0                     }, 0      , SWR_ENGINE_NB-1, PARAM, "resampler"},
-{"swr"                  , "select SW Resampler"         , 0                      , AV_OPT_TYPE_CONST, {.i64=SWR_ENGINE_SWR        }, INT_MIN, INT_MAX   , PARAM, "resampler"},
-{"soxr"                 , "select SoX Resampler"        , 0                      , AV_OPT_TYPE_CONST, {.i64=SWR_ENGINE_SOXR       }, INT_MIN, INT_MAX   , PARAM, "resampler"},
-{"precision"            , "set soxr resampling precision (in bits)"
-                                                        , OFFSET(precision)      , AV_OPT_TYPE_DOUBLE,{.dbl=20.0                  }, 15.0   , 33.0      , PARAM },
-{"cheby"                , "enable soxr Chebyshev passband & higher-precision irrational ratio approximation"
-                                                        , OFFSET(cheby)          , AV_OPT_TYPE_BOOL , {.i64=0                     }, 0      , 1         , PARAM },
 {"min_comp"             , "set minimum difference between timestamps and audio data (in seconds) below which no timestamp compensation of either kind is applied"
                                                         , OFFSET(min_compensation),AV_OPT_TYPE_FLOAT ,{.dbl=FLT_MAX               }, 0      , FLT_MAX   , PARAM },
 {"min_hard_comp"        , "set minimum difference between timestamps and audio data (in seconds) to trigger padding/trimming the data."
diff --git a/libswresample/resample.c b/libswresample/resample.c
index 8e2f76901a..64c448dda6 100644
--- a/libswresample/resample.c
+++ b/libswresample/resample.c
@@ -302,7 +302,7 @@  fail:
 
 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, double kaiser_beta,
-                                    double precision, int cheby, int exact_rational)
+                                    int exact_rational)
 {
     double cutoff = cutoff0? cutoff0 : 0.97;
     double factor= FFMIN(out_rate * cutoff / in_rate, 1.0);
diff --git a/libswresample/soxr_resample.c b/libswresample/soxr_resample.c
deleted file mode 100644
index 8181c749b8..0000000000
--- a/libswresample/soxr_resample.c
+++ /dev/null
@@ -1,130 +0,0 @@ 
-/*
- * audio resampling with soxr
- * Copyright (c) 2012 Rob Sykes <robs@users.sourceforge.net>
- *
- * This file is part of FFmpeg.
- *
- * FFmpeg is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * FFmpeg is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-/**
- * @file
- * audio resampling with soxr
- */
-
-#include "libavutil/log.h"
-#include "swresample_internal.h"
-
-#include <soxr.h>
-
-static struct ResampleContext *create(struct ResampleContext *c, int out_rate, int in_rate, int filter_size, int phase_shift, int linear,
-        double cutoff, enum AVSampleFormat format, enum SwrFilterType filter_type, double kaiser_beta, double precision, int cheby, int exact_rational){
-    soxr_error_t error;
-
-    soxr_datatype_t type =
-        format == AV_SAMPLE_FMT_S16P? SOXR_INT16_S :
-        format == AV_SAMPLE_FMT_S16 ? SOXR_INT16_I :
-        format == AV_SAMPLE_FMT_S32P? SOXR_INT32_S :
-        format == AV_SAMPLE_FMT_S32 ? SOXR_INT32_I :
-        format == AV_SAMPLE_FMT_FLTP? SOXR_FLOAT32_S :
-        format == AV_SAMPLE_FMT_FLT ? SOXR_FLOAT32_I :
-        format == AV_SAMPLE_FMT_DBLP? SOXR_FLOAT64_S :
-        format == AV_SAMPLE_FMT_DBL ? SOXR_FLOAT64_I : (soxr_datatype_t)-1;
-
-    soxr_io_spec_t io_spec = soxr_io_spec(type, type);
-
-    soxr_quality_spec_t q_spec = soxr_quality_spec((int)((precision-2)/4), (SOXR_HI_PREC_CLOCK|SOXR_ROLLOFF_NONE)*!!cheby);
-    q_spec.precision = precision;
-#if !defined SOXR_VERSION /* Deprecated @ March 2013: */
-    q_spec.bw_pc = cutoff? FFMAX(FFMIN(cutoff,.995),.8)*100 : q_spec.bw_pc;
-#else
-    q_spec.passband_end = cutoff? FFMAX(FFMIN(cutoff,.995),.8) : q_spec.passband_end;
-#endif
-
-    soxr_delete((soxr_t)c);
-    c = (struct ResampleContext *)
-        soxr_create(in_rate, out_rate, 0, &error, &io_spec, &q_spec, 0);
-    if (!c)
-        av_log(NULL, AV_LOG_ERROR, "soxr_create: %s\n", error);
-    return c;
-}
-
-static void destroy(struct ResampleContext * *c){
-    soxr_delete((soxr_t)*c);
-    *c = NULL;
-}
-
-static int flush(struct SwrContext *s){
-    s->delayed_samples_fixup = soxr_delay((soxr_t)s->resample);
-
-    soxr_process((soxr_t)s->resample, NULL, 0, NULL, NULL, 0, NULL);
-
-    {
-        float f;
-        size_t idone, odone;
-        soxr_process((soxr_t)s->resample, &f, 0, &idone, &f, 0, &odone);
-        s->delayed_samples_fixup -= soxr_delay((soxr_t)s->resample);
-    }
-
-    return 0;
-}
-
-static int process(
-        struct ResampleContext * c, AudioData *dst, int dst_size,
-        AudioData *src, int src_size, int *consumed){
-    size_t idone, odone;
-    soxr_error_t error = soxr_set_error((soxr_t)c, soxr_set_num_channels((soxr_t)c, src->ch_count));
-    if (!error)
-        error = soxr_process((soxr_t)c, src->ch, (size_t)src_size,
-                             &idone, dst->ch, (size_t)dst_size, &odone);
-    else
-        idone = 0;
-
-    *consumed = (int)idone;
-    return error? -1 : odone;
-}
-
-static int64_t get_delay(struct SwrContext *s, int64_t base){
-    double delayed_samples = soxr_delay((soxr_t)s->resample);
-    double delay_s;
-
-    if (s->flushed)
-        delayed_samples += s->delayed_samples_fixup;
-
-    delay_s = delayed_samples / s->out_sample_rate;
-
-    return (int64_t)(delay_s * base + .5);
-}
-
-static int invert_initial_buffer(struct ResampleContext *c, AudioData *dst, const AudioData *src,
-                                 int in_count, int *out_idx, int *out_sz){
-    return 0;
-}
-
-static int64_t get_out_samples(struct SwrContext *s, int in_samples){
-    double out_samples = (double)s->out_sample_rate / s->in_sample_rate * in_samples;
-    double delayed_samples = soxr_delay((soxr_t)s->resample);
-
-    if (s->flushed)
-        delayed_samples += s->delayed_samples_fixup;
-
-    return (int64_t)(out_samples + delayed_samples + 1 + .5);
-}
-
-struct Resampler const swri_soxr_resampler={
-    create, destroy, process, flush, NULL /* set_compensation */, get_delay,
-    invert_initial_buffer, get_out_samples
-};
-
diff --git a/libswresample/swresample.c b/libswresample/swresample.c
index dea61391ac..de46118d86 100644
--- a/libswresample/swresample.c
+++ b/libswresample/swresample.c
@@ -133,7 +133,6 @@  static void clear_context(SwrContext *s){
     swri_audio_convert_free(&s->full_convert);
     swri_rematrix_free(s);
 
-    s->delayed_samples_fixup = 0;
     s->flushed = 0;
 }
 
@@ -188,16 +187,6 @@  av_cold int swr_init(struct SwrContext *s){
         s->out_ch_layout = 0;
     }
 
-    switch(s->engine){
-#if CONFIG_LIBSOXR
-        case SWR_ENGINE_SOXR: s->resampler = &swri_soxr_resampler; break;
-#endif
-        case SWR_ENGINE_SWR : s->resampler = &swri_resampler; break;
-        default:
-            av_log(s, AV_LOG_ERROR, "Requested resampling engine is unavailable\n");
-            return AVERROR(EINVAL);
-    }
-
     if(!s->used_ch_count)
         s->used_ch_count= s->in.ch_count;
 
@@ -225,8 +214,7 @@  av_cold int swr_init(struct SwrContext *s){
             s->int_sample_fmt= AV_SAMPLE_FMT_S16P;
         }else if(   av_get_planar_sample_fmt(s-> in_sample_fmt) == AV_SAMPLE_FMT_S32P
                  && av_get_planar_sample_fmt(s->out_sample_fmt) == AV_SAMPLE_FMT_S32P
-                 && !s->rematrix
-                 && s->engine != SWR_ENGINE_SOXR){
+                 && !s->rematrix){
             s->int_sample_fmt= AV_SAMPLE_FMT_S32P;
         }else if(av_get_bytes_per_sample(s->in_sample_fmt) <= 4){
             s->int_sample_fmt= AV_SAMPLE_FMT_FLTP;
@@ -265,7 +253,7 @@  av_cold int swr_init(struct SwrContext *s){
     }
 
     if (s->out_sample_rate!=s->in_sample_rate || (s->flags & SWR_FLAG_RESAMPLE)){
-        s->resample = s->resampler->init(s->resample, s->out_sample_rate, s->in_sample_rate, s->filter_size, s->phase_shift, s->linear_interp, s->cutoff, s->int_sample_fmt, s->filter_type, s->kaiser_beta, s->precision, s->cheby, s->exact_rational);
+        s->resample = s->resampler->init(s->resample, s->out_sample_rate, s->in_sample_rate, s->filter_size, s->phase_shift, s->linear_interp, s->cutoff, s->int_sample_fmt, s->filter_type, s->kaiser_beta, s->exact_rational);
         if (!s->resample) {
             av_log(s, AV_LOG_ERROR, "Failed to initialize resampler\n");
             return AVERROR(ENOMEM);
@@ -482,7 +470,7 @@  static int resample(SwrContext *s, AudioData *out_param, int out_count,
     AudioData in, out, tmp;
     int ret_sum=0;
     int border=0;
-    int padless = ARCH_X86 && s->engine == SWR_ENGINE_SWR ? 7 : 0;
+    int padless = ARCH_X86 && 7;
 
     av_assert1(s->in_buffer.ch_count == in_param->ch_count);
     av_assert1(s->in_buffer.planar   == in_param->planar);
diff --git a/libswresample/swresample.h b/libswresample/swresample.h
index a8db5c2490..f63e3aea85 100644
--- a/libswresample/swresample.h
+++ b/libswresample/swresample.h
@@ -159,13 +159,6 @@  enum SwrDitherType {
     SWR_DITHER_NB,              ///< not part of API/ABI
 };
 
-/** Resampling Engines */
-enum SwrEngine {
-    SWR_ENGINE_SWR,             /**< SW Resampler */
-    SWR_ENGINE_SOXR,            /**< SoX Resampler */
-    SWR_ENGINE_NB,              ///< not part of API/ABI
-};
-
 /** Resampling Filter Types */
 enum SwrFilterType {
     SWR_FILTER_TYPE_CUBIC,              /**< Cubic */
diff --git a/libswresample/swresample_internal.h b/libswresample/swresample_internal.h
index f2ea5a226d..7296d2b9fe 100644
--- a/libswresample/swresample_internal.h
+++ b/libswresample/swresample_internal.h
@@ -69,7 +69,7 @@  struct DitherContext {
 };
 
 typedef struct ResampleContext * (* resample_init_func)(struct ResampleContext *c, int out_rate, int in_rate, int filter_size, int phase_shift, int linear,
-                                    double cutoff, enum AVSampleFormat format, enum SwrFilterType filter_type, double kaiser_beta, double precision, int cheby, int exact_rational);
+                                    double cutoff, enum AVSampleFormat format, enum SwrFilterType filter_type, double kaiser_beta, int exact_rational);
 typedef void    (* resample_free_func)(struct ResampleContext **c);
 typedef int     (* multiple_resample_func)(struct ResampleContext *c, AudioData *dst, int dst_size, AudioData *src, int src_size, int *consumed);
 typedef int     (* resample_flush_func)(struct SwrContext *c);
@@ -89,9 +89,6 @@  struct Resampler {
   get_out_samples_func          get_out_samples;
 };
 
-extern struct Resampler const swri_resampler;
-extern struct Resampler const swri_soxr_resampler;
-
 struct SwrContext {
     const AVClass *av_class;                        ///< AVClass used for AVOption and av_log()
     int log_level_offset;                           ///< logging level offset
@@ -112,7 +109,6 @@  struct SwrContext {
     int matrix_encoding;                            /**< matrixed stereo encoding */
     const int *channel_map;                         ///< channel index (or -1 if muted channel) map
     int used_ch_count;                              ///< number of used input channels (mapped channel count if channel_map, otherwise in.ch_count)
-    int engine;
 
     int user_in_ch_count;                           ///< User set input channel count
     int user_out_ch_count;                          ///< User set output channel count
@@ -131,8 +127,6 @@  struct SwrContext {
     double cutoff;                                  /**< resampling cutoff frequency (swr: 6dB point; soxr: 0dB point). 1.0 corresponds to half the output sample rate */
     int filter_type;                                /**< swr resampling filter type */
     double kaiser_beta;                                /**< swr beta value for Kaiser window (only applicable if filter_type == AV_FILTER_TYPE_KAISER) */
-    double precision;                               /**< soxr resampling precision (in bits) */
-    int cheby;                                      /**< soxr: if 1 then passband rolloff will be none (Chebyshev) & irrational ratio approximation precision will be higher */
 
     float min_compensation;                         ///< swr minimum below which no compensation will happen
     float min_hard_compensation;                    ///< swr minimum below which no silence inject / sample drop will happen
@@ -160,7 +154,6 @@  struct SwrContext {
     int64_t outpts;                                 ///< output PTS
     int64_t firstpts;                               ///< first PTS
     int drop_output;                                ///< number of output samples to drop
-    double delayed_samples_fixup;                   ///< soxr 0.1.1: needed to fixup delayed_samples after flush has been called.
 
     struct AudioConvert *in_convert;                ///< input conversion context
     struct AudioConvert *out_convert;               ///< output conversion context