Commit Graph

191 Commits

Author SHA1 Message Date
Michael Niedermayer
bce4da85e8 swresample/swresample: Fix input channel count in resample_first computation
Found-by: Marcin Gorzel <gorzel@google.com>
Reviewed-by: Marcin Gorzel <gorzel@google.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-07-26 02:42:42 +02:00
Hendrik Schreiber
647fd4b829 swresample/swresample: Fix for seg fault in swr_convert_internal() -> sum2_float during dithering.
Removed +len1 in call to s->mix_2_1_f() as I found no logical explanation for it. After removal, problem was gone.

Signed-off-by: Hendrik Schreiber <hs@tagtraum.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2018-04-07 02:10:45 +02:00
Carl Eugen Hoyos
8518294558 lswr/swresample: Mention the actually supported formats when erroring out.
Fixes ticket #6779.
2017-10-28 15:11:18 +02:00
Muhammad Faiz
c52638cca2 swresample/swresample: do not use s32p internally by default when resampling
use fltp when doing s32 -> s32 resampling
because s32p has no simd optimization

benchmark:
old 17.913s
new  7.584s (use fma3)

Reviewed-by: wm4 <nfxjfg@googlemail.com>
Signed-off-by: Muhammad Faiz <mfcc64@gmail.com>
2017-03-18 13:57:03 +07:00
Muhammad Faiz
6c7a0876fe swresample/swresample: do not reset tsf on swr_alloc_set_opts
so tsf option in aresample will have effect
previously tsf/internal_sample_format had no effect

fate is updated
s32p previously used fltp internally
dblp previously used fltp/dblp internally

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Muhammad Faiz <mfcc64@gmail.com>
2017-03-13 02:45:36 +07:00
Michael Niedermayer
b3928a1cc6 swresample/swresample: Check count before memcpy()
Fixes undefined operation
Fixes part of 668007-media

Found-by: Matt Wolenetz <wolenetz@google.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-12-10 02:05:17 +01:00
Paul B Mahol
9876d8fc6d swresample: add int64 sample format 2016-08-18 15:30:05 +02:00
Michael Niedermayer
30b2611ed3 swresample: Skip over dither steps if dithering scale is 0
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-08-18 11:52:11 +02:00
Michael Niedermayer
946acacdcd swresample: move dither init up
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-08-18 11:50:14 +02:00
Muhammad Faiz
b8c6e5a661 swresample: add exact_rational option
give high quality resampling
as good as with linear_interp=on
as fast as without linear_interp=on
tested visually with ffplay
ffplay -f lavfi "aevalsrc='sin(10000*t*t)', aresample=osr=48000, showcqt=gamma=5"
ffplay -f lavfi "aevalsrc='sin(10000*t*t)', aresample=osr=48000:linear_interp=on, showcqt=gamma=5"
ffplay -f lavfi "aevalsrc='sin(10000*t*t)', aresample=osr=48000:exact_rational=on, showcqt=gamma=5"

slightly speed improvement
for fair comparison with -cpuflags 0
audio.wav is ~ 1 hour 44100 stereo 16bit wav file
ffmpeg -i audio.wav -af aresample=osr=48000 -f null -
        old         new
real    13.498s     13.121s
user    13.364s     12.987s
sys      0.131s      0.129s

linear_interp=on
        old         new
real    23.035s     23.050s
user    22.907s     22.917s
sys      0.119s     0.125s

exact_rational=on
real    12.418s
user    12.298s
sys      0.114s

possibility to decrease memory usage if soft compensation is ignored

Signed-off-by: Muhammad Faiz <mfcc64@gmail.com>
2016-06-13 12:36:01 +07:00
Michael Niedermayer
914ad90edd swresample/swresample: Remove "less than" comparissions of enums
Found-by: wm4
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2016-03-22 14:20:12 +01:00
Michael Niedermayer
32f53958b8 swresample/swresample: Fix integer overflow in seed calculation
Fixes CID1322333

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2015-09-03 09:32:43 +02:00
Michael Niedermayer
d4325b2fea swr: Remember previously set int_sample_format from user
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-06-22 18:34:39 +02:00
Michael Niedermayer
0dd2790df5 swresample/swresample: Clear delayed_samples_fixup in clear_context()
This probably makes no difference but its more proper

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-06-22 18:34:39 +02:00
Michael Niedermayer
5de3a589f1 swresample/swresample: Print used int_sample_fmt
Suggested-by: wm4
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-06-21 18:12:56 +02:00
Michael Niedermayer
4977692461 swresample: Choose 16bit internally only if input and output is 16bit or less
or if no rematrix and no resampling is performed and the input is 16bit
note reampling and rematrix itself always use more than 16bit internally
the "internal" sampling format is the format between these steps

Its unlikely the difference from this commit is audible in any case
unless there is some bug either before or after the change.
but multiple people prefer this and it slightly improves the precission
of computations.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-06-21 17:33:46 +02:00
Michael Niedermayer
56f0fe6b84 swr: Fix ASSERT_LEVEL warning
Found-by: cehoyos
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-06-08 20:16:06 +02:00
Clément Bœsch
c5a08956a3 swresample: fix initilaize/initialize typo 2015-06-06 12:16:18 +02:00
Michael Niedermayer
c3f87f7545 swresample/swresample: Cleanup on init failure.
This avoids leaks if the user doest call swr_close() after a failed init

Found-by: James Almer <jamrial@gmail.com>
Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-06-04 12:35:04 +02:00
Michael Niedermayer
cc17b43d8d swresample: Add swr_get_out_samples()
Previous version reviewed-by: Pavel Koshevoy <pkoshevoy@gmail.com>
Previous version reviewed-by: wm4 <nfxjfg@googlemail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-06-04 05:37:32 +02:00
Ganesh Ajjanagadde
196b885a5f swresample/dither: check memory allocation
check memory allocation in swri_get_dither()

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-06-03 11:46:37 +02:00
Michael Niedermayer
02915602d9 swresample: Check the return value of resampler->init()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-06-03 01:05:19 +02:00
Rainer Hochecker
adb7372f74 swr: fix alignment issue caused by 8ch sse functions
Fix crash when doing 8 ch conversion from apps compiled with MSVS
Thanks to Ronald for giving this hint:
https://ffmpeg.org/pipermail/ffmpeg-devel/2015-May/173049.html

Reviewed-by: "Ronald S. Bultje" <rsbultje@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-05-13 22:44:06 +02:00
Michael Niedermayer
3c77bb5f23 swresample: Check channel layouts and channels against each other and print human readable error messages
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-04-12 22:21:34 +02:00
Michael Niedermayer
80a28c7509 swresample: Allow reinitialization without ever setting channel layouts 2015-04-12 22:21:34 +02:00
Michael Niedermayer
d7b9cb2f7a swresample: Allow reinitialization without ever setting channel counts
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-04-12 22:21:34 +02:00
Michael Niedermayer
1a10134e20 swresample/swresample: Use av_mallocz_array()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-03-30 23:24:33 +02:00
Michael Niedermayer
4d00860ac7 swresample: Add prefix to soxr_resampler
also move declaration to header

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2015-02-27 19:20:43 +01:00
Michael Niedermayer
649c158e8c Add FFMPEG_VERSION into the binary libs
This simplifies identifying from which revision a binary of a lib came from

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-12-19 19:32:40 +01:00
Michael Niedermayer
e4f8a973aa swresample: Fix swr_drop_output so it does not flush the buffers
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-11-04 17:17:23 +01:00
Michael Niedermayer
080c846f59 swresample: do not put multiple statements in one line
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-10-16 18:18:40 +02:00
Michael Niedermayer
6b347f519d swresample/swresample: replace always true if() by av_assert0()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-10-06 01:29:15 +02:00
Michael Niedermayer
f9fefa499f swresample/swresample: fix sample drop loop end condition
Fixes Ticket3985

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-10-06 01:29:06 +02:00
Michael Niedermayer
f4e814f787 swresample: check av_opt_set for failure in swr_alloc_set_opts()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-11 01:34:34 +02:00
Michael Niedermayer
05ff1a2c05 swresample/swresample: Treat mono as planar
This might in some cases improve performance.

Idea from: fbc0b86599
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-04 03:05:05 +02:00
Timothy Gu
37715b4594 swresample: split option table to a separate file
Signed-off-by: Timothy Gu <timothygu99@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-07-06 03:45:46 +02:00
Ronald S. Bultje
b785c62681 swr: handle initial negative sample index outside DSP function.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-14 14:36:18 +02:00
Michael Niedermayer
96cb4c8718 swresample: swr_close()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-05-15 18:27:23 +02:00
Michael Niedermayer
6c6e4dd139 swr: check that the context for swr_convert() has been initialized
Reviewed-by: ubitux
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-02-24 08:23:42 +01:00
Michael Niedermayer
a66be60888 swresample: add swr_is_initialized()
Idea-from/based-on: 7e86c27b4e
Reviewed-by: ubitux
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-02-24 08:23:22 +01:00
Michael Niedermayer
f284e2a58a swresample: factorize clear_context() out
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-02-22 21:36:30 +01:00
Stefano Sabatini
334e2e2363 lavu,lavc,lswr: do not hardcode AV_SAMPLE_FMT_NB value when setting sample format max value
The constant may change in libavutil but the library may be compiled
against an older version, thus rejecting a value which is otherwise
supported by the new libavutil.

INT_MAX is used here to denote the max allowed value for a sample format.

The opt-test code is changed to provide a valid reference example.
2013-12-26 11:35:27 +01:00
Michael Niedermayer
a6af5da7a2 swresample: use the internal buffer for resampling the last few samples
Fixes out of array read
Fixes Ticket3193

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-12-04 20:40:42 +01:00
Stefano Sabatini
904c89ac1b lswr/swresample: convert ocl and icl options to AV_OPT_TYPE_CHANNEL_LAYOUT
Improve interface flexibility. In particular makes it possible to set
channel layout through symbolic names using the av_opt_set() interface.
2013-10-17 18:09:54 +02:00
Michael Niedermayer
9078b40d35 swresample: replace 2 av_free() by av_freep()
avoids leaving stale pointers in memory

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-09-16 22:44:15 +02:00
Michael Niedermayer
e2b718464e swresample: Make rematrix maxvalue user settable
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-07-22 03:23:54 +02:00
Timothy Gu
a9bbf59be7 cosmetics: Fix "dont" "wont" "doesnt" typos
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-06-29 02:31:16 +02:00
Michael Niedermayer
3289670142 swr: dont treat 32 and 24 as equal in simple copy check
Fixes dithering from 32 to 24 bit

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-06-05 03:06:34 +02:00
Paul B Mahol
0804171104 swresample: set flags & description and add documentation for output_sample_bits
Allows users to actually use such option.

Signed-off-by: Paul B Mahol <onemda@gmail.com>
2013-06-04 21:57:25 +00:00
Michael Niedermayer
495bf1b685 swr: Fix dithering of s16 with SIMD
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-06-04 23:50:45 +02:00