14 Commits

Author SHA1 Message Date
Dmitrii Gershenkop
6f75e879b6 avfilter/vf_vpp_amf: Minor clean up.
-vf_vpp_amf.c: Remove unused variables.
-vf_amf_common.c: Fix hdrmeta_buffer memory leak.
-hwcontext_amf.c: Fix av_amf_extract_hdr_metadata not picking up light metadata if display mastering metadata is not set.
-doc/filters.texi: Remove irrelevant example with HDR metadata for vpp_amf.
2026-03-31 11:17:51 +00:00
Kacper Michajłow
5074d9f06e hwcontext_amf: fix version variable type and remove cast
Fixes compilation errors on newer Clang/GCC that errors out on
incompatible pointers.

error: incompatible pointer types passing 'unsigned long long *' to
parameter of type 'amf_uint64 *' (aka 'unsigned long *')
[-Wincompatible-pointer-types]

Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
2026-03-11 18:41:10 +00:00
Dmitrii Gershenkop
910000fe59 avfilter/vf_vpp_amf: Extend AMF Color Converter HDR capabilities 2026-03-11 10:23:35 +01:00
Alexandru Ardelean
3291afd30f libavutil: hwcontext_amf: remove unreachable statements
Inside the amf_device_derive() function, there seem to be some
unreachable 'break' statements, which can be removed.
And also the final 'return 0' statement will also be unreachable
especially since there is a default case in the switch block.

Signed-off-by: Alexandru Ardelean <aardelean@deviqon.com>
2026-03-05 15:42:00 +00:00
Dmitrii Ovchinnikov
6972b127de avfilter: Add vsrc_amf - AMF based screen capture
This patch adds screen capture support via AMF vsrc_amf:
ffmpeg -y \
    -filter_complex "vsrc_amf=framerate=120:capture_mode=keep_framerate" \
    -c:v hevc_amf \
    -frames:v 300 \
    output_grab.mp4

If the HW frames pool is insufficient,
increase extra_hw_frames in filter_complex.
2026-01-19 10:16:37 +00:00
Dmitrii Ovchinnikov
140b4f28c3 avutil/hwcontext_amf: move AVMutex to internal context 2025-11-24 20:06:24 +00:00
Dmitrii Ovchinnikov
62184be548 avutil/hwcontext_amf: Simplified blocking before frame submission
Instead of blocking the entire context, which can cause issues in more
complex pipelines, now only frame sending is blocked via AVMutex
2025-11-13 15:49:42 +01:00
Araz Iusubov
cd33219558 avutil/hwcontext_amf: add device cache size
This change improves pipeline stability and reduces
dynamic GPU surface allocations when using AMF with copy_frame = 1.
This optimization has no negative effect.
2025-07-29 23:38:08 +02:00
Dmitrii Ovchinnikov
38379168ed avutil/hwcontext_amf: fix error logging on amf_init_from_device. 2025-06-06 13:42:18 +02:00
Dmitrii Ovchinnikov
39ab61bd75 avutil/hwcontext_amf: add support for d3d12va initialisation 2025-06-06 13:40:01 +02:00
Dmitrii Ovchinnikov
5b460bde8b libavutil/hwcontext_amf: add format validation in transfer_data functions 2025-03-21 17:36:13 +01:00
Dmitrii Ovchinnikov
7225e307be Added support for direct RGB input to AMF encoder 2025-03-06 15:38:58 +01:00
Kacper Michajłow
f00a08c0ce avutil/hwcontext_amf: fix crash on uninit after init failed
amf_device_create() calls amf_device_uninit() on errors, but if things
were not initialized it will null deref amf_ctx->factory.

Fixes: https://github.com/mpv-player/mpv/issues/15814

Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
2025-02-07 13:30:01 +01:00
Dmitrii Ovchinnikov
9e7242579e avutil: add hwcontext_amf.
Adds  hwcontext_amf, enabling a shared AMF context for encoders,
decoders, and AMF-based filters, without copy to the host memory.
Code also was tested in HandBrake.

Benefits:
 - Optimizations for direct video memory access from CPU
 - Significant performance boost in full AMF pipelines with filters
 - Integration of GPU filters like VPP, Super Resolution, and
    Compression Artefact Removal(in future plans)
 - VCN power management control for decoders.
 - Ability to specify which VCN instance to use for decoding
   (like for encoder)
 - AMD will soon introduce full AMF API for multimedia accelerator MA35D
   - With AMF API, integration will be much easier:
      GPU and the accelerator will have the same API
   - including encoder, decoder, scaler, color converter,
      Windows and Linux.
   Learn more:
      https://www.amd.com/en/products/accelerators/alveo/ma35d.html

Changes by versions:
v2: Header file cleanup.
v3: Removed an unnecessary class.
v4: code cleanup and improved error handling
v5: Fixes related to HandBrake integration.
v6: Sequential filters error and memory leak have been fixed.
2025-02-04 00:14:14 +01:00