Commit Graph

125915 Commits

Author SHA1 Message Date
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
Michael Niedermayer
5d4d3bdc61 avcodec/pgssubdec: always give an output rect a palette
Fixes: NULL pointer dereference
Fixes: poc_null_deref.sup
Fixes: Fobbab5Vtlr3
Found-by: VRI with 图龙锋
2026-07-31 13:34:50 +00:00
Dan Dennedy
66a8c37582 scale_d3d11: Fix hw_frame_ctx reference leak
This fixes #20995. The reference is taken twice and assigned to the same pointer (see above in the same function). Only the latter is needed.
2026-07-31 13:29:24 +00:00
younengxiao
0dd50ec535 avfilter/dnn: initialize DNNData at the config_input call sites
vf_dnn_processing.c and vf_dnn_detect.c both declare an uninitialized
DNNData model_input before using it. This commit initialize it.

Signed-off-by: younengxiao <steven.xiao@amd.com>
2026-07-31 13:21:29 +00:00
Michael Niedermayer
db05df9d13 avcodec/cfhd: reject transform-2 output wider than the plane
Fixes: out of array access
Fixes: cfhd_transform2_output_width_oob.avi
Fixes: MimvoaEVpKow
Found-by: Adrian Junge (vurlo)
2026-07-31 13:18:57 +00:00
shadowcaster3
ad53728984 avformat/mpegtsenc: add mpegts_pcr_pid option for separate PCR PID
Add a new muxer option mpegts_pcr_pid that generates PCR on a dedicated
adaptation-field-only PID, separate from any elementary stream.

ISDB-T 1seg receivers require PCR on a standalone PID. When PCR shares
the video PID, these receivers acquire the service but refuse to decode
video and audio. This is standard practice in Japanese digital
terrestrial broadcasting per ARIB TR-B14.

When mpegts_pcr_pid is set to a valid PID value:
- PCR packets are generated as adaptation-field-only packets on the
  specified PID at the interval set by pcr_period
- The video stream adaptation fields do not carry PCR flags
- The PMT PCR_PID field is set to the specified PID

When mpegts_pcr_pid is -1 (default): existing behavior is unchanged.

The existing mpegts_insert_pcr_only function is refactored into a
parameterized mpegts_insert_pcr_only_pid(s, pid, cc, discontinuity)
to avoid code duplication.

Fixes: https://code.ffmpeg.org/FFmpeg/FFmpeg/issues/23649
Signed-off-by: shadowcaster3 <vasyl.samoilov@gmail.com>
2026-07-31 06:25:59 +00:00
Zuxy Meng
a83c6ad946 libavcodec/x86/h264_intrapred: Base-4 numbers for shuffling immediates
0xee -> q3232 for example for better readability

Signed-off-by: Zuxy Meng <zuxy.meng@gmail.com>
2026-07-30 22:41:04 -07:00
Zuxy Meng
43efff09ee libavcodec/x86/h264_intrapred: xmmN -> mN, movdqa -> mova
Use m aliases instead of xmm registers directly so that certain macros
can work (e.g. SWAP); likewise replace movdqa with mova

Signed-off-by: Zuxy Meng <zuxy.meng@gmail.com>
2026-07-30 22:41:04 -07:00
Abdessamie
a441a2eb38 avformat/rtsp: clear authentication on cross-origin redirects
RTSP redirects retain URL credentials and authentication state when a
Location URI changes to another origin. This can forward reusable
credentials to a server with a different scheme, host, or port.

Clear the stored credentials and authentication state when the redirect
crosses an origin boundary. Preserve them for same-origin redirects.

Fixes: cross-origin credential disclosure
Fixes: rtsp_redirect_auth_leak_poc.py
Fixes: VaKaPOnfN02z
2026-07-31 04:01:32 +00:00
Michael Niedermayer
2c18311d59 avcodec/dovi_rpuenc: normalize vdr_dm_metadata_present to 0/1 2026-07-31 04:00:56 +00:00
Kenan Alghythee
f1ed338541 avcodec/dovi_rpuenc: validate the data mapping before generation
Fixes: out of array access
Fixes: SUcVEyk7r3Gc
Found-by: Kenan Alghythee <kalghy2@uic.edu>
2026-07-31 04:00:56 +00:00
Michael Niedermayer
79e10e5196 avcodec/dovi_rpudec: bound num_x/y_partitions
Fixes: out of array access
Fixes: SUcVEyk7r3Gc
Found-by: Kenan Alghythee <kalghy2@uic.edu>
2026-07-31 04:00:56 +00:00