This is an automated email from the git hooks/post-receive script.

Git pushed a commit to branch master
in repository ffmpeg.

commit 3409e8060cf1a74a82432842e69bbf88b4954a0c
Author:     Julius Bairaktaris <[email protected]>
AuthorDate: Fri Jul 31 12:57:58 2026 +0200
Commit:     ArazIusubov <[email protected]>
CommitDate: Wed Sep 16 22:05:28 2026 +0000

    avfilter/vf_sr_amf: fix solid green frame with algorithm=point
    
    AMF returns an unwritten surface for AMF_HQ_SCALER_ALGORITHM_POINT when
    the surface format is NV12 or P010, exactly as it does for VideoSR1.1 on
    YUV: Init(), SubmitInput() and QueryOutput() all report AMF_OK and the
    output is a solid green frame. Unlike VideoSR1.1 this is not a documented
    limitation - point is listed as a plain scaling algorithm with no format
    restriction - and it has been open on AMD's tracker since 2023.
    
    Reuse the sr1-1 handling: negotiate the packed 8-bit RGB formats for
    point as well, so a converter is auto-inserted for YUV input, and reject
    an NV12/P010-backed hardware surface in config_output instead of emitting
    green.
    
    Reproduced with:
    
      ffmpeg -init_hw_device amf -f lavfi -i testsrc2=size=1280x720 \
        -vf "format=nv12,hwupload,sr_amf=w=2560:h=1440:algorithm=point,\
    hwdownload,format=nv12,format=rgb24" -frames:v 1 out.png
    
    Before this patch the output is a single flat green frame. After it that
    hardware NV12 input is rejected at configuration with an error naming
    the formats point accepts; a later commit converts it on the GPU
    instead. Software YUV input goes through the converter negotiation
    inserts and matches bilinear, bicubic and sr1-0:
    
      ffmpeg -init_hw_device amf -f lavfi -i testsrc2=size=1280x720 \
        -vf "format=nv12,sr_amf=w=2560:h=1440:algorithm=point,\
    hwdownload,format=rgba,format=rgb24" -frames:v 1 out.png
    
    Tested on Windows 11, RX 9070 XT, driver 32.0.31041.1004.
    
    Refs https://github.com/GPUOpen-LibrariesAndSDKs/AMF/issues/427
    
    Assisted-by: Claude Opus 5
    Signed-off-by: Julius Bairaktaris <[email protected]>
---
 doc/filters.texi        |  4 ++++
 libavfilter/vf_sr_amf.c | 26 +++++++++++++++++---------
 2 files changed, 21 insertions(+), 9 deletions(-)

diff --git a/doc/filters.texi b/doc/filters.texi
index 064a3a18a8..ca7bfcb194 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -23273,6 +23273,10 @@ This is a default value
 
 @item point
 Point
+AMF returns an unwritten surface for this algorithm when the format is
+@code{nv12} or @code{p010}, so software input in those formats is converted to
+a packed RGB format (@code{rgba} or @code{bgra}) automatically and a hardware
+surface in them is rejected.
 
 @item sr1-1
 Video SR1.1
diff --git a/libavfilter/vf_sr_amf.c b/libavfilter/vf_sr_amf.c
index 9ab5b8c2f2..e4d56c24a1 100644
--- a/libavfilter/vf_sr_amf.c
+++ b/libavfilter/vf_sr_amf.c
@@ -52,6 +52,12 @@
 #endif
 
 
+static int amf_hq_scaler_needs_packed_rgb(int algorithm)
+{
+    return algorithm == AMF_HQ_SCALER_ALGORITHM_VIDEOSR1_1 ||
+           algorithm == AMF_HQ_SCALER_ALGORITHM_POINT;
+}
+
 static int amf_filter_query_formats(AVFilterContext *avctx)
 {
     AMFFilterContext *ctx = avctx->priv;
@@ -76,17 +82,17 @@ static int amf_filter_query_formats(AVFilterContext *avctx)
         AV_PIX_FMT_RGBAF16,
         AV_PIX_FMT_NONE,
     };
-    // VideoSR1.1 needs packed RGB on DX11/DX12
-    static const enum AVPixelFormat pix_fmts_sr1_1[] = {
+    // sr1-1 and point produce a blank surface on YUV input
+    static const enum AVPixelFormat pix_fmts_packed_rgb[] = {
         AV_PIX_FMT_RGBA,
         AV_PIX_FMT_BGRA,
         AV_PIX_FMT_AMF_SURFACE,
         AV_PIX_FMT_NONE,
     };
 
-    if (ctx->algorithm == AMF_HQ_SCALER_ALGORITHM_VIDEOSR1_1) {
-        input_pix_fmts  = pix_fmts_sr1_1;
-        output_pix_fmts = pix_fmts_sr1_1;
+    if (amf_hq_scaler_needs_packed_rgb(ctx->algorithm)) {
+        input_pix_fmts  = pix_fmts_packed_rgb;
+        output_pix_fmts = pix_fmts_packed_rgb;
     } else {
         input_pix_fmts  = input_pix_fmts_default;
         output_pix_fmts = output_pix_fmts_default;
@@ -110,12 +116,14 @@ static int amf_filter_config_output(AVFilterLink *outlink)
     if (err < 0)
         return err;
 
-    if (ctx->algorithm == AMF_HQ_SCALER_ALGORITHM_VIDEOSR1_1 &&
+    if (amf_hq_scaler_needs_packed_rgb(ctx->algorithm) &&
         (in_format == AV_PIX_FMT_NV12 || in_format == AV_PIX_FMT_P010)) {
         av_log(avctx, AV_LOG_ERROR,
-               "sr1-1 (VideoSR1.1) requires a packed RGB format (rgba); "
-               "%s is not supported. Convert the input first (e.g. 
format=rgba) or "
-               "select another algorithm.\n",
+               "%s requires a packed RGB format (rgba); %s is not supported. "
+               "Convert the input first (e.g. format=rgba) or select another "
+               "algorithm.\n",
+               ctx->algorithm == AMF_HQ_SCALER_ALGORITHM_POINT ? "point"
+                                                               : "sr1-1 
(VideoSR1.1)",
                av_get_pix_fmt_name(in_format));
         return AVERROR(EINVAL);
     }

-- 
To stop receiving notification emails like this one, please contact
[email protected].
_______________________________________________
ffmpeg-cvslog mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to