Samples made following the current (for now) faulty specification may not
include alignment bits at the end of VUI parameters, so instead of erroring
out, warn about it and keep going.
In a writing scenario, like the lcevc_metadata bsf, the output bitstream will
be written with them.
Signed-off-by: James Almer <jamrial@gmail.com>
put_signed_rect_clamped uses different types for differnt
8bit and >8bit content. The 8bit SSE2 function used the real
type in its function signature; this does not coincide with
the array of function pointers it gets put into and therefore
also not with how it is called which is UB. Also, casts of
function pointers to void* like it is done here are not
legal ISO-C as function pointers and object pointers need not
be convertible.
So just declare the function to have the required type for
the function pointer array.
Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
{ADD,PUT}_RECT was only used once since the removal of
mmx functions in d29a9c2aa6.
Furthermore, several of the INIT_XMM calls lacked the
actual cpuflags. Therefore the cpu flag suffix has been
manually added to the function names; furthermore, cpuflags()
as well as the check for supported instructions wouldn't work.
So add the cpu flags to INIT_XMM.
Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
packusdw saturates to uint16_t, yet CLIPW is designed for signed values.
If any of the saturated unsigned values were >= 2^16*, the macro would
return 0. Anyway, given that packusdw already saturates below,
clipping from both sides again is simply wasteful.
*: I don't know whether this can happen at all.
Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Pass the input value by value and return the output value
as return value and not by passing the input value by reference.
This improves decoding speed by 2% here.
Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
The decoder has been made to use unsigned values after
the fuzzer encountered signed integer overflow;
the same can probably happen in the encoder (I don't know),
but it definitely can happen in the checkasm test that
will be added soon. So use unsigned here, too.
Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
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>