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>
10 years ago
Michael Niedermayer
56f0fe6b84
swr: Fix ASSERT_LEVEL warning
...
Found-by: cehoyos
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
10 years ago
Clément Bœsch
c5a08956a3
swresample: fix initilaize/initialize typo
10 years ago
Michael Niedermayer
b14361486b
swresample/resample: fix typos
...
Found-by: wm4 <nfxjfg@googlemail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
10 years ago
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>
10 years ago
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>
10 years ago
Michael Niedermayer
52acd22a7d
libswresample/rematrix: Check for malloc errors
...
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
10 years ago
Ganesh Ajjanagadde
196b885a5f
swresample/dither: check memory allocation
...
check memory allocation in swri_get_dither()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
10 years ago
Michael Niedermayer
02915602d9
swresample: Check the return value of resampler->init()
...
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
10 years ago
James Almer
c16e99e3b3
x86: check for AV_CPU_FLAG_AVXSLOW where useful
...
Signed-off-by: James Almer <jamrial@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
10 years ago
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>
10 years ago
Michael Niedermayer
223a859853
swresample/dither_template: Do not define macro functions to nothing
...
This avoids potential warnings
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
10 years ago
Michael Niedermayer
ff50b1b13b
swresample/swresample-test: Randomly wipe out channel counts
...
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
10 years ago
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>
10 years ago
Michael Niedermayer
80a28c7509
swresample: Allow reinitialization without ever setting channel layouts
10 years ago
Michael Niedermayer
d7b9cb2f7a
swresample: Allow reinitialization without ever setting channel counts
...
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
10 years ago
James Almer
43482bd1a5
swr/resample: use av_clip functions
...
Signed-off-by: James Almer <jamrial@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
10 years ago
Michael Niedermayer
1a10134e20
swresample/swresample: Use av_mallocz_array()
...
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
10 years ago
Michael Niedermayer
e16592c42e
swresample/resample: Fix undefined shifts
...
Found-by: Clang -fsanitize=shift
Reported-by: Thierry Foucu <tfoucu@google.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
10 years ago
Michael Niedermayer
4d00860ac7
swresample: Add prefix to soxr_resampler
...
also move declaration to header
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
10 years ago
Michael Niedermayer
c0e3b46118
swresample: add av_cold to init functions
...
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
10 years ago
Michael Niedermayer
0cb95f9082
swresample/resample_template: Add () to protect the arguments of the OUT() macro
...
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
10 years ago
Michael Niedermayer
37013fd018
swresample/swresample-test: Add () to protect uint_rand() argument
...
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
10 years ago
James Almer
f7ed997a6d
x86/swr: make pack_8ch functions work with compilers without aligned stack
...
Signed-off-by: James Almer <jamrial@gmail.com>
10 years ago
Michael Niedermayer
b74ecb82fa
swresample/x86/rematrix_init: Check av_malloc* return codes, forward errors
...
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
10 years ago
Michael Niedermayer
48ffaaaaef
swresample/x86/rematrix_init: Use av_mallocz_array()
...
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
10 years ago
Michael Niedermayer
9d7ae72725
swresample: Use int instead of enum for fields which are accessed through AVOptions as int
...
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
10 years ago
Michael Niedermayer
c77cc2c176
swresample/dither: Cleanup number suffixes
...
The <<31 case needs LL
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
10 years ago
Reimar Döffinger
6efd0ba977
swresample_internal.h: Move struct declaration before first use.
...
It seems more logical and works with more restricted C compilers
like tinycc.
Signed-off-by: Reimar Döffinger <Reimar.Doeffinger@gmx.de>
10 years ago
James Almer
59ac93f6af
x86/swr: add SSE/AVX unpack_6ch functions
...
int32/float only
Reviewed-by: Michael Niedermayer <michaelni@gmx.at>
Signed-off-by: James Almer <jamrial@gmail.com>
10 years ago
James Almer
6abf00d615
x86/swr: load constants outside the loop in pack_6ch functions
...
Reviewed-by: Michael Niedermayer <michaelni@gmx.at>
Signed-off-by: James Almer <jamrial@gmail.com>
10 years ago
James Almer
975ff6a3c6
x86/swr: disable pack_8ch functions on msvc/icl x86_32
...
Until a proper fix is committed.
Signed-off-by: James Almer <jamrial@gmail.com>
10 years ago
James Almer
5f14f9e984
x86/swr: add missing alignment check to pack_6ch functions
...
Reviewed-by: Michael Niedermayer <michaelni@gmx.at>
Signed-off-by: James Almer <jamrial@gmail.com>
10 years ago
James Almer
37b35feb64
x86/swr: add SSE2/AVX pack_8ch functions
...
Reviewed-by: Michael Niedermayer <michaelni@gmx.at>
Reviewed-by: Ronald S. Bultje <rsbultje@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
10 years ago
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>
10 years ago
Rob Sykes
4b6f225374
swresample/soxr_resample: fix error handling
...
Fixes CID1257659
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
10 years ago
James Almer
edff061fb0
x86/swr: add ff_float_to_int32_a_avx2
...
13797 decicycles in ff_float_to_int32_a_sse2, 32768 runs, 0 skips
8603 decicycles in ff_float_to_int32_a_avx2, 32766 runs, 2 skips
Reviewed-by: Christophe Gisquet <christophe.gisquet@gmail.com>
Signed-off-by: James Almer <jamrial@gmail.com>
10 years ago
James Almer
b385c4c6a3
x86/swr: replace sse4 instructions in pack_6ch with sse ones
...
There's no benefit from using blendps here except on CPUs with AVX, where
it's faster than shufps according to Intel's documentation.
As such, rename the sse4 functions to sse/sse2 and use shufps instead.
Reviewed-by: Michael Niedermayer <michaelni@gmx.at>
Signed-off-by: James Almer <jamrial@gmail.com>
10 years ago
Michael Niedermayer
e4f8a973aa
swresample: Fix swr_drop_output so it does not flush the buffers
...
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
10 years ago
Michael Niedermayer
f6bb2cd1b0
swresample/resample: fix invert_initial_buffer() after flush
...
Fixes: asan_heap-uaf_2071250_7_139.ogg
Fixes: assertion failure
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
10 years ago
Michael Niedermayer
080c846f59
swresample: do not put multiple statements in one line
...
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
10 years ago
Michael Niedermayer
344f8d307a
swresample/audioconvert: Fix undefined behavior (left shift of negative value)
...
Fixes: asan_heap-oob_4da4f3_8_asan_heap-oob_4da4f3_419_scene1a.mm
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
10 years ago
Michael Niedermayer
6b347f519d
swresample/swresample: replace always true if() by av_assert0()
...
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
10 years ago
Michael Niedermayer
f9fefa499f
swresample/swresample: fix sample drop loop end condition
...
Fixes Ticket3985
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
10 years ago
Reimar Döffinger
2c5c37ade1
libswresample: move condition to start of loop.
...
This avoids several issue like calculating sum/maxcoef
incorrectly due to adding up matrix entries that will
be overwritten, as well as out-of-range writes to
s->matrix if the maximum allowed number of channels is used.
Signed-off-by: Reimar Döffinger <Reimar.Doeffinger@gmx.de>
10 years ago
Reimar Döffinger
284123d7fd
Remove pointless if.
...
A branch to avoid some calculation seems unlikely to have any benefits.
Signed-off-by: Reimar Döffinger <Reimar.Doeffinger@gmx.de>
10 years ago
Reimar Döffinger
2231d5b671
libswresample: Avoid needlessly large on-stack array.
...
We only actually need to use a tiny part of it.
Unfortunately we seem to have no real test coverage on
the code, so this is a bit risky.
Signed-off-by: Reimar Döffinger <Reimar.Doeffinger@gmx.de>
10 years ago
Michael Niedermayer
7c51f5bd39
swr: aarch64 audio_convert and neon clobber test
...
Ported from avresample
Code by: Mans Rullgard, Janne Grunau, Martin Storsjo
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
10 years ago
Michael Niedermayer
b7d5e016a3
swresample: Add AVFrame based API
...
Based on commit fb1ddcdc8f
by Luca Barbato <lu_zero@gentoo.org>
Adapted for libswresample by Michael Niedermayer
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
11 years ago
Michael Niedermayer
f4e814f787
swresample: check av_opt_set for failure in swr_alloc_set_opts()
...
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
11 years ago