summaryrefslogtreecommitdiff
path: root/libswresample/swresample.c
Commit message (Collapse)AuthorAge
* libswresample: Split version.hMartin Storsjö2022-03-16
| | | | Signed-off-by: Martin Storsjö <martin@martin.st>
* swresample: convert to new channel layout APIJames Almer2022-03-15
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* libswresample/swresamplec: Err num(negative-size) was used as a function ↵Yu Yang2021-12-09
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | parameter If memory allocation fails, ERROR(ENOMEM) '-12' will be returned. When resample() is done first, the negative size param would cause buffer-overflow and SEGV in swri_rematrix(). When swri_rematrix() is run first, resample() would not cause an error but Err num as a wrong parameter passing. Err num should be returned immediately. And remove an unneeded term from an assert. coredump info: #0 0x499517 in posix_memalign (/home/r1/ffmpeg/ffmpeg_4.4.1+0x499517) #1 0x6c1f0b4 in av_malloc /home/r1/ffmpeg/ffmpeg-4.4.1/build/src/libavutil/mem.c:86:9 #2 0x6c208fe in av_mallocz /home/r1/ffmpeg/ffmpeg-4.4.1/build/src/libavutil/mem.c:239:17 #3 0x6c207ad in av_mallocz_array /home/r1/ffmpeg/ffmpeg-4.4.1/build/src/libavutil/mem.c:195:12 #4 0x654b2e5 in swri_realloc_audio /home/r1/ffmpeg/ffmpeg-4.4.1/build/src/libswresample/swresample.c:418:14 #5 0x654f9a1 in swr_convert_internal /home/r1/ffmpeg/ffmpeg-4.4.1/build/src/libswresample/swresample.c:601:17 #6 0x654d2c0 in swr_convert /home/r1/ffmpeg/ffmpeg-4.4.1/build/src/libswresample/swresample.c:766:19 #7 0x186cf56 in flush_frame /home/r1/ffmpeg/ffmpeg-4.4.1/build/src/libavfilter/af_aresample.c:251:13 #8 0x186a454 in request_frame /home/r1/ffmpeg/ffmpeg-4.4.1/build/src/libavfilter/af_aresample.c:288:20 #9 0x787d9c in ff_request_frame_to_filter /home/r1/ffmpeg/ffmpeg-4.4.1/build/src/libavfilter/avfilter.c:459:15 #10 0x7877f1 in forward_status_change /home/r1/ffmpeg/ffmpeg-4.4.1/build/src/libavfilter/avfilter.c:1257:19 #11 0x77ed7e in ff_filter_activate_default /home/r1/ffmpeg/ffmpeg-4.4.1/build/src/libavfilter/avfilter.c:1288:20 #12 0x77e4e1 in ff_filter_activate /home/r1/ffmpeg/ffmpeg-4.4.1/build/src/libavfilter/avfilter.c:1441:11 #13 0x793b3f in ff_filter_graph_run_once /home/r1/ffmpeg/ffmpeg-4.4.1/build/src/libavfilter/avfiltergraph.c:1403:12 #14 0x7a7bee in get_frame_internal /home/r1/ffmpeg/ffmpeg-4.4.1/build/src/libavfilter/buffersink.c:131:19 #15 0x7a7287 in av_buffersink_get_frame_flags /home/r1/ffmpeg/ffmpeg-4.4.1/build/src/libavfilter/buffersink.c:142:12 #16 0x792888 in avfilter_graph_request_oldest /home/r1/ffmpeg/ffmpeg-4.4.1/build/src/libavfilter/avfiltergraph.c:1356:17 #17 0x5d07df in transcode_from_filter /home/r1/ffmpeg/ffmpeg-4.4.1/build/src/fftools/ffmpeg.c:4639:11 #18 0x59e557 in transcode_step /home/r1/ffmpeg/ffmpeg-4.4.1/build/src/fftools/ffmpeg.c:4729:20 #19 0x593970 in transcode /home/r1/ffmpeg/ffmpeg-4.4.1/build/src/fftools/ffmpeg.c:4805:15 #20 0x58f7a4 in main /home/r1/ffmpeg/ffmpeg-4.4.1/build/src/fftools/ffmpeg.c:5010:9 #21 0x7f6fd2dee0b2 in __libc_start_main /build/glibc-eX1tMB/glibc-2.31/csu/../csu/libc-start.c:308:16 SUMMARY: AddressSanitizer: negative-size-param (/home/r1/ffmpeg/ffmpeg_4.4.1+0x497e67) in __asan_memcpy Reported-by: TOTE Robot <oslab@tsinghua.edu.cn> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* swresample/swresample: Remove array size hint from swr_convert()Andreas Rheinhardt2021-12-03
| | | | | | | | | | | | | | SWR_CH_MAX is internal only and the arrays are therefore not required to have that many elements (and they typically don't do it). So remove this potentially confusing hint. (Newer versions of GCC emit -Warray-parameter= warnings for this, because the definition with explicit size differs from the declaration (which leaves the size unspecified); this is IMO a false-positive, because definition and declaration didn't conflict, but anyway it is fixed by this commit.) Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* Replace all occurences of av_mallocz_array() by av_calloc()Andreas Rheinhardt2021-09-20
| | | | | | | They do the same. Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* Silence "string-plus-int" warning shown by clang.Carl Eugen Hoyos2020-01-06
| | | | libswscale/utils.c:89:42: warning: adding 'unsigned long' to a string does not append to the string [-Wstring-plus-int]
* swresample/swresample: check for invalid sample ratesPaul B Mahol2019-05-26
|
* swresample/swresample: Fix input channel count in resample_first computationMichael Niedermayer2018-07-26
| | | | | | Found-by: Marcin Gorzel <gorzel@google.com> Reviewed-by: Marcin Gorzel <gorzel@google.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* swresample/swresample: Fix for seg fault in swr_convert_internal() -> ↵Hendrik Schreiber2018-04-07
| | | | | | | | | 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>
* lswr/swresample: Mention the actually supported formats when erroring out.Carl Eugen Hoyos2017-10-28
| | | | Fixes ticket #6779.
* swresample/swresample: do not use s32p internally by default when resamplingMuhammad Faiz2017-03-18
| | | | | | | | | | | | 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>
* swresample/swresample: do not reset tsf on swr_alloc_set_optsMuhammad Faiz2017-03-13
| | | | | | | | | | | | 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>
* swresample/swresample: Check count before memcpy()Michael Niedermayer2016-12-10
| | | | | | | | Fixes undefined operation Fixes part of 668007-media Found-by: Matt Wolenetz <wolenetz@google.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* swresample: add int64 sample formatPaul B Mahol2016-08-18
|
* swresample: Skip over dither steps if dithering scale is 0Michael Niedermayer2016-08-18
| | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* swresample: move dither init upMichael Niedermayer2016-08-18
| | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* swresample: add exact_rational optionMuhammad Faiz2016-06-13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* swresample/swresample: Remove "less than" comparissions of enumsMichael Niedermayer2016-03-22
| | | | | Found-by: wm4 Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* swresample/swresample: Fix integer overflow in seed calculationMichael Niedermayer2015-09-03
| | | | | | Fixes CID1322333 Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* swr: Remember previously set int_sample_format from userMichael Niedermayer2015-06-22
| | | | Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* swresample/swresample: Clear delayed_samples_fixup in clear_context()Michael Niedermayer2015-06-22
| | | | | | This probably makes no difference but its more proper Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* swresample/swresample: Print used int_sample_fmtMichael Niedermayer2015-06-21
| | | | | Suggested-by: wm4 Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* swresample: Choose 16bit internally only if input and output is 16bit or lessMichael Niedermayer2015-06-21
| | | | | | | | | | | | | 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>
* swr: Fix ASSERT_LEVEL warningMichael Niedermayer2015-06-08
| | | | | Found-by: cehoyos Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* swresample: fix initilaize/initialize typoClément Bœsch2015-06-06
|
* swresample/swresample: Cleanup on init failure.Michael Niedermayer2015-06-04
| | | | | | | | 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>
* swresample: Add swr_get_out_samples()Michael Niedermayer2015-06-04
| | | | | | 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>
* swresample/dither: check memory allocationGanesh Ajjanagadde2015-06-03
| | | | | | check memory allocation in swri_get_dither() Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* swresample: Check the return value of resampler->init()Michael Niedermayer2015-06-03
| | | | Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* swr: fix alignment issue caused by 8ch sse functionsRainer Hochecker2015-05-13
| | | | | | | | | 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>
* swresample: Check channel layouts and channels against each other and print ↵Michael Niedermayer2015-04-12
| | | | | | human readable error messages Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* swresample: Allow reinitialization without ever setting channel layoutsMichael Niedermayer2015-04-12
|
* swresample: Allow reinitialization without ever setting channel countsMichael Niedermayer2015-04-12
| | | | Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* swresample/swresample: Use av_mallocz_array()Michael Niedermayer2015-03-30
| | | | Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* swresample: Add prefix to soxr_resamplerMichael Niedermayer2015-02-27
| | | | | | also move declaration to header Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* Add FFMPEG_VERSION into the binary libsMichael Niedermayer2014-12-19
| | | | | | This simplifies identifying from which revision a binary of a lib came from Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* swresample: Fix swr_drop_output so it does not flush the buffersMichael Niedermayer2014-11-04
| | | | Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* swresample: do not put multiple statements in one lineMichael Niedermayer2014-10-16
| | | | Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* swresample/swresample: replace always true if() by av_assert0()Michael Niedermayer2014-10-06
| | | | Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* swresample/swresample: fix sample drop loop end conditionMichael Niedermayer2014-10-06
| | | | | | Fixes Ticket3985 Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* swresample: check av_opt_set for failure in swr_alloc_set_opts()Michael Niedermayer2014-08-11
| | | | Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* swresample/swresample: Treat mono as planarMichael Niedermayer2014-08-04
| | | | | | | This might in some cases improve performance. Idea from: fbc0b8659967ea54a8472b5f795270d38bb085dd Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* swresample: split option table to a separate fileTimothy Gu2014-07-06
| | | | | Signed-off-by: Timothy Gu <timothygu99@gmail.com> Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* swr: handle initial negative sample index outside DSP function.Ronald S. Bultje2014-06-14
| | | | Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* swresample: swr_close()Michael Niedermayer2014-05-15
| | | | Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* swr: check that the context for swr_convert() has been initializedMichael Niedermayer2014-02-24
| | | | | Reviewed-by: ubitux Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* swresample: add swr_is_initialized()Michael Niedermayer2014-02-24
| | | | | | Idea-from/based-on: 7e86c27b4ee9e5a3fbe6cf5249b9d918b2a5e731 Reviewed-by: ubitux Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* swresample: factorize clear_context() outMichael Niedermayer2014-02-22
| | | | Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
* lavu,lavc,lswr: do not hardcode AV_SAMPLE_FMT_NB value when setting sample ↵Stefano Sabatini2013-12-26
| | | | | | | | | | | | 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.
* swresample: use the internal buffer for resampling the last few samplesMichael Niedermayer2013-12-04
| | | | | | | Fixes out of array read Fixes Ticket3193 Signed-off-by: Michael Niedermayer <michaelni@gmx.at>