FFmpeg
vf_transpose_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 #include "transpose.h"
25 
26 #define CGS 32
27 
28 typedef struct TransposeVulkanContext {
33 
34  VkDescriptorImageInfo input_images[3];
35  VkDescriptorImageInfo output_images[3];
36 
37  int dir;
41 
43 {
44  int err = 0;
45  FFVkSPIRVShader *shd;
46  TransposeVulkanContext *s = ctx->priv;
47  FFVulkanContext *vkctx = &s->vkctx;
48  const int planes = av_pix_fmt_count_planes(s->vkctx.output_format);
49 
50  FFVulkanDescriptorSetBinding image_descs[] = {
51  {
52  .name = "input_images",
53  .type = VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER,
54  .dimensions = 2,
55  .elems = planes,
56  .stages = VK_SHADER_STAGE_COMPUTE_BIT,
57  .updater = s->input_images,
58  },
59  {
60  .name = "output_images",
61  .type = VK_DESCRIPTOR_TYPE_STORAGE_IMAGE,
62  .mem_layout = ff_vk_shader_rep_fmt(s->vkctx.output_format),
63  .mem_quali = "writeonly",
64  .dimensions = 2,
65  .elems = planes,
66  .stages = VK_SHADER_STAGE_COMPUTE_BIT,
67  .updater = s->output_images,
68  },
69  };
70 
71  image_descs[0].sampler = ff_vk_init_sampler(vkctx, 1, VK_FILTER_LINEAR);
72  if (!image_descs[0].sampler)
73  return AVERROR_EXTERNAL;
74 
75  ff_vk_qf_init(vkctx, &s->qf, VK_QUEUE_COMPUTE_BIT, 0);
76 
77  {
78  s->pl = ff_vk_create_pipeline(vkctx, &s->qf);
79  if (!s->pl)
80  return AVERROR(ENOMEM);
81 
82  shd = ff_vk_init_shader(s->pl, "transpose_compute", image_descs[0].stages);
83  if (!shd)
84  return AVERROR(ENOMEM);
85 
86  ff_vk_set_compute_shader_sizes(shd, (int [3]){ CGS, 1, 1 });
87  RET(ff_vk_add_descriptor_set(vkctx, s->pl, shd, image_descs, FF_ARRAY_ELEMS(image_descs), 0));
88 
89  GLSLC(0, void main() );
90  GLSLC(0, { );
91  GLSLC(1, ivec2 size; );
92  GLSLC(1, ivec2 pos = ivec2(gl_GlobalInvocationID.xy); );
93  for (int i = 0; i < planes; i++) {
94  GLSLC(0, );
95  GLSLF(1, size = imageSize(output_images[%i]); ,i);
96  GLSLC(1, if (IS_WITHIN(pos, size)) { );
97  if (s->dir == TRANSPOSE_CCLOCK)
98  GLSLF(2, vec4 res = texture(input_images[%i], ivec2(size.y - pos.y, pos.x)); ,i);
99  else if (s->dir == TRANSPOSE_CLOCK_FLIP || s->dir == TRANSPOSE_CLOCK) {
100  GLSLF(2, vec4 res = texture(input_images[%i], ivec2(size.yx - pos.yx)); ,i);
101  if (s->dir == TRANSPOSE_CLOCK)
102  GLSLC(2, pos = ivec2(pos.x, size.y - pos.y); );
103  } else
104  GLSLF(2, vec4 res = texture(input_images[%i], pos.yx); ,i);
105  GLSLF(2, imageStore(output_images[%i], pos, res); ,i);
106  GLSLC(1, } );
107  }
108  GLSLC(0, } );
109 
110  RET(ff_vk_compile_shader(vkctx, shd, "main"));
111  RET(ff_vk_init_pipeline_layout(vkctx, s->pl));
112  RET(ff_vk_init_compute_pipeline(vkctx, s->pl));
113  }
114 
115  RET(ff_vk_create_exec_ctx(vkctx, &s->exec, &s->qf));
116  s->initialized = 1;
117 
118 fail:
119  return err;
120 }
121 
122 static int process_frames(AVFilterContext *avctx, AVFrame *outframe, AVFrame *inframe)
123 {
124  int err = 0;
125  VkCommandBuffer cmd_buf;
126  TransposeVulkanContext *s = avctx->priv;
127  FFVulkanContext *vkctx = &s->vkctx;
128  FFVulkanFunctions *vk = &s->vkctx.vkfn;
129  const int planes = av_pix_fmt_count_planes(s->vkctx.output_format);
130 
131  AVVkFrame *in = (AVVkFrame *)inframe->data[0];
132  AVVkFrame *out = (AVVkFrame *)outframe->data[0];
133 
134  const VkFormat *input_formats = av_vkfmt_from_pixfmt(s->vkctx.input_format);
135  const VkFormat *output_formats = av_vkfmt_from_pixfmt(s->vkctx.output_format);
136 
137  ff_vk_start_exec_recording(vkctx, s->exec);
138  cmd_buf = ff_vk_get_exec_buf(s->exec);
139 
140  for (int i = 0; i < planes; i++) {
141  RET(ff_vk_create_imageview(vkctx, s->exec,
142  &s->input_images[i].imageView, in->img[i],
143  input_formats[i],
145 
146  RET(ff_vk_create_imageview(vkctx, s->exec,
147  &s->output_images[i].imageView, out->img[i],
148  output_formats[i],
150 
151  s->input_images[i].imageLayout = VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL;
152  s->output_images[i].imageLayout = VK_IMAGE_LAYOUT_GENERAL;
153  }
154 
155  ff_vk_update_descriptor_set(vkctx, s->pl, 0);
156 
157  for (int i = 0; i < planes; i++) {
158  VkImageMemoryBarrier barriers[] = {
159  {
160  .sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER,
161  .srcAccessMask = 0,
162  .dstAccessMask = VK_ACCESS_SHADER_READ_BIT,
163  .oldLayout = in->layout[i],
164  .newLayout = s->input_images[i].imageLayout,
165  .srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED,
166  .dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED,
167  .image = in->img[i],
168  .subresourceRange.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT,
169  .subresourceRange.levelCount = 1,
170  .subresourceRange.layerCount = 1,
171  },
172  {
173  .sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER,
174  .srcAccessMask = 0,
175  .dstAccessMask = VK_ACCESS_SHADER_WRITE_BIT,
176  .oldLayout = out->layout[i],
177  .newLayout = s->output_images[i].imageLayout,
178  .srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED,
179  .dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED,
180  .image = out->img[i],
181  .subresourceRange.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT,
182  .subresourceRange.levelCount = 1,
183  .subresourceRange.layerCount = 1,
184  },
185  };
186 
187  vk->CmdPipelineBarrier(cmd_buf, VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT,
188  VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, 0,
189  0, NULL, 0, NULL, FF_ARRAY_ELEMS(barriers), barriers);
190 
191  in->layout[i] = barriers[0].newLayout;
192  in->access[i] = barriers[0].dstAccessMask;
193 
194  out->layout[i] = barriers[1].newLayout;
195  out->access[i] = barriers[1].dstAccessMask;
196  }
197 
198  ff_vk_bind_pipeline_exec(vkctx, s->exec, s->pl);
199  vk->CmdDispatch(cmd_buf, FFALIGN(s->vkctx.output_width, CGS)/CGS,
200  s->vkctx.output_height, 1);
201 
202  ff_vk_add_exec_dep(vkctx, s->exec, inframe, VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT);
203  ff_vk_add_exec_dep(vkctx, s->exec, outframe, VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT);
204 
205  err = ff_vk_submit_exec_queue(vkctx, s->exec);
206  if (err)
207  return err;
208 
209  ff_vk_qf_rotate(&s->qf);
210 
211  return 0;
212 
213 fail:
214  ff_vk_discard_exec_deps(s->exec);
215  return err;
216 }
217 
219 {
220  int err;
221  AVFrame *out = NULL;
222  AVFilterContext *ctx = inlink->dst;
223  TransposeVulkanContext *s = ctx->priv;
224  AVFilterLink *outlink = ctx->outputs[0];
225 
226  if (s->passthrough)
227  return ff_filter_frame(outlink, in);
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  if (!s->initialized)
236  RET(init_filter(ctx, in));
237 
238  RET(process_frames(ctx, out, in));
239 
241 
242  if (in->sample_aspect_ratio.num)
243  out->sample_aspect_ratio = in->sample_aspect_ratio;
244  else {
245  out->sample_aspect_ratio.num = in->sample_aspect_ratio.den;
246  out->sample_aspect_ratio.den = in->sample_aspect_ratio.num;
247  }
248 
249  av_frame_free(&in);
250 
251  return ff_filter_frame(outlink, out);
252 
253 fail:
254  av_frame_free(&in);
255  av_frame_free(&out);
256  return err;
257 }
258 
260 {
261  TransposeVulkanContext *s = avctx->priv;
262  ff_vk_uninit(&s->vkctx);
263 
264  s->initialized = 0;
265 }
266 
267 static int config_props_output(AVFilterLink *outlink)
268 {
269  AVFilterContext *avctx = outlink->src;
270  TransposeVulkanContext *s = avctx->priv;
271  FFVulkanContext *vkctx = &s->vkctx;
272  AVFilterLink *inlink = avctx->inputs[0];
273 
274  if ((inlink->w >= inlink->h && s->passthrough == TRANSPOSE_PT_TYPE_LANDSCAPE) ||
275  (inlink->w <= inlink->h && s->passthrough == TRANSPOSE_PT_TYPE_PORTRAIT)) {
276  av_log(avctx, AV_LOG_VERBOSE,
277  "w:%d h:%d -> w:%d h:%d (passthrough mode)\n",
278  inlink->w, inlink->h, inlink->w, inlink->h);
279  outlink->hw_frames_ctx = av_buffer_ref(inlink->hw_frames_ctx);
280  return outlink->hw_frames_ctx ? 0 : AVERROR(ENOMEM);
281  } else {
282  s->passthrough = TRANSPOSE_PT_TYPE_NONE;
283  }
284 
285  vkctx->output_width = inlink->h;
286  vkctx->output_height = inlink->w;
287 
288  if (inlink->sample_aspect_ratio.num)
289  outlink->sample_aspect_ratio = av_div_q((AVRational) { 1, 1 },
290  inlink->sample_aspect_ratio);
291  else
292  outlink->sample_aspect_ratio = inlink->sample_aspect_ratio;
293 
294  return ff_vk_filter_config_output(outlink);
295 }
296 
297 #define OFFSET(x) offsetof(TransposeVulkanContext, x)
298 #define FLAGS (AV_OPT_FLAG_FILTERING_PARAM | AV_OPT_FLAG_VIDEO_PARAM)
299 
301  { "dir", "set transpose direction", OFFSET(dir), AV_OPT_TYPE_INT, { .i64 = TRANSPOSE_CCLOCK_FLIP }, 0, 7, FLAGS, "dir" },
302  { "cclock_flip", "rotate counter-clockwise with vertical flip", 0, AV_OPT_TYPE_CONST, { .i64 = TRANSPOSE_CCLOCK_FLIP }, .flags=FLAGS, .unit = "dir" },
303  { "clock", "rotate clockwise", 0, AV_OPT_TYPE_CONST, { .i64 = TRANSPOSE_CLOCK }, .flags=FLAGS, .unit = "dir" },
304  { "cclock", "rotate counter-clockwise", 0, AV_OPT_TYPE_CONST, { .i64 = TRANSPOSE_CCLOCK }, .flags=FLAGS, .unit = "dir" },
305  { "clock_flip", "rotate clockwise with vertical flip", 0, AV_OPT_TYPE_CONST, { .i64 = TRANSPOSE_CLOCK_FLIP }, .flags=FLAGS, .unit = "dir" },
306 
307  { "passthrough", "do not apply transposition if the input matches the specified geometry",
308  OFFSET(passthrough), AV_OPT_TYPE_INT, {.i64=TRANSPOSE_PT_TYPE_NONE}, 0, INT_MAX, FLAGS, "passthrough" },
309  { "none", "always apply transposition", 0, AV_OPT_TYPE_CONST, {.i64=TRANSPOSE_PT_TYPE_NONE}, INT_MIN, INT_MAX, FLAGS, "passthrough" },
310  { "portrait", "preserve portrait geometry", 0, AV_OPT_TYPE_CONST, {.i64=TRANSPOSE_PT_TYPE_PORTRAIT}, INT_MIN, INT_MAX, FLAGS, "passthrough" },
311  { "landscape", "preserve landscape geometry", 0, AV_OPT_TYPE_CONST, {.i64=TRANSPOSE_PT_TYPE_LANDSCAPE}, INT_MIN, INT_MAX, FLAGS, "passthrough" },
312 
313  { NULL }
314 };
315 
316 AVFILTER_DEFINE_CLASS(transpose_vulkan);
317 
319  {
320  .name = "default",
321  .type = AVMEDIA_TYPE_VIDEO,
322  .filter_frame = &filter_frame,
323  .config_props = &ff_vk_filter_config_input,
324  }
325 };
326 
328  {
329  .name = "default",
330  .type = AVMEDIA_TYPE_VIDEO,
331  .config_props = &config_props_output,
332  }
333 };
334 
336  .name = "transpose_vulkan",
337  .description = NULL_IF_CONFIG_SMALL("Transpose Vulkan Filter"),
338  .priv_size = sizeof(TransposeVulkanContext),
344  .priv_class = &transpose_vulkan_class,
345  .flags_internal = FF_FILTER_FLAG_HWFRAME_AWARE,
346 };
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
FFVulkanContext::output_height
int output_height
Definition: vulkan.h:208
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
av_div_q
AVRational av_div_q(AVRational b, AVRational c)
Divide one rational by another.
Definition: rational.c:88
transpose_vulkan_uninit
static av_cold void transpose_vulkan_uninit(AVFilterContext *avctx)
Definition: vf_transpose_vulkan.c:259
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
inlink
The exact code depends on how similar the blocks are and how related they are to the and needs to apply these operations to the correct inlink or outlink if there are several Macros are available to factor that when no extra processing is inlink
Definition: filter_design.txt:212
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
TransposeVulkanContext::vkctx
FFVulkanContext vkctx
Definition: vf_transpose_vulkan.c:29
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
AV_LOG_VERBOSE
#define AV_LOG_VERBOSE
Detailed information.
Definition: log.h:196
TRANSPOSE_CLOCK_FLIP
@ TRANSPOSE_CLOCK_FLIP
Definition: transpose.h:34
ff_vk_uninit
void ff_vk_uninit(FFVulkanContext *s)
Frees the main Vulkan context.
Definition: vulkan.c:1378
av_buffer_ref
AVBufferRef * av_buffer_ref(const AVBufferRef *buf)
Create a new reference to an AVBuffer.
Definition: buffer.c:103
TransposeVulkanContext::initialized
int initialized
Definition: vf_transpose_vulkan.c:39
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
TRANSPOSE_CCLOCK
@ TRANSPOSE_CCLOCK
Definition: transpose.h:33
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
av_pix_fmt_count_planes
int av_pix_fmt_count_planes(enum AVPixelFormat pix_fmt)
Definition: pixdesc.c:2700
transpose_vulkan_outputs
static const AVFilterPad transpose_vulkan_outputs[]
Definition: vf_transpose_vulkan.c:327
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:127
vulkan_filter.h
filter_frame
static int filter_frame(AVFilterLink *inlink, AVFrame *in)
Definition: vf_transpose_vulkan.c:218
OFFSET
#define OFFSET(x)
Definition: vf_transpose_vulkan.c:297
TransposeVulkanContext
Definition: vf_transpose_vulkan.c:28
TransposeVulkanContext::output_images
VkDescriptorImageInfo output_images[3]
Definition: vf_transpose_vulkan.c:35
AVRational::num
int num
Numerator.
Definition: rational.h:59
AVFilterPad
A filter pad used for either input or output.
Definition: internal.h:50
process_frames
static int process_frames(AVFilterContext *avctx, AVFrame *outframe, AVFrame *inframe)
Definition: vf_transpose_vulkan.c:122
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
FFVulkanContext::output_width
int output_width
Definition: vulkan.h:207
s
#define s(width, name)
Definition: cbs_vp9.c:257
TransposeVulkanContext::dir
int dir
Definition: vf_transpose_vulkan.c:37
TransposeVulkanContext::qf
FFVkQueueFamilyCtx qf
Definition: vf_transpose_vulkan.c:30
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
FILTER_INPUTS
#define FILTER_INPUTS(array)
Definition: internal.h:191
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
planes
static const struct @321 planes[]
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
AVRational
Rational number (pair of numerator and denominator).
Definition: rational.h:58
transpose_vulkan_options
static const AVOption transpose_vulkan_options[]
Definition: vf_transpose_vulkan.c:300
AVFilterContext::inputs
AVFilterLink ** inputs
array of pointers to input links
Definition: avfilter.h:410
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
ff_vk_filter_config_output
int ff_vk_filter_config_output(AVFilterLink *outlink)
Definition: vulkan_filter.c:133
ff_vk_qf_rotate
void ff_vk_qf_rotate(FFVkQueueFamilyCtx *qf)
Rotate through the queues in a queue family.
Definition: vulkan.c:132
FFVulkanContext
Definition: vulkan.h:188
ff_vf_transpose_vulkan
const AVFilter ff_vf_transpose_vulkan
Definition: vf_transpose_vulkan.c:335
FFVulkanPipeline
Definition: vulkan.h:104
ff_vk_discard_exec_deps
void ff_vk_discard_exec_deps(FFVkExecContext *e)
Discards all queue dependencies.
Definition: vulkan.c:447
config_props_output
static int config_props_output(AVFilterLink *outlink)
Definition: vf_transpose_vulkan.c:267
TRANSPOSE_PT_TYPE_PORTRAIT
@ TRANSPOSE_PT_TYPE_PORTRAIT
Definition: transpose.h:27
AVFILTER_DEFINE_CLASS
AVFILTER_DEFINE_CLASS(transpose_vulkan)
AVVkFrame::access
VkAccessFlagBits access[AV_NUM_DATA_POINTERS]
Updated after every barrier.
Definition: hwcontext_vulkan.h:240
TransposeVulkanContext::input_images
VkDescriptorImageInfo input_images[3]
Definition: vf_transpose_vulkan.c:34
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
TRANSPOSE_PT_TYPE_NONE
@ TRANSPOSE_PT_TYPE_NONE
Definition: transpose.h:25
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
FFVkQueueFamilyCtx
Definition: vulkan.h:97
TransposeVulkanContext::exec
FFVkExecContext * exec
Definition: vf_transpose_vulkan.c:31
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
internal.h
FILTER_SINGLE_PIXFMT
#define FILTER_SINGLE_PIXFMT(pix_fmt_)
Definition: internal.h:181
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
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
TRANSPOSE_CLOCK
@ TRANSPOSE_CLOCK
Definition: transpose.h:32
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
transpose_vulkan_inputs
static const AVFilterPad transpose_vulkan_inputs[]
Definition: vf_transpose_vulkan.c:318
AVFilter
Filter definition.
Definition: avfilter.h:165
pos
unsigned int pos
Definition: spdifenc.c:412
TransposeVulkanContext::pl
FFVulkanPipeline * pl
Definition: vf_transpose_vulkan.c:32
AVFrame::sample_aspect_ratio
AVRational sample_aspect_ratio
Sample aspect ratio for the video frame, 0/1 if unknown/unspecified.
Definition: frame.h:419
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
TRANSPOSE_CCLOCK_FLIP
@ TRANSPOSE_CCLOCK_FLIP
Definition: transpose.h:31
TransposeVulkanContext::passthrough
int passthrough
Definition: vf_transpose_vulkan.c:38
random_seed.h
FFVkSPIRVShader
Definition: vulkan.h:58
AVRational::den
int den
Denominator.
Definition: rational.h:60
AV_OPT_TYPE_INT
@ AV_OPT_TYPE_INT
Definition: opt.h:224
init_filter
static av_cold int init_filter(AVFilterContext *ctx, AVFrame *in)
Definition: vf_transpose_vulkan.c:42
transpose.h
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
FLAGS
#define FLAGS
Definition: vf_transpose_vulkan.c:298
AVFilterContext
An instance of a filter.
Definition: avfilter.h:402
TRANSPOSE_PT_TYPE_LANDSCAPE
@ TRANSPOSE_PT_TYPE_LANDSCAPE
Definition: transpose.h:26
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
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
av_log
#define av_log(a,...)
Definition: tableprint_vlc.h:28
uninit
static av_cold int uninit(AVCodecContext *avctx)
Definition: crystalhd.c:282
AV_OPT_TYPE_CONST
@ AV_OPT_TYPE_CONST
Definition: opt.h:233
RET
#define RET(x)
Definition: vulkan.h:52
FFVulkanFunctions
Definition: vulkan_functions.h:175
CGS
#define CGS
Definition: vf_transpose_vulkan.c:26