Commit 30c7995759 for ffmpeg
commit 30c7995759e161988ea5fc89eb44aa7857f075e2
Author: Lynne <dev@lynne.ee>
Date: Sat Dec 5 15:48:21 2026 +0800
avfilter/scale_vulkan: keep subsampled conversions off swscale
swscale's Vulkan backend can't handle subsampled formats yet, so since
940e407c64 converting RGB to NV12 or YUV420P failed with ENOTSUP unless
both dimensions changed. Use the shader for those, as before.
Fixes: #24419
diff --git a/libavfilter/vf_scale_vulkan.c b/libavfilter/vf_scale_vulkan.c
index c71af65b88..716d41f573 100644
--- a/libavfilter/vf_scale_vulkan.c
+++ b/libavfilter/vf_scale_vulkan.c
@@ -322,6 +322,12 @@ fail:
return err;
}
+static int is_subsampled(enum AVPixelFormat fmt)
+{
+ const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(fmt);
+ return desc->log2_chroma_w || desc->log2_chroma_h;
+}
+
static int scale_vulkan_config_output(AVFilterLink *outlink)
{
int err;
@@ -366,7 +372,10 @@ static int scale_vulkan_config_output(AVFilterLink *outlink)
return AVERROR_PATCHWELCOME;
}
} else if ((inlink->w == outlink->w || inlink->h == outlink->h) &&
- (s->vkctx.input_format != s->vkctx.output_format)) {
+ (s->vkctx.input_format != s->vkctx.output_format) &&
+ /* swscale's Vulkan backend can't do subsampled formats yet */
+ !is_subsampled(s->vkctx.input_format) &&
+ !is_subsampled(s->vkctx.output_format)) {
s->sws = sws_alloc_context();
if (!s->sws)
return AVERROR(ENOMEM);