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
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>
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
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.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>
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>
checkasm:
- CPU: AMD Ryzen 9 9950X3D 16-Core Processor (00B40F40)
- Timing source: x86 (rdtsc)
- Bench duration: 100000 µs per function (448667793 cycles)
- Random seed: 3773883393
Benchmark results:
name cycles (vs ref)
f32_lut_3d_xyz_dynamic_c: 125193.9
f32_lut_3d_xyz_static_c: 25792.1
f32_lut_3d_xyzw_dynamic_c: 123807.1
f32_lut_3d_xyzw_static_c: 25739.0
This is roughly ~50% faster than the existing code in lut3d.c, from a quick
test.
Sponsored-by: Sovereign Tech Fund
Signed-off-by: Niklas Haas <git@haasn.dev>
Since the switch to libcheckasm, checkasm no longer uses
FFmpeg's emms_c, timers, AVLFG or string handling functions,
so remove these headers.
This necessitated adding some missing headers (mostly string.h)
to some files.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This has been done in order to use the same parameters
that influence the number of elements to be processed
sets to make benchmarks between different instruction
sets comparable. Yet it has a downside: Only one parameter
combination would ever be executed when using --repeat,
hiding potential bugs.
Luckily libcheckasm makes it easy to fix this:
At the start of every test function, the internal state
of rnd() is reset, so that it produces the same sequence
of random values. So just initialize these parameters
every time (and before actually testing any function).
This also would make this test trivially parallelizable with --repeat.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This has been done in order to use the same height
for each function for benchmarks of different
instruction sets to make the benchmarks comparable.
Yet it has a downside: Only one number would ever be
executed when using --repeat, hiding potential bugs.
Luckily libcheckasm makes it easy to fix this:
At the start of every test function, the internal state
of rnd() is reset, so that it produces the same sequence
of random values. So just initialize the heights every time
(and before actually testing any function).
This also would make this test trivially parallelizable with --repeat.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
llviddsp functions typically operate on whole lines,
i.e. the pointers are aligned to STRIDE_ALIGN. They
can therefore avoid tail handling by just clobbering
the padding (if any).
The test gets a random width via 16 * av_clip(rnd(), 16, 128);
in practice, it is very unlikely for rnd() to return
a value between 16 and 128, so width is typically 16*16 or
16*128. Buffers of this size are allocated later.
When rnd() returns an odd number in the allowed range
(this happens for the seed 4161216273), the buffers used
in the test don't contain the padding that exists in actual
usage, leading to invalid stores and also to segmentation faults
(usage of aligned load instructions on unaligned addresses).
Fix this by adding the necessary alignment to the buffers.
Also don't use a static variable to store width (it is unnecessary,
because since the switch to libcheckasm, rnd() always returns
the same sequence of random numbers for test runs with different
instruction sets) and use a really random width, not something
that is mostly just one of two values and always mod 16.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This has been done in order to use the same number of blocks
for benchmarks of different instruction sets to
make the benchmarks comparable. Yet it has a downside:
Only one number would ever be executed when using --repeat.
Luckily libcheckasm makes it easy to fix this:
At the start of every test function, the internal state
of rnd() is reset, so that it produces the same sequence
of random values. So just removing the static variable works.
This would also makes this test trivially parallelizable.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This has been done in order to use the same width
for benchmarks of different instruction sets to
make the benchmarks comparable. Yet it has a downside:
Only one width would ever be executed when using --repeat.
Luckily libcheckasm makes it easy to fix this:
At the start of every test function, the internal state
of rnd() is reset, so that it produces the same sequence
of random values. So just removing the static variable works.
This would also make this test trivially parallelizable.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Return EEXIST when output overwrite is refused so ffmpeg exits with a
non-zero status for -n and interactive no responses.
Signed-off-by: 张永鹏 <roc63@outlook.com>
Superseded by SSE4. This makes the huffyuv decoders ABI compliant,
e.g. nothing messes up the FPU state at all any more. Therefore
the emms_c() can be removed from huffyuvdec.c.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Up until now ff_vc1_v_loop_filter4_ssse3 used MMX registers
despite being an SSSE3 function. Porting it to XMM registers
didn't lead to any change in benchmarks here, but abides
by the ABI (one function less that does not omit emms).
Unfortunately the size of the function increased by 64B
by this.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
STTS sample deltas follow decode order, while AVPacket.duration is
defined as the interval to the next PTS in presentation order. Assigning
the deltas directly therefore produces incorrect packet durations for
VFR video with reordered frames.
After index construction and edit-list processing, sort samples by PTS
and set every duration with a following PTS from adjacent presentation
timestamps. This reorders STTS durations where possible and derives
intervals produced by the STTS/CTTS combination when necessary. Keep the
original timing table if allocation fails or timestamps are invalid.
Add FATE coverage for the official VFR H.264 sample and for a generated
MPEG-4 case whose presentation intervals are not a permutation of its
STTS deltas. Update the HEVC dts2pts CRA reference for the corrected
presentation-order durations.
Signed-off-by: panboxiaosa <panboxiaosa@gmail.com>
Segment starts on the seek timeline are derived from EXTINF durations,
so the first keyframe of the target segment can have a slightly lower
DTS than the snapped seek position, in which case the packet discard
loop would skip it and resume playback one segment late. Make sure we
start at the very beginning of the stream in this case.
Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
Rebase the first packet's timestamp onto the start of the segment list
regardless of playlist type, and report it as start_time. Previously
only EVENT playlists did this and live streams took start_time from the
first loaded segment at the live edge. Which is not correct as some
servers provide very deep (hours even) time shift in live playlist. The
evicted segments are already tracked by EXT-X-MEDIA-SEQUENCE. This
allows us to use all available segments, not only the future ones on
live playlist.
Also prefer PTS over DTS, as EXTINF durations and start_time are
presentation time.
Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
The return value of MoveFileExW was not being correctly interpreted,
see https://learn.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-movefileexw.
On Windows a failed rename over the file: protocol now surfaces as failed to rename file %s to %s:
Operation not permitted (ff_rename, libavformat/avio.c:867) plus an AVERROR(EPERM) return, where previously the muxer
reported success and the user was left with a missing or stale output file and no diagnostic. This affects the
write-to-temp-then-rename paths in hlsenc, dashenc, hdsenc, smoothstreamingenc, segment, and img2enc (e.g. HLS/DASH
playlist updates, -write_temp_file, segment list finalization).
Also, added unit tests to exercise the rename function.
Signed-off-by: Christopher Decker <chris.decker08@gmail.com>
This is possible after the recent MMX->XMM conversions
and preferable as it makes the test stricter.
Reviewed-by: Niklas Haas <ffmpeg@haasn.dev>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Before the switch to libcheckasm, rnd returned an unsigned value;
now it only returns a signed value in the range 0..INT_MAX,
so that the sign bit is not random at all. This means that when
rnd is used to initialize four bytes at a time, one bit is not random.
Fix this by mapping rnd to checkasm_rand_uint32().
Reviewed-by: Niklas Haas <ffmpeg@haasn.dev>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This reverts commit 978a0821ee.
The stability of the negotiation process has never been studied
with multiple rounds.
It has always been documented to users that scale was the filter
to insert to manage format conversions. A second filter for
a specific type of conversion should never have been added:
the proper fix for the issue that this commit tried to fix is
to give scale the ability to handle premultiplication too.
Add a small synthetic TrueHD sample that exercises large MAT padding in
spdifenc. The sample covers both the input_timing path with padding above
MAT_FRAME_SIZE / 2 and the output_timing discontinuity path.
It also verifies queued MAT frame emission when one input packet completes
more than one MAT frame.
Signed-off-by: Nathan Lucas <nlucasgit@gmail.com>
Deprecate MMX. No change in performance. Also add test coverage in
checkasm.
pred8x8_dc_rv40_mmxext: 10.0 ( 1.24x)
pred8x8_dc_rv40_sse2: 10.0 ( 1.24x)
Signed-off-by: Zuxy Meng <zuxy.meng@gmail.com>
Remove the static supported_formats[] allowlist from hwcontext_cuda.
cuda_frames_get_constraints() now iterates all registered pixel formats
and includes every non-hwaccel, non-palette format. cuda_frames_init()
validates with av_pix_fmt_desc_get() instead of checking against the
allowlist.
Palette formats have a special-cased use of plane[1] for the palette itself
and it's not worth the hassle of supporting in an otherwise clean generic
copy loop.
Also add a roundtrip test that uploads a deterministic byte pattern to
CUDA, downloads it back, and verifies the data match. This tests all
non-hwaccel pixel formats. The test is gated on CONFIG_CUDA.