2718 Commits

Author SHA1 Message Date
Romain Beauxis
82d7e375f1 libavdevice/alsa.c: fix NULL pointer dereference 2026-04-19 15:00:08 +00:00
Andreas Rheinhardt
e0ed3fa834 tests/checkasm: Add snowdsp test
Only inner_add_yblock for now.
Hint: Said function uses a pointer to an array of pointers as parameter.
The MMX version clobbers the array in such a way that calling the
function repeatedly with the same arguments (as happens inside bench_new())
leads to buffer overflows and segfaults. Therefore CALL4 had to be
overridden to restore the original pointers. This workaround will be
removed soon when the MMX version is removed.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-04-13 12:46:24 +02:00
Kacper Michajłow
cc41e6a462 tests/fate/hlsenc: add hls-event-no-endlist test
Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
2026-04-11 01:58:34 +02:00
Priyanshu Thapliyal
056562a5ff fate/lavf: add PDV round-trip and seek coverage
Add FATE coverage for PDV encoding and decoding via lavf, including
intra and inter frame cases, skip-nokey decoding, and container-level
seek coverage.

Use -strict experimental in the encode commands because the encoder
is marked experimental.
2026-04-09 03:01:43 +00:00
Sankalpa Sarkar
7b49a69f43 fate: add unit tests for libavutil/timecode functions 2026-04-05 22:23:08 +02:00
Sankalpa Sarkar
b462674645 fate/hlsenc: Add tests for untested features 2026-04-05 14:02:48 +00:00
Dana Feng
31a711aa68 vf_mpdecimate: Add comprehensive tests for keep and max options
Add tests for the mpdecimate filter to verify correct behavior:
- fate-filter-mpdecimate-keep: tests keep=3 option
- fate-filter-mpdecimate-keep1: tests keep=1 option
- fate-filter-mpdecimate-maxdrop-pos: tests max=3 (positive) option
- fate-filter-mpdecimate-maxdrop-neg: tests max=-3 (negative) option

Signed-off-by: Dana Feng <danaf@twosigma.com>
2026-04-05 00:26:55 +00:00
marcos ashton
e18c8c533d tests/fate/libavutil: add FATE test for mathematics
Test the integer math utility functions: av_gcd, av_rescale,
av_rescale_rnd (all rounding modes including PASS_MINMAX),
av_rescale_q, av_compare_ts, av_compare_mod, av_rescale_delta,
and av_add_stable. Includes large-value tests that exercise the
128-bit multiply path in av_rescale_rnd.

av_bessel_i0 is not tested since it uses floating point math
that is not bitexact across platforms.

Coverage for libavutil/mathematics.c: 0.00% -> 82.03%

Remaining uncovered lines are av_bessel_i0 (float, 23 lines)
and one edge case fallback in av_rescale_delta.
2026-04-05 00:12:29 +00:00
marcos ashton
66b1dbfb98 tests/fate/libavutil: add FATE test for samplefmt
Test all public API functions: name/format round-trip lookups,
bytes_per_sample, is_planar, packed/planar conversions,
alt_sample_fmt, get_sample_fmt_string, samples_get_buffer_size,
samples_alloc, samples_alloc_array_and_samples, samples_copy,
and samples_set_silence. OOM error paths are exercised via
av_max_alloc().

Coverage for libavutil/samplefmt.c: 0.00% -> 95.28%

Remaining uncovered lines are the fill_arrays failure path
and the overlapping memmove branch in samples_copy.
2026-04-05 00:12:29 +00:00
marcos ashton
117897bcd0 tests/fate/libavutil: add FATE test for rc4
Test the three public API functions: av_rc4_alloc, av_rc4_init,
and av_rc4_crypt. Verifies keystream output against RFC 6229
test vectors for 40, 56, 64, and 128-bit keys, encrypt/decrypt
round-trip, inplace operation, and the invalid key_bits error path.

Coverage for libavutil/rc4.c: 0.00% -> 100.00%
2026-04-05 00:12:29 +00:00
marcos ashton
878eabdfef tests/fate/libavutil: add FATE test for video_enc_params
Unit test covering av_video_enc_params_alloc,
av_video_enc_params_block, and
av_video_enc_params_create_side_data.

Tests allocation for all three codec types (VP9, H264, MPEG2) and
the NONE type, with 0 and 4 blocks, with and without size output.
Verifies block getter indexing by writing and reading back
coordinates, dimensions, and delta_qp values. Tests frame-level qp
and delta_qp fields, and side data creation with frame attachment.

Coverage for libavutil/video_enc_params.c: 0.00% -> 86.21%
(remaining uncovered lines are OOM error paths)

Signed-off-by: marcos ashton <marcosashiglesias@gmail.com>
2026-03-31 18:05:51 +01:00
marcos ashton
c8ec660d78 tests/fate/libavutil: add FATE test for detection_bbox
Unit test covering av_detection_bbox_alloc, av_get_detection_bbox,
and av_detection_bbox_create_side_data.

Tests allocation with 0, 1, and 4 bounding boxes, with and without
size output. Verifies bbox getter indexing by writing and reading
back coordinates, labels, and confidence values. Tests classify
fields (labels and confidences), the header source field, and
side data creation with frame attachment.

Coverage for libavutil/detection_bbox.c: 0.00% -> 86.67%
(remaining uncovered lines are OOM error paths)

Signed-off-by: marcos ashton <marcosashiglesias@gmail.com>
2026-03-31 18:05:51 +01:00
marcos ashton
be2fa77344 tests/fate/libavutil: add FATE test for spherical
Unit test covering all 4 public API functions in libavutil/spherical.c:
av_spherical_alloc, av_spherical_projection_name, av_spherical_from_name,
and av_spherical_tile_bounds.

Tests allocation with and without size output, all 7 projection type
name lookups, projection name round-trip verification, out-of-range
handling, and tile bounds computation for full-frame, quarter-tile,
and centered-tile configurations.

Coverage for libavutil/spherical.c: 0.00% -> 100.00%

Signed-off-by: marcos ashton <marcosashiglesias@gmail.com>
2026-03-31 18:05:51 +01:00
Jun Zhao
514f57f85d tests/checkasm: add HEVC intra prediction test
Add checkasm test for HEVC intra prediction covering DC, planar, and
angular modes at all block sizes (4x4 to 32x32) for 8-bit and 10-bit
depth.

Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2026-03-30 14:32:10 +00:00
Soham Kute
e3bcb9ac76 avformat/tests: add FATE tests for yuv4mpegpipe pixel formats
The existing fate-lavf-yuv420p.y4m covers only the default format.
Add four entries that pass -pix_fmt explicitly to the lavf_video
macro: yuv422p, yuv444p, yuv411p, and gray.

These exercise the branches in yuv4mpegpipe_write_header() that write
the "C422", "C444", "C411", and "Cmono" chroma descriptor strings in
the stream header.  All four are gated on ENCDEC(RAWVIDEO,YUV4MPEGPIPE)
and added to FATE_LAVF_VIDEO_SCALE so they inherit the requirement for
CONFIG_SCALE_FILTER that lavf_video's -auto_conversion_filters needs.

Reference files were generated from the actual encoder output and
follow the md5+size+CRC format used by the other lavf references.

Signed-off-by: Soham Kute <officialsohamkute@gmail.com>
2026-03-29 23:01:39 +00:00
Soham Kute
9bf999c24f avcodec/tests: add encoder-parser API test for H.261
Add tests/api/api-enc-parser-test.c, a generic encoder+parser round-trip
test that takes codec_name, width, and height on the command line
(defaults: h261 176 144).

Three cases are tested:

garbage - a single av_parser_parse2() call on 8 bytes with no Picture
Start Code; verifies out_size == 0 so the parser emits no spurious data.

bulk - encodes 2 frames, concatenates the raw packets, feeds the whole
buffer to a fresh parser in one call, then flushes.  Verifies that
exactly 2 non-empty frames come out and that the parser found the PSC
boundary between them.

split - the same buffer fed in two halves (chunk boundary falls inside
frame 0).  Verifies the parser still emits exactly 2 frames when input
arrives incrementally, and that the collected bytes are identical to
the bulk output (checked with memcmp).

Implementation notes: avcodec_get_supported_config() selects the pixel
format; chroma height uses AV_CEIL_RSHIFT with log2_chroma_h from
AVPixFmtDescriptor; data[1] and data[2] are checked independently so
semi-planar formats work; the encoded buffer is given
AV_INPUT_BUFFER_PADDING_SIZE zero bytes at the end; parse_stream()
skips the fed chunk if consumed==0 to prevent an infinite loop.

Two FATE entries in tests/fate/api.mak: QCIF (176x144) and CIF
(352x288), both standard H.261 resolutions.

Signed-off-by: Soham Kute <officialsohamkute@gmail.com>
2026-03-29 23:01:39 +00:00
Soham Kute
dc8183377c avutil/tests/file: replace trivial test with error-path coverage
The original test only mapped the source file and printed its content,
exercising none of the error branches in av_file_map().

Replace it with a test that maps a real file (path via argv[1] for
out-of-tree builds) and verifies it is non-empty, then calls
av_file_map() on a nonexistent file twice: once with log_offset=0 to
confirm the error is logged at AV_LOG_ERROR, and once with log_offset=1
to confirm the level is raised by one, covering the
log_level_offset_offset path in av_vlog().  A custom av_log callback
captures the emitted level independently of the global log level.
The two error cases share a single for() loop to avoid duplication.

Add a FATE entry in tests/fate/libavutil.mak with CMP=null since
there is no fixed stdout to compare.

Signed-off-by: Soham Kute <officialsohamkute@gmail.com>
2026-03-29 23:01:39 +00:00
Andreas Rheinhardt
7cf5e90586 tests/checkasm: Add sbcdsp tests
Only sbc_analyze_4 and sbc_analyze_8 for now.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-03-28 11:25:38 +01:00
Andreas Rheinhardt
af45345f7e tests/fate: Add SBC tests
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-03-28 11:25:38 +01:00
Romain Beauxis
053fb462d8 tests/fate/ogg-*.mak: Make sure that copy tests do not run when
$(FFMPEG) is not compiled.
2026-03-23 10:53:33 -05:00
marcos ashton
924cc51ffe tests/fate/pcm: add FATE tests for pcm_bluray encoder and decoder
Add enc_dec_pcm roundtrip tests for the pcm_bluray codec covering
mono, stereo, 5.1, 7.0, and 7.1 channel layouts in s16. The 5.1
and 7.0 tests use an explicit pan filter for channel layout
conversion so the PAN_FILTER dependency is declared only where
needed. An additional s32 test uses a FATE sample file with real
>16-bit content (divertimenti_2ch_96kHz_s24.wav) and decodes to
s32le to verify the full 32-bit round-trip.

enc_dec_pcm is used instead of transcode because the MPEGTS muxer
produces different binary output on 32-bit and 64-bit platforms,
causing the intermediate file checksum to fail on 32-bit CI.

Coverage for libavcodec/pcm-bluray.c: 0.00% -> 93.75%
Coverage for libavcodec/pcm-blurayenc.c: 0.00% -> 91.71%

Signed-off-by: marcos ashton <marcosashiglesias@gmail.com>
2026-03-21 01:04:20 +00:00
marcos ashton
345071f747 tests/fate/libavutil: add FATE test for stereo3d
Add a unit test covering av_stereo3d_alloc, av_stereo3d_alloc_size,
av_stereo3d_create_side_data, av_stereo3d_type_name,
av_stereo3d_from_name, av_stereo3d_view_name,
av_stereo3d_view_from_name, and av_stereo3d_primary_eye_name.
The from_name calls are driven by a static name table so each
string appears exactly once. Round-trip inverse checks verify
that type_name/from_name and view_name/view_from_name are
consistent with each other.

Coverage for libavutil/stereo3d.c: 0.00% -> 100.00%

Signed-off-by: marcos ashton <marcosashiglesias@gmail.com>
2026-03-21 01:04:20 +00:00
marcos ashton
ed19c181c2 tests/fate/libavutil: add FATE test for film_grain_params
Add a unit test covering alloc, create_side_data, and select
for AV1 and H.274 film grain parameter types (22 cases).

Coverage for libavutil/film_grain_params.c: 0.00% -> 97.73%

Signed-off-by: marcos ashton <marcosashiglesias@gmail.com>
2026-03-21 01:04:20 +00:00
Andreas Rheinhardt
338316f0a3 tests/checkasm: Add test for mpeg4videodsp
It already uncovered a bug in the MMX version of gmc.

Reviewed-by: Lynne <dev@lynne.ee>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-03-19 14:44:30 +01:00
Nicolas Gaullier
fbb3c99032 fate/gapless: remove duplicate ffprobe dependencies
Signed-off-by: Nicolas Gaullier <nicolas.gaullier@cji.paris>
2026-03-12 13:54:35 +00:00
Nicolas Gaullier
2cf8d64f3c fate/probe: simplify for consistency
Signed-off-by: Nicolas Gaullier <nicolas.gaullier@cji.paris>
2026-03-12 13:54:35 +00:00
Nicolas Gaullier
db336e1c51 fate/scale2ref_keep_aspect: fix dependency
Regression since 5b5e692da6.

Signed-off-by: Nicolas Gaullier <nicolas.gaullier@cji.paris>
2026-03-12 13:54:35 +00:00
Andreas Rheinhardt
2862fa37e1 tests/checkasm: Add pixelutils test
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-03-09 10:17:26 +01:00
Romain Beauxis
e5e8efae5c libavformat/mov.c: Fix seek in fragmented mp4 files where the audio and video streams are written to seperate fragments 2026-03-08 16:22:24 -05:00
Andreas Rheinhardt
f37cfb370f avcodec/avcodec: Deprecate intra_dc_precision
It is only used by the MPEG-2 encoder, so replace it
by a private option instead. Use a more elaborate term
for it: intra_dc_precision ("dc" could be anything).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-03-07 20:14:36 +01:00
Andreas Rheinhardt
ee72731722 tests/fate/vcodec: Test intra_dc_precision
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-03-07 20:14:36 +01:00
Michael Niedermayer
92f8dd1ea1 tests/fate/mov: add quotes to some map arguments
Fixes failures for the tests/data/mov-mp4-iamf-7_1_4-video-first.mp4 target on some systems.

Signed-off-by: James Almer <jamrial@gmail.com>
2026-03-02 13:05:18 -03:00
James Almer
40e60a7db0 tests/fate/mov: add tests to demux specific streams within a IAMF Track
Signed-off-by: James Almer <jamrial@gmail.com>
2026-03-02 09:28:36 -03:00
Andreas Rheinhardt
fd44e277c8 tests/checkasm: Add huffyuvencdsp test
Only covers sub_hfyu_median_pred_int16 for now.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-03-01 11:56:57 +01:00
Steven Liu
2559f263ea tests/fate/flvenc: add vvc in enhanced flv test case 2026-03-01 04:21:45 +00:00
Adrien Guinet
da9a6d51f5 avformat/mov: add support for multiple decryption keys
This commit introduces new options to support more than one decryption
keys:
* add a decryption_keys option to MOV, that supports a dictionary of
  KID=>key (in hex), using AV_OPT_TYPE_DICT
* add the corresponding cenc_decryption_keys option to DASH

Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
2026-02-28 04:01:08 +01:00
Niklas Haas
b7bbcccbfe tests/swscale: disable fate-sws-ops-list on BE platforms
The issue is that every le/be pair ends up with a swapped op list:

 rgb24 -> rgb48be:
   [ u8 XXXX -> +++X] SWS_OP_READ         : 3 elem(s) packed >> 0
   [ u8 ...X -> +++X] SWS_OP_CONVERT      : u8 -> u16 (expand)
-  [u16 ...X -> zzzX] SWS_OP_SWAP_BYTES
-  [u16 ...X -> zzzX] SWS_OP_WRITE        : 3 elem(s) packed >> 0
+  [u16 ...X -> +++X] SWS_OP_WRITE        : 3 elem(s) packed >> 0
     (X = unused, z = byteswapped, + = exact, 0 = zero)
 rgb24 -> rgb48le:
   [ u8 XXXX -> +++X] SWS_OP_READ         : 3 elem(s) packed >> 0
   [ u8 ...X -> +++X] SWS_OP_CONVERT      : u8 -> u16 (expand)
-  [u16 ...X -> +++X] SWS_OP_WRITE        : 3 elem(s) packed >> 0
+  [u16 ...X -> zzzX] SWS_OP_SWAP_BYTES
+  [u16 ...X -> zzzX] SWS_OP_WRITE        : 3 elem(s) packed >> 0
     (X = unused, z = byteswapped, + = exact, 0 = zero)

I'm not sure of a good work-around that's not needlessly difficult to
implement, so just disable it on BE platforms for now. The actual underlying
conversions should still be covered by the sws-unscaled test.
2026-02-26 18:08:49 +00:00
Niklas Haas
ea791a4ef1 swscale/tests/swscale: parse flags from string
We don't actually have an SwsContext yet at this point, so just use
AV_OPT_SEARCH_FAKE_OBJ. For the actual evaluation, the signature only
requires that we pass a "pointer to a struct that contains an AVClass as
its first member", so passing a double pointer to the class itself is
sufficient.
2026-02-23 19:23:09 +01:00
Ramiro Polla
80edf78e58 tests/fate/image: add jpegls tests with restart markers
The samples have been generated with:
jpeg -c -ls 0 -z 1 great_wave_128.ppm jpegls/ilv0_rst.jls
jpeg -c -ls 1 -z 1 great_wave_128.ppm jpegls/ilv1_rst.jls

Note: ilv2 is still unsupported
2026-02-20 16:32:10 +01:00
Andreas Rheinhardt
ae60f47a2c tests/fate/{dca,qoa,truehd}: Make fate-audio work
Based on the Makefile variables, "make fate-audio"
is supposed to include the tests for several audio
codecs with their own Makefile. Yet because they are
included after audio.mak*, this doesn't work atm.
Fix this by adding explicit prerequisites.

*: Expansion of variables is not deferred in the context
of prerequisites.

Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-02-19 14:35:04 +01:00
Andreas Rheinhardt
166b01aefd tests/fate/dca: Add ffprobe dependency to dca-lossless tests
Forgotten in e1484a30e5.

Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-02-19 14:34:45 +01:00
Romain Beauxis
0e89d993c5 libavformat/oggenc.c: re-initialize stream on new metadata. 2026-02-18 16:25:06 +00:00
James Almer
e1484a30e5 avformat/dtshddec: properly support priming and padding samples
Don't just export initial_padding, but also take it into account for timestamps
by adjusting the stream's start_time. Also, export the padding samples in a way
that's actually supported, as currently trailing_padding is unused so no user
will look at it.

For the sake of not reducing coverage and because the lossy tests have reference
files that contain the priming samples, add the skip_manual flags2 to the tests
so we still output them. A new ffprobe call will ensure the demuxer behavior is
tested too.

Signed-off-by: James Almer <jamrial@gmail.com>
2026-02-12 09:59:54 -03:00
James Almer
70f0ddd2ca tests/fate/dca: use stream_demux for lossless tests
Unlike md5, the adler32 hash shows the frames with priming samples, which will
be useful in the following commits.

Signed-off-by: James Almer <jamrial@gmail.com>
2026-02-12 09:59:54 -03:00
John Chadwick
8b9b71494b tests/fate/image: Add psd-rgbxx
This is an rgb test image with two auxilliary channels and no alpha
channels.
2026-02-11 20:35:20 +00:00
James Almer
2e79453549 tests/fate/id3v2: don't use a reference file for fate-id3v2-invalid-tags
This fixes running the test under Valgrind, where more, unrelated lines are
printed, making the comparison fail.

Signed-off-by: James Almer <jamrial@gmail.com>
2026-02-09 14:04:22 +00:00
James Almer
11e9a325ec tests/fate/matroska: remove copyts from audio tests
It's not needed after the previous commit.

Signed-off-by: James Almer <jamrial@gmail.com>
2026-02-05 23:21:49 -03:00
Zhao Zhili
a0d4c07b86 tests/checkasm: add test for png
Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
2026-02-04 12:05:35 +08:00
Jun Zhao
0886e50c6b lavc/hevc: add aarch64 neon for 8-bit dequant
Implement NEON optimization for HEVC dequant at 8-bit depth.

The NEON implementation uses srshr (Signed Rounding Shift Right) which
does both the add with offset and right shift in a single instruction.

Optimization details:
- 4x4 (16 coeffs): Single load-process-store sequence
- 8x8 (64 coeffs): Fully unrolled, no loop overhead
- 16x16 (256 coeffs): Pipelined load/compute/store to hide memory latency
- 32x32 (1024 coeffs): Pipelined with all available NEON registers

Performance benchmark on Apple M4:
./tests/checkasm/checkasm --test=hevc_dequant --bench
hevc_dequant_4x4_8_c:                                   11.3 ( 1.00x)
hevc_dequant_4x4_8_neon:                                 6.3 ( 1.78x)

hevc_dequant_8x8_8_c:                                   33.9 ( 1.00x)
hevc_dequant_8x8_8_neon:                                 6.6 ( 5.11x)

hevc_dequant_16x16_8_c:                                153.8 ( 1.00x)
hevc_dequant_16x16_8_neon:                               9.0 (17.02x)

hevc_dequant_32x32_8_c:                                 78.1 ( 1.00x)
hevc_dequant_32x32_8_neon:                              31.9 ( 2.45x)

Note on Performance Anomaly:
The observation that hevc_dequant_32x32_8_c is faster than 16x16 (78.1 vs 153.8)
is due to Clang auto-vectorizing only for sizes >= 32x32.
Compiler: Apple clang version 17.0.0 (clang-1700.6.3.2)

Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2026-01-25 06:55:26 +00:00
Andreas Rheinhardt
0629ebb5ff tests/checkasm: Add CRC test
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-01-04 15:49:30 +01:00