[PR] avfilter/vf_vqe_amf: don't tag every output frame as BT.601 (PR #23971)

JuliusBairaktaris via ffmpeg-devel <[email protected]> Fri, 31 Jul 2026 10:47:24 -0000
Newsgroups gmane.comp.video.ffmpeg.devel
Message-ID <178549543933.51.16755577694932371430@29965ddac10e>
PR #23971 opened by JuliusBairaktaris
URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/23971
Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/23971.patch

Fixes #23970.

`amf_filter_filter_frame()` overrides the output colorspace whenever `color_profile` differs from `AMF_VIDEO_CONVERTER_COLOR_PROFILE_UNKNOWN`, which is `-1`, while `AMF_VIDEO_CONVERTER_COLOR_PROFILE_601` is `0`. `vqe_amf` exposes no color options and never initialised the inherited field, so every output frame was tagged `AVCOL_SPC_SMPTE170M`.

Before / after, BT.709 input:

```
ffmpeg -i bt709.mp4 -vf "vqe_amf,hwdownload,format=nv12" -frames:v 10 -c:v libx264 out.mp4
ffprobe -v error -select_streams v:0 -show_entries stream=color_space -of csv=p=0 out.mp4
```

`smpte170m` -> `bt709`. `sr_amf`, `vpp_amf` and `frc_amf` were unaffected and are unchanged.

Tested on Windows 11, RX 9070 XT, driver 32.0.31035.1003.



>From 4cc7c75dc19beb22fb4f24859eb953fb8c4f8d8d Mon Sep 17 00:00:00 2001
From: Julius Bairaktaris <[email protected]>
Date: Fri, 31 Jul 2026 12:39:53 +0200
Subject: [PATCH] avfilter/vf_vqe_amf: don't tag every output frame as BT.601

amf_filter_filter_frame() overrides the output colorspace whenever
color_profile differs from AMF_VIDEO_CONVERTER_COLOR_PROFILE_UNKNOWN.
That constant is -1, while AMF_VIDEO_CONVERTER_COLOR_PROFILE_601 is 0.

vqe_amf exposes no color options and never initialised the inherited
field, so color_profile kept its zero-initialised value, which is _601,
and every output frame was tagged AVCOL_SPC_SMPTE170M regardless of the
input. sr_amf sets the whole group explicitly and frc_amf uses its own
filter_frame, so only vqe_amf was affected.

Players that honour the negotiated colorimetry render BT.709 content
through the BT.601 matrix as a result.

The remaining inherited color fields are safe: AMF_COLOR_RANGE_UNDEFINED,
AMF_COLOR_PRIMARIES_UNDEFINED and
AMF_COLOR_TRANSFER_CHARACTERISTIC_UNDEFINED are all 0.

Tested on Windows 11, RX 9070 XT, driver 32.0.31035.1003.

Signed-off-by: Julius Bairaktaris <[email protected]>
---
 libavfilter/vf_vqe_amf.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/libavfilter/vf_vqe_amf.c b/libavfilter/vf_vqe_amf.c
index d7249d999b..fd7ee807e6 100644
--- a/libavfilter/vf_vqe_amf.c
+++ b/libavfilter/vf_vqe_amf.c
@@ -54,6 +54,7 @@ static int amf_vqe_init(AVFilterContext *avctx) {
     AMFVQEFilterContext *ctx = avctx->priv;
 
     ctx->common.format = AV_PIX_FMT_NONE;
+    ctx->common.color_profile = AMF_VIDEO_CONVERTER_COLOR_PROFILE_UNKNOWN;
 
     return 0;
 }
-- 
2.52.0

_______________________________________________
ffmpeg-devel mailing list -- [email protected]
To unsubscribe send an email to [email protected]