This is an automated email from the git hooks/post-receive script. Git pushed a commit to branch master in repository ffmpeg.
commit 940e407c64a5161a3cc58430da7a2db0b420b013 Author: Lynne <[email protected]> AuthorDate: Tue Mar 3 18:13:36 2026 +0100 Commit: Lynne <[email protected]> CommitDate: Tue Mar 24 15:21:17 2026 +0100 libavfilter/scale_vulkan: use swscale's Vulkan code This commit enables using swscale's newly added Vulkan code. Sponsored-by: Sovereign Tech Fund --- libavfilter/vf_scale_vulkan.c | 41 +++++++++++++++++++++++++++++++---------- 1 file changed, 31 insertions(+), 10 deletions(-) diff --git a/libavfilter/vf_scale_vulkan.c b/libavfilter/vf_scale_vulkan.c index a1e4f59a72..663b084190 100644 --- a/libavfilter/vf_scale_vulkan.c +++ b/libavfilter/vf_scale_vulkan.c @@ -26,6 +26,7 @@ #include "filters.h" #include "colorspace.h" #include "video.h" +#include "libswscale/swscale.h" extern const unsigned char ff_debayer_comp_spv_data[]; extern const unsigned int ff_debayer_comp_spv_len; @@ -46,6 +47,7 @@ enum DebayerFunc { typedef struct ScaleVulkanContext { FFVulkanContext vkctx; + SwsContext *sws; int initialized; FFVkExecPool e; @@ -359,21 +361,11 @@ static int scale_vulkan_filter_frame(AVFilterLink *link, AVFrame *in) goto fail; } - if (!s->initialized) { - if (s->vkctx.input_format == AV_PIX_FMT_BAYER_RGGB16) - RET(init_debayer(ctx, in)); - else - RET(init_filter(ctx, in)); - } - s->opts.crop_x = in->crop_left; s->opts.crop_y = in->crop_top; s->opts.crop_w = in->width - (in->crop_left + in->crop_right); s->opts.crop_h = in->height - (in->crop_top + in->crop_bottom); - RET(ff_vk_filter_process_simple(&s->vkctx, &s->e, &s->shd, out, in, - s->sampler, &s->opts, sizeof(s->opts))); - err = av_frame_copy_props(out, in); if (err < 0) goto fail; @@ -388,6 +380,29 @@ static int scale_vulkan_filter_frame(AVFilterLink *link, AVFrame *in) if (s->vkctx.output_format != s->vkctx.input_format) out->chroma_location = AVCHROMA_LOC_TOPLEFT; + if (!s->sws) { + if (!s->initialized) { + s->qf = ff_vk_qf_find(&s->vkctx, VK_QUEUE_COMPUTE_BIT, 0); + if (!s->qf) { + av_log(ctx, AV_LOG_ERROR, "Device has no compute queues\n"); + err = AVERROR(ENOTSUP); + goto fail; + } + + if (s->vkctx.input_format == AV_PIX_FMT_BAYER_RGGB16) + RET(init_debayer(ctx, in)); + else + RET(init_filter(ctx, in)); + } + + RET(ff_vk_filter_process_simple(&s->vkctx, &s->e, &s->shd, out, in, + s->sampler, &s->opts, sizeof(s->opts))); + } else { + err = sws_scale_frame(s->sws, out, in); + if (err < 0) + goto fail; + } + av_frame_free(&in); return ff_filter_frame(outlink, out); @@ -439,6 +454,11 @@ static int scale_vulkan_config_output(AVFilterLink *outlink) av_log(avctx, AV_LOG_ERROR, "Scaling is not supported with debayering\n"); return AVERROR_PATCHWELCOME; } + } else if (inlink->w == outlink->w || inlink->w == outlink->w) { + s->sws = sws_alloc_context(); + if (!s->sws) + return AVERROR(ENOMEM); + av_opt_set(s->sws, "sws_flags", "unstable", 0); } else if (s->vkctx.output_format != s->vkctx.input_format) { if (!ff_vk_mt_is_np_rgb(s->vkctx.input_format)) { av_log(avctx, AV_LOG_ERROR, "Unsupported input format for conversion\n"); @@ -466,6 +486,7 @@ static void scale_vulkan_uninit(AVFilterContext *avctx) ff_vk_exec_pool_free(vkctx, &s->e); ff_vk_shader_free(vkctx, &s->shd); + sws_free_context(&s->sws); if (s->sampler) vk->DestroySampler(vkctx->hwctx->act_dev, s->sampler, _______________________________________________ ffmpeg-cvslog mailing list -- [email protected] To unsubscribe send an email to [email protected]
