Commit Graph
125926 Commits
Author SHA1 Message Date
Lynne 64fe3bee7f vulkan: enable VK_KHR_shader_maximal_reconvergence when available 2026-08-03 10:57:45 +09:00
Romain Beauxis 146e0f7b79 avformat/mp3enc: fix underflow of the LAME encoder delay
AV_RL32() is unsigned, so a skip_samples value below 528 + 1 wraps around
instead of clamping to zero and is written out as a delay of 4095 samples.
2026-08-03 01:54:44 +00:00
ninbura c2802e520a avdevice/avfoundation: add device selection by USB serial and unique ID
A capture device could previously be selected only by index or by name.
Both are unreliable when multiple audio/video devices share a name or
across reboots. AVFoundation reorders the device indices, and the USB
video uniqueID embeds the macOS locationID, which can be reassigned on
reboot or replug and can then resolve to a different physical device.

Add -video_device_id and -audio_device_id, which take a prefixed
identifier: uid:<unique ID> or serial:<USB serial number>.

The USB serial number is the only identifier that stays pegged to a
given physical unit. For video it is resolved to the device's current
locationID via IOKit. For audio it is matched against the uniqueID,
which already embeds it. The unique ID covers devices that have no
serial, such as virtual camera/audio devices.

-list_devices additionally prints each device's uniqueID and USB serial
so the values can be discovered. IOKit is detected in configure and used
only when available.

Signed-off-by: Gabriel Balaich <ffmpeg@ninbura.com>
2026-08-02 12:10:11 -05:00
Andreas Rheinhardt f0fc529cbe avcodec/x86/lossless_videodsp: Use memory operand where possible
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-08-02 18:36:52 +02:00
Andreas Rheinhardt 6c123e217b avcodec/x86/lossless_videodsp: Hoist calculation out of loop
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-08-02 18:36:52 +02:00
Andreas Rheinhardt b4d11f4046 avcodec/x86/lossless_videodsp: Optimize add_gradient_pred
Combinations of shift and add like
pslldq  m3, m2, 1
paddb   m2, m3
are linear in the input register m2. This implies
that instead of applying the same sequence of shifts and adds
to two different registers and adding said registers
one can just add the register first and then apply
said sequence of shifts and adds once.

Old benchmarks:
  add_gradient_pred_c:           2296.2
  add_gradient_pred_ssse3:        570.4 ( 3.95x)
  add_gradient_pred_avx2:         308.8 ( 7.29x)

New benchmarks:
  add_gradient_pred_c:           2315.6
  add_gradient_pred_ssse3:        344.0 ( 6.72x)
  add_gradient_pred_avx2:         205.2 (11.28x)

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-08-02 18:36:51 +02:00
张永鹏 d09b0c5e17 fftools/ffmpeg_opt: return an error when refusing overwrite
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>
2026-08-02 11:33:56 -05:00
Michael Niedermayer afd059c340 avcodec/nvenc: write AV1 timecode metadata in AV1 syntax
Fixes: https://code.ffmpeg.org/FFmpeg/FFmpeg/issues/20610

Tested on 5090 by claude
2026-08-02 16:06:47 +00:00
Michael Niedermayer 5589dfd9bc avcodec/utils: add ff_alloc_timecode_metadata_av1() 2026-08-02 16:06:47 +00:00
Michael Niedermayer a290dec0bf avcodec/utils: factor the timecode fields out of ff_alloc_timecode_sei 2026-08-02 16:06:47 +00:00
Michael Niedermayer ae0e0ba3c3 avformat/mov: reject a trun sample count the input cannot hold
Fixes: OOM
Fixes: 525088811/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5229499332231168
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
2026-08-02 16:05:57 +00:00
Lynne 0da8f2f4ee vulkan_encode_av1: set primary_ref_frame to a reference name, not a slot
primary_ref_frame is an index into the seven reference names, but the
code assigned it the reference's DPB slot. The two coincide only while
the reference sits in slot 0; once it rotates to slot 1,
referenceNameSlotIndices[primary_ref_frame] is -1, which is invalid,
and NVIDIA drivers lose the device. Inherited from vaapi_encode_av1,
where the same confusion is harmless as the raw frame header maps
every reference name to the same slot.

Have set_name_slot() return the name it picked and use that.

Fixes #20540.
2026-08-02 22:11:28 +09:00
Lynne ac16cfb86e hwcontext_vulkan: only originate host image layout transitions from copyable layouts
Host image layout transitions may only originate from a layout in
pCopySrcLayouts, or from UNDEFINED, discarding the contents. The host
transfer path transitioned from whatever layout the frame was last
left in, which for pool-recycled frames can be a video layout, which
no driver lists as host-copyable.

Uploads overwrite the entire image, so transition from UNDEFINED
there. Downloads have to preserve the contents, so route frames in a
non-host-copyable layout through the GPU path.
2026-08-02 22:11:28 +09:00
Lynne 2dd3328240 vulkan: give ff_vk_host_map_buffer an explicit import length
The function sized every import from src_data to the end of the source
buffer. For packets which are small views of a much larger allocation,
this pinned and mapped every page of the underlying allocation, at
around 1.6us per page, regardless of what the GPU ever touches.

Take the import length as a VkDeviceSize, clamped to the end of the
source buffer; the clamp doubles as the implementation of
VK_WHOLE_SIZE.
2026-08-02 22:11:28 +09:00
Lynne d42cd604d0 vulkan_ffv1: always keep the decoder's fltmap descriptor valid
The setup shader statically uses the fltmap binding, but the decoder
only bound a buffer to it for float formats, leaving a dangling
descriptor on everything else, with the write reachable by any
bitstream signalling remap.

Gate remap on a new push-constant flag, so that streams signalling it
without a fltmap buffer error out, and point the descriptor at the
slice feedback buffer when no fltmap exists; the gate guarantees it is
never written through this binding.
2026-08-02 22:11:27 +09:00
Lynne 2b0c0b2c00 hwcontext_vulkan: do not enable host transfers on coinciding decode output
Decode output which doubles as reference frames (COINCIDE mode)
remains an active DPB slot for as long as the decoder keeps
referencing it, and decode submissions bake the image layout into
their barriers at record time. A host-side layout transition can
therefore not be synchronized against them, and host transfers of such
frames were found to corrupt image contents on Intel once frame
threading varied the submission order.

Do not set VK_IMAGE_USAGE_HOST_TRANSFER_BIT_EXT on such frames. This
makes the incompatibility visible through the usage flags, and routes
our own transfer path through the queue.
2026-08-02 22:11:27 +09:00
Lynne b27f276bdd vulkan_ffv1: use the extradata slice structure in the low-slice-count warning
slice_count is only set while decoding a frame, so the warning always
printed a slice count of 0 at init time, and fired on streams with
plenty of slices.
2026-08-02 22:11:27 +09:00
Lynne 898b8aa922 vulkan_ffv1: survive setup failures on preceding frames
A frame's private data is allocated before start_frame(), and its free
callback runs even if setup failed partway, so partially-initialized
private data has to be tolerated everywhere: inter frames reffed the
previous frame's slice state without checking it exists, end_frame()
waited on a semaphore that was never created, and the free callback
read a feedback buffer that was never allocated or written. Inter
frames after a failed frame now error out until the next keyframe.

Also set the device function pointers before anything can fail, as the
free callback needs them.
2026-08-02 22:11:23 +09:00
Guo Yejun a7e72069f1 avfilter/dnn: fix race when querying queue length
Replace av_usleep polling with a condition variable wait.
2026-08-02 07:59:44 +00:00
Guo Yejun 133923a209 avfilter/dnn: assign correct output layout before use 2026-08-02 12:38:31 +08:00
Andreas Rheinhardt a59498db08 avcodec/huffyuvdsp: Remove pix_fmt parameter from ff_huffyuvdsp_init()
It is unused since the mmx add_hfyu_median_pred_int16 function
has been removed.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-08-02 02:19:05 +02:00
Andreas Rheinhardt c8fb970a92 avcodec/x86/huffyuvdsp: Remove ff_add_hfyu_median_prediction_mmxext
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>
2026-08-02 02:19:04 +02:00
Andreas Rheinhardt 0127016c41 avcodec/x86/huffyuvdsp: Add SSE4 add_hfyu_median_pred_int16
Heavily based upon the existing mmxext function, but
it allows to use p{max,min}uw, so also supports 16bpp
pixel formats. It is also faster:

  add_hfyu_median_pred_int16_c:       14368.1
  add_hfyu_median_pred_int16_mmxext:   7384.2 ( 1.94x)
  add_hfyu_median_pred_int16_sse4:     6474.4 ( 2.21x)

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-08-02 02:12:51 +02:00
Andreas Rheinhardt eb40b0b6b7 tests/checkasm/huffyuvdsp: Add test for add_hfyu_median_pred_int16
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-08-02 02:00:49 +02:00
Andreas Rheinhardt d8cb1ef0e5 avcodec/x86/huffyuvdsp: Remove remnants of MMX
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-08-02 02:00:49 +02:00
Andreas Rheinhardt 0d342f01f0 avcodec/x86/huffyuvdsp_template: Don't push+pop reg unnecessarily
All calling conventions on x64 have enough volatile GPRs.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-08-02 02:00:49 +02:00
Andreas Rheinhardt 3928c291b7 avcodec/x86/huffyuvdsp: Remove unaligned add_int16 version
Both source and dst are always properly aligned (to stride align)
here; also document this fact.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-08-02 02:00:49 +02:00
Andreas Rheinhardt b1142ed5be tests/checkasm/huffyuvdsp: Actually test width not multiple of 16
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-08-02 02:00:49 +02:00
Andreas Rheinhardt dd8730cfe3 tests/checkasm/huffyuvdsp: Actually test masks
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-08-02 02:00:49 +02:00
Andreas Rheinhardt 7c9d1fd3c0 tests/checkasm/huffyuvdsp: Return early if there is no function to test
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-08-02 02:00:49 +02:00
James Almer d9da090b1d avformat/dashdec: don't stop at the first input EOF
The current logic would stop demuxing the entire manifest once the first Representation
returned EOF, which could result in plenty of packets from other Representations being
lost.

Signed-off-by: James Almer <jamrial@gmail.com>
2026-08-01 19:47:08 -03:00
James Almer d2476bfd2b avformat/iamf_parse: bound the output mix gain duration by the audio elements
Based on a patch by Michael Niedermayer

Fixes: unbounded allocation
Fixes: poc_output_mix_config_dos.iamf
Fixes: 387qWpjUgeKH
Found-by: Duong Tran Thai (CyStack)
Signed-off-by: James Almer <jamrial@gmail.com>
2026-08-01 19:44:49 -03:00
James Almer 1b946a3abd avformat/iamf_parse: check that num_sub_mixes and num_audio_elements in Mix Presentations are not zero
As required by the spec in Section 3.7

Signed-off-by: James Almer <jamrial@gmail.com>
2026-08-01 19:44:49 -03:00
Andreas Rheinhardt 406c5a37aa avcodec/x86/vc1dsp_inv_trans: Port to SSE2
No change in performance here.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-08-01 16:50:06 +02:00
Andreas Rheinhardt 3db7a55280 avcodec/x86/vc1dsp_loopfilter: Don't use MMX regs
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>
2026-08-01 16:50:06 +02:00
Andreas Rheinhardt 3ea01992d6 avcodec/x86/vc1dsp_loopfilter: Don't use MMX regs in horiz. loop filter
Using XMM registers in this SSSE3 function leads to fewer shuffles
when transposing the input; it also allows to combine calculating
a1 and a2. Because of this, codesize is the same as before (on Unix64)
although MMX instructions are shorter.

Old benchmarks:
  vc1dsp.vc1_h_loop_filter4_bestcase_c:           3.0
  vc1dsp.vc1_h_loop_filter4_bestcase_ssse3:      32.0 ( 0.09x)
  vc1dsp.vc1_h_loop_filter4_worstcase_c:         42.9
  vc1dsp.vc1_h_loop_filter4_worstcase_ssse3:     31.9 ( 1.35x)

New benchmarks:
  vc1dsp.vc1_h_loop_filter4_bestcase_c:           3.0
  vc1dsp.vc1_h_loop_filter4_bestcase_ssse3:      29.9 ( 0.10x)
  vc1dsp.vc1_h_loop_filter4_worstcase_c:         43.7
  vc1dsp.vc1_h_loop_filter4_worstcase_ssse3:     29.9 ( 1.46x)

Hint: checkasm's benchmark always uses the same buffer that is
partially updated by the horizontal loop filter function (the
middle two of eight columns are updated using word-sized stores).
They therefore lead to store-to-load-forwarding failure. If
checkasm_alternate were used to alternate between two buffers,
the benchmarks would be as follows:

Old benchmarks:
  vc1dsp.vc1_h_loop_filter4_bestcase_c:           3.0
  vc1dsp.vc1_h_loop_filter4_bestcase_ssse3:      16.4 ( 0.18x)
  vc1dsp.vc1_h_loop_filter4_worstcase_c:         23.9
  vc1dsp.vc1_h_loop_filter4_worstcase_ssse3:     16.3 ( 1.47x)

New benchmarks:
  vc1dsp.vc1_h_loop_filter4_bestcase_c:           3.0
  vc1dsp.vc1_h_loop_filter4_bestcase_ssse3:      15.1 ( 0.20x)
  vc1dsp.vc1_h_loop_filter4_worstcase_c:         23.6
  vc1dsp.vc1_h_loop_filter4_worstcase_ssse3:     15.2 ( 1.55x)

Notice that at some callsites, the partially modified buffer
is immediately reloaded again*, so that both scenarios can happen.

*: See the TT_4X4 and TT_4X8 cases at the end of vc1_p_h_loop_filter()
or vc1_b_h_intfi_loop_filter() or the luma field blocks in
vc1_p_h_intfr_loop_filter().

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-08-01 16:50:06 +02:00
Andreas Rheinhardt 8f05c446a1 avcodec/x86/vc1dsp_loopfilter: Use psignw when available
The VC1 loop filter uses something equivalent to
if (a0_sign ^ clip_sign) {
    if (clip_sign) d = -d;
} else d = 0;
which can be mapped to psignw.

Old benchmarks:
  vc1dsp.vc1_h_loop_filter4_bestcase_c:            3.0
  vc1dsp.vc1_h_loop_filter4_bestcase_ssse3:       32.4 ( 0.09x)
  vc1dsp.vc1_h_loop_filter4_worstcase_c:          42.3
  vc1dsp.vc1_h_loop_filter4_worstcase_ssse3:      32.7 ( 1.29x)
  vc1dsp.vc1_h_loop_filter8_bestcase_c:            6.1
  vc1dsp.vc1_h_loop_filter8_bestcase_sse2:        37.1 ( 0.17x)
  vc1dsp.vc1_h_loop_filter8_bestcase_ssse3:       36.4 ( 0.17x)
  vc1dsp.vc1_h_loop_filter8_bestcase_sse4:        36.6 ( 0.17x)
  vc1dsp.vc1_h_loop_filter8_worstcase_c:          87.2
  vc1dsp.vc1_h_loop_filter8_worstcase_sse2:       36.9 ( 2.36x)
  vc1dsp.vc1_h_loop_filter8_worstcase_ssse3:      35.8 ( 2.35x)
  vc1dsp.vc1_h_loop_filter8_worstcase_sse4:       36.7 ( 2.38x)
  vc1dsp.vc1_h_loop_filter16_bestcase_c:          12.0
  vc1dsp.vc1_h_loop_filter16_bestcase_sse2:       40.0 ( 0.30x)
  vc1dsp.vc1_h_loop_filter16_bestcase_ssse3:      39.8 ( 0.30x)
  vc1dsp.vc1_h_loop_filter16_bestcase_sse4:       44.4 ( 0.27x)
  vc1dsp.vc1_h_loop_filter16_worstcase_c:        166.4
  vc1dsp.vc1_h_loop_filter16_worstcase_sse2:      39.9 ( 4.17x)
  vc1dsp.vc1_h_loop_filter16_worstcase_ssse3:     39.7 ( 4.19x)
  vc1dsp.vc1_h_loop_filter16_worstcase_sse4:      43.8 ( 3.80x)
  vc1dsp.vc1_v_loop_filter4_bestcase_c:            3.6
  vc1dsp.vc1_v_loop_filter4_bestcase_ssse3:       16.3 ( 0.22x)
  vc1dsp.vc1_v_loop_filter4_worstcase_c:          49.3
  vc1dsp.vc1_v_loop_filter4_worstcase_ssse3:      16.2 ( 3.04x)
  vc1dsp.vc1_v_loop_filter8_bestcase_c:            6.4
  vc1dsp.vc1_v_loop_filter8_bestcase_sse2:        16.3 ( 0.39x)
  vc1dsp.vc1_v_loop_filter8_bestcase_ssse3:       15.8 ( 0.40x)
  vc1dsp.vc1_v_loop_filter8_worstcase_c:          85.7
  vc1dsp.vc1_v_loop_filter8_worstcase_sse2:       16.3 ( 5.24x)
  vc1dsp.vc1_v_loop_filter8_worstcase_ssse3:      15.8 ( 5.42x)
  vc1dsp.vc1_v_loop_filter16_bestcase_c:          12.7
  vc1dsp.vc1_v_loop_filter16_bestcase_sse2:       24.7 ( 0.52x)
  vc1dsp.vc1_v_loop_filter16_bestcase_ssse3:      22.7 ( 0.56x)
  vc1dsp.vc1_v_loop_filter16_worstcase_c:        169.4
  vc1dsp.vc1_v_loop_filter16_worstcase_sse2:      24.1 ( 7.03x)
  vc1dsp.vc1_v_loop_filter16_worstcase_ssse3:     24.6 ( 6.88x)

New benchmarks:
  vc1dsp.vc1_h_loop_filter4_bestcase_c:            3.0
  vc1dsp.vc1_h_loop_filter4_bestcase_ssse3:       32.0 ( 0.09x)
  vc1dsp.vc1_h_loop_filter4_worstcase_c:          43.2
  vc1dsp.vc1_h_loop_filter4_worstcase_ssse3:      31.8 ( 1.36x)
  vc1dsp.vc1_h_loop_filter8_bestcase_c:            6.0
  vc1dsp.vc1_h_loop_filter8_bestcase_sse2:        36.9 ( 0.16x)
  vc1dsp.vc1_h_loop_filter8_bestcase_ssse3:       35.5 ( 0.17x)
  vc1dsp.vc1_h_loop_filter8_bestcase_sse4:        36.2 ( 0.17x)
  vc1dsp.vc1_h_loop_filter8_worstcase_c:          87.3
  vc1dsp.vc1_h_loop_filter8_worstcase_sse2:       37.6 ( 2.33x)
  vc1dsp.vc1_h_loop_filter8_worstcase_ssse3:      35.3 ( 2.40x)
  vc1dsp.vc1_h_loop_filter8_worstcase_sse4:       36.1 ( 2.42x)
  vc1dsp.vc1_h_loop_filter16_bestcase_c:          11.8
  vc1dsp.vc1_h_loop_filter16_bestcase_sse2:       40.1 ( 0.29x)
  vc1dsp.vc1_h_loop_filter16_bestcase_ssse3:      39.2 ( 0.30x)
  vc1dsp.vc1_h_loop_filter16_bestcase_sse4:       42.9 ( 0.28x)
  vc1dsp.vc1_h_loop_filter16_worstcase_c:        166.5
  vc1dsp.vc1_h_loop_filter16_worstcase_sse2:      39.8 ( 4.18x)
  vc1dsp.vc1_h_loop_filter16_worstcase_ssse3:     39.1 ( 4.26x)
  vc1dsp.vc1_h_loop_filter16_worstcase_sse4:      42.9 ( 3.88x)
  vc1dsp.vc1_v_loop_filter4_bestcase_c:            3.6
  vc1dsp.vc1_v_loop_filter4_bestcase_ssse3:       15.7 ( 0.22x)
  vc1dsp.vc1_v_loop_filter4_worstcase_c:          49.1
  vc1dsp.vc1_v_loop_filter4_worstcase_ssse3:      15.8 ( 3.10x)
  vc1dsp.vc1_v_loop_filter8_bestcase_c:            6.4
  vc1dsp.vc1_v_loop_filter8_bestcase_sse2:        16.3 ( 0.39x)
  vc1dsp.vc1_v_loop_filter8_bestcase_ssse3:       15.3 ( 0.42x)
  vc1dsp.vc1_v_loop_filter8_worstcase_c:          85.7
  vc1dsp.vc1_v_loop_filter8_worstcase_sse2:       16.3 ( 5.26x)
  vc1dsp.vc1_v_loop_filter8_worstcase_ssse3:      15.2 ( 5.62x)
  vc1dsp.vc1_v_loop_filter16_bestcase_c:          13.6
  vc1dsp.vc1_v_loop_filter16_bestcase_sse2:       24.8 ( 0.55x)
  vc1dsp.vc1_v_loop_filter16_bestcase_ssse3:      21.3 ( 0.64x)
  vc1dsp.vc1_v_loop_filter16_worstcase_c:        170.0
  vc1dsp.vc1_v_loop_filter16_worstcase_sse2:      23.9 ( 7.11x)
  vc1dsp.vc1_v_loop_filter16_worstcase_ssse3:     23.3 ( 7.28x)

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-08-01 16:50:06 +02:00
Andreas Rheinhardt 55bdc109a1 avcodec/x86/vc1dsp_loopfilter: Avoid unnecessary PABSW
The loop filter is only active if min(a1,a2)<abs(a0)
which is done via masking. Ergo the sign of min(a1,a2)-abs(a0)
is known (always negative) and one does not need to use
PABSW to get its absolute value.

This gives a small speedup. Old benchmarks:
  vc1dsp.vc1_h_loop_filter4_bestcase_c:            3.1
  vc1dsp.vc1_h_loop_filter4_bestcase_ssse3:       33.6 ( 0.09x)
  vc1dsp.vc1_h_loop_filter4_worstcase_c:          43.0
  vc1dsp.vc1_h_loop_filter4_worstcase_ssse3:      33.4 ( 1.29x)
  vc1dsp.vc1_h_loop_filter8_bestcase_c:            6.0
  vc1dsp.vc1_h_loop_filter8_bestcase_sse2:        38.4 ( 0.16x)
  vc1dsp.vc1_h_loop_filter8_bestcase_ssse3:       37.2 ( 0.16x)
  vc1dsp.vc1_h_loop_filter8_bestcase_sse4:        37.6 ( 0.16x)
  vc1dsp.vc1_h_loop_filter8_worstcase_c:          87.5
  vc1dsp.vc1_h_loop_filter8_worstcase_sse2:       38.4 ( 2.28x)
  vc1dsp.vc1_h_loop_filter8_worstcase_ssse3:      37.6 ( 2.32x)
  vc1dsp.vc1_h_loop_filter8_worstcase_sse4:       37.6 ( 2.32x)
  vc1dsp.vc1_h_loop_filter16_bestcase_c:          11.7
  vc1dsp.vc1_h_loop_filter16_bestcase_sse2:       42.0 ( 0.28x)
  vc1dsp.vc1_h_loop_filter16_bestcase_ssse3:      41.4 ( 0.28x)
  vc1dsp.vc1_h_loop_filter16_bestcase_sse4:       44.8 ( 0.26x)
  vc1dsp.vc1_h_loop_filter16_worstcase_c:        167.2
  vc1dsp.vc1_h_loop_filter16_worstcase_sse2:      41.8 ( 4.00x)
  vc1dsp.vc1_h_loop_filter16_worstcase_ssse3:     41.7 ( 3.92x)
  vc1dsp.vc1_h_loop_filter16_worstcase_sse4:      45.3 ( 3.69x)
  vc1dsp.vc1_v_loop_filter4_bestcase_c:            3.6
  vc1dsp.vc1_v_loop_filter4_bestcase_ssse3:       17.1 ( 0.21x)
  vc1dsp.vc1_v_loop_filter4_worstcase_c:          49.3
  vc1dsp.vc1_v_loop_filter4_worstcase_ssse3:      17.0 ( 2.89x)
  vc1dsp.vc1_v_loop_filter8_bestcase_c:            6.3
  vc1dsp.vc1_v_loop_filter8_bestcase_sse2:        17.7 ( 0.36x)
  vc1dsp.vc1_v_loop_filter8_bestcase_ssse3:       16.8 ( 0.38x)
  vc1dsp.vc1_v_loop_filter8_worstcase_c:          85.8
  vc1dsp.vc1_v_loop_filter8_worstcase_sse2:       17.7 ( 4.83x)
  vc1dsp.vc1_v_loop_filter8_worstcase_ssse3:      16.7 ( 5.12x)
  vc1dsp.vc1_v_loop_filter16_bestcase_c:          12.7
  vc1dsp.vc1_v_loop_filter16_bestcase_sse2:       26.4 ( 0.48x)
  vc1dsp.vc1_v_loop_filter16_bestcase_ssse3:      24.0 ( 0.53x)
  vc1dsp.vc1_v_loop_filter16_worstcase_c:        170.1
  vc1dsp.vc1_v_loop_filter16_worstcase_sse2:      25.7 ( 6.63x)
  vc1dsp.vc1_v_loop_filter16_worstcase_ssse3:     25.2 ( 6.75x)

New benchmarks:
  vc1dsp.vc1_h_loop_filter4_bestcase_c:            3.0
  vc1dsp.vc1_h_loop_filter4_bestcase_ssse3:       32.4 ( 0.09x)
  vc1dsp.vc1_h_loop_filter4_worstcase_c:          42.3
  vc1dsp.vc1_h_loop_filter4_worstcase_ssse3:      32.7 ( 1.29x)
  vc1dsp.vc1_h_loop_filter8_bestcase_c:            6.1
  vc1dsp.vc1_h_loop_filter8_bestcase_sse2:        37.1 ( 0.17x)
  vc1dsp.vc1_h_loop_filter8_bestcase_ssse3:       36.4 ( 0.17x)
  vc1dsp.vc1_h_loop_filter8_bestcase_sse4:        36.6 ( 0.17x)
  vc1dsp.vc1_h_loop_filter8_worstcase_c:          87.2
  vc1dsp.vc1_h_loop_filter8_worstcase_sse2:       36.9 ( 2.36x)
  vc1dsp.vc1_h_loop_filter8_worstcase_ssse3:      35.8 ( 2.35x)
  vc1dsp.vc1_h_loop_filter8_worstcase_sse4:       36.7 ( 2.38x)
  vc1dsp.vc1_h_loop_filter16_bestcase_c:          12.0
  vc1dsp.vc1_h_loop_filter16_bestcase_sse2:       40.0 ( 0.30x)
  vc1dsp.vc1_h_loop_filter16_bestcase_ssse3:      39.8 ( 0.30x)
  vc1dsp.vc1_h_loop_filter16_bestcase_sse4:       44.4 ( 0.27x)
  vc1dsp.vc1_h_loop_filter16_worstcase_c:        166.4
  vc1dsp.vc1_h_loop_filter16_worstcase_sse2:      39.9 ( 4.17x)
  vc1dsp.vc1_h_loop_filter16_worstcase_ssse3:     39.7 ( 4.19x)
  vc1dsp.vc1_h_loop_filter16_worstcase_sse4:      43.8 ( 3.80x)
  vc1dsp.vc1_v_loop_filter4_bestcase_c:            3.6
  vc1dsp.vc1_v_loop_filter4_bestcase_ssse3:       16.3 ( 0.22x)
  vc1dsp.vc1_v_loop_filter4_worstcase_c:          49.3
  vc1dsp.vc1_v_loop_filter4_worstcase_ssse3:      16.2 ( 3.04x)
  vc1dsp.vc1_v_loop_filter8_bestcase_c:            6.4
  vc1dsp.vc1_v_loop_filter8_bestcase_sse2:        16.3 ( 0.39x)
  vc1dsp.vc1_v_loop_filter8_bestcase_ssse3:       15.8 ( 0.40x)
  vc1dsp.vc1_v_loop_filter8_worstcase_c:          85.7
  vc1dsp.vc1_v_loop_filter8_worstcase_sse2:       16.3 ( 5.24x)
  vc1dsp.vc1_v_loop_filter8_worstcase_ssse3:      15.8 ( 5.42x)
  vc1dsp.vc1_v_loop_filter16_bestcase_c:          12.7
  vc1dsp.vc1_v_loop_filter16_bestcase_sse2:       24.7 ( 0.52x)
  vc1dsp.vc1_v_loop_filter16_bestcase_ssse3:      22.7 ( 0.56x)
  vc1dsp.vc1_v_loop_filter16_worstcase_c:        169.4
  vc1dsp.vc1_v_loop_filter16_worstcase_sse2:      24.1 ( 7.03x)
  vc1dsp.vc1_v_loop_filter16_worstcase_ssse3:     24.6 ( 6.88x)

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-08-01 16:50:06 +02:00
Andreas Rheinhardt f2035a4605 avcodec/x86/vc1dsp_loopfilter: Reorder instructions slightly
In particular, apply the rounding before adding the result
of the multiplication. No change in performance here.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-08-01 16:50:06 +02:00
Andreas Rheinhardt 8434869cfd avcodec/x86/vc1dsp_loopfilter: Reduce number of GPRs used
Reuse the register that held pq for this instead of using
another one. This saves a push+pop on 32bit systems and avoids
REX prefixes on Unix64.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-08-01 16:50:06 +02:00
Andreas Rheinhardt f30ef7eec4 avcodec/x86/vc1dsp_loopfilter: Avoid imul
Multipliying a GPR by 0x01010101 splats a byte to a dword;
the intention was to avoid vector shuffles lateron, yet
this is not true because the byte splat necessitates
a byte->word conversion lateron.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-08-01 16:50:06 +02:00
Andreas Rheinhardt 933b195bcb avcodec/vc1dsp: Avoid negating unnecessarily
Due to the earlier "if (a1 < a0 || a2 < a0)" check
it is guaranteed that min(a1,a2) is < a0, allowing
simplifications.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-08-01 16:50:06 +02:00
Andreas Rheinhardt b5483446d3 avcodec/x86/vc1dsp_init: Avoid fpel wrappers
One can just reuse the already existing SIZExSIZE fpel
wrappers.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2026-08-01 16:50:06 +02:00
Michael Niedermayer 4f8043e658 avcodec/cbs_h266: size vps_direct_ref_layer_flag for the full layer range
Fixes: out of array access
Fixes: poc_vvc_vps.266
Fixes: 1z6RugPwxp39
Found-by: TainAn Bill
2026-08-01 14:45:45 +00:00
Michael Niedermayer 946272b79a avcodec/vulkan/ffv1_dec_setup: bound the fltmap write 2026-07-31 19:37:52 +00:00
Michael Niedermayer c91b50659b avcodec/vulkan/ffv1_dec_setup: test mul_count as unsigned 2026-07-31 19:37:52 +00:00
Michael Niedermayer cc82fdfbd4 avcodec/vulkan/ffv1_dec_setup: reject a remap that produces zero entries 2026-07-31 19:37:52 +00:00
Michael Niedermayer 533a3c254d avcodec/vulkan/ffv1_dec_setup: act on the slice header rejection 2026-07-31 19:37:52 +00:00
Michael Niedermayer 56743898d2 avcodec/ffv1dec: reject a remap that produces zero entries 2026-07-31 19:37:52 +00:00
Michael Niedermayer 8ab8b4fabe avcodec/ffv1dec: mark the slice damaged when its remap fails 2026-07-31 19:37:52 +00:00