FFmpeg
vf_flip_vulkan.c
Go to the documentation of this file.
1 /*
2  * copyright (c) 2021 Wu Jianhua <jianhua.wu@intel.com>
3  * This file is part of FFmpeg.
4  *
5  * FFmpeg is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * FFmpeg is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with FFmpeg; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18  */
19 
20 #include "libavutil/random_seed.h"
21 #include "libavutil/opt.h"
22 #include "vulkan_filter.h"
23 #include "internal.h"
24 
25 #define CGS 32
26 
27 enum FlipType {
31 };
32 
33 typedef struct FlipVulkanContext {
38 
39  VkDescriptorImageInfo input_images[3];
40  VkDescriptorImageInfo output_images[3];
41 
44 
46 {
47  int err = 0;
48  FFVkSPIRVShader *shd;
49  FlipVulkanContext *s = ctx->priv;
50  FFVulkanContext *vkctx = &s->vkctx;
51  const int planes = av_pix_fmt_count_planes(s->vkctx.output_format);
52 
53  FFVulkanDescriptorSetBinding image_descs[] = {
54  {
55  .name = "input_image",
56  .type = VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER,
57  .dimensions = 2,
58  .elems = planes,
59  .stages = VK_SHADER_STAGE_COMPUTE_BIT,
60  .updater = s->input_images,
61  },
62  {
63  .name = "output_image",
64  .type = VK_DESCRIPTOR_TYPE_STORAGE_IMAGE,
65  .mem_layout = ff_vk_shader_rep_fmt(s->vkctx.output_format),
66  .mem_quali = "writeonly",
67  .dimensions = 2,
68  .elems = planes,
69  .stages = VK_SHADER_STAGE_COMPUTE_BIT,
70  .updater = s->output_images,
71  },
72  };
73 
74  image_descs[0].sampler = ff_vk_init_sampler(vkctx, 1, VK_FILTER_LINEAR);
75  if (!image_descs[0].sampler)
76  return AVERROR_EXTERNAL;
77 
78  ff_vk_qf_init(vkctx, &s->qf, VK_QUEUE_COMPUTE_BIT, 0);
79 
80  {
81  s->pl = ff_vk_create_pipeline(vkctx, &s->qf);
82  if (!s->pl)
83  return AVERROR(ENOMEM);
84 
85  shd = ff_vk_init_shader(s->pl, "flip_compute", image_descs[0].stages);
86  if (!shd)
87  return AVERROR(ENOMEM);
88 
89  ff_vk_set_compute_shader_sizes(shd, (int [3]){ CGS, 1, 1 });
90  RET(ff_vk_add_descriptor_set(vkctx, s->pl, shd, image_descs, FF_ARRAY_ELEMS(image_descs), 0));
91 
92  GLSLC(0, void main() );
93  GLSLC(0, { );
94  GLSLC(1, ivec2 size; );
95  GLSLC(1, const ivec2 pos = ivec2(gl_GlobalInvocationID.xy); );
96  for (int i = 0; i < planes; i++) {
97  GLSLC(0, );
98  GLSLF(1, size = imageSize(output_image[%i]); ,i);
99  GLSLC(1, if (IS_WITHIN(pos, size)) { );
100  switch (type)
101  {
102  case FLIP_HORIZONTAL:
103  GLSLF(2, vec4 res = texture(input_image[%i], ivec2(size.x - pos.x, pos.y)); ,i);
104  break;
105  case FLIP_VERTICAL:
106  GLSLF(2, vec4 res = texture(input_image[%i], ivec2(pos.x, size.y - pos.y)); ,i);
107  break;
108  case FLIP_BOTH:
109  GLSLF(2, vec4 res = texture(input_image[%i], ivec2(size.xy - pos.xy));, i);
110  break;
111  default:
112  GLSLF(2, vec4 res = texture(input_image[%i], pos); ,i);
113  break;
114  }
115  GLSLF(2, imageStore(output_image[%i], pos, res); ,i);
116  GLSLC(1, } );
117  }
118  GLSLC(0, } );
119 
120  RET(ff_vk_compile_shader(vkctx, shd, "main"));
121  RET(ff_vk_init_pipeline_layout(vkctx, s->pl));
122  RET(ff_vk_init_compute_pipeline(vkctx, s->pl));
123  }
124 
125  RET(ff_vk_create_exec_ctx(vkctx, &s->exec, &s->qf));
126  s->initialized = 1;
127 
128 fail:
129  return err;
130 }
131 
133 {
134  FlipVulkanContext *s = avctx->priv;
135  ff_vk_uninit(&s->vkctx);
136 
137  s->initialized = 0;
138 }
139 
140 static int process_frames(AVFilterContext *avctx, AVFrame *outframe, AVFrame *inframe)
141 {
142  int err = 0;
143  VkCommandBuffer cmd_buf;
144  FlipVulkanContext *s = avctx->priv;
145  FFVulkanContext *vkctx = &s->vkctx;
146  FFVulkanFunctions *vk = &s->vkctx.vkfn;
147  AVVkFrame *in = (AVVkFrame *)inframe->data[0];
148  AVVkFrame *out = (AVVkFrame *)outframe->data[0];
149  const int planes = av_pix_fmt_count_planes(s->vkctx.output_format);
150  const VkFormat *input_formats = av_vkfmt_from_pixfmt(s->vkctx.input_format);
151  const VkFormat *output_formats = av_vkfmt_from_pixfmt(s->vkctx.output_format);
152 
153  ff_vk_start_exec_recording(vkctx, s->exec);
154  cmd_buf = ff_vk_get_exec_buf(s->exec);
155 
156  for (int i = 0; i < planes; i++) {
157  RET(ff_vk_create_imageview(vkctx, s->exec,
158  &s->input_images[i].imageView, in->img[i],
159  input_formats[i],
161 
162  RET(ff_vk_create_imageview(vkctx, s->exec,
163  &s->output_images[i].imageView, out->img[i],
164  output_formats[i],
166 
167  s->input_images[i].imageLayout = VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL;
168  s->output_images[i].imageLayout = VK_IMAGE_LAYOUT_GENERAL;
169  }
170 
171  ff_vk_update_descriptor_set(vkctx, s->pl, 0);
172 
173  for (int i = 0; i < planes; i++) {
174  VkImageMemoryBarrier barriers[] = {
175  {
176  .sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER,
177  .srcAccessMask = 0,
178  .dstAccessMask = VK_ACCESS_SHADER_READ_BIT,
179  .oldLayout = in->layout[i],
180  .newLayout = s->input_images[i].imageLayout,
181  .srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED,
182  .dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED,
183  .image = in->img[i],
184  .subresourceRange.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT,
185  .subresourceRange.levelCount = 1,
186  .subresourceRange.layerCount = 1,
187  },
188  {
189  .sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER,
190  .srcAccessMask = 0,
191  .dstAccessMask = VK_ACCESS_SHADER_WRITE_BIT,
192  .oldLayout = out->layout[i],
193  .newLayout = s->output_images[i].imageLayout,
194  .srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED,
195  .dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED,
196  .image = out->img[i],
197  .subresourceRange.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT,
198  .subresourceRange.levelCount = 1,
199  .subresourceRange.layerCount = 1,
200  },
201  };
202 
203  vk->CmdPipelineBarrier(cmd_buf, VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT,
204  VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, 0,
205  0, NULL, 0, NULL, FF_ARRAY_ELEMS(barriers), barriers);
206 
207  in->layout[i] = barriers[0].newLayout;
208  in->access[i] = barriers[0].dstAccessMask;
209 
210  out->layout[i] = barriers[1].newLayout;
211  out->access[i] = barriers[1].dstAccessMask;
212  }
213 
214  ff_vk_bind_pipeline_exec(vkctx, s->exec, s->pl);
215  vk->CmdDispatch(cmd_buf, FFALIGN(s->vkctx.output_width, CGS)/CGS,
216  s->vkctx.output_height, 1);
217 
218  ff_vk_add_exec_dep(vkctx, s->exec, inframe, VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT);
219  ff_vk_add_exec_dep(vkctx, s->exec, outframe, VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT);
220 
221  err = ff_vk_submit_exec_queue(vkctx, s->exec);
222  if (err)
223  return err;
224 
225  ff_vk_qf_rotate(&s->qf);
226 
227  return 0;
228 fail:
229  ff_vk_discard_exec_deps(s->exec);
230  return err;
231 }
232 
234 {
235  int err;
236  AVFrame *out = NULL;
237  AVFilterContext *ctx = link->dst;
238  FlipVulkanContext *s = ctx->priv;
239  AVFilterLink *outlink = ctx->outputs[0];
240 
241  out = ff_get_video_buffer(outlink, outlink->w, outlink->h);
242  if (!out) {
243  err = AVERROR(ENOMEM);
244  goto fail;
245  }
246 
247  if (!s->initialized)
248  RET(init_filter(ctx, in, type));
249 
250  RET(process_frames(ctx, out, in));
251 
253 
254  av_frame_free(&in);
255 
256  return ff_filter_frame(outlink, out);
257 
258 fail:
259  av_frame_free(&in);
260  av_frame_free(&out);
261  return err;
262 }
263 
265 {
266  return filter_frame(link, in, FLIP_HORIZONTAL);
267 }
268 
270 {
271  return filter_frame(link, in, FLIP_VERTICAL);
272 }
273 
275 {
276  return filter_frame(link, in, FLIP_BOTH);
277 }
278 
280  {
281  .name = "default",
282  .type = AVMEDIA_TYPE_VIDEO,
283  .config_props = &ff_vk_filter_config_output,
284  }
285 };
286 
287 static const AVOption hflip_vulkan_options[] = {
288  { NULL },
289 };
290 
291 AVFILTER_DEFINE_CLASS(hflip_vulkan);
292 
294  {
295  .name = "default",
296  .type = AVMEDIA_TYPE_VIDEO,
297  .filter_frame = &hflip_vulkan_filter_frame,
298  .config_props = &ff_vk_filter_config_input,
299  }
300 };
301 
303  .name = "hflip_vulkan",
304  .description = NULL_IF_CONFIG_SMALL("Horizontally flip the input video in Vulkan"),
305  .priv_size = sizeof(FlipVulkanContext),
311  .priv_class = &hflip_vulkan_class,
312  .flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE,
313 };
314 
315 static const AVOption vflip_vulkan_options[] = {
316  { NULL },
317 };
318 
319 AVFILTER_DEFINE_CLASS(vflip_vulkan);
320 
322  {
323  .name = "default",
324  .type = AVMEDIA_TYPE_VIDEO,
325  .filter_frame = &vflip_vulkan_filter_frame,
326  .config_props = &ff_vk_filter_config_input,
327  }
328 };
329 
331  .name = "vflip_vulkan",
332  .description = NULL_IF_CONFIG_SMALL("Vertically flip the input video in Vulkan"),
333  .priv_size = sizeof(FlipVulkanContext),
339  .priv_class = &vflip_vulkan_class,
340  .flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE,
341 };
342 
343 static const AVOption flip_vulkan_options[] = {
344  { NULL },
345 };
346 
347 AVFILTER_DEFINE_CLASS(flip_vulkan);
348 
349 static const AVFilterPad flip_vulkan_inputs[] = {
350  {
351  .name = "default",
352  .type = AVMEDIA_TYPE_VIDEO,
353  .filter_frame = &flip_vulkan_filter_frame,
354  .config_props = &ff_vk_filter_config_input,
355  }
356 };
357 
359  .name = "flip_vulkan",
360  .description = NULL_IF_CONFIG_SMALL("Flip both horizontally and vertically"),
361  .priv_size = sizeof(FlipVulkanContext),
367  .priv_class = &flip_vulkan_class,
368  .flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE,
369 };
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:98
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_comp_identity_map
const VkComponentMapping ff_comp_identity_map
Definition: vulkan.c:51
out
FILE * out
Definition: movenc.c:54
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:371
ff_filter_frame
int ff_filter_frame(AVFilterLink *link, AVFrame *frame)
Send a frame of data to the next filter.
Definition: avfilter.c:1018
ff_vk_bind_pipeline_exec
void ff_vk_bind_pipeline_exec(FFVulkanContext *s, FFVkExecContext *e, FFVulkanPipeline *pl)
Add a command to bind the completed pipeline and its descriptor sets.
Definition: vulkan.c:1263
flip_vulkan_filter_frame
static int flip_vulkan_filter_frame(AVFilterLink *link, AVFrame *in)
Definition: vf_flip_vulkan.c:274
av_frame_free
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
Definition: frame.c:109
AVFrame
This structure describes decoded (raw) audio or video data.
Definition: frame.h:317
FFVulkanDescriptorSetBinding::stages
VkShaderStageFlags stages
Definition: vulkan.h:86
ff_vk_filter_init
int ff_vk_filter_init(AVFilterContext *avctx)
General lavfi IO functions.
Definition: vulkan_filter.c:184
AVOption
AVOption.
Definition: opt.h:247
ff_vk_compile_shader
int ff_vk_compile_shader(FFVulkanContext *s, FFVkSPIRVShader *shd, const char *entrypoint)
Compiles the shader, entrypoint must be set to "main".
Definition: vulkan.c:848
ff_vk_uninit
void ff_vk_uninit(FFVulkanContext *s)
Frees the main Vulkan context.
Definition: vulkan.c:1378
AVFilter::name
const char * name
Filter name.
Definition: avfilter.h:169
AV_PIX_FMT_VULKAN
@ AV_PIX_FMT_VULKAN
Vulkan hardware images.
Definition: pixfmt.h:346
AVFrame::data
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
Definition: frame.h:338
ff_vk_add_exec_dep
int ff_vk_add_exec_dep(FFVulkanContext *s, FFVkExecContext *e, AVFrame *frame, VkPipelineStageFlagBits in_wait_dst_flag)
Adds a frame as a queue dependency.
Definition: vulkan.c:509
init
static int init
Definition: av_tx.c:47
ff_vk_get_exec_buf
VkCommandBuffer ff_vk_get_exec_buf(FFVkExecContext *e)
Gets the command buffer to use for this submission from the exe context.
Definition: vulkan.c:504
ff_vf_vflip_vulkan
const AVFilter ff_vf_vflip_vulkan
Definition: vf_flip_vulkan.c:330
av_pix_fmt_count_planes
int av_pix_fmt_count_planes(enum AVPixelFormat pix_fmt)
Definition: pixdesc.c:2700
FlipType
FlipType
Definition: vf_flip_vulkan.c:27
vflip_vulkan_options
static const AVOption vflip_vulkan_options[]
Definition: vf_flip_vulkan.c:315
AVVkFrame::img
VkImage img[AV_NUM_DATA_POINTERS]
Vulkan images to which the memory is bound to.
Definition: hwcontext_vulkan.h:217
AVFilterContext::priv
void * priv
private data for use by the filter
Definition: avfilter.h:417
fail
#define fail()
Definition: checkasm.h:128
vulkan_filter.h
type
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf type
Definition: writing_filters.txt:86
AVFilterPad
A filter pad used for either input or output.
Definition: internal.h:50
ff_vk_qf_init
void ff_vk_qf_init(FFVulkanContext *s, FFVkQueueFamilyCtx *qf, VkQueueFlagBits dev_family, int nb_queues)
Initialize a queue family with a specific number of queues.
Definition: vulkan.c:96
FF_ARRAY_ELEMS
#define FF_ARRAY_ELEMS(a)
Definition: sinewin_tablegen.c:29
av_cold
#define av_cold
Definition: attributes.h:90
ff_vk_create_imageview
int ff_vk_create_imageview(FFVulkanContext *s, FFVkExecContext *e, VkImageView *v, VkImage img, VkFormat fmt, const VkComponentMapping map)
Create an imageview.
Definition: vulkan.c:742
ff_vf_hflip_vulkan
const AVFilter ff_vf_hflip_vulkan
Definition: vf_flip_vulkan.c:302
s
#define s(width, name)
Definition: cbs_vp9.c:257
FlipVulkanContext::initialized
int initialized
Definition: vf_flip_vulkan.c:42
vflip_vulkan_inputs
static const AVFilterPad vflip_vulkan_inputs[]
Definition: vf_flip_vulkan.c:321
ff_vk_init_shader
FFVkSPIRVShader * ff_vk_init_shader(FFVulkanPipeline *pl, const char *name, VkShaderStageFlags stage)
Inits a shader for a specific pipeline.
Definition: vulkan.c:795
ctx
AVFormatContext * ctx
Definition: movenc.c:48
FlipVulkanContext::input_images
VkDescriptorImageInfo input_images[3]
Definition: vf_flip_vulkan.c:39
hflip_vulkan_inputs
static const AVFilterPad hflip_vulkan_inputs[]
Definition: vf_flip_vulkan.c:293
FILTER_INPUTS
#define FILTER_INPUTS(array)
Definition: internal.h:191
link
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 link
Definition: filter_design.txt:23
ff_vk_update_descriptor_set
void ff_vk_update_descriptor_set(FFVulkanContext *s, FFVulkanPipeline *pl, int set_id)
Updates a descriptor set via the updaters defined.
Definition: vulkan.c:1079
ff_vk_start_exec_recording
int ff_vk_start_exec_recording(FFVulkanContext *s, FFVkExecContext *e)
Begin recording to the command buffer.
Definition: vulkan.c:463
av_vkfmt_from_pixfmt
const VkFormat * av_vkfmt_from_pixfmt(enum AVPixelFormat p)
Returns the format of each image up to the number of planes for a given sw_format.
Definition: hwcontext_vulkan.c:238
main
int main(int argc, char *argv[])
Definition: avio_list_dir.c:112
NULL
#define NULL
Definition: coverity.c:32
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:537
init_filter
static av_cold int init_filter(AVFilterContext *ctx, AVFrame *in, enum FlipType type)
Definition: vf_flip_vulkan.c:45
ff_vk_create_exec_ctx
int ff_vk_create_exec_ctx(FFVulkanContext *s, FFVkExecContext **ctx, FFVkQueueFamilyCtx *qf)
Init an execution context for command recording and queue submission.
Definition: vulkan.c:385
FLIP_VERTICAL
@ FLIP_VERTICAL
Definition: vf_flip_vulkan.c:28
ff_vk_filter_config_output
int ff_vk_filter_config_output(AVFilterLink *outlink)
Definition: vulkan_filter.c:133
filter_frame
static int filter_frame(AVFilterLink *link, AVFrame *in, enum FlipType type)
Definition: vf_flip_vulkan.c:233
ff_vk_qf_rotate
void ff_vk_qf_rotate(FFVkQueueFamilyCtx *qf)
Rotate through the queues in a queue family.
Definition: vulkan.c:132
FlipVulkanContext::output_images
VkDescriptorImageInfo output_images[3]
Definition: vf_flip_vulkan.c:40
FFVulkanContext
Definition: vulkan.h:188
FFVulkanPipeline
Definition: vulkan.h:104
FlipVulkanContext::qf
FFVkQueueFamilyCtx qf
Definition: vf_flip_vulkan.c:35
ff_vk_discard_exec_deps
void ff_vk_discard_exec_deps(FFVkExecContext *e)
Discards all queue dependencies.
Definition: vulkan.c:447
AVFILTER_DEFINE_CLASS
AVFILTER_DEFINE_CLASS(hflip_vulkan)
AVVkFrame::access
VkAccessFlagBits access[AV_NUM_DATA_POINTERS]
Updated after every barrier.
Definition: hwcontext_vulkan.h:240
FFVulkanDescriptorSetBinding
Definition: vulkan.h:78
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:117
AVVkFrame
Definition: hwcontext_vulkan.h:213
FLIP_BOTH
@ FLIP_BOTH
Definition: vf_flip_vulkan.c:30
flip_vulkan_inputs
static const AVFilterPad flip_vulkan_inputs[]
Definition: vf_flip_vulkan.c:349
ff_vk_init_pipeline_layout
int ff_vk_init_pipeline_layout(FFVulkanContext *s, FFVulkanPipeline *pl)
Initializes the pipeline layout after all shaders and descriptor sets have been finished.
Definition: vulkan.c:1115
size
int size
Definition: twinvq_data.h:10344
process_frames
static int process_frames(AVFilterContext *avctx, AVFrame *outframe, AVFrame *inframe)
Definition: vf_flip_vulkan.c:140
FFVkQueueFamilyCtx
Definition: vulkan.h:97
FLIP_HORIZONTAL
@ FLIP_HORIZONTAL
Definition: vf_flip_vulkan.c:29
ff_vk_submit_exec_queue
int ff_vk_submit_exec_queue(FFVulkanContext *s, FFVkExecContext *e)
Submits a command buffer to the queue for execution.
Definition: vulkan.c:590
AVERROR_EXTERNAL
#define AVERROR_EXTERNAL
Generic error in an external library.
Definition: error.h:59
FFVkExecContext
Definition: vulkan.h:154
FFVulkanDescriptorSetBinding::name
const char * name
Definition: vulkan.h:79
hflip_vulkan_filter_frame
static int hflip_vulkan_filter_frame(AVFilterLink *link, AVFrame *in)
Definition: vf_flip_vulkan.c:264
internal.h
flip_vulkan_uninit
static av_cold void flip_vulkan_uninit(AVFilterContext *avctx)
Definition: vf_flip_vulkan.c:132
FILTER_SINGLE_PIXFMT
#define FILTER_SINGLE_PIXFMT(pix_fmt_)
Definition: internal.h:181
vflip_vulkan_filter_frame
static int vflip_vulkan_filter_frame(AVFilterLink *link, AVFrame *in)
Definition: vf_flip_vulkan.c:269
ff_vk_init_compute_pipeline
int ff_vk_init_compute_pipeline(FFVulkanContext *s, FFVulkanPipeline *pl)
Initializes a compute pipeline.
Definition: vulkan.c:1228
i
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:271
FlipVulkanContext::vkctx
FFVulkanContext vkctx
Definition: vf_flip_vulkan.c:34
hflip_vulkan_options
static const AVOption hflip_vulkan_options[]
Definition: vf_flip_vulkan.c:287
ff_vk_shader_rep_fmt
const char * ff_vk_shader_rep_fmt(enum AVPixelFormat pixfmt)
Gets the glsl format string for a pixel format.
Definition: vulkan.c:721
ff_vf_flip_vulkan
const AVFilter ff_vf_flip_vulkan
Definition: vf_flip_vulkan.c:358
AVFilterPad::name
const char * name
Pad name.
Definition: internal.h:56
GLSLF
#define GLSLF(N, S,...)
Definition: vulkan.h:46
ff_vk_create_pipeline
FFVulkanPipeline * ff_vk_create_pipeline(FFVulkanContext *s, FFVkQueueFamilyCtx *qf)
Inits a pipeline.
Definition: vulkan.c:1219
flip_vulkan_outputs
static const AVFilterPad flip_vulkan_outputs[]
Definition: vf_flip_vulkan.c:279
AVFilter
Filter definition.
Definition: avfilter.h:165
pos
unsigned int pos
Definition: spdifenc.c:412
FlipVulkanContext::pl
FFVulkanPipeline * pl
Definition: vf_flip_vulkan.c:37
ff_vk_add_descriptor_set
int ff_vk_add_descriptor_set(FFVulkanContext *s, FFVulkanPipeline *pl, FFVkSPIRVShader *shd, FFVulkanDescriptorSetBinding *desc, int num, int only_print_to_shader)
Adds a descriptor set to the shader and registers them in the pipeline.
Definition: vulkan.c:922
random_seed.h
FFVkSPIRVShader
Definition: vulkan.h:58
FFVulkanDescriptorSetBinding::sampler
FFVkSampler * sampler
Definition: vulkan.h:87
ff_vk_init_sampler
FFVkSampler * ff_vk_init_sampler(FFVulkanContext *s, int unnorm_coords, VkFilter filt)
Create a Vulkan sampler, will be auto-freed in ff_vk_filter_uninit()
Definition: vulkan.c:670
AVFilterContext
An instance of a filter.
Definition: avfilter.h:402
planes
static const struct @322 planes[]
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:52
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:201
AVVkFrame::layout
VkImageLayout layout[AV_NUM_DATA_POINTERS]
Definition: hwcontext_vulkan.h:241
FlipVulkanContext
Definition: vf_flip_vulkan.c:33
FFALIGN
#define FFALIGN(x, a)
Definition: macros.h:78
FILTER_OUTPUTS
#define FILTER_OUTPUTS(array)
Definition: internal.h:192
ff_vk_set_compute_shader_sizes
void ff_vk_set_compute_shader_sizes(FFVkSPIRVShader *shd, int local_size[3])
Writes the workgroup size for a shader.
Definition: vulkan.c:816
uninit
static av_cold int uninit(AVCodecContext *avctx)
Definition: crystalhd.c:282
RET
#define RET(x)
Definition: vulkan.h:52
FFVulkanFunctions
Definition: vulkan_functions.h:175
FlipVulkanContext::exec
FFVkExecContext * exec
Definition: vf_flip_vulkan.c:36
CGS
#define CGS
Definition: vf_flip_vulkan.c:25
flip_vulkan_options
static const AVOption flip_vulkan_options[]
Definition: vf_flip_vulkan.c:343