ff_sbcdsp_init() checks SBCDSPContext.increment to set
sbc_analyze_8s (which is not tested), leading to Valgrind
errors.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This is possible because the state of the PRNG at the beginning
of every test function is the same for every cpu flag (since
the switch to libcheckasm). It also has the advantage that
random sizes are checked when using --repeat.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
The CRC test uses a linked list of containing the CRC tables
of already tested instruction sets; the head of the list
is in static storage and up until now was never freed
(i.e. reported as "still reachable" by Valgrind).
Free it properly by adding an uninit callback.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
The TX tests require a context that is initialized
for a specific set of CPU flags. So in order to have
a context for the reference function to use, the last
context is stored (in static storage). This works well
in normal usage, but it does not work with the --repeat
feature that has been added to checkasm by the switch
to libcheckasm: When the C functions ought to be tested
a second time, there is a mismatch between the new
function pointer (which is the C version) and the reference
context (which is initialized to optimized CPU flags;
up until now, there was no stored context when testing
the C versions, but there is with --repeat), leading to segfaults.
Fix this by adding an uninit callback for the TX test,
replacing the atexit handler.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This update is done because of the newly added init and uninit
callbacks which will be used to fix a segfault when repeating
the tx test; it also improves both the quality and performance
of the PRNG.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
e822e429f3 utils: Silence an MSVC warning about conversion from double to float
abf8fb0261 utils: Add checkasm_randomize_interval() and float equivalent
7aea236f8f utils: Simplify checkasm_randomize_range() formulation
49972c1c72 utils: Fix advertised value range of checkasm_randf()
11c569cbdc utils: Use appropriate PRNG size for checkasm_init()
6fd9bafd11 utils: Add way more PRNG helper functions
d7f10858c8 utils: Use prng() primitive for checkasm_randomize()
781f16f1ac utils: Parallelize PRNG
4681280b65 selftest: Add tests for utils.h functions
02d0b1ee4c Clear CPU state after any checkasm_call()
48821c5d14 Print cpu mask in JSON output
5d500889dc tests/selftest: Test CPU flag masking
dbf5380202 tests: Offset arch-specific CPU flags by 10
09b4c6a8c9 include/checkasm.h: Add CheckasmCpuInfo.mask
dd1ca4ed09 utils: Document PRNG re-seeding at the start of each test
c93961a221 utils: Use substantially more robust PRNG
e46c473f73 Re-order conditional (mostly cosmetic)
16738f028d Seed PRNG before running CheckasmTest.init()
9292f9cf6d Bikeshed summary line a bit more, especially for interrupted runs
0f03612ec9 Suppress non-failure output after first iteration
bfdb230dd9 checkasm: Print statusline to track current test/bench progress
c8996a284b checkasm: Move test iteration variable to global state
46e136ee0e utils: Add self-repainting statusline buffer
800053edca Route all log messages through checkasm_fprintf()
f6791fee59 utils: Redefine checkasm_fprintf() as checkasm_vfprintf()
629a211feb Add optional CheckasmTest.init() and uninit()
354f3d3e8d riscv/callcheck: Avoid out-of-range li immediate under LLVM on rv32
6e1b4cd6ca riscv/cpu: Include <asm/unistd.h> for __NR_riscv_hwprobe
8130043b32 Fix CPU detection for AVX512F
9760810b49 Support YMM copy tests on processors with only AVX
dc8c320313 Support XMM copy tests on processors with only SSE
git-subtree-dir: tests/checkasm/ext
git-subtree-split: e822e429f33e4d02e0815bd497952b3f6deb0a7d
Add documentation for three previously undocumented common DNN options:
- async: toggle async inference (default enabled)
- nireq: number of concurrent inference requests
- batch_size: frames per inference request
Also add usage examples for the Libtorch backend showing basic
CPU inference and batch inference pipelines.
Signed-off-by: Raja Rathour <rajarathour1829@gmail.com>
When a CUDA frame with a supported RGB sw_format is received, map the
GPU device pointer directly into a LibTorch tensor using
torch::from_blob() with CUDA device options, bypassing cudaMemcpy
entirely.
Changes:
- Add fill_model_input_cuda() that extracts the CUdeviceptr from the
AVHWFramesContext and wraps it in a PyTorch GPU tensor with a no-op
deleter (memory owned by FFmpeg AVBuffer ref-counting).
- Handle GPU memory alignment padding via custom strides derived from
AVFrame linesize.
- Permute the mapped NHWC tensor to NCHW (PyTorch convention).
- Manage CUDA context explicitly with cuCtxPushCurrent/cuCtxPopCurrent
for thread safety in async filter graphs.
- Implement zero-copy Device-to-Device output mapping that writes the
model result directly into the output frame's VRAM, bypassing
ff_proc_from_dnn_to_frame / sws_scale entirely for CUDA frames.
- Add torch::cuda::synchronize() to prevent async race conditions
with downstream encoders (e.g. NVENC reading uninitialized frames).
- Add format validation in ff_dnn_zero_copy_supported_cuda() to reject
unsupported sw_formats and batching with CUDA zero-copy early.
- Register AV_PIX_FMT_CUDA in vf_dnn_processing pixel format list.
- Gracefully fall back to CPU path when sw_format is not a supported
RGB variant or when CONFIG_CUDA is not enabled.
Signed-off-by: Raja-89 <imraja729@gmail.com>
This reverts commit 795bccdaf5.
The heap-buffer-overflow was a symptom of the >8 bit boundary
conditions bug fixed in the previous commit. This workaround is no
longer needed.
This restores spatial-only interpolation of the whole frame for the
first and last fields, instead of running the temporal edge filter
against cloned reference frames on the outermost lines. Because of that
first frame references are updated to pre-fix values.
Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
The mrefs/prefs boundary conditions scaled the y limits by the number of
bytes per sample, even though the ref offsets are already expressed in
elements. For content deeper than 8 bits this clamped perfectly valid
in-bounds line taps.
Found by validating the libplacebo GPU port against this filter, which
matches exactly on 16-bit content everywhere except these lines.
This changes the output for >8 bit content on the affected lines.
Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
Implement the fixed-point LFE x96 interpolation filter in AArch64
NEON. Four input samples are processed per iteration. The history
sample is kept in a vector lane, and ext constructs the delayed input.
Benchmarks by Martin Storsjö using checkasm:
a53 a55 a520 a72 a76 a720
1.86x 1.88x 1.24x 1.99x 1.62x 2.30x
Author's measurement on Neoverse-N1 (Oracle Cloud, clang 14): 1.29x.
Signed-off-by: Jeongkeun Kim <variety0724@gmail.com>
AV_OPT_TYPE_PIXEL_FMT and AV_OPT_TYPE_SAMPLE_FMT are documented
to use the corresponding enum type. This matters when using
-fshort-enums.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
The trailing padding is read from the AV_PKT_DATA_SKIP_SAMPLES side data of
every packet, overwriting the previous value, so only the last packet was
ever accounted for. A single packet holds at most one frame, which caps the
padding that can be written at 1152 + 528 + 1 samples.
LAME regularly reports more than that: gapless/gapless.mp3 carries 1984 and
comes out of a stream copy with 1681, decoding to 303 samples more than the
file it was copied from.
Accumulate instead, and add the decoder delay once the total is known.
Fixes: https://trac.ffmpeg.org/ticket/9755
c2802e520a selected kIOMainPortDefault whenever the SDK is new enough
(__MAC_OS_X_VERSION_MAX_ALLOWED), but that symbol is only available
since macOS 12, so building with a newer SDK against an older
deployment target failed with -Wunguarded-availability-new.
Check the deployment target (__MAC_OS_X_VERSION_MIN_REQUIRED) instead
and keep using the equivalent kIOMasterPortDefault when targeting
older releases.
See: https://lists.ffmpeg.org/archives/list/ffmpeg-devel@ffmpeg.org/thread/S7PGVSGNLIZ2WRYV6VOBAD3RWYUNWA3H/
Reported-by: Helmut K. C. Tessarek <tessarek@evermeet.cx>
Signed-off-by: Gabriel Balaich <ffmpeg@ninbura.com>
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>
ITU-R BS.2127-1 maps U+030 and U-030 to the matching ear-level front channels at unity gain.
the current matrix uses 0.707 when the input also contains front channels. use 1.0 instead.
Signed-off-by: Ayoub Nabil Boubagrat <237098474+ayoubnabil@users.noreply.github.com>
For a word mask register (where all the values are either
0x0 or 0xFFFF) a right logical shift by 15 is equivalent
to negating, so instead of negating the mask and then adding
it to another register one can simply subtract the mask from
the other register.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Mantissas are the last data in the channel subsegment and it appears it
is sometimes missing a very few bits for the parsing to complete.
This must not be confused with data corruption.
In standard conditions with certified products, it has been observed
that the occurence of this issue is pretty steady and about once every 2
hours. The truncation is at about 950 out of the 1024 values (923 is the
minimum I have seen so far).
The current code raises a severe 'Read past end' error and all data is
lost resulting in 20ms(@25fps) of silence for the affected channel.
This patch introduces a tolerance: if 800 out of the 1024 mantissas have
been parsed, a simple warning is raised and the data is preserved.
Signed-off-by: Nicolas Gaullier <nicolas.gaullier@cji.paris>
Every hardware accel implementation and now Vulkan require API present
stating with Windows 7, so it's about time we stop pretending to support
Vista.
Signed-off-by: James Almer <jamrial@gmail.com>
ITU-R BS.1770 assigns a weight of 1.0 to height channels, but the
filter included the top-back channels in the 1.41 surround mask.
remove the top-back channels from that mask and add a FATE test for
the resulting loudness measurement.
fixes#23968.
Signed-off-by: Ayoub Nabil <237098474+ayoubnabil@users.noreply.github.com>
"pan=stereo|FL=UNK" resolves to AVChannel id 768, which was used as an
index into a 64 element array before the previous commit.
UNK is used because it was the only one of the three reachable high ids
that exited with 0 before the fix; AMBI (1024) aborted and UNSD (512)
failed with an unrelated message, so a test that only checked for a
non-zero exit status would have passed before the fix as well.
For the same reason the test greps the error message on stderr instead of
only looking at the exit status: a crash also exits non-zero.
Signed-off-by: iSold Leo <s@qwqlog.com>
parse_channel_name() only rejects negative values on the named channel
path, while the numbered "c%d" path also checks against MAX_CHANNELS.
av_channel_from_string() accepts UNSD (512), UNK (768) and AMBI (1024),
and the id was then used directly to index used_in_ch[MAX_CHANNELS] on
the stack and pan->gain[out_ch_id][in_ch_id].
Before this change:
ffmpeg -f lavfi -i "anullsrc=cl=stereo" -af "pan=stereo|FL=AMBI" -f null -
af_pan.c:214:17: runtime error: index 1024 out of bounds for type 'int[64]'
The first out of bounds access is the read at the "reference twice"
check, so the symptom depends on what happens to be on the stack:
FL=UNK is silently accepted and produces silence, FL=UNSD reports
"Can not reference in channel 512 twice", and FL=AMBI aborts.
The check has to be at the caller and not in parse_channel_name(), which
is shared with the out channel path: there the named id is converted by
av_channel_layout_index_from_channel() into a layout index, so high ids
are legitimately supported and "pan=AMBI|AMBI=FL" works.
AVERROR_PATCHWELCOME is used because these are valid AVChannel values
that af_pan cannot represent: for named input channels the gain matrix is
indexed by the raw id, and the renumbering loop in config_props() is
bounded by MAX_CHANNELS as well, so such a mapping never worked.
The in_ch_id < 0 half is currently unreachable and only kept for symmetry
with the out channel check above.
Regression since 1f96db959c, which dropped
the "channel_id >= MAX_CHANNELS" part of the check when converting to the
new channel layout API.
Reported-by: karnakarreddi
Fixes: #22963
Signed-off-by: iSold Leo <s@qwqlog.com>
The final edge clamp computes the source position using int
multiplication before shifting. With sufficiently wide inputs this
overflows, which may suppress the clamp and leave the last output
pixels interpolated with the padding byte.
Promote the multiplication to int64_t in the C, MMXEXT and VSX
implementations.
Add a regression test covering the rightmost pixel of a wide upscale,
which is wrong before this change on both the C and the MMXEXT path.
Fixes: signed integer overflow: 15 * 255918080 cannot be represented in type 'int'
Fixes: #21591
Signed-off-by: iSold Leo <s@qwqlog.com>
update ctx->ov_option.layout to the explict value which will be
used in function init_model_ov.
also move the code before input_resizable which uses the layout
Host map'd bufs skipped flushes unconditionally, always forcing the coherent flag
regardless of the memory type actually chosen for the import.
All known implementations import host memory as coherent, in which case nothing changes.
Dependencies were only released when a context was about to be reused, so
all buffers and deps got held up and piled up in the queue.
Release them as soon as they're done instead. Cuts RAM usage down by a ton.