1
0
mirror of https://git.ffmpeg.org/ffmpeg.git synced 2026-10-24 02:09:03 +03:00
Commit Graph

7212 Commits

Author SHA1 Message Date
James Almer
818cecc6e1 tests/api/movenc: add a test for fragmented output with no samples
Covers the fix from 9f35e220ff.

Signed-off-by: James Almer <jamrial@gmail.com>
2026-08-30 16:03:25 +00:00
Wu Jianhua
df48dc624e tests/fate/image: add fate-tiff-icc
Signed-off-by: Wu Jianhua <toqsxw@outlook.com>
2026-08-28 18:50:16 +00:00
Wu Jianhua
235b81cb9a avcodec/tiffenc: support writing ICC profiles
Write ICC profiles as TIFF UNDEFINED data and align all out-of-line IFD values to a word boundary. Account for non-empty ICC side data while allocating the packet and calculate the image size in checked 64-bit arithmetic.

Signed-off-by: Wu Jianhua <toqsxw@outlook.com>
2026-08-28 18:50:16 +00:00
James Almer
3acec0a1af avformat/iamf_writer: don't discard skip samples signaled through side data for Opus
If it's set, then it should be used.
Fixes issue #24285.

Signed-off-by: James Almer <jamrial@gmail.com>
2026-08-28 00:17:50 -03:00
Théo Valette
78efc17cc5 avformat/movenc: preserve timecode flags when copying tmcd tracks
The MOV demuxer retains tmcd timecode flags in codec extradata, but copied
tracks never initialize MOVTrack.timecode_flags. mov_write_tmcd_tag()
therefore writes zero when reconstructing the sample description, causing
unchanged frame counters to be interpreted as non-drop-frame.

Initialize the complete flags field from sample-description extradata for
copied tmcd tracks. fate-copy-trac236 covers three drop-frame tmcd tracks.

Fixes issue #20841.

Reported-by: unsword01 <unsword01@noreply.code.ffmpeg.org>
Signed-off-by: Théo Valette <315040668+theovalette@users.noreply.github.com>
2026-08-27 14:08:13 +00:00
Romain Beauxis
e48a073d7e avformat/http: reject malformed response status lines
A status line carrying no HTTP version parsed as status code 0, which
check_http_code() then accepted as a success: the body of an error reply, or of
a reply from something that is not an HTTP server at all, was handed to the
demuxer. strtol() was equally lenient about the code itself, accepting a sign,
a count of digits other than three, and a value outside the range HTTP defines.

Parse the grammar RFC 9112 actually specifies: a case sensitive "HTTP/"
followed by DIGIT "." DIGIT, then exactly three digits on a whitespace
boundary, and reject a code outside the 100-599 range of RFC 9110 section 15.

A status line with no reason phrase at all, "HTTP/1.1 200", stays accepted; the
separator RFC 9112 requires there is missing often enough in the wild.

reason now points at the phrase itself rather than at the separator before it,
so check_http_code() no longer has to skip that separator on its own.

Worth noting: this invalidates several class of previously accepted
invalid http responses, include the ICY responses class from legacy
shoutcast servers.

ICY responses are planned on being re-introduced as opt-in via the new
libcurl HTTP stack.
2026-08-27 13:43:01 +00:00
Romain Beauxis
72dc02e52f tests/http: test response status line parsing
Covers well formed status lines, a missing or non numeric status code, lines
that do not start with an HTTP version, and status lines whose version or code
does not respect the grammar of RFC 9112.

The reference output records the current behavior: every one of those malformed
lines is accepted, most of them as a 2xx success.
2026-08-27 13:43:01 +00:00
marcos ashton
17c109e8d9 tests/fate/libavutil: add FATE test for side_data
Test av_frame_side_data_desc and av_frame_side_data_name on
valid and invalid types, av_frame_side_data_get and its _c
variant for present and absent types,
av_frame_side_data_remove (including MULTI types with
duplicates), av_frame_side_data_remove_by_props filtering by
AV_SIDE_DATA_PROP_*, av_frame_side_data_clone with and without
AV_FRAME_SIDE_DATA_FLAG_REPLACE (including the AVERROR(EEXIST)
and AVERROR(EINVAL) paths) and with AV_FRAME_SIDE_DATA_FLAG_UNIQUE,
av_frame_side_data_add in move mode, with
AV_FRAME_SIDE_DATA_FLAG_NEW_REF and with
AV_FRAME_SIDE_DATA_FLAG_REPLACE over an existing entry, and
av_frame_side_data_free.

Coverage for libavutil/side_data.c: 72.14% -> 86.43%

Numbers measured against a full FATE run. Remaining uncovered
lines are internal allocation-failure error paths requiring
injected failures mid-operation.

Signed-off-by: marcos ashton <marcosashiglesias@gmail.com>
2026-08-27 10:54:38 +00:00
marcos ashton
58c47ca583 tests/fate/libavutil: add FATE test for hdr_dynamic_metadata
Test av_dynamic_hdr_plus_alloc, av_dynamic_hdr_plus_create_side_data,
av_dynamic_hdr_plus_to_t35 in all three documented modes (size
query, caller-allocated, existing caller-owned buffer) including
the AVERROR_BUFFER_TOO_SMALL path, and av_dynamic_hdr_plus_from_t35
as a round-trip inverse.

Two HDR10+ fixtures are used. The first is a conforming
ST 2094-40:2020 ApplicationVersion 1 payload: one processing
window, the nine distribution maxrgb percentiles required by
section 8.5.4, and neither actual-peak-luminance item nor
ColorSaturationWeight, both excluded for that version by section
9.4. The second is marked in the source as deliberately
non-conforming and exists only to reach the optional
serializer/parser branches: a second processing window with its
geometry, both actual-peak-luminance matrices, per-window tone
mapping and color saturation. Every field either fixture
populates is decoded and printed, so a serializer or parser that
drops or corrupts a value changes the reference rather than
passing a flag-only check.

Also test that av_dynamic_hdr_plus_to_t35 ignores
application_version and always writes the CTA-861-H value, the
NULL and oversized error paths, and
av_dynamic_hdr_smpte2094_app5_alloc,
av_dynamic_hdr_smpte2094_app5_create_side_data and the App5
to_t35 / from_t35 round trip over four fixtures covering both
early-out paths (no adaptive tone map, reference-white tone
mapping) and both sides of the component mixing and gain curve
selectors: per-image parameters with component mixing type 3 and
explicit control point slopes, and common parameters shared from
alternate 0 with a mixing type other than 3 and the pchip slope.
The App5 to_t35 validation failures and the OOM paths via
av_max_alloc are covered as well.

Coverage for libavutil/hdr_dynamic_metadata.c: 31.02% -> 95.53%

The baseline comes from the HDR10+ sample tests on a full FATE
run (fate-hevc-hdr10-plus-metadata, fate-png-mdcv and the
Matroska/WebM HDR10+ remux tests).

Signed-off-by: marcos ashton <marcosashiglesias@gmail.com>
2026-08-27 10:54:38 +00:00
marcos ashton
b799c7772b tests/fate/libavutil: add FATE test for downmix_info
Test av_downmix_info_update_side_data() including first-call
allocation with zero-initialized defaults, field write/read-back,
second-call reuse (same pointer, preserved values), and the OOM
path via av_max_alloc.

Coverage for libavutil/downmix_info.c: 100.00% -> 100.00%

On a full FATE run the file is already covered by the AC-3
decoder tests (fate-ac3-4.0 and friends), which require
FATE_SAMPLES. This test exercises the API directly and keeps the
file covered on builds that run without samples.

Signed-off-by: marcos ashton <marcosashiglesias@gmail.com>
2026-08-27 10:54:38 +00:00
marcos ashton
2a61dbb99f tests/fate/libavutil: add FATE test for pixdesc
Test av_get_pix_fmt / av_get_pix_fmt_name round-trip across all
pixel formats, av_color_{range,primaries,transfer,space}_name,
av_chroma_location_name and av_alpha_mode_name round-trips
through their from_name() counterparts using a name-equivalence
check (two enum values may legitimately share the same name
string), av_chroma_location_enum_to_pos and pos_to_enum
round-trip across all valid chroma locations, and iterate every
pixel format printing av_get_padded_bits_per_pixel and
av_pix_fmt_count_planes.

Coverage for libavutil/pixdesc.c: 83.63% -> 90.03%

Numbers measured against a full FATE run. Remaining uncovered
lines are av_get_pix_fmt_string, the av_get_pix_fmt_loss /
av_find_best_pix_fmt_of_2 public wrappers and a few loss
branches, the palette branches of av_read_image_line and
av_write_image_line, and the *_ext name lookups in
av_color_{primaries,transfer}_from_name.

Signed-off-by: marcos ashton <marcosashiglesias@gmail.com>
2026-08-27 10:54:38 +00:00
Andreas Rheinhardt
a6f573a1db avcodec/x86/h264_deblock: Avoid mmx register in deblock_h_luma_8
Old benchmarks:
  h_loop_filter_luma_8bpp_c:        41.1
  h_loop_filter_luma_8bpp_sse2:     60.6 ( 0.68x)
  h_loop_filter_luma_8bpp_avx:      60.4 ( 0.68x)

New benchmarks:
  h_loop_filter_luma_8bpp_c:        42.0
  h_loop_filter_luma_8bpp_sse2:     48.1 ( 0.87x)
  h_loop_filter_luma_8bpp_avx:      48.3 ( 0.87x)

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-08-27 00:51:10 +02:00
Ayoub Nabil Boubagrat
fea2db1be1 avcodec/ac3enc: preserve strongly out-of-phase coupling bands
the encoder always formed the stereo coupling channel as L+R and disabled phsflginu, which could cancel strongly out-of-phase bands before quantization. use an L-R carrier and signal the phase flag only when difference energy dominates in every coupling block, while quiet and ambiguous bands retain the existing L+R path. this reduces the multitone fate stddev from about 1158 to 588.

Signed-off-by: Ayoub Nabil Boubagrat <237098474+ayoubnabil@users.noreply.github.com>
2026-08-26 15:53:44 +00:00
Ayoub Nabil Boubagrat
09219cc683 swscale: print the effective scaler with SWS_PRINT_INFO
use the resolved luma scaler for the log. keep the SWS_BICUBLIN description only when chroma is actually bilinear.

add coverage for scaler_sub overrides and the missing FATE dependency. this fixes the incorrect scaler output reported in #23975.

Signed-off-by: Ayoub Nabil Boubagrat <237098474+ayoubnabil@users.noreply.github.com>
2026-08-25 16:06:34 +00:00
Martin Storsjö
3d5534d271 checkasm: Fix building for macos/aarch64
Commit 74705b3970 changed to only
compile some of the checkasm source files when they are expected
to be non-empty, but the condition for when perf/macos_kperf.c
is needed is wrong, breaking building checkasm in default macos
aarch64 configurations.

Checkasm decides whether to enable the macos kperf codepaths on
its own, irrespective of ffmpeg's configure's --enable-macos-kperf
(which defaults to disabled) - see the end of checkasm's
src/perf_internal.h for the condition:

    #if defined(__APPLE__) && ARCH_AARCH64
      /* This only depends on <dlfcn.h>, and isn't needed on other architectures. */
      #define HAVE_MACOS_KPERF 1
    #else
      #define HAVE_MACOS_KPERF 0
    #endif

To approximate this, build macos_kperf.c for any aarch64 target.
For non-macOS cases, perf_internal.h defines inline functions in
most aarch64 build configurations, so we don't end up with an
empty translation unit in any case.
2026-08-25 11:25:49 +02:00
iSold Leo
ca99230f71 avformat/mp3enc: buffer ID3v2 for non-seekable outputs
ID3v2 writes the tag size by seeking back to its header. This fails after output has been flushed to a non-seekable AVIO context, leaving a zero-sized tag. Attached pictures expose this reliably; sufficiently large metadata is affected too.

Build the tag in a dynamic buffer for non-seekable MP3 outputs and copy it after finalization. Keep the direct path for seekable outputs.

Fixes: #23917
Signed-off-by: iSold Leo <s@qwqlog.com>
2026-08-24 20:09:35 +00:00
James Almer
1019f8f036 tests/fate/aac: add tests for PCE layouts with height channels
Signed-off-by: James Almer <jamrial@gmail.com>
2026-08-23 13:35:29 -03:00
James Almer
10c3380e47 tests/audiogen: support up to 16 channels
Needed by the next commit.

Signed-off-by: James Almer <jamrial@gmail.com>
2026-08-23 13:35:29 -03:00
Andreas Rheinhardt
9419d4c3a5 avcodec/x86/h264_deblock: Don't use mmx in deblock_h_luma_intra_8
Old benchmarks:
  h_loop_filter_luma_intra_8bpp_c:        26.3
  h_loop_filter_luma_intra_8bpp_sse2:     57.4 ( 0.46x)
  h_loop_filter_luma_intra_8bpp_avx:      57.6 ( 0.46x)

New benchmarks:
  h_loop_filter_luma_intra_8bpp_c:        26.5
  h_loop_filter_luma_intra_8bpp_sse2:     52.2 ( 0.51x)
  h_loop_filter_luma_intra_8bpp_avx:      52.3 ( 0.51x)

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-08-23 17:10:58 +02:00
Andreas Rheinhardt
dea13cca4f tests/api/Makefile: Don't undef main
Should be unnecessary since fde3bb16f9.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-08-23 13:46:55 +02:00
Andreas Rheinhardt
732a8644b8 tests/fate/wav: Deduplicate encinfo rules
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-08-23 13:46:55 +02:00
Andreas Rheinhardt
89f58356b3 avcodec/tests/encinfo: Convert into API test
It doesn't use any internals of lavc. Converting it to an API
test tool reduces disk usage for shared builds.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-08-23 13:46:55 +02:00
James Almer
b79d4c4c0a tests/fate/lavf-container: add an EAC3 in MP4 test
Signed-off-by: James Almer <jamrial@gmail.com>
2026-08-22 20:25:22 -03:00
Ayoub Nabil Boubagrat
cd4fc473be avfilter/af_afir: clamp initial ir selection
the ir option may exceed nbirs because its static range is independent
of the configured number of impulse responses. init() only clamps
prev_selir, leaving selir able to index ctx->inputs out of range.

with the default nbirs=1, afir=ir=1 reads ctx->inputs[2] and crashes.
clamp selir like process_command() and add a fate test.

Signed-off-by: Ayoub Nabil Boubagrat <237098474+ayoubnabil@users.noreply.github.com>
2026-08-21 18:11:48 +00:00
Romain Beauxis
a1d17fdd28 avformat/mp3dec: parse iTunes gapless info
Apple encoders do not write the LAME extension of the Xing tag, so the
files they produce get no gapless handling at all and no exact duration
either, the sample used here carrying no VBR tag whatsoever.

Contrary to the LAME tag, the iTunSMPB priming count already includes the
decoder delay, so apply it as is, the way the mov demuxer already does,
and validate it against the three counts adding up to what the frames
decode to.
2026-08-21 03:38:24 +00:00
Romain Beauxis
20b70144a6 tests/fate/gapless: complete the mp3 test dependencies
The gapless() helper decodes through the wav muxer into the md5 protocol,
neither of which FRAMECRC requires, and ffprobe_demux reads the sample
through the file protocol, against a reference that covers the sample
format the mp3 decoder picked.
2026-08-21 03:38:24 +00:00
Zuxy Meng
2a168907d3 avcodec/x86/vp9mc.asm: Replace MMX with SSE2
Use SSE2 for (put|avg)[48]; identical performance.

Signed-off-by: Zuxy Meng <zuxy.meng@gmail.com>
2026-08-19 23:28:47 -07:00
James Almer
f91beaf929 fate/tests/ac3: add missing eac3 fixed tests
This ensures the fixed decoder has the same coverage as the float one.

Signed-off-by: James Almer <jamrial@gmail.com>
2026-08-19 19:12:50 -03:00
Andreas Rheinhardt
b6e90cc92c avcodec/fmtconvert: Remove now unused subsystem
Unused since 2312ae4d10.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-08-19 22:25:07 +02:00
Ayoub Nabil
2312ae4d10 avcodec/ac3dec: avoid coefficient truncation in float decoder
The float decoder dequantized spectral coefficients into an int32_t
buffer using mantissa >> exponent. This discarded the fractional part
before conversion to float and substantially raised the dither noise
floor for low-level coefficients.

Store decoded coefficients as INTFLOAT and apply 2^-exponent directly
in the floating-point path. Keep the fixed-point decoder unchanged, and
perform coupling, rematrixing and final scaling in the native type.

This also removes the now-unused fmtconvert dependency. Add a synthetic
FATE test that measures the corrected dither level. Existing PCM
references remain within one sample except fate-ac3-2.0, whose measured
maximum difference is two samples.

Fixes #23684.
2026-08-19 15:29:46 +00:00
Ayoub Nabil Boubagrat
564f92cce2 avcodec/ac3dec_fixed: preserve overlap across dependent substreams
ac-3 cores and dependent e-ac-3 substreams may use different
coefficient scales while owning separate delay slots.

the global reset added in 5ba2a2c841 cleared both sets of slots on
every substream switch, corrupting the mdct overlap of valid 7.1
streams.

track the scale per substream and clear only its own delay slots when
it changes. add a fate test using the existing the_great_wall sample.

Signed-off-by: Ayoub Nabil Boubagrat <237098474+ayoubnabil@users.noreply.github.com>
2026-08-19 01:54:15 +00:00
Vignesh Venkat
d998016f92 avformat/mov: Support rndr track reference type
This is similar to `cdsc` but intended for rendering metadata.
From a demuxer's point of view both of them are essentially the
same.

Added in the draft spec here: https://www.mpeg.org/standards/MPEG-4/12/

Link to the newly added fate sample: https://drive.google.com/file/d/1qfRALYT6ZCcijKEAkrWWjIDq_E2dm3Ix/view?usp=drive_link

Signed-off-by: Vignesh Venkat <vigneshv@google.com>
2026-08-18 22:26:29 +00:00
jiangjie
21bbd98e7b avfilter/blend: clip expression output to pixel depth
Clip integer expression results in the double domain before storing them. This keeps high-bit-depth samples within their declared range and gives NaN and infinities defined behavior while preserving float formats.

Fixes issue #24121.
2026-08-18 13:55:13 +00:00
Andreas Rheinhardt
4ca56d0f90 avcodec/x86/vp8dsp: Port ff_vp8_luma_dc_wht_sse to xmm regs
Some parts of it benefit from wider registers:

  vp8_luma_dc_wht_c:        22.7
  vp8_luma_dc_wht_sse:      14.7 ( 1.55x)
  vp8_luma_dc_wht_sse2:     13.2 ( 1.73x)

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-08-18 11:51:33 +02:00
Andreas Rheinhardt
515a1a4eb0 tests/checkasm/vp8dsp: Don't use declare_func_emms unnecessarily
Possible since b9161b93b5.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-08-18 11:51:33 +02:00
James Almer
3dddcc3282 avformat/hashenc: extend output of streamhash muxer
Add the same features as the framehash muxer.

This makes it much more useful as it prints important information that some
tests may need where framehash is not an option given it prints too many lines
(e.g., samples with tons of frames where timestamps or packet flags are
irrelevant, and just a single hash is enough).

Signed-off-by: James Almer <jamrial@gmail.com>
2026-08-17 20:41:46 -03:00
Andreas Rheinhardt
a1d860a00d avformat/tests/movenc: Convert to API test tool
This is possible because it only uses the public API;
and beneficial when using shared builds (as not all
the internals of lavf are linked statically in the binary).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-08-17 21:06:01 +02:00
Andreas Rheinhardt
74705b3970 tests/checkasm/Makefile: Don't build empty files
Empty translation units are actually invalid C that compilers
happen to accept (but warn about when using -pedantic).
In any case, they are unnecessary, so don't build them.

Reviewed-by: Kacper Michajłow <kasper93@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-08-16 19:20:45 +02:00
Kacper Michajłow
6fa1295f4f tests/fate/filter-video: add aresample dependency to ebur128-height test
Fixes: fc02470c62

Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
2026-08-15 15:10:36 +02:00
Romain Beauxis
db63217491 fate/mov: skip cover-art re-encode test without mjpeg decoder and scale filter 2026-08-15 08:00:55 -05:00
Zuxy Meng
cb98f5c3df avcodec/x86/hevc/add_res: Replace MMX with SSE2
Convert hevc_add_residual_4_10 to use SSE2 and remove declare_func_emms
in test code.

  hevc_add_res_4x4_10_c:          21.7
  hevc_add_res_4x4_10_mmxext:      9.4 ( 2.31x)
  hevc_add_res_4x4_10_sse2:        9.2 ( 2.35x)

Signed-off-by: Zuxy Meng <zuxy.meng@gmail.com>
2026-08-14 17:43:17 -07:00
James Almer
c39bc13fdb swresample/tests/rematrix: print rows in layout order
Otherwise, custom layouts will be printed as if they were in native order.

Signed-off-by: James Almer <jamrial@gmail.com>
2026-08-14 16:11:08 -03:00
Ayoub Nabil Boubagrat
d02bad0c90 swresample/rematrix: accept unused channels
custom layouts containing AV_CHAN_UNUSED were rejected by
swr_build_matrix2().

accept unused channels in input and output layouts. preserve their
physical positions, clear input columns, and leave output rows silent.

add fate coverage for both cases. this fixes #24094.

Signed-off-by: Ayoub Nabil Boubagrat <237098474+ayoubnabil@users.noreply.github.com>
2026-08-14 19:08:29 +00:00
Andreas Rheinhardt
b397eba2f0 avcodec/h264dsp: Use ptrdiff_t for stride in idct functions
Reviewed-by: Martin Storsjö <martin@martin.st>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-08-13 00:29:25 +02:00
Kacper Michajłow
51699b70cd checkasm/sbcdsp: rename CONST macro to avoid clash with windows.h
Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
2026-08-12 17:21:06 +02:00
Kacper Michajłow
11536e78d2 checkasm/sw_ops: don't return a value from void functions
Fixes: e65dab2b59
Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
2026-08-12 17:21:05 +02:00
Martin Storsjö
82d03c6d8e tests/checkasm: Give the ttaencdsp function a separate name
Otherwise, if running both ttadsp and ttaencdsp tests in the same
checkasm run, we get failures as the two functions don't match.

This fixes running the "checkasm" binary without any "--test"
parameter.
2026-08-12 15:57:48 +03:00
Romain Beauxis
e5ecfe8970 avformat/id3v2: make legacy COMM descriptor-as-key behavior opt-in
A COMM frame carries both a language and a short content descriptor, so its
only unambiguous metadata key is "comment-<descriptor>-<lang>", while the
extra export of the bare descriptor as a key silently overrides a real tag
whenever the descriptor matches a known tag name such as "album".

Restrict that legacy export to the container-level ID3v2 tag of callers that
ask for it through the new AVFMT_FLAG_LEGACY_ID3V2_COMM_KEYS flag (-fflags
+legacy_id3v2_comm_keys), which is deprecated along with
FF_API_OLD_ID3V2_COMMENT and only exists to give those callers a transition
path.
2026-08-12 12:39:44 +00:00
Andreas Rheinhardt
715d7d85d6 swresample/rematrix: Use AVChannel in av_channel_layout_index_from_chan
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-08-12 00:09:05 +02:00
Andreas Rheinhardt
7b05d16ce7 avcodec/mpeg4videodsp: Use ptrdiff_t for stride
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-08-11 21:17:13 +02:00