FFmpeg
Loading...
Searching...
No Matches
vf_xfade_vulkan.c
Go to the documentation of this file.
1/*
2 * This file is part of FFmpeg.
3 *
4 * FFmpeg is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
8 *
9 * FFmpeg is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with FFmpeg; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17 */
18
19#include "libavutil/avassert.h"
20#include "libavutil/opt.h"
21
22#include "vulkan_filter.h"
23#include "filters.h"
24#include "video.h"
25
26#define IN_A 0
27#define IN_B 1
28#define IN_NB 2
29
30extern const unsigned char ff_xfade_comp_spv_data[];
31extern const unsigned int ff_xfade_comp_spv_len;
32
33typedef struct XFadeParameters {
34 float progress;
36
37typedef struct XFadeVulkanContext {
39
43
48 VkSampler sampler;
49
50 // PTS when the fade should start (in IN_A timebase)
52
53 // PTS offset between IN_A and IN_B
55
56 // Duration of the transition
58
59 // Current PTS of the first input (IN_A)
61
62 // If frames are currently just passed through
63 // unmodified, like before and after the actual
64 // transition.
66
69
90
92{
93 int err = 0;
94 XFadeVulkanContext *s = avctx->priv;
95 FFVulkanContext *vkctx = &s->vkctx;
96 const int planes = av_pix_fmt_count_planes(s->vkctx.output_format);
97
98 s->qf = ff_vk_qf_find(vkctx, VK_QUEUE_COMPUTE_BIT, 0);
99 if (!s->qf) {
100 av_log(avctx, AV_LOG_ERROR, "Device has no compute queues\n");
101 err = AVERROR(ENOTSUP);
102 goto fail;
103 }
104
105 RET(ff_vk_exec_pool_init(vkctx, s->qf, &s->e, FF_VK_DEFAULT_EXEC_CONTEXTS, 0, 0, 0, NULL));
106 RET(ff_vk_init_sampler(vkctx, &s->sampler, 1, VK_FILTER_NEAREST));
107
108 SPEC_LIST_CREATE(sl, 2, 2*sizeof(int))
109 SPEC_LIST_ADD(sl, 0, 32, s->transition);
110 SPEC_LIST_ADD(sl, 1, 32, planes);
111
112 ff_vk_shader_load(&s->shd, VK_SHADER_STAGE_COMPUTE_BIT,
113 sl, (int []) { 32, 32, 1 }, 0);
114
116 { /* output_images */
117 .type = VK_DESCRIPTOR_TYPE_STORAGE_IMAGE,
118 .stages = VK_SHADER_STAGE_COMPUTE_BIT,
119 .elems = planes,
120 },
121 { /* a_images */
122 .type = VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER,
123 .stages = VK_SHADER_STAGE_COMPUTE_BIT,
124 .samplers = DUP_SAMPLER(s->sampler),
125 .elems = planes,
126 },
127 { /* b_images */
128 .type = VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER,
129 .stages = VK_SHADER_STAGE_COMPUTE_BIT,
130 .samplers = DUP_SAMPLER(s->sampler),
131 .elems = planes,
132 },
133 };
134 ff_vk_shader_add_descriptor_set(vkctx, &s->shd, desc, 3, 0);
135
137 VK_SHADER_STAGE_COMPUTE_BIT);
138
139 RET(ff_vk_shader_link(vkctx, &s->shd,
141 ff_xfade_comp_spv_len, "main"));
142
143 RET(ff_vk_shader_register_exec(vkctx, &s->e, &s->shd));
144
145 s->initialized = 1;
146
147fail:
148 return err;
149}
150
151static int xfade_frame(AVFilterContext *avctx, AVFrame *frame_a, AVFrame *frame_b)
152{
153 int err;
154 AVFilterLink *outlink = avctx->outputs[0];
155 XFadeVulkanContext *s = avctx->priv;
156 float progress;
157
158 AVFrame *output = ff_get_video_buffer(outlink, outlink->w, outlink->h);
159 if (!output) {
160 err = AVERROR(ENOMEM);
161 goto fail;
162 }
163
164 if (!s->initialized) {
167 if (a_fc->sw_format != b_fc->sw_format) {
168 av_log(avctx, AV_LOG_ERROR,
169 "Currently the sw format of the first input needs to match the second!\n");
170 return AVERROR(EINVAL);
171 }
172 RET(init_vulkan(avctx));
173 }
174
175 RET(av_frame_copy_props(output, frame_a));
176 output->pts = s->pts;
177
178 progress = av_clipf((float)(s->pts - s->start_pts) / s->duration_pts,
179 0.f, 1.f);
180
181 RET(ff_vk_filter_process_Nin(&s->vkctx, &s->e, &s->shd, output,
182 (AVFrame *[]){ frame_a, frame_b }, 2, s->sampler, 1,
183 &(XFadeParameters){ progress }, sizeof(XFadeParameters)));
184
185 return ff_filter_frame(outlink, output);
186
187fail:
188 av_frame_free(&output);
189 return err;
190}
191
193{
194 int err;
195 AVFilterContext *avctx = outlink->src;
196 XFadeVulkanContext *s = avctx->priv;
197 AVFilterLink *inlink_a = avctx->inputs[IN_A];
198 AVFilterLink *inlink_b = avctx->inputs[IN_B];
199 FilterLink *il = ff_filter_link(inlink_a);
200 FilterLink *ol = ff_filter_link(outlink);
201
202 if (inlink_a->w != inlink_b->w || inlink_a->h != inlink_b->h) {
203 av_log(avctx, AV_LOG_ERROR, "First input link %s parameters "
204 "(size %dx%d) do not match the corresponding "
205 "second input link %s parameters (size %dx%d)\n",
206 avctx->input_pads[IN_A].name, inlink_a->w, inlink_a->h,
207 avctx->input_pads[IN_B].name, inlink_b->w, inlink_b->h);
208 return AVERROR(EINVAL);
209 }
210
211 if (inlink_a->time_base.num != inlink_b->time_base.num ||
212 inlink_a->time_base.den != inlink_b->time_base.den) {
213 av_log(avctx, AV_LOG_ERROR, "First input link %s timebase "
214 "(%d/%d) does not match the corresponding "
215 "second input link %s timebase (%d/%d)\n",
216 avctx->input_pads[IN_A].name, inlink_a->time_base.num, inlink_a->time_base.den,
217 avctx->input_pads[IN_B].name, inlink_b->time_base.num, inlink_b->time_base.den);
218 return AVERROR(EINVAL);
219 }
220
221 s->start_pts = s->inputs_offset_pts = AV_NOPTS_VALUE;
222
223 outlink->time_base = inlink_a->time_base;
224 ol->frame_rate = il->frame_rate;
225 outlink->sample_aspect_ratio = inlink_a->sample_aspect_ratio;
226
227 if (s->duration)
228 s->duration_pts = av_rescale_q(s->duration, AV_TIME_BASE_Q, inlink_a->time_base);
230
231fail:
232 return err;
233}
234
236 AVFilterLink *inlink, AVFilterLink *outlink)
237{
238 int64_t status_pts;
239 int ret = 0, status;
240 AVFrame *frame = NULL;
241
242 ret = ff_inlink_consume_frame(inlink, &frame);
243 if (ret < 0)
244 return ret;
245
246 if (ret > 0) {
247 // If we do not have an offset yet, it's because we
248 // never got a first input. Just offset to 0
249 if (s->inputs_offset_pts == AV_NOPTS_VALUE)
250 s->inputs_offset_pts = -frame->pts;
251
252 // We got a frame, nothing to do other than adjusting the timestamp
253 frame->pts += s->inputs_offset_pts;
254 return ff_filter_frame(outlink, frame);
255 }
256
257 // Forward status with our timestamp
258 if (ff_inlink_acknowledge_status(inlink, &status, &status_pts)) {
259 if (s->inputs_offset_pts == AV_NOPTS_VALUE)
260 s->inputs_offset_pts = -status_pts;
261
262 ff_outlink_set_status(outlink, status, status_pts + s->inputs_offset_pts);
263 return 0;
264 }
265
266 // No frame available, request one if needed
267 if (ff_outlink_frame_wanted(outlink))
269
270 return 0;
271}
272
273static int activate(AVFilterContext *avctx)
274{
275 XFadeVulkanContext *s = avctx->priv;
276 AVFilterLink *in_a = avctx->inputs[IN_A];
277 AVFilterLink *in_b = avctx->inputs[IN_B];
278 AVFilterLink *outlink = avctx->outputs[0];
279 int64_t status_pts;
280
281 FF_FILTER_FORWARD_STATUS_BACK_ALL(outlink, avctx);
282
283 // Check if we already transitioned or IN_A ended prematurely,
284 // in which case just forward the frames from IN_B with adjusted
285 // timestamps until EOF.
286 if (s->status[IN_A] && !s->status[IN_B])
287 return forward_frame(s, in_b, outlink);
288
289 // We did not finish transitioning yet and the first stream
290 // did not end either, so check if there are more frames to consume.
292 AVFrame *peeked_frame = ff_inlink_peek_frame(in_a, 0);
293 s->pts = peeked_frame->pts;
294
295 if (s->start_pts == AV_NOPTS_VALUE)
296 s->start_pts =
297 s->pts + av_rescale_q(s->offset, AV_TIME_BASE_Q, in_a->time_base);
298
299 // Check if we are not yet transitioning, in which case
300 // just request and forward the input frame.
301 if (s->start_pts > s->pts) {
302 AVFrame *frame_a = NULL;
303 s->passthrough = 1;
304 ff_inlink_consume_frame(in_a, &frame_a);
305 return ff_filter_frame(outlink, frame_a);
306 }
307 s->passthrough = 0;
308
309 // We are transitioning, so we need a frame from IN_B
311 int ret;
312 AVFrame *frame_a = NULL, *frame_b = NULL;
313 ff_inlink_consume_frame(avctx->inputs[IN_A], &frame_a);
314 ff_inlink_consume_frame(avctx->inputs[IN_B], &frame_b);
315
316 // Calculate PTS offset to first input
317 if (s->inputs_offset_pts == AV_NOPTS_VALUE)
318 s->inputs_offset_pts = s->pts - frame_b->pts;
319
320 // Check if we finished transitioning, in which case we
321 // report back EOF to IN_A as it is no longer needed.
322 if (s->pts - s->start_pts > s->duration_pts) {
323 s->status[IN_A] = AVERROR_EOF;
325 s->passthrough = 1;
326 }
327 ret = xfade_frame(avctx, frame_a, frame_b);
328 av_frame_free(&frame_a);
329 av_frame_free(&frame_b);
330 return ret;
331 }
332
333 // We did not get a frame from IN_B, check its status.
334 if (ff_inlink_acknowledge_status(in_b, &s->status[IN_B], &status_pts)) {
335 // We should transition, but IN_B is EOF so just report EOF output now.
336 ff_outlink_set_status(outlink, s->status[IN_B], s->pts);
337 return 0;
338 }
339
340 // We did not get a frame for IN_B but no EOF either, so just request more.
341 if (ff_outlink_frame_wanted(outlink)) {
343 return 0;
344 }
345 }
346
347 // We did not get a frame from IN_A, check its status.
348 if (ff_inlink_acknowledge_status(in_a, &s->status[IN_A], &status_pts)) {
349 // No more frames from IN_A, do not report EOF though, we will just
350 // forward the IN_B frames in the next activate calls.
351 s->passthrough = 1;
352 ff_filter_set_ready(avctx, 100);
353 return 0;
354 }
355
356 // We have no frames yet from IN_A and no EOF, so request some.
357 if (ff_outlink_frame_wanted(outlink)) {
359 return 0;
360 }
361
362 return FFERROR_NOT_READY;
363}
364
365static av_cold void uninit(AVFilterContext *avctx)
366{
367 XFadeVulkanContext *s = avctx->priv;
368 FFVulkanContext *vkctx = &s->vkctx;
369 FFVulkanFunctions *vk = &vkctx->vkfn;
370
371 ff_vk_exec_pool_free(vkctx, &s->e);
372 ff_vk_shader_free(vkctx, &s->shd);
373
374 if (s->sampler)
375 vk->DestroySampler(vkctx->hwctx->act_dev, s->sampler,
376 vkctx->hwctx->alloc);
377
378 ff_vk_uninit(&s->vkctx);
379
380 s->initialized = 0;
381}
382
383static AVFrame *get_video_buffer(AVFilterLink *inlink, int w, int h)
384{
385 XFadeVulkanContext *s = inlink->dst->priv;
386
387 return s->passthrough ?
388 ff_null_get_video_buffer (inlink, w, h) :
390}
391
392#define OFFSET(x) offsetof(XFadeVulkanContext, x)
393#define FLAGS (AV_OPT_FLAG_FILTERING_PARAM | AV_OPT_FLAG_VIDEO_PARAM)
394
396 { "transition", "set cross fade transition", OFFSET(transition), AV_OPT_TYPE_INT, {.i64=FADE}, 0, NB_TRANSITIONS-1, FLAGS, .unit = "transition" },
397 { "fade", "fade transition", 0, AV_OPT_TYPE_CONST, {.i64=FADE}, 0, 0, FLAGS, .unit = "transition" },
398 { "wipeleft", "wipe left transition", 0, AV_OPT_TYPE_CONST, {.i64=WIPELEFT}, 0, 0, FLAGS, .unit = "transition" },
399 { "wiperight", "wipe right transition", 0, AV_OPT_TYPE_CONST, {.i64=WIPERIGHT}, 0, 0, FLAGS, .unit = "transition" },
400 { "wipeup", "wipe up transition", 0, AV_OPT_TYPE_CONST, {.i64=WIPEUP}, 0, 0, FLAGS, .unit = "transition" },
401 { "wipedown", "wipe down transition", 0, AV_OPT_TYPE_CONST, {.i64=WIPEDOWN}, 0, 0, FLAGS, .unit = "transition" },
402 { "slidedown", "slide down transition", 0, AV_OPT_TYPE_CONST, {.i64=SLIDEDOWN}, 0, 0, FLAGS, .unit = "transition" },
403 { "slideup", "slide up transition", 0, AV_OPT_TYPE_CONST, {.i64=SLIDEUP}, 0, 0, FLAGS, .unit = "transition" },
404 { "slideleft", "slide left transition", 0, AV_OPT_TYPE_CONST, {.i64=SLIDELEFT}, 0, 0, FLAGS, .unit = "transition" },
405 { "slideright", "slide right transition", 0, AV_OPT_TYPE_CONST, {.i64=SLIDERIGHT}, 0, 0, FLAGS, .unit = "transition" },
406 { "circleopen", "circleopen transition", 0, AV_OPT_TYPE_CONST, {.i64=CIRCLEOPEN}, 0, 0, FLAGS, .unit = "transition" },
407 { "circleclose", "circleclose transition", 0, AV_OPT_TYPE_CONST, {.i64=CIRCLECLOSE}, 0, 0, FLAGS, .unit = "transition" },
408 { "dissolve", "dissolve transition", 0, AV_OPT_TYPE_CONST, {.i64=DISSOLVE}, 0, 0, FLAGS, .unit = "transition" },
409 { "pixelize", "pixelize transition", 0, AV_OPT_TYPE_CONST, {.i64=PIXELIZE}, 0, 0, FLAGS, .unit = "transition" },
410 { "wipetl", "wipe top left transition", 0, AV_OPT_TYPE_CONST, {.i64=WIPETL}, 0, 0, FLAGS, .unit = "transition" },
411 { "wipetr", "wipe top right transition", 0, AV_OPT_TYPE_CONST, {.i64=WIPETR}, 0, 0, FLAGS, .unit = "transition" },
412 { "wipebl", "wipe bottom left transition", 0, AV_OPT_TYPE_CONST, {.i64=WIPEBL}, 0, 0, FLAGS, .unit = "transition" },
413 { "wipebr", "wipe bottom right transition", 0, AV_OPT_TYPE_CONST, {.i64=WIPEBR}, 0, 0, FLAGS, .unit = "transition" },
414 { "duration", "set cross fade duration", OFFSET(duration), AV_OPT_TYPE_DURATION, {.i64=1000000}, 0, 60000000, FLAGS },
415 { "offset", "set cross fade start relative to first input stream", OFFSET(offset), AV_OPT_TYPE_DURATION, {.i64=0}, INT64_MIN, INT64_MAX, FLAGS },
416 { NULL }
417};
418
420
422 {
423 .name = "main",
424 .type = AVMEDIA_TYPE_VIDEO,
425 .get_buffer.video = &get_video_buffer,
426 .config_props = &ff_vk_filter_config_input,
427 },
428 {
429 .name = "xfade",
430 .type = AVMEDIA_TYPE_VIDEO,
431 .get_buffer.video = &get_video_buffer,
432 .config_props = &ff_vk_filter_config_input,
433 },
434};
435
437 {
438 .name = "default",
439 .type = AVMEDIA_TYPE_VIDEO,
440 .config_props = &config_props_output,
441 },
442};
443
445 .p.name = "xfade_vulkan",
446 .p.description = NULL_IF_CONFIG_SMALL("Cross fade one video with another video."),
447 .p.priv_class = &xfade_vulkan_class,
448 .p.flags = AVFILTER_FLAG_HWDEVICE,
449 .priv_size = sizeof(XFadeVulkanContext),
451 .uninit = &uninit,
452 .activate = &activate,
456 .flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE,
457};
#define FADE(name, type)
Definition af_afade.c:185
const FFFilter ff_vf_xfade_vulkan
simple assert() macros that are a bit more flexible than ISO C assert().
static AVFrame * get_video_buffer(AVFilterLink *inlink, int w, int h)
Definition avf_concat.c:205
void ff_inlink_set_status(AVFilterLink *link, int status)
Set the status on an input link.
Definition avfilter.c:1632
int ff_inlink_acknowledge_status(AVFilterLink *link, int *rstatus, int64_t *rpts)
Test and acknowledge the change of status on the link.
Definition avfilter.c:1467
int ff_inlink_check_available_frame(AVFilterLink *link)
Test if a frame is available on the link.
Definition avfilter.c:1489
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
Definition avfilter.c:1068
int ff_outlink_frame_wanted(AVFilterLink *link)
Test if a frame is wanted on an output link.
Definition avfilter.c:1690
AVFrame * ff_inlink_peek_frame(AVFilterLink *link, size_t idx)
Access a frame in the link fifo without consuming it.
Definition avfilter.c:1561
void ff_filter_set_ready(AVFilterContext *filter, unsigned priority)
Mark a filter ready and schedule it for activation.
Definition avfilter.c:229
int ff_inlink_consume_frame(AVFilterLink *link, AVFrame **rframe)
Take a frame from the link's FIFO and update the link's stats.
Definition avfilter.c:1520
void ff_inlink_request_frame(AVFilterLink *link)
Mark that a frame is wanted on the link.
Definition avfilter.c:1623
#define s(width, name)
Definition cbs_vp9.c:198
#define FLAGS
Definition cmdutils.c:596
#define av_clipf
Definition common.h:145
#define NULL
Definition coverity.c:32
long long int64_t
Definition coverity.c:34
static AVFrame * frame
int(* init)(AVBSFContext *ctx)
Definition dts2pts.c:608
static int64_t duration
Definition ffplay.c:349
#define fail
Definition test.h:479
@ AV_OPT_TYPE_CONST
Special option type for declaring named constants.
Definition opt.h:298
@ AV_OPT_TYPE_DURATION
Underlying C type is int64_t.
Definition opt.h:318
@ AV_OPT_TYPE_INT
Underlying C type is int.
Definition opt.h:258
#define AVFILTER_FLAG_HWDEVICE
The filter can create hardware frames using AVFilterContext.hw_device_ctx.
Definition avfilter.h:187
#define AVERROR_EOF
End of file.
Definition error.h:57
#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
int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq)
Rescale a 64-bit integer by 2 rational numbers.
@ AVMEDIA_TYPE_VIDEO
Definition avutil.h:200
#define AV_NOPTS_VALUE
Undefined timestamp value.
Definition avutil.h:247
#define AV_TIME_BASE_Q
Internal time base represented as fractional value.
Definition avutil.h:263
static av_cold void uninit(AVBitStreamFilterContext *ctx)
static int activate(AVBitStreamFilterContext *ctx)
unsigned offset
Definition libaomenc.c:763
#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 void ff_outlink_set_status(AVFilterLink *link, int status, int64_t pts)
Set the status field of a link from the source filter.
Definition filters.h:629
#define FFERROR_NOT_READY
Filters implementation helper functions and internal structures.
Definition filters.h:34
#define FF_FILTER_FORWARD_STATUS_BACK_ALL(outlink, filter)
Forward the status on an output link to all input links.
Definition filters.h:652
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
#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:97
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:2258
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:2568
void ff_vk_exec_pool_free(FFVulkanContext *s, FFVkExecPool *pool)
Definition vulkan.c:331
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:395
int ff_vk_shader_add_push_const(FFVulkanShader *shd, int offset, int size, VkShaderStageFlagBits stage)
Add/update push constants for execution.
Definition vulkan.c:1627
void ff_vk_uninit(FFVulkanContext *s)
Frees main context.
Definition vulkan.c:2833
void ff_vk_shader_free(FFVulkanContext *s, FFVulkanShader *shd)
Free a shader.
Definition vulkan.c:2809
int ff_vk_shader_register_exec(FFVulkanContext *s, FFVkExecPool *pool, FFVulkanShader *shd)
Register a shader with an exec pool.
Definition vulkan.c:2602
int ff_vk_init_sampler(FFVulkanContext *s, VkSampler *sampler, int unnorm_coords, VkFilter filt)
Create a sampler.
Definition vulkan.c:1638
AVVulkanDeviceQueueFamily * ff_vk_qf_find(FFVulkanContext *s, VkQueueFlagBits dev_family, VkVideoCodecOperationFlagBitsKHR vid_ops)
Chooses an appropriate QF.
Definition vulkan.c:316
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:2462
const char * desc
Definition libsvtav1.c:83
static const struct @257111027162314367033347246032313251342043035002 planes[]
uint8_t w
Definition llvidencdsp.c:39
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
int64_t pts
Presentation timestamp in time_base units (time when frame should be shown to user).
Definition frame.h:574
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
int num
Numerator.
Definition rational.h:59
int den
Denominator.
Definition rational.h:60
const VkAllocationCallbacks * alloc
Custom memory allocator, else NULL.
VkDevice act_dev
Active device.
AVVulkanDeviceContext * hwctx
Definition vulkan.h:339
FFVulkanFunctions vkfn
Definition vulkan.h:298
FFVulkanContext vkctx
FFVulkanShader shd
AVVulkanDeviceQueueFamily * qf
#define av_log(a,...)
static int config_props_output(AVFilterLink *outlink)
XFadeTransitions
Definition vf_xfade.c:29
@ WIPELEFT
Definition vf_xfade.c:32
@ DISSOLVE
Definition vf_xfade.c:56
@ WIPETR
Definition vf_xfade.c:69
@ SLIDEUP
Definition vf_xfade.c:38
@ SLIDEDOWN
Definition vf_xfade.c:39
@ PIXELIZE
Definition vf_xfade.c:57
@ WIPEDOWN
Definition vf_xfade.c:35
@ WIPEBR
Definition vf_xfade.c:71
@ NB_TRANSITIONS
Definition vf_xfade.c:89
@ CIRCLECLOSE
Definition vf_xfade.c:51
@ WIPERIGHT
Definition vf_xfade.c:33
@ WIPEBL
Definition vf_xfade.c:70
@ SLIDELEFT
Definition vf_xfade.c:36
@ WIPETL
Definition vf_xfade.c:68
@ SLIDERIGHT
Definition vf_xfade.c:37
@ WIPEUP
Definition vf_xfade.c:34
@ CIRCLEOPEN
Definition vf_xfade.c:50
#define IN_NB
const unsigned int ff_xfade_comp_spv_len
static int activate(AVFilterContext *avctx)
static int xfade_frame(AVFilterContext *avctx, AVFrame *frame_a, AVFrame *frame_b)
static AVFrame * get_video_buffer(AVFilterLink *inlink, int w, int h)
#define IN_A
static int forward_frame(XFadeVulkanContext *s, AVFilterLink *inlink, AVFilterLink *outlink)
const unsigned char ff_xfade_comp_spv_data[]
#define IN_B
static const AVOption xfade_vulkan_options[]
static const AVFilterPad xfade_vulkan_outputs[]
static const AVFilterPad xfade_vulkan_inputs[]
static av_cold int init_vulkan(AVFilterContext *avctx)
static av_cold void uninit(AVFilterContext *avctx)
static int config_props_output(AVFilterLink *outlink)
#define OFFSET(x)
AVFrame * ff_null_get_video_buffer(AVFilterLink *link, int w, int h)
Definition video.c:44
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
AVFrame * ff_default_get_video_buffer(AVFilterLink *link, int w, int h)
Definition video.c:84
#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
#define DUP_SAMPLER(x)
Definition vulkan.h:73
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.