Commit Graph
7511 Commits
Author SHA1 Message Date
Romain Beauxis cac8deb2f9 avformat/mov: keep the current sample when a fragment is inserted at it
When a fragment's samples are inserted into the index exactly at a stream's current sample, current_sample is left on the first inserted entry, and tts_index is never moved with the shifted timing entries, so after a seek a stream moves back to the start of the loaded fragment or gets the composition offset of another sample.

Advance current_sample and tts_index past the inserted entries, and roll tts_index back with current_sample when a truncated trun is trimmed.

The seek in fate-mov-mp4-frag-chapters-seek now returns the same packets and timestamps as a read without the fragment index.
2026-11-04 13:19:26 +00:00
Romain Beauxis be65e08c18 avformat/mov: ignore discarded streams when placing the fragment position on seek
With seek_individually, the last stream seeked sets next_root_atom, so a chapter track whose samples all sit in the first fragment makes mov_read_packet() read every fragment from the start of the file before it reaches the seeked sample.

Resume reading from the earliest fragment any stream that is read landed in, which keeps the fragments that a lagging audio track still needs and ignores the chapter track.

The seek in fate-mov-mp4-frag-chapters-seek no longer restarts from the beginning of the file.
2026-11-04 13:19:26 +00:00
Romain Beauxis 0aceb38155 tests/fate/mov: seek in a fragmented file with a chapter track
Mux the chapters of vorbis_chapter_extension_demo.ogg with generated audio and B-frame video into a fragmented MP4, then seek to 8 s with use_mfra_for=pts and read 40 packets across one fragment boundary.

The reference records the current behaviour, where the read starts at 2 s without audio because the chapter track's seek leaves the fragment index on the first fragment.
2026-11-04 13:19:26 +00:00
Kacper Michajłow 39ccb3ca12 avutil/csp: fix the negative segment of the BT.1361 transfer
See Rec. ITU-R BT.1361.
2026-11-04 02:31:56 +00:00
Kacper Michajłow ef53ec02d8 avformat/hls: drop WebVTT cues repeated across segment boundaries
A WebVTT segment contains every cue shown during its period (RFC 8216,
3.5), so a cue that reaches into the next segment appears in both. Keep
the cues of the previous segment and drop the ones the current segment
repeats, so each cue is delivered once. The kept cues read before the
media position was known move onto it once it is, so the comparison is on
one timeline. Nothing is repeated across a discontinuity, so the kept cues
are dropped when the opened segment has another discontinuity sequence
number (RFC 8216, 4.3.3.3), which also covers a boundary that already left
a live playlist.

Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
2026-11-04 02:28:56 +00:00
Kacper Michajłow 729de963f9 avformat/hls: keep the subtitle cues still shown at the seek target
Discard the cues of a subtitle playlist by their end time when seeking
or when the playlist is enabled during playback, so a cue that is on
screen at the target is delivered instead of the next one starting after
it.

Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
2026-11-04 02:28:56 +00:00
Kacper Michajłow b4738344cd avformat/hls: apply the X-TIMESTAMP-MAP header of WebVTT segments
Set the timestamp_map option of the webvtt demuxer for the subtitle
segments in place of prefer_hls_mpegts_pts, which no demuxer has, so the
cue times land on the MPEG-TS timeline of the audio and video. That time
is on the 33 bit PES clock, so each cue is put on the period of that clock
nearest to the position of the media, which is read first when both are
enabled. A cue read without any media does not become that position, and
a cue still buffered when the media is enabled is placed relative to it
before it is returned.

Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
2026-11-04 02:28:56 +00:00
Kacper Michajłow 039335d9bc avformat/webvttdec: add an option to apply the X-TIMESTAMP-MAP header
HLS WebVTT segments carry an X-TIMESTAMP-MAP header that maps a cue time
to an MPEG-TS time of the other renditions (RFC 8216, 3.5). With
timestamp_map set, add the offset it gives to the cue timestamps, and use
the 90 kHz MPEG-TS time base for the stream so that the mapping stays
exact. Skip the header when it comes in a block of its own instead of
ending the parsing there.

Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
2026-11-04 02:28:56 +00:00
Kacper Michajłow 39e14c2e0c tests/fate/demux: add HLS WebVTT timestamp map and seek tests
Audio from 10 s with WebVTT segments mapping cue time 0 to 10 s, a cue
that spans three segments and a seek into the second segment.

Note tests are ugly with printf generation, but this is the only way to
get full HLS test to work, it's not a single file that we could upload
to fate samples server.

Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
2026-11-04 02:28:56 +00:00
Kacper Michajłow cce3a9d1bc tests/fate/demux: clean up only its own files after the HLS WebVTT test
The globs also matched the data of other tests named hls-webvtt-*.

Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
2026-11-04 02:28:56 +00:00
Gyula Sebok a77727882a tests/checkasm/llviddsp: Test add_left_pred_int16 with more masks
Only 0xFF was tested, while the decoders use masks up to 0xFFFF
(HuffYUV up to 16 bits, UtVideo 10 bits, MagicYUV 10 to 14 bits).
Test the masks for all bit depths from 8 to 16.

Signed-off-by: Gyula Sebok <gyula.sbk@gmail.com>
2026-11-03 18:33:02 +00:00
Gyula Sebok 8e6a5f1988 tests/checkasm/llviddsp: Fix operator precedence in the random width
1 + rnd() % 16*128 is parsed as 1 + (rnd() % 16) * 128, which only
gives 16 different widths, all of them 1 modulo 128. Use 1..2048, as
intended in 78193e6490.

Signed-off-by: Gyula Sebok <gyula.sbk@gmail.com>
2026-11-03 18:33:02 +00:00
Michael Niedermayer 39bf2a1cfb avcodec/tests: cover hardware encoder timestamp fixup at EOF
Exercise empty input and short streams around the decode delay without requiring hardware. Print results for FATE comparison, including the EOF state and timestamp difference.

Assisted-by: Fairy
2026-11-03 17:19:41 +00:00
Martin Mirchev c511a7fcf7 fate/image: add a test for 16-bit JPEG-LS with line interleaving
Encode a 16-bit gray image with the jpegls encoder, set the ILV byte of
the SOS header to 1 and check that it decodes to the source picture.

Signed-off-by: Martin Mirchev <mmirchev@comp.nus.edu.sg>
2026-11-03 12:58:10 +00:00
Rainbaby f80a436ffd tests/fate/video: add an AVS1-P16 Broadcasting decoding test
cavs/avsplus-1080i-testcard.ts is five pictures (I P B P B) of a 1080i
broadcast test card, captured off air from a Beijing DTMB multiplex on
2021-09-23. It carries no program content, only a zone plate, frequency
bursts and channel idents.

The five pictures cover AEC intra and inter decoding, field coded
pictures, two enhanced field coded B pictures and 15 annex A pseudo
start codes. No existing FATE sample reaches any of these paths:
fate-cavs and fate-cavs-bunny are both JiZhun and progressive.

Signed-off-by: Rainbaby <r@bgr.jp>
2026-11-02 22:18:06 +00:00
Rainbaby 51f56976ae avcodec/cavs_parser: report the profile
The parser skipped a byte it had already read. Reporting it is what
moves the cavs-demux reference.

Signed-off-by: Rainbaby <r@bgr.jp>
2026-11-02 22:18:06 +00:00
Rainbaby 6c6a2764d9 avcodec/cavsdsp: widen the qpel interpolation intermediate
The horizontal pass of the two dimensional quarter sample interpolation
reaches (96 + 42) * 255 = 35190 in the ii and kk positions and overflows
the int16_t intermediate. The other four positions use the half sample
filter, stay within -510..2550 and keep int16_t. Only the C path is
affected; the x86 SIMD covers just the one dimensional positions.

Signed-off-by: Rainbaby <r@bgr.jp>
2026-11-02 22:18:06 +00:00
Rainbaby 375e3df8fe tests/fate/video: add a second Chinese AVS decoding test
cavs/bunny.mp4 is already in the FATE suite for fate-cavs-demux, and it
reaches decoding paths the existing fate-cavs sample does not.

Signed-off-by: Rainbaby <r@bgr.jp>
2026-11-02 22:18:06 +00:00
Kacper Michajłow 9559567dfa tests/md5.sh: probe md5 tools without a subshell
Little bit faster.

Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
2026-11-02 18:20:48 +00:00
Kacper Michajłow 265b60bc50 fate/mpegts: pipe the dvbsub multi-service remuxes into ffprobe
The test wrote two transport streams to tests/data/fate only to probe
the second. Pipe the remuxes into ffprobe instead.

Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
2026-11-02 18:20:48 +00:00
Kacper Michajłow ca5cdce773 fate/ogg-vorbis: read the chained-large-comment input from pipe:
ffmpeg opens the input - with the fd protocol, which the test does not
depend on. Read pipe:, which it does.

Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
2026-11-02 18:20:48 +00:00
Kacper Michajłow 81a394ecbe fate/astc: pipe the KTX header and HDR reject outputs
The header test wrote two KTX files only to read a few header fields,
the reject test wrote a file it expects to fail. Pipe the header test's
output into od, which dumps the fields from glInternalFormat to the
mipmap level count, and send the reject test's output to stdout.

Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
2026-11-02 18:20:48 +00:00
Kacper Michajłow 5653f1d000 fate/voice: pipe the zero G.723.1 frame into the comfortnoise decode
The GEN rule wrote the 24 zero bytes to a file that only this test
read. Pipe them straight into the decode instead.

Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
2026-11-02 18:20:48 +00:00
Kacper Michajłow 10f48d07a1 fate/demux: pipe the crafted VPK header into ffmpeg
The GEN rule wrote the 21 bytes to a file that only this test read.
Print them straight into ffmpeg instead.

Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
2026-11-02 18:20:48 +00:00
Kacper Michajłow 65d76cef1a fate/matroska: pipe the stereo3d override and metadata tests
The metadata test wrote its matroska files to tests/data/fate and
deleted them by hand, the override test went through run_with_temp.
Pipe the encode, the remux and the probe instead.

Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
2026-11-02 18:20:48 +00:00
Kacper Michajłow 6ef8dd7ef5 fate/rtsp: pipe the SDP descriptions into ffprobe
The sample rate tests wrote each description to a file only to probe
it. Pipe it into ffprobe instead, with -f sdp, as the format was found
by the file extension before.

Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
2026-11-02 18:20:48 +00:00
Kacper Michajłow f9418a8f5f fate/ac3: pipe the dexp24 and dither encodes into the decode
Both GEN rules wrote an ac3 file that only one test decoded. Pipe the
encode straight into the decode instead.

Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
2026-11-02 18:20:48 +00:00
Kacper Michajłow 27a30c58c1 fate/aac: pipe the channel layout encodes into ffprobe
Each GEN rule wrote an adts file that only one probe test read. Pipe
the encode straight into the probe instead.

Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
2026-11-02 18:20:48 +00:00
Kacper Michajłow fd7161d542 tests/fate-run.sh: fail a test when any command of a pipeline fails
A pipeline returns the status of its last command, so a test piping
ffmpeg into ffprobe or framecrc passed when ffmpeg failed after writing
its output, for example on a leak reported by LeakSanitizer. Enable
pipefail where the shell supports it.

Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
2026-11-02 18:20:48 +00:00
Kacper Michajłow 604d708fd4 fate/ogg-vorbis: read the misplaced-headers pages from the sample with dd
Each page range was cut by dd from a data remux of the sample, and dd
stops reading before ffmpeg has written all of it. Read the ranges
from the sample directly, the test then needs only ffprobe.

Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
2026-11-02 18:20:48 +00:00
Mark Thompson 693195b518 lavc/apv: Precompute transquant constants once per tile component
Adds a new dsp function to compute a constants buffer in the form most
suitable to the specific implementation.  This gets called once per
tile component to prepare the constants buffer, and then the transquant
functions get a pointer to that buffer to use.

CPU: Intel(R) Xeon(R) Gold 6252 CPU @ 2.10GHz
Before:
  decode_transquant_10_c:       333.2
  decode_transquant_10_avx2:     65.5 ( 5.09x)
After:
  decode_transquant_10_c:       330.9
  decode_transquant_10_avx2:     57.3 ( 5.78x)

No significant difference on ARM Cortex-A53/A73.
2026-11-01 14:33:45 +00:00
Mark Thompson d971771eea checkasm/apv_dsp: Improve test coverage
Test all bit depths, using random QP, qmatrix, and coefficients.

This makes the coefficients by sending a random residual through a
forward transform and quantisation in order to keep all of the
arithmetic within the encoder range.  One coefficient is sometimes set
to a large value to exercise the dequantisation clipping, which is
otherwise never hit here.

Benchmarking continues to use a dense block similar to the old test to
ensure that results are comparable and represent the worst case.
2026-11-01 14:33:45 +00:00
Alexkane e2740a3e0d avutil/opt: validate the operand of a flags update before casting it
set_string_number() parses the operand of a "+x" or "-x" flags update as
a double and casts it to int64_t to OR it into, or mask it out of, the
current flags. Only the combined value then reaches the range check in
write_number(), so the operand itself was never validated:

- A value outside the int64_t range, or inf, makes the conversion
  undefined behaviour (C17 6.3.1.4). UBSan reports it for
  av_opt_set(ctx, "flags", "+77777777777777777777", 0), and what the
  cast produces depends on the target: measured on AArch64, where it
  saturates, "+1e20" happened to be rejected downstream while "-1e20"
  was accepted.
- A fractional operand is silently truncated, so "+1.5" and "-1.5" are
  accepted although "1.5" is refused as not being a valid set of flags.

Run the existing flags range check on the operand before the cast, so an
invalid operand returns AVERROR(ERANGE) exactly like an invalid absolute
value, as av_opt_set() documents, and add the four cases to fate-opt.

Reported by FuzzAnything-ORG with a UBSan trace.
Fixes #22389
2026-11-01 05:04:00 +00:00
James Almer 4f23f20e88 tests/fate/cbs: add cbs_lcevc tests
Signed-off-by: James Almer <jamrial@gmail.com>
2026-10-31 20:38:49 -03:00
Jun Zhao 4811625b5f avcodec/dvbsubenc: provide the page ids in extradata
The DVB subtitles written by this encoder always use page 1 as
composition and ancillary page id, but the encoder never told the muxers
about it: it never set any extradata.

Muxers need it. The Matroska CodecPrivate of an S_DVBSUB track is
mandatory and holds the composition page id, the ancillary page id and
the subtitling type, five bytes in that order; MPEG-TS reorders these
fields into its subtitling descriptor, which carries the language and
the type before the page ids, and the decoder only reads the page ids.
A file without them is invalid, and players that require them (VLC
refuses to create such a track and then filters the segments by page id)
show no subtitles at all, while players that do not, like mpv, are
unaffected.

Set the five bytes in the encoder so that every container gets them,
including MPEG-TS, which previously filled in the page ids with the same
hardcoded default. The encoded packets are unchanged; only the
fate-sub-dvb reference gains the extradata line of the output stream.

Fixes: https://code.ffmpeg.org/FFmpeg/FFmpeg/issues/25610
Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2026-10-31 11:00:25 +00:00
Jun Zhao 53c4520719 avformat/mpegtsenc: keep the hard of hearing subtitling type
The subtitling type written into the subtitling descriptor is taken from
the stream extradata whenever it holds a full record, five bytes per
service: composition page id, ancillary page id and subtitling type.
That record can come from an encoder, which cannot know dispositions, so
a stream for the hard of hearing would be written as a normal subtitle.

Replace a normal subtitling type (0x1x) with the matching one for the
hard of hearing (0x2x, same monitor aspect ratio criticality) when the
stream disposition says so. Only single-service records are adjusted:
the demuxer flags the whole stream as soon as one of several services is
for the hard of hearing, so rewriting a multi-service record would also
change the type of the other services.

Covered by fate-mpegts-dvbsub-hearing-impaired (single service) and
fate-mpegts-dvbsub-multi-service (several services).

Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2026-10-31 11:00:25 +00:00
Zuxy Meng df2926615e avcodec/x86/h264: convert qpel MMX to SSE2
Convert the last MMX (mmxext) qpel functions, all 4-wide
8-bit and 10-bit paths, to SSE2, following the 8x8_l2
conversion: new symbols carry the sse2 suffix and dispatch
moves from EXTERNAL_MMXEXT to EXTERNAL_SSE2.

checkasm h264qpel passes. almost identical performance in most
converted functions except for small regression caused by replacing
MMX's memory operand with movq and reg-reg op.
2026-10-30 22:46:00 -07:00
Romain Beauxis 1bfb91609d avformat/oggparsevorbis: prevent out of order or missing chained headers
Header packets of a chained stream are only buffered in identification,
comment, setup order. A misplaced packet discards the buffered set with
a warning, so a missing or misordered header no longer mixes headers
from different chains into the new extradata. A misplaced comment
header is skipped without applying its metadata.

Reserved packet types are ignored, as required by Vorbis I section
1.3.2, and leave a buffered header set intact.
2026-10-30 13:57:55 +00:00
Romain Beauxis 1347b93c27 avformat/oggparsevorbis: ignore comment headers outside a header set
255302da70 and 5a633ec2dd applied the metadata of mid-stream comment
headers for MPD streams. No MPD release sends them: since v0.15, its
encoder starts a new chain with a full header set on tag changes.

A lone comment header is invalid. It is skipped to avoid failing the
stream, but its metadata is not honoured.
2026-10-30 13:57:55 +00:00
Romain Beauxis 47dd2171bd fate/ogg-vorbis: add a test for misplaced chained stream headers
Splice pages of moog_small.ogg into a stream with comment and setup
headers without identification header, then an identification header
followed by audio.

The reference records the current output: the metadata of misplaced
comment headers is applied, and headers from different places are
packed into new extradata.
2026-10-30 13:57:55 +00:00
Niklas HaasandClaude Opus 5.5 17a4a474f4 swscale: build and run ops tests unconditionally
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Niklas Haas <git@haasn.dev>
2026-10-30 10:55:13 +00:00
Martin Mirchev 60a2818f76 fate/vpx: add a test for Theora quantizer changes with frame threading
Patch the first quantizer of the first frame of a remuxed existing
sample that uses three quantizers per frame, and decode it with four
frame threads.

Signed-off-by: Martin Mirchev <mmirchev@comp.nus.edu.sg>
2026-10-30 04:22:49 +00:00
Jun Zhao 31ba826726 swscale/tests: cover chroma range conversion with FATE references
Print intermediate chroma results for both range directions at
8/9/10/12/14/16 bits, including neutral and nearby values. Test both
planes with the C and available native implementations, and keep
expected values in tests/ref/fate/sws-range-convert.

Based on the test implementation from Forgejo_Fairy in PR #25549.

Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2026-10-29 03:10:43 +00:00
Jun Zhao 987b6193bd checkasm/sw_range_convert: include neutral chroma samples
Include the neutral chroma center in the inputs compared between the C
and optimized range-conversion implementations at every tested depth.

Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2026-10-29 03:10:43 +00:00
Jun Zhao eb59f938ae swscale/range_convert: preserve chroma center in range conversion
solve_range_convert() anchored the range conversion offset at the upper
endpoint (src_max -> dst_max). For chroma, mapping the limited-range
interval [16, 240] to the full-range interval [0, 255] via the upper
endpoint shifts the neutral chroma center (128 << (bit_depth - 8)) to
127.5 in 8-bit units.

After 4bee010844 added the fixed-point rounding bias, that -0.5 LSB
shift canceled out the final output rounding bias for colored chroma,
leaving a systematic -0.5 LSB truncation bias in full-range chroma and
causing neutral gray to still round down to 127 on the x86 4:2:0 vertical
filter path.

Per ITU-T H.273 Section 8.3, the achromatic chroma center is
128 << (bit_depth - 8) in both limited and full range. Anchor the chroma
range conversion offset at the neutral chroma center while keeping the
luma offset anchored at the upper endpoint.

Based on the root-cause analysis and patch from Forgejo_Fairy and alec
in issues #24005 and #25521.

Fixes: https://code.ffmpeg.org/FFmpeg/FFmpeg/issues/24005
Fixes: https://code.ffmpeg.org/FFmpeg/FFmpeg/issues/25521
Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2026-10-29 03:10:43 +00:00
Kacper Michajłow def599cc17 avformat/hls: parse the EXT-X-START attributes in any order
TIME-OFFSET was only read as the first attribute of EXT-X-START, so a
tag with PRECISE first was ignored. RFC 8216 4.2 does not order the
pairs of an attribute-list. Parse it with ff_parse_key_value() as the
other attribute lists are.

Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
2026-10-29 02:15:48 +00:00
Kacper Michajłow 9719420739 libavformat/tests: remove the hls test program
The hls-start demux tests cover the cases of the hls-parse tests
through the demuxer. There is no need for hls.c API test code.

Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
2026-10-29 02:15:48 +00:00
Kacper Michajłow 78e7790789 tests/fate/demux: add HLS EXT-X-START tests
hls-start-master.m3u8 has an EXT-X-START before its EXT-X-MEDIA and
EXT-X-STREAM-INF tags. Its variant hls-start-media.m3u8 has one of its
own and its audio rendition none. Both are live playlists of four
0.144 s segments. hls-start-variant.m3u8 is the same Master Playlist
without EXT-X-START. hls-start-endlist.m3u8 has an EXT-X-ENDLIST
between its EXT-X-START and its first segment.

Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
2026-10-29 02:15:48 +00:00
Jun Zhao 743814d181 tests/fate: add a test for a filtergraph closing a looped input
The graph closes its three looped inputs by letting trim return EOF
while the main input is still active. On the unfixed code this
deadlocks the CLI with a significant probability, so the test then
only finishes by timeout; with the fix it passes deterministically.

Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2026-10-29 02:06:15 +00:00
Kacper Michajłow beb24ceb27 fate/ogg-vorbis: pipe the chained-large-comment inputs
The test read its two parts through a concat: URL built from
target_path, which is not portable and doesn't work with Windows pathes,
at least not with enough escaping sprinkled on top. Pipe both parts
straight into the framecrc run and pass the comment to -/metadata
through a pipe, so the test writes no files.

Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
2026-10-28 20:57:24 -05:00