FFmpeg
vf_overlay_vulkan.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) Lynne
3  *
4  * This file is part of FFmpeg.
5  *
6  * FFmpeg is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * FFmpeg is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with FFmpeg; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19  */
20 
21 #include "libavutil/random_seed.h"
22 #include "libavutil/opt.h"
23 #include "vulkan_filter.h"
24 #include "vulkan_spirv.h"
25 #include "internal.h"
26 #include "framesync.h"
27 #include "video.h"
28 
29 typedef struct OverlayVulkanContext {
32 
38  VkSampler sampler;
39 
40  /* Push constants / options */
41  struct {
44  } opts;
45 
46  int overlay_x;
47  int overlay_y;
48  int overlay_w;
49  int overlay_h;
51 
52 static const char overlay_noalpha[] = {
53  C(0, void overlay_noalpha(int i, ivec2 pos) )
54  C(0, { )
55  C(1, if ((o_offset[i].x <= pos.x) && (o_offset[i].y <= pos.y) &&
56  (pos.x < (o_offset[i].x + o_size[i].x)) &&
57  (pos.y < (o_offset[i].y + o_size[i].y))) { )
58  C(2, vec4 res = texture(overlay_img[i], pos - o_offset[i]); )
59  C(2, imageStore(output_img[i], pos, res); )
60  C(1, } else { )
61  C(2, vec4 res = texture(main_img[i], pos); )
62  C(2, imageStore(output_img[i], pos, res); )
63  C(1, } )
64  C(0, } )
65 };
66 
67 static const char overlay_alpha[] = {
68  C(0, void overlay_alpha_opaque(int i, ivec2 pos) )
69  C(0, { )
70  C(1, vec4 res = texture(main_img[i], pos); )
71  C(1, if ((o_offset[i].x <= pos.x) && (o_offset[i].y <= pos.y) &&
72  (pos.x < (o_offset[i].x + o_size[i].x)) &&
73  (pos.y < (o_offset[i].y + o_size[i].y))) { )
74  C(2, vec4 ovr = texture(overlay_img[i], pos - o_offset[i]); )
75  C(2, res = ovr * ovr.a + res * (1.0f - ovr.a); )
76  C(2, res.a = 1.0f; )
77  C(2, imageStore(output_img[i], pos, res); )
78  C(1, } )
79  C(1, imageStore(output_img[i], pos, res); )
80  C(0, } )
81 };
82 
84 {
85  int err;
86  uint8_t *spv_data;
87  size_t spv_len;
88  void *spv_opaque = NULL;
89  OverlayVulkanContext *s = ctx->priv;
90  FFVulkanContext *vkctx = &s->vkctx;
91  const int planes = av_pix_fmt_count_planes(s->vkctx.output_format);
92  const int ialpha = av_pix_fmt_desc_get(s->vkctx.input_format)->flags & AV_PIX_FMT_FLAG_ALPHA;
93  const AVPixFmtDescriptor *pix_desc = av_pix_fmt_desc_get(s->vkctx.output_format);
94  FFVkSPIRVShader *shd = &s->shd;
95  FFVkSPIRVCompiler *spv;
97 
98  spv = ff_vk_spirv_init();
99  if (!spv) {
100  av_log(ctx, AV_LOG_ERROR, "Unable to initialize SPIR-V compiler!\n");
101  return AVERROR_EXTERNAL;
102  }
103 
104  ff_vk_qf_init(vkctx, &s->qf, VK_QUEUE_COMPUTE_BIT);
105  RET(ff_vk_exec_pool_init(vkctx, &s->qf, &s->e, s->qf.nb_queues*4, 0, 0, 0, NULL));
106  RET(ff_vk_init_sampler(vkctx, &s->sampler, 1, VK_FILTER_NEAREST));
107  RET(ff_vk_shader_init(&s->pl, &s->shd, "overlay_compute",
108  VK_SHADER_STAGE_COMPUTE_BIT, 0));
109 
110  ff_vk_shader_set_compute_sizes(&s->shd, 32, 32, 1);
111 
112  GLSLC(0, layout(push_constant, std430) uniform pushConstants { );
113  GLSLC(1, ivec2 o_offset[3]; );
114  GLSLC(1, ivec2 o_size[3]; );
115  GLSLC(0, }; );
116  GLSLC(0, );
117 
118  ff_vk_add_push_constant(&s->pl, 0, sizeof(s->opts),
119  VK_SHADER_STAGE_COMPUTE_BIT);
120 
122  {
123  .name = "main_img",
124  .type = VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER,
125  .dimensions = 2,
126  .elems = planes,
127  .stages = VK_SHADER_STAGE_COMPUTE_BIT,
128  .samplers = DUP_SAMPLER(s->sampler),
129  },
130  {
131  .name = "overlay_img",
132  .type = VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER,
133  .dimensions = 2,
134  .elems = planes,
135  .stages = VK_SHADER_STAGE_COMPUTE_BIT,
136  .samplers = DUP_SAMPLER(s->sampler),
137  },
138  {
139  .name = "output_img",
140  .type = VK_DESCRIPTOR_TYPE_STORAGE_IMAGE,
141  .mem_layout = ff_vk_shader_rep_fmt(s->vkctx.output_format),
142  .mem_quali = "writeonly",
143  .dimensions = 2,
144  .elems = planes,
145  .stages = VK_SHADER_STAGE_COMPUTE_BIT,
146  },
147  };
148 
149  RET(ff_vk_pipeline_descriptor_set_add(vkctx, &s->pl, shd, desc, 3, 0, 0));
150 
152  GLSLD( overlay_alpha );
153  GLSLC(0, void main() );
154  GLSLC(0, { );
155  GLSLC(1, ivec2 pos = ivec2(gl_GlobalInvocationID.xy); );
156  GLSLF(1, int planes = %i; ,planes);
157  GLSLC(1, for (int i = 0; i < planes; i++) { );
158  if (ialpha)
159  GLSLC(2, overlay_alpha_opaque(i, pos); );
160  else
161  GLSLC(2, overlay_noalpha(i, pos); );
162  GLSLC(1, } );
163  GLSLC(0, } );
164 
165  RET(spv->compile_shader(spv, ctx, shd, &spv_data, &spv_len, "main",
166  &spv_opaque));
167  RET(ff_vk_shader_create(vkctx, shd, spv_data, spv_len, "main"));
168 
169  RET(ff_vk_init_compute_pipeline(vkctx, &s->pl, shd));
170  RET(ff_vk_exec_pipeline_register(vkctx, &s->e, &s->pl));
171 
172  s->opts.o_offset[0] = s->overlay_x;
173  s->opts.o_offset[1] = s->overlay_y;
174  s->opts.o_offset[2] = s->opts.o_offset[0] >> pix_desc->log2_chroma_w;
175  s->opts.o_offset[3] = s->opts.o_offset[1] >> pix_desc->log2_chroma_h;
176  s->opts.o_offset[4] = s->opts.o_offset[0] >> pix_desc->log2_chroma_w;
177  s->opts.o_offset[5] = s->opts.o_offset[1] >> pix_desc->log2_chroma_h;
178 
179  s->opts.o_size[0] = s->overlay_w;
180  s->opts.o_size[1] = s->overlay_h;
181  s->opts.o_size[2] = s->opts.o_size[0] >> pix_desc->log2_chroma_w;
182  s->opts.o_size[3] = s->opts.o_size[1] >> pix_desc->log2_chroma_h;
183  s->opts.o_size[4] = s->opts.o_size[0] >> pix_desc->log2_chroma_w;
184  s->opts.o_size[5] = s->opts.o_size[1] >> pix_desc->log2_chroma_h;
185 
186  s->initialized = 1;
187 
188 fail:
189  if (spv_opaque)
190  spv->free_shader(spv, &spv_opaque);
191  if (spv)
192  spv->uninit(&spv);
193 
194  return err;
195 }
196 
198 {
199  int err;
200  AVFilterContext *ctx = fs->parent;
201  OverlayVulkanContext *s = ctx->priv;
202  AVFilterLink *outlink = ctx->outputs[0];
203  AVFrame *input_main, *input_overlay, *out;
204 
205  err = ff_framesync_get_frame(fs, 0, &input_main, 0);
206  if (err < 0)
207  goto fail;
208  err = ff_framesync_get_frame(fs, 1, &input_overlay, 0);
209  if (err < 0)
210  goto fail;
211 
212  if (!input_main || !input_overlay)
213  return 0;
214 
215  if (!s->initialized) {
216  AVHWFramesContext *main_fc = (AVHWFramesContext*)input_main->hw_frames_ctx->data;
217  AVHWFramesContext *overlay_fc = (AVHWFramesContext*)input_overlay->hw_frames_ctx->data;
218  if (main_fc->sw_format != overlay_fc->sw_format) {
219  av_log(ctx, AV_LOG_ERROR, "Mismatching sw formats!\n");
220  return AVERROR(EINVAL);
221  }
222 
223  s->overlay_w = input_overlay->width;
224  s->overlay_h = input_overlay->height;
225 
226  RET(init_filter(ctx));
227  }
228 
229  out = ff_get_video_buffer(outlink, outlink->w, outlink->h);
230  if (!out) {
231  err = AVERROR(ENOMEM);
232  goto fail;
233  }
234 
235  RET(ff_vk_filter_process_Nin(&s->vkctx, &s->e, &s->pl,
236  out, (AVFrame *[]){ input_main, input_overlay }, 2,
237  s->sampler, &s->opts, sizeof(s->opts)));
238 
239  err = av_frame_copy_props(out, input_main);
240  if (err < 0)
241  goto fail;
242 
243  return ff_filter_frame(outlink, out);
244 
245 fail:
246  av_frame_free(&out);
247  return err;
248 }
249 
251 {
252  int err;
253  AVFilterContext *avctx = outlink->src;
254  OverlayVulkanContext *s = avctx->priv;
255 
256  err = ff_vk_filter_config_output(outlink);
257  if (err < 0)
258  return err;
259 
260  err = ff_framesync_init_dualinput(&s->fs, avctx);
261  if (err < 0)
262  return err;
263 
264  return ff_framesync_configure(&s->fs);
265 }
266 
268 {
269  OverlayVulkanContext *s = avctx->priv;
270 
271  return ff_framesync_activate(&s->fs);
272 }
273 
275 {
276  OverlayVulkanContext *s = avctx->priv;
277 
278  s->fs.on_event = &overlay_vulkan_blend;
279 
280  return ff_vk_filter_init(avctx);
281 }
282 
284 {
285  OverlayVulkanContext *s = avctx->priv;
286  FFVulkanContext *vkctx = &s->vkctx;
287  FFVulkanFunctions *vk = &vkctx->vkfn;
288 
289  ff_vk_exec_pool_free(vkctx, &s->e);
290  ff_vk_pipeline_free(vkctx, &s->pl);
291  ff_vk_shader_free(vkctx, &s->shd);
292 
293  if (s->sampler)
294  vk->DestroySampler(vkctx->hwctx->act_dev, s->sampler,
295  vkctx->hwctx->alloc);
296 
297  ff_vk_uninit(&s->vkctx);
298  ff_framesync_uninit(&s->fs);
299 
300  s->initialized = 0;
301 }
302 
303 #define OFFSET(x) offsetof(OverlayVulkanContext, x)
304 #define FLAGS (AV_OPT_FLAG_FILTERING_PARAM | AV_OPT_FLAG_VIDEO_PARAM)
306  { "x", "Set horizontal offset", OFFSET(overlay_x), AV_OPT_TYPE_INT, {.i64 = 0}, 0, INT_MAX, .flags = FLAGS },
307  { "y", "Set vertical offset", OFFSET(overlay_y), AV_OPT_TYPE_INT, {.i64 = 0}, 0, INT_MAX, .flags = FLAGS },
308  { NULL },
309 };
310 
311 AVFILTER_DEFINE_CLASS(overlay_vulkan);
312 
314  {
315  .name = "main",
316  .type = AVMEDIA_TYPE_VIDEO,
317  .config_props = &ff_vk_filter_config_input,
318  },
319  {
320  .name = "overlay",
321  .type = AVMEDIA_TYPE_VIDEO,
322  .config_props = &ff_vk_filter_config_input,
323  },
324 };
325 
327  {
328  .name = "default",
329  .type = AVMEDIA_TYPE_VIDEO,
330  .config_props = &overlay_vulkan_config_output,
331  },
332 };
333 
335  .name = "overlay_vulkan",
336  .description = NULL_IF_CONFIG_SMALL("Overlay a source on top of another"),
337  .priv_size = sizeof(OverlayVulkanContext),
344  .priv_class = &overlay_vulkan_class,
345  .flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE,
346  .flags = AVFILTER_FLAG_HWDEVICE,
347 };
ff_get_video_buffer
AVFrame * ff_get_video_buffer(AVFilterLink *link, int w, int h)
Request a picture buffer with a specific set of permissions.
Definition: video.c:112
ff_framesync_configure
int ff_framesync_configure(FFFrameSync *fs)
Configure a frame sync structure.
Definition: framesync.c:134
ff_vk_pipeline_free
void ff_vk_pipeline_free(FFVulkanContext *s, FFVulkanPipeline *pl)
Definition: vulkan.c:1844
AVERROR
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
opt.h
ff_framesync_uninit
void ff_framesync_uninit(FFFrameSync *fs)
Free all memory currently allocated.
Definition: framesync.c:304
out
FILE * out
Definition: movenc.c:55
FF_FILTER_FLAG_HWFRAME_AWARE
#define FF_FILTER_FLAG_HWFRAME_AWARE
The filter is aware of hardware frames, and any hardware frame context should not be automatically pr...
Definition: internal.h:351
ff_filter_frame
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
Definition: avfilter.c:1015
av_pix_fmt_desc_get
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
Definition: pixdesc.c:2965
AVBufferRef::data
uint8_t * data
The data buffer.
Definition: buffer.h:90
ff_framesync_get_frame
int ff_framesync_get_frame(FFFrameSync *fs, unsigned in, AVFrame **rframe, unsigned get)
Get the current frame in an input.
Definition: framesync.c:267
overlay_noalpha
static const char overlay_noalpha[]
Definition: vf_overlay_vulkan.c:52
ff_vk_qf_init
int ff_vk_qf_init(FFVulkanContext *s, FFVkQueueFamilyCtx *qf, VkQueueFlagBits dev_family)
Chooses a QF and loads it into a context.
Definition: vulkan.c:225
av_frame_free
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
Definition: frame.c:160
AVFrame
This structure describes decoded (raw) audio or video data.
Definition: frame.h:375
AVFrame::width
int width
Definition: frame.h:447
ff_vk_filter_init
int ff_vk_filter_init(AVFilterContext *avctx)
General lavfi IO functions.
Definition: vulkan_filter.c:221
ff_vk_filter_process_Nin
int ff_vk_filter_process_Nin(FFVulkanContext *vkctx, FFVkExecPool *e, FFVulkanPipeline *pl, AVFrame *out, AVFrame *in[], int nb_in, VkSampler sampler, void *push_src, size_t push_size)
Up to 16 inputs, one output.
Definition: vulkan_filter.c:387
ff_vk_shader_create
int ff_vk_shader_create(FFVulkanContext *s, FFVkSPIRVShader *shd, uint8_t *spirv, size_t spirv_size, const char *entrypoint)
Definition: vulkan.c:1415
AVOption
AVOption.
Definition: opt.h:346
overlay_vulkan_activate
static int overlay_vulkan_activate(AVFilterContext *avctx)
Definition: vf_overlay_vulkan.c:267
overlay_vulkan_config_output
static int overlay_vulkan_config_output(AVFilterLink *outlink)
Definition: vf_overlay_vulkan.c:250
overlay_vulkan_outputs
static const AVFilterPad overlay_vulkan_outputs[]
Definition: vf_overlay_vulkan.c:326
ff_vk_uninit
void ff_vk_uninit(FFVulkanContext *s)
Frees main context.
Definition: vulkan.c:1873
FFVkSPIRVCompiler::uninit
void(* uninit)(struct FFVkSPIRVCompiler **ctx)
Definition: vulkan_spirv.h:33
AVFilter::name
const char * name
Filter name.
Definition: avfilter.h:170
ff_vk_pipeline_descriptor_set_add
int ff_vk_pipeline_descriptor_set_add(FFVulkanContext *s, FFVulkanPipeline *pl, FFVkSPIRVShader *shd, FFVulkanDescriptorSetBinding *desc, int nb, int read_only, int print_to_shader_only)
Add descriptor to a pipeline.
Definition: vulkan.c:1465
FFFrameSync
Frame sync structure.
Definition: framesync.h:168
ff_vk_shader_set_compute_sizes
void ff_vk_shader_set_compute_sizes(FFVkSPIRVShader *shd, int x, int y, int z)
Definition: vulkan.c:1373
video.h
overlay_vulkan_blend
static int overlay_vulkan_blend(FFFrameSync *fs)
Definition: vf_overlay_vulkan.c:197
AV_PIX_FMT_VULKAN
@ AV_PIX_FMT_VULKAN
Vulkan hardware images.
Definition: pixfmt.h:379
av_pix_fmt_count_planes
int av_pix_fmt_count_planes(enum AVPixelFormat pix_fmt)
Definition: pixdesc.c:3005
AVVulkanDeviceContext::alloc
const VkAllocationCallbacks * alloc
Custom memory allocator, else NULL.
Definition: hwcontext_vulkan.h:49
ff_vk_add_push_constant
int ff_vk_add_push_constant(FFVulkanPipeline *pl, int offset, int size, VkShaderStageFlagBits stage)
Add/update push constants for execution.
Definition: vulkan.c:1143
AVFilterContext::priv
void * priv
private data for use by the filter
Definition: avfilter.h:422
fail
#define fail()
Definition: checkasm.h:179
vulkan_filter.h
OverlayVulkanContext::pl
FFVulkanPipeline pl
Definition: vf_overlay_vulkan.c:34
ff_vf_overlay_vulkan
const AVFilter ff_vf_overlay_vulkan
Definition: vf_overlay_vulkan.c:334
AVFilterPad
A filter pad used for either input or output.
Definition: internal.h:33
C
s EdgeDetect Foobar g libavfilter vf_edgedetect c libavfilter vf_foobar c edit libavfilter and add an entry for foobar following the pattern of the other filters edit libavfilter allfilters and add an entry for foobar following the pattern of the other filters configure make j< whatever > ffmpeg ffmpeg i you should get a foobar png with Lena edge detected That s your new playground is ready Some little details about what s going which in turn will define variables for the build system and the C
Definition: writing_filters.txt:58
AV_LOG_ERROR
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:180
av_cold
#define av_cold
Definition: attributes.h:90
OverlayVulkanContext::overlay_x
int overlay_x
Definition: vf_overlay_vulkan.c:46
s
#define s(width, name)
Definition: cbs_vp9.c:198
FLAGS
#define FLAGS
Definition: vf_overlay_vulkan.c:304
OverlayVulkanContext::o_offset
int32_t o_offset[2 *3]
Definition: vf_overlay_vulkan.c:42
AV_PIX_FMT_FLAG_ALPHA
#define AV_PIX_FMT_FLAG_ALPHA
The pixel format has an alpha channel.
Definition: pixdesc.h:147
ctx
AVFormatContext * ctx
Definition: movenc.c:49
overlay_vulkan_options
static const AVOption overlay_vulkan_options[]
Definition: vf_overlay_vulkan.c:305
OFFSET
#define OFFSET(x)
Definition: vf_overlay_vulkan.c:303
AVPixFmtDescriptor::log2_chroma_w
uint8_t log2_chroma_w
Amount to shift the luma width right to find the chroma width.
Definition: pixdesc.h:80
FFVkSPIRVCompiler::compile_shader
int(* compile_shader)(struct FFVkSPIRVCompiler *ctx, void *avctx, struct FFVkSPIRVShader *shd, uint8_t **data, size_t *size, const char *entrypoint, void **opaque)
Definition: vulkan_spirv.h:29
ff_vk_exec_pool_free
void ff_vk_exec_pool_free(FFVulkanContext *s, FFVkExecPool *pool)
Definition: vulkan.c:256
FILTER_INPUTS
#define FILTER_INPUTS(array)
Definition: internal.h:182
init_filter
static av_cold int init_filter(AVFilterContext *ctx)
Definition: vf_overlay_vulkan.c:83
NULL
#define NULL
Definition: coverity.c:32
AVHWFramesContext::sw_format
enum AVPixelFormat sw_format
The pixel format identifying the actual data layout of the hardware frames.
Definition: hwcontext.h:210
av_frame_copy_props
int av_frame_copy_props(AVFrame *dst, const AVFrame *src)
Copy only "metadata" fields from src to dst.
Definition: frame.c:709
GLSLD
#define GLSLD(D)
Definition: vulkan.h:59
fs
#define fs(width, name, subs,...)
Definition: cbs_vp9.c:200
overlay_vulkan_inputs
static const AVFilterPad overlay_vulkan_inputs[]
Definition: vf_overlay_vulkan.c:313
OverlayVulkanContext::overlay_w
int overlay_w
Definition: vf_overlay_vulkan.c:48
activate
filter_frame For filters that do not use the activate() callback
OverlayVulkanContext::e
FFVkExecPool e
Definition: vf_overlay_vulkan.c:35
ff_vk_filter_config_output
int ff_vk_filter_config_output(AVFilterLink *outlink)
Definition: vulkan_filter.c:198
ff_vk_init_compute_pipeline
int ff_vk_init_compute_pipeline(FFVulkanContext *s, FFVulkanPipeline *pl, FFVkSPIRVShader *shd)
Definition: vulkan.c:1785
ff_vk_exec_pool_init
int ff_vk_exec_pool_init(FFVulkanContext *s, FFVkQueueFamilyCtx *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:296
FFVulkanContext
Definition: vulkan.h:228
AVPixFmtDescriptor::flags
uint64_t flags
Combination of AV_PIX_FMT_FLAG_...
Definition: pixdesc.h:94
FFVulkanPipeline
Definition: vulkan.h:131
ff_vk_shader_init
int ff_vk_shader_init(FFVulkanPipeline *pl, FFVkSPIRVShader *shd, const char *name, VkShaderStageFlags stage, uint32_t required_subgroup_size)
Shader management.
Definition: vulkan.c:1347
overlay_vulkan_init
static av_cold int overlay_vulkan_init(AVFilterContext *avctx)
Definition: vf_overlay_vulkan.c:274
main
int main(int argc, char **argv)
Definition: avio_http_serve_files.c:99
init
int(* init)(AVBSFContext *ctx)
Definition: dts2pts.c:366
FFVulkanDescriptorSetBinding
Definition: vulkan.h:83
NULL_IF_CONFIG_SMALL
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
Definition: internal.h:94
ff_framesync_init_dualinput
int ff_framesync_init_dualinput(FFFrameSync *fs, AVFilterContext *parent)
Initialize a frame sync structure for dualinput.
Definition: framesync.c:375
AVFILTER_FLAG_HWDEVICE
#define AVFILTER_FLAG_HWDEVICE
The filter can create hardware frames using AVFilterContext.hw_device_ctx.
Definition: avfilter.h:138
FFVkQueueFamilyCtx
Definition: vulkan.h:110
OverlayVulkanContext::sampler
VkSampler sampler
Definition: vf_overlay_vulkan.c:38
OverlayVulkanContext
Definition: vf_overlay_vulkan.c:29
AVERROR_EXTERNAL
#define AVERROR_EXTERNAL
Generic error in an external library.
Definition: error.h:59
internal.h
FFVkSPIRVCompiler
Definition: vulkan_spirv.h:27
layout
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel layout
Definition: filter_design.txt:18
FILTER_SINGLE_PIXFMT
#define FILTER_SINGLE_PIXFMT(pix_fmt_)
Definition: internal.h:172
uninit
static void uninit(AVBSFContext *ctx)
Definition: pcm_rechunk.c:68
planes
static const struct @396 planes[]
i
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:256
overlay_alpha
static const char overlay_alpha[]
Definition: vf_overlay_vulkan.c:67
DUP_SAMPLER
#define DUP_SAMPLER(x)
Definition: vulkan.h:73
ff_vk_shader_rep_fmt
const char * ff_vk_shader_rep_fmt(enum AVPixelFormat pixfmt)
Returns the format to use for images in shaders.
Definition: vulkan.c:1207
vulkan_spirv.h
AVFilterPad::name
const char * name
Pad name.
Definition: internal.h:39
OverlayVulkanContext::vkctx
FFVulkanContext vkctx
Definition: vf_overlay_vulkan.c:30
GLSLF
#define GLSLF(N, S,...)
Definition: vulkan.h:54
OverlayVulkanContext::shd
FFVkSPIRVShader shd
Definition: vf_overlay_vulkan.c:37
FFVkSPIRVCompiler::free_shader
void(* free_shader)(struct FFVkSPIRVCompiler *ctx, void **opaque)
Definition: vulkan_spirv.h:32
AVFILTER_DEFINE_CLASS
AVFILTER_DEFINE_CLASS(overlay_vulkan)
AVFilter
Filter definition.
Definition: avfilter.h:166
AVHWFramesContext
This struct describes a set or pool of "hardware" frames (i.e.
Definition: hwcontext.h:115
FFVulkanContext::vkfn
FFVulkanFunctions vkfn
Definition: vulkan.h:231
FFVkExecPool
Definition: vulkan.h:210
OverlayVulkanContext::o_size
int32_t o_size[2 *3]
Definition: vf_overlay_vulkan.c:43
pos
unsigned int pos
Definition: spdifenc.c:414
AVFrame::hw_frames_ctx
AVBufferRef * hw_frames_ctx
For hwaccel-format frames, this should be a reference to the AVHWFramesContext describing the frame.
Definition: frame.h:726
AVFrame::height
int height
Definition: frame.h:447
random_seed.h
framesync.h
FFVkSPIRVShader
Definition: vulkan.h:75
OverlayVulkanContext::fs
FFFrameSync fs
Definition: vf_overlay_vulkan.c:31
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Definition: opt.h:235
overlay_vulkan_uninit
static void overlay_vulkan_uninit(AVFilterContext *avctx)
Definition: vf_overlay_vulkan.c:283
AVFilterContext
An instance of a filter.
Definition: avfilter.h:407
OverlayVulkanContext::opts
struct OverlayVulkanContext::@288 opts
desc
const char * desc
Definition: libsvtav1.c:75
GLSLC
#define GLSLC(N, S)
Definition: vulkan.h:44
ff_vk_filter_config_input
int ff_vk_filter_config_input(AVFilterLink *inlink)
Definition: vulkan_filter.c:166
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
FFVulkanContext::hwctx
AVVulkanDeviceContext * hwctx
Definition: vulkan.h:253
AVPixFmtDescriptor
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
Definition: pixdesc.h:69
AVVulkanDeviceContext::act_dev
VkDevice act_dev
Active device.
Definition: hwcontext_vulkan.h:71
FILTER_OUTPUTS
#define FILTER_OUTPUTS(array)
Definition: internal.h:183
ff_vk_init_sampler
int ff_vk_init_sampler(FFVulkanContext *s, VkSampler *sampler, int unnorm_coords, VkFilter filt)
Create a sampler.
Definition: vulkan.c:1163
ff_vk_exec_pipeline_register
int ff_vk_exec_pipeline_register(FFVulkanContext *s, FFVkExecPool *pool, FFVulkanPipeline *pl)
Register a pipeline with an exec pool.
Definition: vulkan.c:1579
int32_t
int32_t
Definition: audioconvert.c:56
av_log
#define av_log(a,...)
Definition: tableprint_vlc.h:27
ff_framesync_activate
int ff_framesync_activate(FFFrameSync *fs)
Examine the frames in the filter's input and try to produce output.
Definition: framesync.c:355
ff_vk_shader_free
void ff_vk_shader_free(FFVulkanContext *s, FFVkSPIRVShader *shd)
Definition: vulkan.c:1406
OverlayVulkanContext::initialized
int initialized
Definition: vf_overlay_vulkan.c:33
RET
#define RET(x)
Definition: vulkan.h:67
FFVulkanFunctions
Definition: vulkan_functions.h:226
AVPixFmtDescriptor::log2_chroma_h
uint8_t log2_chroma_h
Amount to shift the luma height right to find the chroma height.
Definition: pixdesc.h:89
OverlayVulkanContext::overlay_y
int overlay_y
Definition: vf_overlay_vulkan.c:47
OverlayVulkanContext::overlay_h
int overlay_h
Definition: vf_overlay_vulkan.c:49
OverlayVulkanContext::qf
FFVkQueueFamilyCtx qf
Definition: vf_overlay_vulkan.c:36