This is an automated email from the git hooks/post-receive script. Git pushed a commit to branch master in repository ffmpeg.
commit 7f9391b76a13e0628a7757079dc3b39d75ea54f4 Author: Julius Bairaktaris <[email protected]> AuthorDate: Sun Jun 28 17:58:44 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=sr1-1 Per AMD's AMF_HQ_Scaler_API.md, the HQ Scaler's VideoSR1.1 algorithm is only supported on a DX11/DX12 engine and with input/output formats other than NV12 or P010 (it accepts packed RGB: BGRA, RGBA, R10G10B10A2 or RGBA_F16). The filter however advertised NV12/P010 as valid input and passed the input format straight to AMFHQScaler::Init(), which returns AMF_OK even for the unsupported format. The existing result check therefore never fired and the filter silently emitted a solid green frame. When algorithm=sr1-1, restrict the negotiated formats to the packed 8-bit RGB formats RGBA and BGRA, which round-trip cleanly through the AMF hwcontext (both upload and hwdownload), so a converter is auto-inserted for YUV input, and reject an unsupported hardware surface explicitly in config_output instead of producing green. The other SR1.1-capable formats (R10G10B10A2, RGBA_F16) are not exposed: they are absent from the AMF hwcontext's supported_formats[]/supported_transfer_formats[], so an AMF frames context cannot use them and hwdownload would fail with ENOSYS; exposing them belongs in a separate hwcontext_amf change. Note that AMF's VideoSR algorithms (sr1-0 and sr1-1) leave the alpha channel zeroed and expose no property to control it; drop alpha downstream, e.g. with format=rgb24, for an opaque result. Refs AMD AMF_HQ_Scaler_API.md and mpv-player/mpv#18068. Assisted-by: Claude Opus 5 Signed-off-by: Julius Bairaktaris <[email protected]> --- doc/filters.texi | 8 ++++++++ libavfilter/vf_sr_amf.c | 31 ++++++++++++++++++++++++++++--- 2 files changed, 36 insertions(+), 3 deletions(-) diff --git a/doc/filters.texi b/doc/filters.texi index 6efaac71f6..064a3a18a8 100644 --- a/doc/filters.texi +++ b/doc/filters.texi @@ -23276,6 +23276,14 @@ Point @item sr1-1 Video SR1.1 +This algorithm only supports packed RGB formats and requires a DirectX 11 or +DirectX 12 device, so it is available on Windows only. Software input in +another format such as @code{nv12} or @code{p010} is converted to a packed RGB +format (@code{rgba} or @code{bgra}) automatically; a hardware surface in such a +format is rejected. +Note that the VideoSR algorithms (@code{sr1-0} and @code{sr1-1}) do not +preserve the alpha channel (it is left zeroed); append e.g. @code{format=rgb24} +downstream if an opaque result is required. @end table diff --git a/libavfilter/vf_sr_amf.c b/libavfilter/vf_sr_amf.c index 17bfdc2a03..9ab5b8c2f2 100644 --- a/libavfilter/vf_sr_amf.c +++ b/libavfilter/vf_sr_amf.c @@ -54,8 +54,9 @@ static int amf_filter_query_formats(AVFilterContext *avctx) { - const enum AVPixelFormat *output_pix_fmts; - static const enum AVPixelFormat input_pix_fmts[] = { + AMFFilterContext *ctx = avctx->priv; + const enum AVPixelFormat *input_pix_fmts, *output_pix_fmts; + static const enum AVPixelFormat input_pix_fmts_default[] = { AV_PIX_FMT_NV12, AV_PIX_FMT_P010, AV_PIX_FMT_BGRA, @@ -75,7 +76,21 @@ static int amf_filter_query_formats(AVFilterContext *avctx) AV_PIX_FMT_RGBAF16, AV_PIX_FMT_NONE, }; - output_pix_fmts = output_pix_fmts_default; + // VideoSR1.1 needs packed RGB on DX11/DX12 + static const enum AVPixelFormat pix_fmts_sr1_1[] = { + 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; + } else { + input_pix_fmts = input_pix_fmts_default; + output_pix_fmts = output_pix_fmts_default; + } return amf_setup_input_output_formats(avctx, input_pix_fmts, output_pix_fmts); } @@ -95,6 +110,16 @@ static int amf_filter_config_output(AVFilterLink *outlink) if (err < 0) return err; + if (ctx->algorithm == AMF_HQ_SCALER_ALGORITHM_VIDEOSR1_1 && + (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", + av_get_pix_fmt_name(in_format)); + return AVERROR(EINVAL); + } + // HQ scaler should be used for upscaling only if (inlink->w > outlink->w || inlink->h > outlink->h) { av_log(avctx, AV_LOG_ERROR, "AMF HQ scaler should be used for upscaling only.\n"); -- 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]
