17 Commits
Author SHA1 Message Date
Kacper Michajłow 755b6bdfd5 swresample/tests/swresample: align the sample buffers
They are plain byte arrays on the stack but are read and written as
samples of up to double size.

Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
2026-09-29 22:39:11 +02:00
Kacper Michajłow 739132b015 swresample/tests/swresample: fail when a context cannot be initialized
swr_init() failures were only printed and the test still exited with 0.
Return failure through the cleanup instead, also for the allocation
failures that returned without it.

Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
2026-09-29 22:39:11 +02:00
Kacper Michajłow 5191917736 swresample/tests/swresample: free the contexts
The two contexts and the layouts were never released, which trips leak
checking once the test runs under FATE.

Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
2026-09-29 22:39:11 +02:00
Romain Beauxis e4be207d82 Add missing .gitignore. 2026-08-17 22:21:44 +00:00
Andreas Rheinhardt df86c5ef3a swresample/tests/swresample: Avoid av_assert2, remove ASSERT_LEVEL override
Said #define ASSERT_LEVEL 2 was ineffective because it followed
the inclusion of avassert.h. It only leads to warnings when
ASSERT_LEVEL is defined to something other than 2 (it is not
defined by default).

Also avoid using av_assert2() in a test tool: These are supposed to
be picky, so using always-enabled av_assert0 is appropriate.
This was probably the intention of the ASSERT_LEVEL override
all along.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-08-15 18:51:18 +02:00
James Almer c39bc13fdb swresample/tests/rematrix: print rows in layout order
Otherwise, custom layouts will be printed as if they were in native order.

Signed-off-by: James Almer <jamrial@gmail.com>
2026-08-14 16:11:08 -03:00
Ayoub Nabil Boubagrat d02bad0c90 swresample/rematrix: accept unused channels
custom layouts containing AV_CHAN_UNUSED were rejected by
swr_build_matrix2().

accept unused channels in input and output layouts. preserve their
physical positions, clear input columns, and leave output rows silent.

add fate coverage for both cases. this fixes #24094.

Signed-off-by: Ayoub Nabil Boubagrat <237098474+ayoubnabil@users.noreply.github.com>
2026-08-14 19:08:29 +00:00
Ayoub Nabil Boubagrat 85d2cfd52e libswresample/tests/rematrix: uninit channel layouts
release parsed channel layouts before exiting.

Signed-off-by: Ayoub Nabil Boubagrat <237098474+ayoubnabil@users.noreply.github.com>
2026-08-14 19:08:29 +00:00
James Almer afd6b8451f libswresample/tests/rematrix: rewrite into a matrix printing tool
Signed-off-by: James Almer <jamrial@gmail.com>
2026-08-09 13:55:37 -03:00
James Almer 77998c0dec swresample/rematrix: handle missing channels from 22.2 layout
Signed-off-by: James Almer <jamrial@gmail.com>
2026-08-09 13:55:37 -03:00
Ayoub Nabil Boubagrat 5c395992f9 swresample/rematrix: handle top-back channels
top-back channels are currently left unaccounted and can be dropped during downmixing.

when the output retains top-front channels, follow IAMF 1.1.0 and fold top-back into top-front at 0.707. prefer this path over ear-level rear channels to preserve the height layer in x.1.4 to x.1.2 downmixes.

when no matching height output remains, map top-back to back or side channels, then fall back to front or mono outputs. handle top-back center separately and add direct tests for every matrix path.

Signed-off-by: Ayoub Nabil Boubagrat <237098474+ayoubnabil@users.noreply.github.com>
2026-08-07 02:33:33 +00:00
Ivan Grigorev bdbb580d9c swresample/tests: add resample realloc regression test
Add a regression test exercising the swr_convert(N) -> swr_convert(2N)
edge case: the second call reuses the internal preout buffer at full
capacity, with no trailing slack from swri_realloc_audio()'s amortized
doubling. internal_sample_fmt is forced to S16P to reach the int16 SIMD
resample path, where ff_resample_common_int16_sse2 overruns its
destination by 2 bytes on the last iteration.

Without a resampler fix this test fails under valgrind/ASAN with a
heap-buffer-overflow (Invalid write of size 4, 2 bytes past the end).

Signed-off-by: Ivan Grigorev <ivangrigoriev@meta.com>
2026-06-14 15:34:43 +00:00
Andreas Rheinhardt 2a90e7d725 av{codec,util}/tests: Remove pointless undefs
Before commit e96d90eed6 lavu/internal.h
contained redefined various discouraged/forbidden functions to induce
compilation failures upon use, like e.g.
 #define malloc please_use_av_malloc
In order to use these functions, some files had to undefine these
macros. This commit removes the remaining pointless undefs.

Reviewed-by: Rémi Denis-Courmont <remi@remlab.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2025-11-24 16:48:31 +01:00
James Almer 8a5896ec1f swresample: convert to new channel layout API
Signed-off-by: James Almer <jamrial@gmail.com>
2022-03-15 09:42:46 -03:00
Andreas Rheinhardt 01d158d1c8 all: Remove unused-but-set variables
Newer versions of Clang detect this and emit warnings for it.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2021-12-03 16:09:14 +01:00
Clément Bœsch a9eda4b260 swr: fix time.h include 2016-06-22 14:00:08 +02:00
Clément Bœsch 5d48e4eafa Merge commit 'a6a750c7ef240b72ce01e9653343a0ddf247d196'
* commit 'a6a750c7ef240b72ce01e9653343a0ddf247d196':
  tests: Move all test programs to a subdirectory

Merged-by: Clément Bœsch <clement@stupeflix.com>
2016-06-22 13:44:34 +02:00