vf_amf: add amf_vqe filter (AMD Video Quality Enhancer) - #18281
Open
JuliusBairaktaris wants to merge 3 commits into
Open
vf_amf: add amf_vqe filter (AMD Video Quality Enhancer)#18281JuliusBairaktaris wants to merge 3 commits into
JuliusBairaktaris wants to merge 3 commits into
Conversation
kasper93
reviewed
Jul 23, 2026
kasper93
requested changes
Jul 23, 2026
Split the shared AMF runtime, D3D11 context and surface conversion out of the FRC-specific code so more filter components can reuse it. The AMF component is now created by name, the submit/query helper takes a per-filter init callback, and the filter's options, properties and process loop stay in their own section. The amf_frc processing is otherwise unchanged, except that create_amf_context() no longer calls destroy() on its error path: the single talloc_free() in the create helper already runs the filter destructor, so dropping the extra call fixes a pre-existing double-free of the amf_priv when context init fails.
Add a filter based on the AMF Video Quality Enhancer component. It improves the perceptual quality of low bitrate video by reducing blocking and mosquito noise artifacts. Unlike amf_frc it is a plain one frame in, one frame out component, so it reuses the shared scaffolding but has its own process loop that keeps the frame rate unchanged.
JuliusBairaktaris
force-pushed
the
amf-vqe
branch
from
July 23, 2026 22:38
ed05874 to
702f8ae
Compare
Author
|
Thanks for the review — reworked it along the lines you suggested:
Split into two commits: the generic split (no functional change to |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds
--vf=amf_vqe, a filter based on the AMF Video Quality Enhancercomponent, which reduces the blocking artifacts introduced by AVC/HEVC
compression at low bit rates while preserving details. This is a good fit for
the d3d11va playback path on AMD hardware, where low bitrate streams are
common.
The filter is implemented in
video/filter/vf_amf.calongsideamf_frc,since it needs exactly the same scaffolding: AMF runtime loading, a separate
D3D11 context, shared-texture conversion in both directions, and the
submit/query loop. It is a plain one frame in, one frame out component, so no
changes to
process()were needed.The first commit is a mechanical rename (
frc->comp,init_frc->init_component, generic log messages) to make the shared code componentagnostic; no functional change. The second adds the filter itself.
Implementation notes:
Init()is deferred to the first frame and called with the actual D3D11texture dimensions, following the existing FRC precedent.
AMF_VIDEO_ENHANCER_OUTPUT_SIZEis documented as required for theenhancement to be performed, but is not exposed by all runtime versions
(
AMF_NOT_FOUNDon the driver tested below), where it is not neededeither. Setting it is therefore best effort.
AMF_MEMORY_DX11likeamf_frcdoes.attenuationis exposed.AMF_VE_FCR_RADIUSis deprecated upstreamand documented as having no effect, and
AMF_VE_FCR_SPLIT_VIEWisdocumented as experimental (it renders a squeezed side by side comparison),
so neither seemed worth exposing.
Tested on Windows 11 with an RX 9070 XT (RDNA4), driver 32.0.31021.5001,
using
--hwdec=d3d11va --d3d11va-zero-copy=yes --gpu-api=d3d11 --vo=gpu-nexton low bitrate 720p H.264:SSIM 0.970 at
attenuation=0.4, and PSNR 51.3 dB at the minimumattenuation=0.02, i.e. the option is applied and behaves monotonically.amf_frcstill works after the rename commit.Note on the lavfi alternative: FFmpeg recently gained a
vqe_amffilter, butit currently fails to initialize with d3d11va input
(https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/23874), and even with that fixed
it returns AMF surfaces on a link negotiated as D3D11
(https://code.ffmpeg.org/FFmpeg/FFmpeg/issues/23875), so it is not usable
from mpv's filter chain. A native filter also avoids the bridge entirely,
which is the same reasoning that applies to
amf_frc.