1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2026-06-19 19:03:00 +02:00

125119 Commits

Author SHA1 Message Date
Ramiro Polla f523577512 swscale/aarch64: convert generation of ops_entries.c to a fate test
This serves two purposes:
- there is a test to check that the file is always up-to-date
- it can easily be regenerated using fate's own infrastructure
2026-06-19 14:33:28 +00:00
Ramiro Polla c00b5be5de swscale/format: modify SwsSwizzleOp in-place in swizzle_inv() 2026-06-19 14:32:44 +00:00
Ramiro Polla d90645c4db swscale/cms: pass SwsColor by pointer instead of value in gamut_from_colorspace() 2026-06-19 14:32:44 +00:00
Ramiro Polla 6f52c88f45 swscale/graph: pass SwsFormat by pointer instead of value in adapt_colors() 2026-06-19 14:32:44 +00:00
Ramiro Polla 12750ed512 swscale/lut3d: pass SwsFormat by pointer instead of value in ff_sws_lut3d_pick_pixfmt() 2026-06-19 14:32:44 +00:00
Ramiro Polla a9cd93c917 swscale/ops: pass SwsSwizzleOp by pointer instead of value in ff_sws_comp_mask_swizzle() 2026-06-19 14:32:44 +00:00
Ramiro Polla 7599173512 swscale/ops: pass SwsComps by pointer instead of value in extract_{constant_rows,scalar,swizzle}() 2026-06-19 14:32:44 +00:00
Ramiro Polla 176493e4c4 swscale/ops: pass SwsLinearOp by pointer instead of value in ff_sws_linear_mask() 2026-06-19 14:32:44 +00:00
Ramiro Polla 59cba3147f swscale/uops: rename SwsOpTable/SwsOpEntry to SwsUOpTable/SwsUOpEntry
These structs are only used through ff_sws_uop_lookup() and are not part
of the SwsOp dispatch path, so rename them to reflect their actual scope.
2026-06-19 14:32:02 +00:00
Ramiro Polla b532f4a6ce swscale/tests/sws_ops_aarch64: remove on-stack copy of const data
It doesn't get modified, so there's no need to create a copy.
2026-06-19 14:31:27 +00:00
Andreas Rheinhardt 9ea36321f9 avcodec/liboapvenc: Use av_freep() where appropriate
Reviewed-by: Kacper Michajłow <kasper93@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-06-19 15:18:54 +02:00
Azat Nurgaliev bccaf86a89 avcodec/amfdec: propagate color and HDR metadata from AMF surfaces
The AMF hardware decoder exposes color information and HDR side data on
output surfaces, but the decoder previously copied only static avctx
values onto output frames. Read primaries, transfer, range, and profile
from each surface, keep avctx updated, and fall back to cached values
when a field is not signalled on a given frame.

On resolution change, re-create the hw frames context instead of
trying to re-init an already initialized pool.

Attach HDR10 mastering/display metadata when PQ transfer is detected.
Release the AMF HDR metadata buffer after attaching side data.
2026-06-19 09:48:56 +00:00
Araz Iusubov 431ceceac7 avcodec/amfenc: add high_quality quality preset 2026-06-19 08:44:30 +00:00
Jun Zhao a4317c4ff8 avcodec/webvttdec: map WebVTT cue timestamps to ASS {\kf} tags
Split each cue at its inline timestamps and emit every segment as
"{\kf<cs>}<text>", the duration being the segment's own span (next
timestamp minus current); the tag precedes the text so the karaoke fill
runs during the segment.  Boundaries are rounded to centiseconds against
the cue start and differenced, so durations telescope to the cue length
without drift.  Packet timing uses pkt_timebase rather than assuming a
1/1000 time base.  Out-of-range, non-monotonic and malformed timestamps
are ignored; cues without timestamps are emitted unchanged.

ASS {\kf} only approximates WebVTT timed text (no ::cue(:past/:future)).

Fixes: ticket #23289
Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2026-06-19 04:33:18 +00:00
marcos ashton 8a863106de avcodec/x86/me_cmp: add SSSE3 median_sad8
Same approach as median_sad16, processing one 8 pixel row per XMM
register.

median_sad_1_c:     141.4 ( 1.00x)
median_sad_1_ssse3:  29.1 ( 4.86x)

Benchmarks and tests run with checkasm on an Intel Core Ultra 7 155H.

Signed-off-by: marcos ashton <marcosashiglesias@gmail.com>
2026-06-18 22:08:02 +00:00
marcos ashton b8a44a7f76 avcodec/x86/me_cmp: add SSSE3 median_sad16
The median_sad functions have NEON implementations but no x86 ones,
so x86 always used the C code. x86_64 only due to register pressure.

median_sad_0_c:     314.5 ( 1.00x)
median_sad_0_ssse3:  51.1 ( 6.16x)

Benchmarks and tests run with checkasm on an Intel Core Ultra 7 155H.

Signed-off-by: marcos ashton <marcosashiglesias@gmail.com>
2026-06-18 22:08:02 +00:00
James Almer dedb75a810 avcodec/encode: take into account priming samples in the last packet duration
The generic code was setting the last packet duration based on the input frame
while ignoring the fact the encoder may have output an initial padding amount
of samples in the first (e.g. 481 for mp2, 256 for AC3, etc).

Signed-off-by: James Almer <jamrial@gmail.com>
2026-06-18 21:17:23 +00:00
James Almer 62731e05ab avformat/mov: don't assume a sample to be the last in fragmented input
Both the seek index and the stream duration are constantly being updated as
trun boxes are read.

Fixes mpv issue 18149.

Signed-off-by: James Almer <jamrial@gmail.com>
2026-06-18 13:46:54 -03:00
Ramiro Polla 10e9f273ee swscale/uops: relax detection of exact computations in linear
The first computation in a linear row doesn't have anything to
accumulate to, so a multiply-accumulate instruction won't be used
either way. This led to identical functions being instantiated for
different params.
2026-06-18 14:50:45 +00:00
Ramiro Polla 80cd1a4361 swscale/uops: skip offset from unity detection for linear
There is no easy optimization that can be triggered by knowing that the
offset is exactly 1. This led to identical functions being instantiated
for different params.
2026-06-18 14:50:45 +00:00
Ramiro Polla 3c6c6388b0 swscale/aarch64/ops: skip filtering ops lists when generating ops_entries.c
sws_ops_aarch64 would still register operations that came before the
filtering ops (which are unsupported).
2026-06-18 14:50:13 +00:00
Ramiro Polla d0313ea2c2 swscale/aarch64/ops: convert single-component packed read/write to planar
b488ee55 relaxed the check and stopped taking the number of components
into account. This led to the generation of duplicate read/write
functions for single component packed/planar.

ops_entries.c wasn't regenerated to take this into account; instead
some conversions were no longer being supported for the neon backend.
2026-06-18 14:50:13 +00:00
Andreas Rheinhardt ea9c361a7b avcodec/snow: Don't override fpel hdsp function
The functions do the same, yet the dedicated functions
from hpeldsp are more optimized.
(Notice that the motion estimation code only uses
aligned scratchpad buffers as destination when using
hdsp functions, so Snow-specific functions with relaxed
alignment like for the me-cmp API are not necessary.)

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-06-18 16:05:30 +02:00
James Almer 364d309af8 avcodec/liboapvenc: fix compilation
Rebase conflict gone wrong.

Signed-off-by: James Almer <jamrial@gmail.com>
2026-06-18 11:00:40 -03:00
Dawid Kozinski 5942e4e900 avcodec/liboapvenc: Added support for mastering display color volume and content light level metadata 2026-06-18 09:54:51 -03:00
James Almer d2d371d10d Reapply "fate/aac: add xHE-AAC decode and loudness normalization tests"
This reverts commit ee39fe499f.

The failing test is a duplicate test looking for a sample in the wrong folder.
2026-06-18 09:23:16 -03:00
Michael Niedermayer c098b07035 avformat/movenc: initialize all tracks
Fixes: NULL pointer dereference

As a sideeffect this also sets the timescale correctly if an
intermediate matches MOV_TIMESCALE_Q, the previous code stoped
in that case as it could not distinguish it from the overflow detection

Regression since: 51f5f60443

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-06-18 12:04:39 +00:00
Jun Zhao dd6ae3e024 .forgejo/pre-commit: add local commit-msg hook
Register check_commit_msg.sh as a commit-msg stage hook in the
pre-commit configuration so developers get immediate feedback
on commit message format during `git commit`.

Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2026-06-18 10:35:27 +00:00
Jun Zhao 4394a36c6b tools/check_commit_msg: add commit message validation script
Add a shell script that validates commit messages against FFmpeg
conventions.  Based on the lint_commit_msg.py checker from mpv
(Kacper Michajłow, Timo Rothenpieler).

Supports three entry points: stdin (for CI pipelines), file
argument (for pre-commit commit-msg hook), and revision range
(for manual batch checking).

Checks enforced (errors block):
  - Subject matches "component[/module]: description" pattern
  - No conventional-commits style (feat:/fix:/chore:/refactor:)
  - Blank line between subject and body
  - No duplicate Signed-off-by from same person
  - No multiple subject-like lines in body (squash-mess detection)

Checks that only warn:
  - Subject line > 120 characters
  - Trailing whitespace on subject line
  - Subject should not end with a period
  - Prefix should not contain file extension (.c, .h, etc.)

Merge, Revert and Reapply subjects are exempted from format checks.

Usage:
  echo "avcodec/vvc: fix pred" | sh tools/check_commit_msg.sh
  sh tools/check_commit_msg.sh .git/COMMIT_EDITMSG
  sh tools/check_commit_msg.sh HEAD~5..HEAD

Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
2026-06-18 10:35:27 +00:00
Andreas Rheinhardt f760b2fb67 avcodec/x86/cavsdsp: Combine #if blocks, avoid av_unused
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-06-17 23:05:23 +02:00
Andreas Rheinhardt 087f25c2ab avcodec/x86/rv40dsp_init: Remove pointless av_unused
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-06-17 23:05:23 +02:00
Andreas Rheinhardt 2a46d30855 avcodec/x86/hpeldsp: Remove declaration of non-existing func
Forgotten in a51279bbde.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-06-17 23:05:23 +02:00
Romain Beauxis e8cfe912f4 avformat/hls: Also report stream-level metadata update. 2026-06-17 15:39:33 -05:00
Steve Lhomme b441d97486 configure: use -ldl with AMF if necessary
It uses dlopen(). On some systems that requires to link with libdl.so.

Co-authored-by: Kacper Michajłow <kasper93@gmail.com>
2026-06-17 14:39:56 +00:00
Andreas Rheinhardt eb7f4b4e79 avcodec/x86/h264_intrapred: Add AVX2 horizontal pred versions
pred8x8_horizontal_8_c:                   6.9
pred8x8_horizontal_8_sse2:                9.9 ( 0.70x)
pred8x8_horizontal_8_ssse3:               9.5 ( 0.73x)
pred8x8_horizontal_8_avx2:                5.1 ( 1.35x)

pred16x16_horizontal_8_c:                10.9
pred16x16_horizontal_8_sse2:             15.0 ( 0.72x)
pred16x16_horizontal_8_ssse3:            11.7 ( 0.93x)
pred16x16_horizontal_8_avx2:              9.6 ( 1.13x)

The new functions are cheap and only occupy 2*48B.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-06-17 14:33:28 +02:00
Andreas Rheinhardt 93412ff602 avcodec/x86/h264_intrapred: Avoid reg-reg moves
Possible if src of the PRED4x4_LOWPASS macro is not used lateron.
Saves 195B of .text here.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-06-17 14:33:28 +02:00
Dmitrii Gershenkop 485f195690 avutil/hwcontext_amf: Implement AMF hardware memory mapping support. 2026-06-17 12:30:56 +00:00
Zhao Zhili 5c2f9899df avformat/matroskaenc: fix error code on LCEVC payload allocation failure
The branch returned the ret variable when av_malloc() failed, but ret
is uninitialized at that point unless an earlier branch happened to
set it.
2026-06-17 11:11:18 +00:00
Lynne ee39fe499f Revert "fate/aac: add xHE-AAC decode and loudness normalization tests"
This reverts commit dae76b2cb1.
2026-06-17 18:01:18 +09:00
Lynne dae76b2cb1 fate/aac: add xHE-AAC decode and loudness normalization tests
Frequency-domain mono/stereo decoding at several sampling rates, M/S,
TNS, and target_level-based loudness normalization, compared against
the reference decoder output of the ISO/IEC 23003-3 conformance
sequences (at -16, -24 and -31 dB targets driven by loudnessInfoV1
metadata), plus an exhale-encoded stream carrying v0 loudnessInfo().
2026-06-17 17:34:27 +09:00
Lynne a51ec04adf aacdec_usac: parse loudnessInfoV1
Real-world xHE-AAC streams and the ISO/IEC 23003-3 conformance
sequences carry their loudness metadata exclusively as loudnessInfoV1()
inside loudnessInfoSetExtension(), which was previously rejected with
AVERROR_PATCHWELCOME, making such streams undecodable and loudness
normalization inoperative on them.

loudnessInfoV1() is identical to loudnessInfo() apart from an added
eqSetId field. Parse it, restrict measurement selection to
eqSetId == 0 (in line with the downmixId/drcSetId restrictions), and
skip unknown loudnessInfoSetExtension() payloads using their explicitly
coded size instead of erroring out.
2026-06-17 17:34:24 +09:00
Hunter Kvalevog 8f970a24d5 configure: add pkg-config check for libtheora
This allows libtheora to be found via pkg-config in addition to the
existing approach.

Signed-off-by: Hunter Kvalevog <hunter@kvog.sh>
2026-06-17 02:31:43 +00:00
Michael Niedermayer a554d0aa8a swscale/aarch64: fix uyvy/yuyv to yuv420p/yuv422p on odd width
interleaved_yuv_to_planar, shared by uyvytoyuv422, uyvytoyuv420,
yuyvtoyuv422 and yuyvtoyuv420, only handled even widths. The packed
UYVY/YUYV macroblocks are pixel pairs and the trailing half macroblock of
an odd width was mishandled:

- the slow path (width <= 31) decrements its pixel counter by two from an
  odd value, so it never reaches zero and the loop runs far past the line,
  overwriting the destination (observed as a crash in checkasm);
- the fast path (width >= 32) shifts the tail pointers back by width-32 and
  reprocesses an overlapping, misaligned tuple, producing wrong samples and
  dropping the last chroma column.

Process only whole pixel pairs and emit the trailing odd column from a
per-line epilogue that matches the C reference: for yuv422 one Y, U and V
sample; for yuv420 the Y of both lines of the pair with the chroma averaged
across them, and luma only for the final line when the height is odd. The
empty even part (width 0 or 1) is guarded so the slow path no longer enters
its run-past loop.

All four variants are now bit-exact with the C reference for even and odd
widths. Verified with checkasm under qemu-aarch64.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-06-17 02:40:59 +02:00
Michael Niedermayer 21782b7b31 swscale/x86/rgb_2_rgb: fix uyvytoyuv422 overwrite on odd width
uyvytoyuv422 converts packed UYVY, whose macroblocks are pixel pairs, and
the SIMD code only handled even widths. On an odd width the trailing half
macroblock made the kernel write past the end of the Y/U/V destinations:
the AVX512ICL masked tail dropped the odd pixel and the fall-through
re-entered the SIMD loop, writing a full mmsize*2 chunk past the planes
(127 bytes of Y, 63 of U and 63 of V); the sse2/avx/avx2 scalar tail
wrote one byte past the Y plane.

Process only whole pairs and emit the trailing odd column from a small
per-row epilogue that matches uyvytoyuv422_c (ydst[w-1] = src[2w-1],
udst[cw-1] = src[2w-2], vdst[cw-1] = src[2w]).

All four SIMD variants are now bit-exact with the C reference for even and
odd widths and no longer overwrite the destination. Verified on AVX512ICL
hardware (Ryzen 9 9950X) with checkasm.

Found-by: Claude (Anthropic). Human-verified and reported by Omkhar Arasaratnam <omkhar@linkedin.com>.
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-06-17 02:40:59 +02:00
Michael Niedermayer d67a6d27c2 avcodec/snowenc: fix chroma reference edge extension for odd width
When extending the edges of the reconstructed reference frame, the chroma
plane width and height were passed to draw_edges() as w >> chroma_h_shift
(floor) instead of AV_CEIL_RSHIFT(). For an odd width with subsampled chroma
(e.g. 4:2:0) the chroma plane is one column wider than the floor, and
draw_edges() replicates the edge columns, so it overwrote the last real
chroma column with the previous one. The decoder does not draw_edges() its
reference, so its copy kept the correct value: the encoder and decoder
references diverged and every following inter frame was reconstructed
differently by the two, breaking bit-exact (lossless) round-tripping and
drifting lossy inter coding, for any odd-width 4:2:0 snow stream.

Use AV_CEIL_RSHIFT(), matching the input_picture edge extension just above.

Found-by: Claude
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-06-17 02:27:33 +02:00
Bogdan Lisman a62d996927 avcodec/snowenc: fix SIGFPE in get_dc() when a block lies outside the plane
get_dc() divides the accumulated, OBMC-weighted DC by aa, the sum of the
squared OBMC weights taken over the in-plane pixels.  When an OBMC block
falls entirely outside the plane - e.g. a tiny chroma plane after mcdeint
splits a frame into fields - no pixel contributes, aa stays 0 and the
ROUNDED_DIV() divides by zero (SIGFPE).  ab is 0 in exactly the same case,
so the result degenerates to 0; return it directly.

Reproducible with the GPL mcdeint filter in slow/extra_slow mode, e.g.

    ffmpeg -f lavfi -i testsrc=s=128x2 -vf mcdeint=mode=slow -f null -

Add a self-contained lavfi-based FATE regression test for the slow mode,
which previously crashed and is therefore not covered by the existing
sample-based fast/medium tests.

Fixes trac ticket #7779.

Signed-off-by: Bogdan Lisman <bogdan@pydevsolutions.com>
2026-06-17 02:27:33 +02:00
Michael Niedermayer 30c6667dad avcodec/snowenc: fix out-of-bounds OBMC read in get_dc() for narrow planes
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2026-06-17 02:26:14 +02:00
Marvin Scholz bfa67bafad lavfi: af_showinfo: add support for IAMF side-data 2026-06-17 00:03:14 +00:00
Bogdan Lisman d69e8d0a95 avcodec/decode: reset PTS correction counters in ff_decode_flush_buffers
pts_correction_num_faulty_pts and pts_correction_num_faulty_dts were not
cleared by ff_decode_flush_buffers(), so they survived avcodec_flush_buffers().
After a seek, guess_correct_pts() therefore kept biasing its reordered-pts vs
dts choice on pre-seek history instead of starting fresh as it does after
ff_decode_preinit(), which already zeroes both counters. This could yield an
incorrect AVFrame.best_effort_timestamp on the frames following a seek.

Reset both counters on flush, next to the existing last_pts/last_dts reset, so
the decoder's timestamp-correction state is fully reinitialized.

Fixes: ticket #11645
Reported-by: keks51
Signed-off-by: Bogdan Lisman <bogdan@pydevsolutions.com>
2026-06-16 15:59:52 +00:00
James Almer 491e0d1cfb avformat/matroskaenc: write LCEVC payloads as ITU-T T35 block additional
Signed-off-by: James Almer <jamrial@gmail.com>
2026-06-16 10:20:33 -03:00