FFmpeg
Loading...
Searching...
No Matches
vf_blend_vulkan.c
Go to the documentation of this file.
1/*
2 * copyright (c) 2021-2022 Wu Jianhua <jianhua.wu@intel.com>
3 * Copyright (c) Lynne
4 *
5 * The blend modes are based on the blend.c.
6 *
7 * This file is part of FFmpeg.
8 *
9 * FFmpeg is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public
11 * License as published by the Free Software Foundation; either
12 * version 2.1 of the License, or (at your option) any later version.
13 *
14 * FFmpeg is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
18 *
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with FFmpeg; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
22 */
23
24#include "libavutil/opt.h"
25#include "vulkan_filter.h"
26
27#include "filters.h"
28#include "framesync.h"
29#include "blend.h"
30#include "video.h"
31
32extern const unsigned char ff_blend_comp_spv_data[];
33extern const unsigned int ff_blend_comp_spv_len;
34
35#define IN_TOP 0
36#define IN_BOTTOM 1
37
38typedef struct FilterParamsVulkan {
39 float opacity[4];
40 int mode[4];
42
57
59{
60 BlendVulkanContext *s = avctx->priv;
61
62 if (s->all_opacity < 1.0) {
63 s->params.opacity[0] = s->all_opacity;
64 s->params.opacity[1] = s->all_opacity;
65 s->params.opacity[2] = s->all_opacity;
66 s->params.opacity[3] = s->all_opacity;
67 }
68
69 if (s->all_mode >= 0) {
70 s->params.mode[0] = s->all_mode;
71 s->params.mode[1] = s->all_mode;
72 s->params.mode[2] = s->all_mode;
73 s->params.mode[3] = s->all_mode;
74 }
75
76 return 0;
77}
78
79static int process_command(AVFilterContext *ctx, const char *cmd, const char *args,
80 char *res, int res_len, int flags)
81{
82 int ret = ff_filter_process_command(ctx, cmd, args, res, res_len, flags);
83 if (ret < 0)
84 return ret;
85
86 return config_params(ctx);
87}
88
90{
91 int err = 0;
92 BlendVulkanContext *s = avctx->priv;
93 FFVulkanContext *vkctx = &s->vkctx;
94 const int planes = av_pix_fmt_count_planes(s->vkctx.output_format);
96
97 config_params(avctx);
98
99 s->qf = ff_vk_qf_find(vkctx, VK_QUEUE_COMPUTE_BIT, 0);
100 if (!s->qf) {
101 av_log(avctx, AV_LOG_ERROR, "Device has no compute queues\n");
102 err = AVERROR(ENOTSUP);
103 goto fail;
104 }
105
106 RET(ff_vk_exec_pool_init(vkctx, s->qf, &s->e, FF_VK_DEFAULT_EXEC_CONTEXTS, 0, 0, 0, NULL));
107
108 SPEC_LIST_CREATE(sl, 1, 1*sizeof(uint32_t))
109 SPEC_LIST_ADD(sl, 0, 32, planes);
110
111 ff_vk_shader_load(&s->shd, VK_SHADER_STAGE_COMPUTE_BIT, sl,
112 (int []) { 32, 32, 1 }, 0);
113
114 ff_vk_shader_add_push_const(&s->shd, 0, sizeof(s->params),
115 VK_SHADER_STAGE_COMPUTE_BIT);
116
118 { /* top_images */
119 .type = VK_DESCRIPTOR_TYPE_STORAGE_IMAGE,
120 .stages = VK_SHADER_STAGE_COMPUTE_BIT,
121 .elems = planes,
122 },
123 { /* bottom_images */
124 .type = VK_DESCRIPTOR_TYPE_STORAGE_IMAGE,
125 .stages = VK_SHADER_STAGE_COMPUTE_BIT,
126 .elems = planes,
127 },
128 { /* output_images */
129 .type = VK_DESCRIPTOR_TYPE_STORAGE_IMAGE,
130 .stages = VK_SHADER_STAGE_COMPUTE_BIT,
131 .elems = planes,
132 },
133 };
134 ff_vk_shader_add_descriptor_set(vkctx, &s->shd, desc, 3, 0);
135
136 RET(ff_vk_shader_link(vkctx, &s->shd,
138 ff_blend_comp_spv_len, "main"));
139
140 RET(ff_vk_shader_register_exec(vkctx, &s->e, &s->shd));
141
142 s->initialized = 1;
143
144fail:
145 return err;
146}
147
149{
150 int err;
151 AVFilterContext *avctx = fs->parent;
152 BlendVulkanContext *s = avctx->priv;
153 AVFilterLink *outlink = avctx->outputs[0];
154 AVFrame *top, *bottom, *out;
155
156 out = ff_get_video_buffer(outlink, outlink->w, outlink->h);
157 if (!out) {
158 err = AVERROR(ENOMEM);
159 goto fail;
160 }
161
163 RET(ff_framesync_get_frame(fs, IN_BOTTOM, &bottom, 0));
164
166
167 if (!s->initialized) {
170 if (top_fc->sw_format != bottom_fc->sw_format) {
171 av_log(avctx, AV_LOG_ERROR,
172 "Currently the sw format of the bottom video need to match the top!\n");
173 err = AVERROR(EINVAL);
174 goto fail;
175 }
176 RET(init_filter(avctx));
177 }
178
179 RET(ff_vk_filter_process_Nin(&s->vkctx, &s->e, &s->shd,
180 out, (AVFrame *[]){ top, bottom }, 2,
181 VK_NULL_HANDLE, 1, &s->params, sizeof(s->params)));
182
183 return ff_filter_frame(outlink, out);
184
185fail:
187 return err;
188}
189
190static av_cold int init(AVFilterContext *avctx)
191{
192 BlendVulkanContext *s = avctx->priv;
193
194 s->fs.on_event = blend_frame;
195
196 return ff_vk_filter_init(avctx);
197}
198
199static av_cold void uninit(AVFilterContext *avctx)
200{
201 BlendVulkanContext *s = avctx->priv;
202 FFVulkanContext *vkctx = &s->vkctx;
203
204 ff_vk_exec_pool_free(vkctx, &s->e);
205 ff_vk_shader_free(vkctx, &s->shd);
206
207 ff_vk_uninit(&s->vkctx);
209
210 s->initialized = 0;
211}
212
214{
215 int err;
216 FilterLink *outl = ff_filter_link(outlink);
217 AVFilterContext *avctx = outlink->src;
218 BlendVulkanContext *s = avctx->priv;
219 AVFilterLink *toplink = avctx->inputs[IN_TOP];
220 FilterLink *tl = ff_filter_link(toplink);
221 AVFilterLink *bottomlink = avctx->inputs[IN_BOTTOM];
222
223 if (toplink->w != bottomlink->w || toplink->h != bottomlink->h) {
224 av_log(avctx, AV_LOG_ERROR, "First input link %s parameters "
225 "(size %dx%d) do not match the corresponding "
226 "second input link %s parameters (size %dx%d)\n",
227 avctx->input_pads[IN_TOP].name, toplink->w, toplink->h,
228 avctx->input_pads[IN_BOTTOM].name, bottomlink->w, bottomlink->h);
229 return AVERROR(EINVAL);
230 }
231
232 outlink->sample_aspect_ratio = toplink->sample_aspect_ratio;
233 outl->frame_rate = tl->frame_rate;
234
236
237 RET(ff_framesync_init_dualinput(&s->fs, avctx));
238
240 outlink->time_base = s->fs.time_base;
241
242 RET(config_params(avctx));
243
244fail:
245 return err;
246}
247
248static int activate(AVFilterContext *avctx)
249{
250 BlendVulkanContext *s = avctx->priv;
251 return ff_framesync_activate(&s->fs);
252}
253
254#define OFFSET(x) offsetof(BlendVulkanContext, x)
255#define FLAGS (AV_OPT_FLAG_FILTERING_PARAM | AV_OPT_FLAG_VIDEO_PARAM)
256
258 { "c0_mode", "set component #0 blend mode", OFFSET(params.mode[0]), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, BLEND_NB - 1, FLAGS, .unit = "mode" },
259 { "c1_mode", "set component #1 blend mode", OFFSET(params.mode[1]), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, BLEND_NB - 1, FLAGS, .unit = "mode" },
260 { "c2_mode", "set component #2 blend mode", OFFSET(params.mode[2]), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, BLEND_NB - 1, FLAGS, .unit = "mode" },
261 { "c3_mode", "set component #3 blend mode", OFFSET(params.mode[3]), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, BLEND_NB - 1, FLAGS, .unit = "mode" },
262 { "all_mode", "set blend mode for all components", OFFSET(all_mode), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, BLEND_NB - 1, FLAGS, .unit = "mode" },
263 { "addition", "", 0, AV_OPT_TYPE_CONST, {.i64=BLEND_ADDITION}, 0, 0, FLAGS, .unit = "mode" },
264 { "addition128","", 0, AV_OPT_TYPE_CONST, {.i64=BLEND_GRAINMERGE}, 0, 0, FLAGS, .unit = "mode" },
265 { "grainmerge", "", 0, AV_OPT_TYPE_CONST, {.i64=BLEND_GRAINMERGE}, 0, 0, FLAGS, .unit = "mode" },
266 { "and", "", 0, AV_OPT_TYPE_CONST, {.i64=BLEND_AND}, 0, 0, FLAGS, .unit = "mode" },
267 { "average", "", 0, AV_OPT_TYPE_CONST, {.i64=BLEND_AVERAGE}, 0, 0, FLAGS, .unit = "mode" },
268 { "burn", "", 0, AV_OPT_TYPE_CONST, {.i64=BLEND_BURN}, 0, 0, FLAGS, .unit = "mode" },
269 { "darken", "", 0, AV_OPT_TYPE_CONST, {.i64=BLEND_DARKEN}, 0, 0, FLAGS, .unit = "mode" },
270 { "difference", "", 0, AV_OPT_TYPE_CONST, {.i64=BLEND_DIFFERENCE}, 0, 0, FLAGS, .unit = "mode" },
271 { "difference128", "", 0, AV_OPT_TYPE_CONST, {.i64=BLEND_GRAINEXTRACT}, 0, 0, FLAGS, .unit = "mode" },
272 { "grainextract", "", 0, AV_OPT_TYPE_CONST, {.i64=BLEND_GRAINEXTRACT}, 0, 0, FLAGS, .unit = "mode" },
273 { "divide", "", 0, AV_OPT_TYPE_CONST, {.i64=BLEND_DIVIDE}, 0, 0, FLAGS, .unit = "mode" },
274 { "dodge", "", 0, AV_OPT_TYPE_CONST, {.i64=BLEND_DODGE}, 0, 0, FLAGS, .unit = "mode" },
275 { "exclusion", "", 0, AV_OPT_TYPE_CONST, {.i64=BLEND_EXCLUSION}, 0, 0, FLAGS, .unit = "mode" },
276 { "extremity", "", 0, AV_OPT_TYPE_CONST, {.i64=BLEND_EXTREMITY}, 0, 0, FLAGS, .unit = "mode" },
277 { "freeze", "", 0, AV_OPT_TYPE_CONST, {.i64=BLEND_FREEZE}, 0, 0, FLAGS, .unit = "mode" },
278 { "glow", "", 0, AV_OPT_TYPE_CONST, {.i64=BLEND_GLOW}, 0, 0, FLAGS, .unit = "mode" },
279 { "hardlight", "", 0, AV_OPT_TYPE_CONST, {.i64=BLEND_HARDLIGHT}, 0, 0, FLAGS, .unit = "mode" },
280 { "hardmix", "", 0, AV_OPT_TYPE_CONST, {.i64=BLEND_HARDMIX}, 0, 0, FLAGS, .unit = "mode" },
281 { "heat", "", 0, AV_OPT_TYPE_CONST, {.i64=BLEND_HEAT}, 0, 0, FLAGS, .unit = "mode" },
282 { "lighten", "", 0, AV_OPT_TYPE_CONST, {.i64=BLEND_LIGHTEN}, 0, 0, FLAGS, .unit = "mode" },
283 { "linearlight","", 0, AV_OPT_TYPE_CONST, {.i64=BLEND_LINEARLIGHT},0, 0, FLAGS, .unit = "mode" },
284 { "multiply", "", 0, AV_OPT_TYPE_CONST, {.i64=BLEND_MULTIPLY}, 0, 0, FLAGS, .unit = "mode" },
285 { "multiply128","", 0, AV_OPT_TYPE_CONST, {.i64=BLEND_MULTIPLY128},0, 0, FLAGS, .unit = "mode" },
286 { "negation", "", 0, AV_OPT_TYPE_CONST, {.i64=BLEND_NEGATION}, 0, 0, FLAGS, .unit = "mode" },
287 { "normal", "", 0, AV_OPT_TYPE_CONST, {.i64=BLEND_NORMAL}, 0, 0, FLAGS, .unit = "mode" },
288 { "or", "", 0, AV_OPT_TYPE_CONST, {.i64=BLEND_OR}, 0, 0, FLAGS, .unit = "mode" },
289 { "overlay", "", 0, AV_OPT_TYPE_CONST, {.i64=BLEND_OVERLAY}, 0, 0, FLAGS, .unit = "mode" },
290 { "phoenix", "", 0, AV_OPT_TYPE_CONST, {.i64=BLEND_PHOENIX}, 0, 0, FLAGS, .unit = "mode" },
291 { "pinlight", "", 0, AV_OPT_TYPE_CONST, {.i64=BLEND_PINLIGHT}, 0, 0, FLAGS, .unit = "mode" },
292 { "reflect", "", 0, AV_OPT_TYPE_CONST, {.i64=BLEND_REFLECT}, 0, 0, FLAGS, .unit = "mode" },
293 { "screen", "", 0, AV_OPT_TYPE_CONST, {.i64=BLEND_SCREEN}, 0, 0, FLAGS, .unit = "mode" },
294 { "softlight", "", 0, AV_OPT_TYPE_CONST, {.i64=BLEND_SOFTLIGHT}, 0, 0, FLAGS, .unit = "mode" },
295 { "subtract", "", 0, AV_OPT_TYPE_CONST, {.i64=BLEND_SUBTRACT}, 0, 0, FLAGS, .unit = "mode" },
296 { "vividlight", "", 0, AV_OPT_TYPE_CONST, {.i64=BLEND_VIVIDLIGHT}, 0, 0, FLAGS, .unit = "mode" },
297 { "xor", "", 0, AV_OPT_TYPE_CONST, {.i64=BLEND_XOR}, 0, 0, FLAGS, .unit = "mode" },
298 { "softdifference","", 0, AV_OPT_TYPE_CONST, {.i64=BLEND_SOFTDIFFERENCE}, 0, 0, FLAGS, .unit = "mode" },
299 { "geometric", "", 0, AV_OPT_TYPE_CONST, {.i64=BLEND_GEOMETRIC}, 0, 0, FLAGS, .unit = "mode" },
300 { "harmonic", "", 0, AV_OPT_TYPE_CONST, {.i64=BLEND_HARMONIC}, 0, 0, FLAGS, .unit = "mode" },
301 { "bleach", "", 0, AV_OPT_TYPE_CONST, {.i64=BLEND_BLEACH}, 0, 0, FLAGS, .unit = "mode" },
302 { "stain", "", 0, AV_OPT_TYPE_CONST, {.i64=BLEND_STAIN}, 0, 0, FLAGS, .unit = "mode" },
303 { "interpolate","", 0, AV_OPT_TYPE_CONST, {.i64=BLEND_INTERPOLATE},0, 0, FLAGS, .unit = "mode" },
304 { "hardoverlay","", 0, AV_OPT_TYPE_CONST, {.i64=BLEND_HARDOVERLAY},0, 0, FLAGS, .unit = "mode" },
305
306 { "c0_opacity", "set color component #0 opacity", OFFSET(params.opacity[0]), AV_OPT_TYPE_FLOAT, { .dbl = 1.0 }, 0, 1, FLAGS },
307 { "c1_opacity", "set color component #1 opacity", OFFSET(params.opacity[1]), AV_OPT_TYPE_FLOAT, { .dbl = 1.0 }, 0, 1, FLAGS },
308 { "c2_opacity", "set color component #2 opacity", OFFSET(params.opacity[2]), AV_OPT_TYPE_FLOAT, { .dbl = 1.0 }, 0, 1, FLAGS },
309 { "c3_opacity", "set color component #3 opacity", OFFSET(params.opacity[3]), AV_OPT_TYPE_FLOAT, { .dbl = 1.0 }, 0, 1, FLAGS },
310 { "all_opacity", "set opacity for all color components", OFFSET(all_opacity), AV_OPT_TYPE_FLOAT, { .dbl = 1.0 }, 0, 1, FLAGS },
311
312 { NULL }
313};
314
316
318 {
319 .name = "top",
320 .type = AVMEDIA_TYPE_VIDEO,
321 .config_props = &ff_vk_filter_config_input,
322 },
323 {
324 .name = "bottom",
325 .type = AVMEDIA_TYPE_VIDEO,
326 .config_props = &ff_vk_filter_config_input,
327 },
328};
329
330
332 {
333 .name = "default",
334 .type = AVMEDIA_TYPE_VIDEO,
335 .config_props = &config_props_output,
336 }
337};
338
340 .p.name = "blend_vulkan",
341 .p.description = NULL_IF_CONFIG_SMALL("Blend two video frames in Vulkan"),
342 .p.priv_class = &blend_vulkan_class,
343 .p.flags = AVFILTER_FLAG_HWDEVICE,
344 .priv_size = sizeof(BlendVulkanContext),
345 .init = &init,
346 .uninit = &uninit,
347 .activate = &activate,
351 .flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE,
352 .process_command = &process_command,
353};
SwsAArch64OpImplParams params
Definition ops.c:51
static int process_command(AVFilterContext *ctx, const char *cmd, const char *args, char *res, int res_len, int flags)
const FFFilter ff_vf_blend_vulkan
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
Definition avfilter.c:1068
int ff_filter_process_command(AVFilterContext *ctx, const char *cmd, const char *arg, char *res, int res_len, int flags)
Generic processing of user supplied commands that are set in the same way as the filter options.
Definition avfilter.c:906
@ BLEND_HARDLIGHT
Definition blend.h:40
@ BLEND_HARDMIX
Definition blend.h:54
@ BLEND_PHOENIX
Definition blend.h:46
@ BLEND_MULTIPLY128
Definition blend.h:58
@ BLEND_EXTREMITY
Definition blend.h:61
@ BLEND_XOR
Definition blend.h:53
@ BLEND_BURN
Definition blend.h:33
@ BLEND_BLEACH
Definition blend.h:65
@ BLEND_AVERAGE
Definition blend.h:32
@ BLEND_DIVIDE
Definition blend.h:37
@ BLEND_OR
Definition blend.h:44
@ BLEND_VIVIDLIGHT
Definition blend.h:52
@ BLEND_STAIN
Definition blend.h:66
@ BLEND_EXCLUSION
Definition blend.h:39
@ BLEND_DIFFERENCE
Definition blend.h:35
@ BLEND_DARKEN
Definition blend.h:34
@ BLEND_REFLECT
Definition blend.h:48
@ BLEND_SOFTDIFFERENCE
Definition blend.h:62
@ BLEND_HARMONIC
Definition blend.h:64
@ BLEND_HARDOVERLAY
Definition blend.h:68
@ BLEND_GRAINEXTRACT
Definition blend.h:36
@ BLEND_PINLIGHT
Definition blend.h:47
@ BLEND_DODGE
Definition blend.h:38
@ BLEND_GLOW
Definition blend.h:56
@ BLEND_OVERLAY
Definition blend.h:45
@ BLEND_AND
Definition blend.h:31
@ BLEND_FREEZE
Definition blend.h:60
@ BLEND_LIGHTEN
Definition blend.h:41
@ BLEND_LINEARLIGHT
Definition blend.h:55
@ BLEND_GEOMETRIC
Definition blend.h:63
@ BLEND_SOFTLIGHT
Definition blend.h:50
@ BLEND_GRAINMERGE
Definition blend.h:57
@ BLEND_INTERPOLATE
Definition blend.h:67
@ BLEND_SCREEN
Definition blend.h:49
@ BLEND_NEGATION
Definition blend.h:43
@ BLEND_HEAT
Definition blend.h:59
@ BLEND_NB
Definition blend.h:69
@ BLEND_ADDITION
Definition blend.h:30
@ BLEND_SUBTRACT
Definition blend.h:51
@ BLEND_MULTIPLY
Definition blend.h:42
#define flags(name, subs,...)
Definition cbs_h264.c:74
#define s(width, name)
Definition cbs_vp9.c:198
#define fs(width, name, subs,...)
Definition cbs_vp9.c:200
#define FLAGS
Definition cmdutils.c:598
#define NULL
Definition coverity.c:32
int(* init)(AVBSFContext *ctx)
Definition dts2pts.c:608
int ff_framesync_configure(FFFrameSync *fs)
Configure a frame sync structure.
Definition framesync.c:137
int ff_framesync_activate(FFFrameSync *fs)
Examine the frames in the filter's input and try to produce output.
Definition framesync.c:352
int ff_framesync_get_frame(FFFrameSync *fs, unsigned in, AVFrame **rframe, unsigned get)
Get the current frame in an input.
Definition framesync.c:269
int ff_framesync_init_dualinput(FFFrameSync *fs, AVFilterContext *parent)
Initialize a frame sync structure for dualinput.
Definition framesync.c:372
void ff_framesync_uninit(FFFrameSync *fs)
Free all memory currently allocated.
Definition framesync.c:301
#define fail
Definition test.h:479
@ AV_OPT_TYPE_CONST
Special option type for declaring named constants.
Definition opt.h:298
@ AV_OPT_TYPE_INT
Underlying C type is int.
Definition opt.h:258
@ AV_OPT_TYPE_FLOAT
Underlying C type is float.
Definition opt.h:270
#define AVFILTER_FLAG_HWDEVICE
The filter can create hardware frames using AVFilterContext.hw_device_ctx.
Definition avfilter.h:187
#define AVERROR(e)
Definition error.h:45
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
Definition frame.c:64
int av_frame_copy_props(AVFrame *dst, const AVFrame *src)
Copy only "metadata" fields from src to dst.
Definition frame.c:599
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition log.h:210
@ AVMEDIA_TYPE_VIDEO
Definition avutil.h:200
static av_cold void uninit(AVBitStreamFilterContext *ctx)
static int activate(AVBitStreamFilterContext *ctx)
#define FILTER_INPUTS(array)
Definition filters.h:264
#define FILTER_OUTPUTS(array)
Definition filters.h:265
#define FF_FILTER_FLAG_HWFRAME_AWARE
The filter is aware of hardware frames, and any hardware frame context should not be automatically pr...
Definition filters.h:208
static FilterLink * ff_filter_link(AVFilterLink *link)
Definition filters.h:199
#define FILTER_SINGLE_PIXFMT(pix_fmt_)
Definition filters.h:254
#define AVFILTER_DEFINE_CLASS(fname)
Definition filters.h:478
static AVFrame * blend_frame(AVFilterContext *ctx, AVFrame *top_buf, const AVFrame *bottom_buf)
Definition vf_blend.c:198
#define av_cold
Definition attributes.h:117
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
Definition internal.h:88
int ff_vk_shader_load(FFVulkanShader *shd, VkPipelineStageFlags stage, VkSpecializationInfo *spec, uint32_t wg_size[3], uint32_t required_subgroup_size)
Initialize a shader object.
Definition vulkan.c:2070
void ff_vk_shader_add_descriptor_set(FFVulkanContext *s, FFVulkanShader *shd, const FFVulkanDescriptorSetBinding *desc, int nb, int singular)
Add descriptor to a shader.
Definition vulkan.c:2373
void ff_vk_exec_pool_free(FFVulkanContext *s, FFVkExecPool *pool)
Definition vulkan.c:310
int ff_vk_exec_pool_init(FFVulkanContext *s, AVVulkanDeviceQueueFamily *qf, FFVkExecPool *pool, int nb_contexts, int nb_queries, VkQueryType query_type, int query_64bit, const void *query_create_pnext)
Allocates/frees an execution pool.
Definition vulkan.c:357
int ff_vk_shader_add_push_const(FFVulkanShader *shd, int offset, int size, VkShaderStageFlagBits stage)
Add/update push constants for execution.
Definition vulkan.c:1443
void ff_vk_uninit(FFVulkanContext *s)
Frees main context.
Definition vulkan.c:2638
void ff_vk_shader_free(FFVulkanContext *s, FFVulkanShader *shd)
Free a shader.
Definition vulkan.c:2614
int ff_vk_shader_register_exec(FFVulkanContext *s, FFVkExecPool *pool, FFVulkanShader *shd)
Register a shader with an exec pool.
Definition vulkan.c:2407
AVVulkanDeviceQueueFamily * ff_vk_qf_find(FFVulkanContext *s, VkQueueFlagBits dev_family, VkVideoCodecOperationFlagBitsKHR vid_ops)
Chooses an appropriate QF.
Definition vulkan.c:297
int ff_vk_shader_link(FFVulkanContext *s, FFVulkanShader *shd, const char *spirv, size_t spirv_len, const char *entrypoint)
Link a shader into an executable.
Definition vulkan.c:2267
const char * desc
Definition libsvtav1.c:83
static const struct @257111027162314367033347246032313251342043035002 planes[]
AVOptions.
int av_pix_fmt_count_planes(enum AVPixelFormat pix_fmt)
Definition pixdesc.c:3500
@ AV_PIX_FMT_VULKAN
Vulkan hardware images.
Definition pixfmt.h:379
uint8_t * data
The data buffer.
Definition buffer.h:90
An instance of a filter.
Definition avfilter.h:273
AVFilterLink ** inputs
array of pointers to input links
Definition avfilter.h:281
AVFilterPad * input_pads
array of input pads
Definition avfilter.h:280
void * priv
private data for use by the filter
Definition avfilter.h:288
AVFilterLink ** outputs
array of pointers to output links
Definition avfilter.h:285
A filter pad used for either input or output.
Definition filters.h:40
const char * name
Pad name.
Definition filters.h:46
This structure describes decoded (raw) audio or video data.
Definition frame.h:472
AVBufferRef * hw_frames_ctx
For hwaccel-format frames, this should be a reference to the AVHWFramesContext describing the frame.
Definition frame.h:769
This struct describes a set or pool of "hardware" frames (i.e.
Definition hwcontext.h:118
enum AVPixelFormat sw_format
The pixel format identifying the actual data layout of the hardware frames.
Definition hwcontext.h:213
AVOption.
Definition opt.h:428
FFVulkanContext vkctx
AVVulkanDeviceQueueFamily * qf
FilterParamsVulkan params
FFVulkanShader shd
Frame sync structure.
Definition framesync.h:168
#define av_log(a,...)
static FILE * out
Definition movenc.c:55
static AVFormatContext * ctx
Definition movenc.c:49
#define BLEND_NORMAL(name, type)
static int activate(AVFilterContext *avctx)
#define IN_BOTTOM
static int config_params(AVFilterContext *avctx)
static int blend_frame(FFFrameSync *fs)
static const AVFilterPad blend_vulkan_inputs[]
static int process_command(AVFilterContext *ctx, const char *cmd, const char *args, char *res, int res_len, int flags)
static const AVFilterPad blend_vulkan_outputs[]
static av_cold void uninit(AVFilterContext *avctx)
static av_cold int init_filter(AVFilterContext *avctx)
static int config_props_output(AVFilterLink *outlink)
#define OFFSET(x)
static const AVOption blend_vulkan_options[]
#define IN_TOP
const unsigned int ff_blend_comp_spv_len
const unsigned char ff_blend_comp_spv_data[]
AVFrame * ff_get_video_buffer(AVFilterLink *link, int w, int h)
Request a picture buffer with a specific set of permissions.
Definition video.c:89
#define FF_VK_DEFAULT_EXEC_CONTEXTS
Definition vulkan.h:121
#define RET(x)
Definition vulkan.h:37
#define SPEC_LIST_ADD(name, idx, val_bits, val)
Definition vulkan.h:55
#define SPEC_LIST_CREATE(name, max_length, max_size)
Definition vulkan.h:45
int ff_vk_filter_config_input(AVFilterLink *inlink)
int ff_vk_filter_config_output(AVFilterLink *outlink)
int ff_vk_filter_process_Nin(FFVulkanContext *vkctx, FFVkExecPool *e, FFVulkanShader *shd, AVFrame *out, AVFrame *in[], int nb_in, VkSampler sampler, uint32_t wgc_z, void *push_src, size_t push_size)
Up to 16 inputs, one output.
int ff_vk_filter_init(AVFilterContext *avctx)
General lavfi IO functions.