FFmpeg
vulkan_dpx.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2025 Lynne <dev@lynne.ee>
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/attributes.h"
22 #include "vulkan_decode.h"
23 #include "hwaccel_internal.h"
24 
25 #include "dpx.h"
26 #include "libavutil/mem.h"
27 
28 extern const unsigned char ff_dpx_unpack_comp_spv_data[];
29 extern const unsigned int ff_dpx_unpack_comp_spv_len;
30 
31 extern const unsigned char ff_dpx_copy_comp_spv_data[];
32 extern const unsigned int ff_dpx_copy_comp_spv_len;
33 
36  .queue_flags = VK_QUEUE_COMPUTE_BIT,
37 };
38 
39 typedef struct DPXVulkanDecodePicture {
42 
43 typedef struct DPXVulkanDecodeContext {
47 
48 typedef struct DecodePushData {
50  int nb_comp;
51  int nb_images;
52  int stride;
55  int shift;
57 
59  const AVBufferRef *buffer_ref,
60  av_unused const uint8_t *buffer,
61  av_unused uint32_t size)
62 {
65  DPXDecContext *dpx = avctx->priv_data;
66 
68  FFVulkanDecodePicture *vp = &pp->vp;
69 
70  /* Host map the frame data if supported */
71  if (!vp->slices_buf &&
72  ctx->s.extensions & FF_VK_EXT_EXTERNAL_HOST_MEMORY)
73  ff_vk_host_map_buffer(&ctx->s, &vp->slices_buf, (uint8_t *)buffer,
74  buffer_ref,
75  VK_BUFFER_USAGE_STORAGE_BUFFER_BIT);
76 
77  return 0;
78 }
79 
81  const uint8_t *data,
82  uint32_t size)
83 {
84  DPXDecContext *dpx = avctx->priv_data;
85 
87  FFVulkanDecodePicture *vp = &pp->vp;
88 
89  if (!vp->slices_buf) {
90  int err = ff_vk_decode_add_slice(avctx, vp, data, size, 0,
91  NULL, NULL);
92  if (err < 0)
93  return err;
94  }
95 
96  return 0;
97 }
98 
99 static int vk_dpx_end_frame(AVCodecContext *avctx)
100 {
101  int err;
104  FFVulkanFunctions *vk = &ctx->s.vkfn;
105 
106  DPXDecContext *dpx = avctx->priv_data;
107  DPXVulkanDecodeContext *dxv = ctx->sd_ctx;
108 
110  FFVulkanDecodePicture *vp = &pp->vp;
111 
112  int unpack = (avctx->bits_per_raw_sample == 12 && !dpx->packing) ||
113  avctx->bits_per_raw_sample == 10;
114 
115  FFVkBuffer *slices_buf = (FFVkBuffer *)vp->slices_buf->data;
116 
117  VkImageMemoryBarrier2 img_bar[8];
118  int nb_img_bar = 0;
119 
120  FFVkExecContext *exec = ff_vk_exec_get(&ctx->s, &ctx->exec_pool);
121  ff_vk_exec_start(&ctx->s, exec);
122 
123  /* Prepare deps */
124  RET(ff_vk_exec_add_dep_frame(&ctx->s, exec, dpx->frame,
125  VK_PIPELINE_STAGE_2_ALL_COMMANDS_BIT,
126  VK_PIPELINE_STAGE_2_COMPUTE_SHADER_BIT));
127 
128  /* Exec-owned output views: freed on exec recycle, so releasing a picture
129  * needs no blocking wait. No mirror_sem: nothing consumes vp->sem here. */
130  VkImageView views[AV_NUM_DATA_POINTERS];
131  RET(ff_vk_create_imageviews(&ctx->s, exec, views, dpx->frame,
133 
134  RET(ff_vk_exec_add_dep_buf(&ctx->s, exec, &vp->slices_buf, 1, 0));
135  vp->slices_buf = NULL;
136 
137  AVVkFrame *vkf = (AVVkFrame *)dpx->frame->data[0];
138  for (int i = 0; i < 4; i++) {
139  vkf->layout[i] = VK_IMAGE_LAYOUT_UNDEFINED;
140  vkf->access[i] = VK_ACCESS_2_NONE;
141  }
142 
143  ff_vk_frame_barrier(&ctx->s, exec, dpx->frame, img_bar, &nb_img_bar,
144  VK_PIPELINE_STAGE_2_ALL_COMMANDS_BIT,
145  VK_PIPELINE_STAGE_2_COMPUTE_SHADER_BIT,
146  VK_ACCESS_2_SHADER_STORAGE_WRITE_BIT,
147  VK_IMAGE_LAYOUT_GENERAL,
148  VK_QUEUE_FAMILY_IGNORED);
149 
150  vk->CmdPipelineBarrier2(exec->buf, &(VkDependencyInfo) {
151  .sType = VK_STRUCTURE_TYPE_DEPENDENCY_INFO,
152  .pImageMemoryBarriers = img_bar,
153  .imageMemoryBarrierCount = nb_img_bar,
154  });
155  nb_img_bar = 0;
156 
157  FFVulkanShader *shd = &dxv->shader;
158  ff_vk_shader_update_img_array(&ctx->s, exec, shd,
159  dpx->frame, views,
160  0, 0,
161  VK_IMAGE_LAYOUT_GENERAL,
162  VK_NULL_HANDLE);
163  ff_vk_shader_update_desc_buffer(&ctx->s, exec, shd,
164  0, 1, 0,
165  slices_buf,
166  0, slices_buf->size,
167  VK_FORMAT_UNDEFINED);
168  if (!unpack) {
169  ff_vk_shader_update_desc_buffer(&ctx->s, exec, shd,
170  0, 2, 0,
171  slices_buf,
172  0, slices_buf->size,
173  VK_FORMAT_UNDEFINED);
174  ff_vk_shader_update_desc_buffer(&ctx->s, exec, shd,
175  0, 3, 0,
176  slices_buf,
177  0, slices_buf->size,
178  VK_FORMAT_UNDEFINED);
179  }
180 
181  ff_vk_exec_bind_shader(&ctx->s, exec, shd);
182 
183  /* Update push data */
186  .nb_comp = dpx->components,
187  .nb_images = ff_vk_count_images(vkf),
188  .stride = dpx->stride,
189  .need_align = dpx->need_align,
190  .padded_10bit = !dpx->unpadded_10bit,
191  .shift = FFALIGN(avctx->bits_per_raw_sample, 8) -
192  avctx->bits_per_raw_sample,
193  };
194 
195  ff_vk_shader_update_push_const(&ctx->s, exec, shd,
196  VK_SHADER_STAGE_COMPUTE_BIT,
197  0, sizeof(pd), &pd);
198 
199  vk->CmdDispatch(exec->buf,
200  FFALIGN(dpx->frame->width, shd->lg_size[0])/shd->lg_size[0],
201  FFALIGN(dpx->frame->height, shd->lg_size[1])/shd->lg_size[1],
202  1);
203 
204  err = ff_vk_exec_submit(&ctx->s, exec);
205  if (err < 0)
206  return err;
207 
208 fail:
209  return 0;
210 }
211 
213  FFVkExecPool *pool, FFVulkanShader *shd, int bits)
214 {
215  int err;
216  DPXDecContext *dpx = avctx->priv_data;
217  AVHWFramesContext *dec_frames_ctx;
218  dec_frames_ctx = (AVHWFramesContext *)avctx->hw_frames_ctx->data;
219 
220  int unpack = (avctx->bits_per_raw_sample == 12 && !dpx->packing) ||
221  avctx->bits_per_raw_sample == 10;
222 
223  SPEC_LIST_CREATE(sl, 2, 2*sizeof(uint32_t))
224  SPEC_LIST_ADD(sl, 0, 32, dpx->endian && bits > 8); /* big endian */
225  if (unpack)
226  SPEC_LIST_ADD(sl, 1, 32, bits == 10); /* packed_10bit */
227  else
228  SPEC_LIST_ADD(sl, 1, 32, FFALIGN(bits, 8)); /* type_bits */
229 
230  ff_vk_shader_load(shd, VK_SHADER_STAGE_COMPUTE_BIT, sl,
231  (uint32_t []) { 512, 1, 1 }, 0);
232 
234  VK_SHADER_STAGE_COMPUTE_BIT);
235 
236  const FFVulkanDescriptorSetBinding desc_set[] = {
237  { /* dst */
238  .type = VK_DESCRIPTOR_TYPE_STORAGE_IMAGE,
239  .stages = VK_SHADER_STAGE_COMPUTE_BIT,
240  .elems = av_pix_fmt_count_planes(dec_frames_ctx->sw_format),
241  },
242  { /* data_buf */
243  .type = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER,
244  .stages = VK_SHADER_STAGE_COMPUTE_BIT,
245  },
246  { /* data_buf16 */
247  .type = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER,
248  .stages = VK_SHADER_STAGE_COMPUTE_BIT,
249  },
250  { /* data_buf32 */
251  .type = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER,
252  .stages = VK_SHADER_STAGE_COMPUTE_BIT,
253  },
254  };
255  ff_vk_shader_add_descriptor_set(s, shd, desc_set, 2 + (2*!unpack), 0);
256 
257  const unsigned char *src = ff_dpx_copy_comp_spv_data;
258  size_t src_len = ff_dpx_copy_comp_spv_len;
259  if (unpack) {
261  src_len = ff_dpx_unpack_comp_spv_len;
262  }
263  RET(ff_vk_shader_link(s, shd, src, src_len, "main"));
264 
265  RET(ff_vk_shader_register_exec(s, pool, shd));
266 
267 fail:
268  return err;
269 }
270 
272 {
273  DPXVulkanDecodeContext *fv = ctx->sd_ctx;
274 
275  ff_vk_shader_free(&ctx->s, &fv->shader);
276 
278 
279  av_freep(&fv);
280 }
281 
283 {
284  int err;
285  DPXDecContext *dpx = avctx->priv_data;
287 
288  switch (dpx->pix_fmt) {
289  case AV_PIX_FMT_GRAY10:
290  case AV_PIX_FMT_GBRAP10:
291  case AV_PIX_FMT_UYVY422:
292  case AV_PIX_FMT_YUV444P:
293  case AV_PIX_FMT_YUVA444P:
294  return AVERROR(ENOTSUP);
295  case AV_PIX_FMT_GBRP10:
296  if (dpx->unpadded_10bit)
297  return AVERROR(ENOTSUP);
299  default:
300  break;
301  }
302 
303  err = ff_vk_decode_init(avctx);
304  if (err < 0)
305  return err;
306 
308  DPXVulkanDecodeContext *dxv = ctx->sd_ctx = av_mallocz(sizeof(*dxv));
309  if (!dxv)
310  return AVERROR(ENOMEM);
311 
312  ctx->sd_ctx_free = &vk_decode_dpx_uninit;
313 
314  RET(init_shader(avctx, &ctx->s, &ctx->exec_pool,
315  &dxv->shader, avctx->bits_per_raw_sample));
316 
317 fail:
318  return err;
319 }
320 
322 {
323  AVHWDeviceContext *dev_ctx = _hwctx.nc;
324 
326  FFVulkanDecodePicture *vp = &pp->vp;
327 
328  ff_vk_decode_free_frame(dev_ctx, vp);
329 }
330 
332  .p.name = "dpx_vulkan",
333  .p.type = AVMEDIA_TYPE_VIDEO,
334  .p.id = AV_CODEC_ID_DPX,
335  .p.pix_fmt = AV_PIX_FMT_VULKAN,
336  .start_frame = &vk_dpx_start_frame,
337  .decode_slice = &vk_dpx_decode_slice,
338  .end_frame = &vk_dpx_end_frame,
339  .free_frame_priv = &vk_dpx_free_frame_priv,
340  .frame_priv_data_size = sizeof(DPXVulkanDecodePicture),
344  .frame_params = &ff_vk_frame_params,
345  .priv_data_size = sizeof(FFVulkanDecodeContext),
347 };
AV_CODEC_ID_DPX
@ AV_CODEC_ID_DPX
Definition: codec_id.h:178
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
DPXVulkanDecodePicture::vp
FFVulkanDecodePicture vp
Definition: vulkan_dpx.c:40
ff_vk_shader_free
void ff_vk_shader_free(FFVulkanContext *s, FFVulkanShader *shd)
Free a shader.
Definition: vulkan.c:2680
DPXDecContext::packing
int packing
Definition: dpx.h:65
AVBufferPool
The buffer pool.
Definition: buffer_internal.h:88
AVBufferRef::data
uint8_t * data
The data buffer.
Definition: buffer.h:90
FFVulkanDecodeContext::shared_ctx
FFVulkanDecodeShared * shared_ctx
Definition: vulkan_decode.h:55
RET
#define RET(x)
Definition: vulkan.h:34
AVRefStructOpaque
RefStruct is an API for creating reference-counted objects with minimal overhead.
Definition: refstruct.h:58
DPXDecContext::hwaccel_picture_private
void * hwaccel_picture_private
Definition: dpx.h:62
AVRefStructOpaque::nc
void * nc
Definition: refstruct.h:59
dpx.h
FFHWAccel::p
AVHWAccel p
The public AVHWAccel.
Definition: hwaccel_internal.h:38
AVFrame::width
int width
Definition: frame.h:544
data
const char data[16]
Definition: mxf.c:149
FFVulkanDecodeDescriptor::codec_id
enum AVCodecID codec_id
Definition: vulkan_decode.h:30
ff_dpx_unpack_comp_spv_data
const unsigned char ff_dpx_unpack_comp_spv_data[]
ff_vk_exec_get
FFVkExecContext * ff_vk_exec_get(FFVulkanContext *s, FFVkExecPool *pool)
Retrieve an execution pool.
Definition: vulkan.c:568
FF_VK_REP_NATIVE
@ FF_VK_REP_NATIVE
Definition: vulkan.h:412
SPEC_LIST_ADD
#define SPEC_LIST_ADD(name, idx, val_bits, val)
Definition: vulkan.h:52
ff_vk_exec_bind_shader
void ff_vk_exec_bind_shader(FFVulkanContext *s, FFVkExecContext *e, const FFVulkanShader *shd)
Bind a shader.
Definition: vulkan.c:2657
FFVulkanDecodeContext
Definition: vulkan_decode.h:54
AV_PIX_FMT_VULKAN
@ AV_PIX_FMT_VULKAN
Vulkan hardware images.
Definition: pixfmt.h:379
ff_vk_exec_add_dep_frame
int ff_vk_exec_add_dep_frame(FFVulkanContext *s, FFVkExecContext *e, AVFrame *f, VkPipelineStageFlagBits2 wait_stage, VkPipelineStageFlagBits2 signal_stage)
Definition: vulkan.c:800
AVFrame::data
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
Definition: frame.h:493
av_pix_fmt_count_planes
int av_pix_fmt_count_planes(enum AVPixelFormat pix_fmt)
Definition: pixdesc.c:3496
vk_decode_dpx_uninit
static void vk_decode_dpx_uninit(FFVulkanDecodeShared *ctx)
Definition: vulkan_dpx.c:271
FFHWAccel
Definition: hwaccel_internal.h:34
AV_PIX_FMT_GBRP10
#define AV_PIX_FMT_GBRP10
Definition: pixfmt.h:558
DecodePushData::shift
int shift
Definition: vulkan_dpx.c:55
DPXDecContext::stride
int stride
Definition: dpx.h:66
ff_vk_shader_update_img_array
void ff_vk_shader_update_img_array(FFVulkanContext *s, FFVkExecContext *e, FFVulkanShader *shd, AVFrame *f, VkImageView *views, int set, int binding, VkImageLayout layout, VkSampler sampler)
Update a descriptor in a buffer with an image array.
Definition: vulkan.c:2608
ff_vk_frame_barrier
void ff_vk_frame_barrier(FFVulkanContext *s, FFVkExecContext *e, AVFrame *pic, VkImageMemoryBarrier2 *bar, int *nb_bar, VkPipelineStageFlags2 src_stage, VkPipelineStageFlags2 dst_stage, VkAccessFlagBits2 new_access, VkImageLayout new_layout, uint32_t new_qf)
Definition: vulkan.c:2093
HWACCEL_CAP_THREAD_SAFE
#define HWACCEL_CAP_THREAD_SAFE
Definition: hwaccel_internal.h:32
ff_vk_shader_register_exec
int ff_vk_shader_register_exec(FFVulkanContext *s, FFVkExecPool *pool, FFVulkanShader *shd)
Register a shader with an exec pool.
Definition: vulkan.c:2473
ff_vk_host_map_buffer
int ff_vk_host_map_buffer(FFVulkanContext *s, AVBufferRef **dst, uint8_t *src_data, const AVBufferRef *src_buf, VkBufferUsageFlags usage)
Maps a system RAM buffer into a Vulkan buffer.
Definition: vulkan.c:1411
DecodePushData::stride
int stride
Definition: vulkan_dpx.c:52
FFVulkanDecodeShared
Definition: vulkan_decode.h:38
DPXVulkanDecodeContext
Definition: vulkan_dpx.c:43
av_unused
#define av_unused
Definition: attributes.h:164
AVHWDeviceContext
This struct aggregates all the (hardware/vendor-specific) "high-level" state, i.e.
Definition: hwcontext.h:63
FFVulkanDescriptorSetBinding::type
VkDescriptorType type
Definition: vulkan.h:80
DecodePushData::bits_per_comp
int bits_per_comp
Definition: vulkan_dpx.c:49
vk_dpx_decode_slice
static int vk_dpx_decode_slice(AVCodecContext *avctx, const uint8_t *data, uint32_t size)
Definition: vulkan_dpx.c:80
AV_PIX_FMT_GBRAP10
#define AV_PIX_FMT_GBRAP10
Definition: pixfmt.h:562
FFVulkanDecodePicture
Definition: vulkan_decode.h:73
bits
uint8_t bits
Definition: vp3data.h:128
DPXVulkanDecodeContext::shader
FFVulkanShader shader
Definition: vulkan_dpx.c:44
ff_vk_dec_dpx_desc
const FFVulkanDecodeDescriptor ff_vk_dec_dpx_desc
Definition: vulkan_dpx.c:34
AVCodecContext::bits_per_raw_sample
int bits_per_raw_sample
Bits per sample/pixel of internal libavcodec pixel/sample format.
Definition: avcodec.h:1571
ctx
static AVFormatContext * ctx
Definition: movenc.c:49
DecodePushData
Definition: vulkan_apv.c:58
ff_vk_exec_add_dep_buf
int ff_vk_exec_add_dep_buf(FFVulkanContext *s, FFVkExecContext *e, AVBufferRef **deps, int nb_deps, int ref)
Execution dependency management.
Definition: vulkan.c:640
DPXDecContext::components
int components
Definition: dpx.h:68
av_mallocz
#define av_mallocz(s)
Definition: tableprint_vlc.h:31
DPXDecContext::endian
int endian
Definition: dpx.h:67
AV_PIX_FMT_GRAY10
#define AV_PIX_FMT_GRAY10
Definition: pixfmt.h:519
fail
#define fail
Definition: test.h:478
HWACCEL_CAP_ASYNC_SAFE
#define HWACCEL_CAP_ASYNC_SAFE
Header providing the internals of AVHWAccel.
Definition: hwaccel_internal.h:31
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:213
hwaccel_internal.h
ff_vk_decode_free_frame
void ff_vk_decode_free_frame(AVHWDeviceContext *dev_ctx, FFVulkanDecodePicture *vp)
Free a frame and its state.
Definition: vulkan_decode.c:647
vk_dpx_free_frame_priv
static void vk_dpx_free_frame_priv(AVRefStructOpaque _hwctx, void *data)
Definition: vulkan_dpx.c:321
AVCodecContext::internal
struct AVCodecInternal * internal
Private context used for internal data.
Definition: avcodec.h:478
av_fallthrough
#define av_fallthrough
Definition: attributes.h:67
av_buffer_pool_uninit
void av_buffer_pool_uninit(AVBufferPool **ppool)
Mark the pool as being available for freeing.
Definition: buffer.c:328
ff_vk_decode_uninit
int ff_vk_decode_uninit(AVCodecContext *avctx)
Free decoder.
Definition: vulkan_decode.c:1253
ff_vk_shader_link
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:2333
SPEC_LIST_CREATE
#define SPEC_LIST_CREATE(name, max_length, max_size)
Definition: vulkan.h:42
AVVkFrame::access
VkAccessFlagBits2 access[AV_NUM_DATA_POINTERS]
Updated after every barrier.
Definition: hwcontext_vulkan.h:290
attributes.h
FFVulkanContext
Definition: vulkan.h:275
ff_vk_frame_params
int ff_vk_frame_params(AVCodecContext *avctx, AVBufferRef *hw_frames_ctx)
Initialize hw_frames_ctx with the parameters needed to decode the stream using the parameters from av...
Definition: vulkan_decode.c:1112
DecodePushData::padded_10bit
int padded_10bit
Definition: vulkan_dpx.c:54
init
int(* init)(AVBSFContext *ctx)
Definition: dts2pts.c:608
ff_vk_shader_update_push_const
void ff_vk_shader_update_push_const(FFVulkanContext *s, FFVkExecContext *e, FFVulkanShader *shd, VkShaderStageFlagBits stage, int offset, size_t size, void *src)
Update push constant in a shader.
Definition: vulkan.c:2647
FFVulkanDescriptorSetBinding
Definition: vulkan.h:78
ff_dpx_unpack_comp_spv_len
const unsigned int ff_dpx_unpack_comp_spv_len
AVCodecInternal::hwaccel_priv_data
void * hwaccel_priv_data
hwaccel-specific private data
Definition: internal.h:130
init_shader
static int init_shader(AVCodecContext *avctx, FFVulkanContext *s, FFVkExecPool *pool, FFVulkanShader *shd, int bits)
Definition: vulkan_dpx.c:212
AVVkFrame
Definition: hwcontext_vulkan.h:261
i
#define i(width, name, range_min, range_max)
Definition: cbs_h264.c:63
for
for(k=2;k<=8;++k)
Definition: h264pred_template.c:424
size
int size
Definition: twinvq_data.h:10344
AV_NUM_DATA_POINTERS
#define AV_NUM_DATA_POINTERS
Definition: frame.h:473
FFVulkanShader
Definition: vulkan.h:191
ff_dpx_copy_comp_spv_len
const unsigned int ff_dpx_copy_comp_spv_len
AV_PIX_FMT_YUVA444P
@ AV_PIX_FMT_YUVA444P
planar YUV 4:4:4 32bpp, (1 Cr & Cb sample per 1x1 Y & A samples)
Definition: pixfmt.h:174
FFVkExecContext
Definition: vulkan.h:111
ff_vk_shader_update_desc_buffer
int ff_vk_shader_update_desc_buffer(FFVulkanContext *s, FFVkExecContext *e, FFVulkanShader *shd, int set, int bind, int elem, FFVkBuffer *buf, VkDeviceSize offset, VkDeviceSize len, VkFormat fmt)
Update a descriptor in a buffer with a buffer.
Definition: vulkan.c:2621
AVHWAccel::name
const char * name
Name of the hardware accelerated codec.
Definition: avcodec.h:1954
FF_VK_EXT_EXTERNAL_HOST_MEMORY
#define FF_VK_EXT_EXTERNAL_HOST_MEMORY
Definition: vulkan_functions.h:36
DPXDecContext::need_align
int need_align
Definition: dpx.h:70
unpack
static int unpack(const uint8_t *src, const uint8_t *src_end, uint8_t *dst, int width, int height)
Unpack buffer.
Definition: eatgv.c:73
ff_vk_exec_start
int ff_vk_exec_start(FFVulkanContext *s, FFVkExecContext *e)
Start/submit/wait an execution.
Definition: vulkan.c:580
vk_decode_dpx_init
static int vk_decode_dpx_init(AVCodecContext *avctx)
Definition: vulkan_dpx.c:282
ff_dpx_copy_comp_spv_data
const unsigned char ff_dpx_copy_comp_spv_data[]
DecodePushData::nb_comp
int nb_comp
Definition: vulkan_dpx.c:50
s
uint8_t s
Definition: llvidencdsp.c:39
DPXVulkanDecodeContext::frame_data_pool
AVBufferPool * frame_data_pool
Definition: vulkan_dpx.c:45
ff_dpx_vulkan_hwaccel
const FFHWAccel ff_dpx_vulkan_hwaccel
Definition: vulkan_dpx.c:331
uninit
static av_cold void uninit(AVBitStreamFilterContext *ctx)
Definition: lcevc_merge.c:135
AVCodecContext::hw_frames_ctx
AVBufferRef * hw_frames_ctx
A reference to the AVHWFramesContext describing the input (for encoding) or output (decoding) frames.
Definition: avcodec.h:1471
AVHWFramesContext
This struct describes a set or pool of "hardware" frames (i.e.
Definition: hwcontext.h:118
ff_vk_shader_add_descriptor_set
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:2439
DecodePushData::need_align
int need_align
Definition: vulkan_dpx.c:53
ff_vk_create_imageviews
int ff_vk_create_imageviews(FFVulkanContext *s, FFVkExecContext *e, VkImageView views[AV_NUM_DATA_POINTERS], AVFrame *f, enum FFVkShaderRepFormat rep_fmt)
Create an imageview and add it as a dependency to an execution.
Definition: vulkan.c:2010
FFVkExecPool
Definition: vulkan.h:253
ff_vk_decode_add_slice
int ff_vk_decode_add_slice(AVCodecContext *avctx, FFVulkanDecodePicture *vp, const uint8_t *data, size_t size, int add_startcode, uint32_t *nb_slices, const uint32_t **offsets)
Add slice data to frame.
Definition: vulkan_decode.c:258
ff_vk_shader_add_push_const
int ff_vk_shader_add_push_const(FFVulkanShader *shd, int offset, int size, VkShaderStageFlagBits stage)
Add/update push constants for execution.
Definition: vulkan.c:1509
AV_PIX_FMT_UYVY422
@ AV_PIX_FMT_UYVY422
packed YUV 4:2:2, 16bpp, Cb Y0 Cr Y1
Definition: pixfmt.h:88
FFVkExecContext::buf
VkCommandBuffer buf
Definition: vulkan.h:122
DecodePushData::nb_images
int nb_images
Definition: vulkan_dpx.c:51
DPXDecContext::pix_fmt
enum AVPixelFormat pix_fmt
Definition: dpx.h:63
AVCodecContext
main external API structure.
Definition: avcodec.h:443
AVFrame::height
int height
Definition: frame.h:544
DPXDecContext::unpadded_10bit
int unpadded_10bit
Definition: dpx.h:69
buffer
the frame and frame reference mechanism is intended to as much as expensive copies of that data while still allowing the filters to produce correct results The data is stored in buffers represented by AVFrame structures Several references can point to the same frame buffer
Definition: filter_design.txt:49
update_thread_context
the pkt_dts and pkt_pts fields in AVFrame will work as usual Restrictions on codec whose streams don t reset across will not work because their bitstreams cannot be decoded in parallel *The contents of buffers must not be read before as well as code calling up to before the decode process starts Call have update_thread_context() run it in the next thread. Add AV_CODEC_CAP_FRAME_THREADS to the codec capabilities. There will be very little speed gain at this point but it should work. Use ff_thread_get_buffer()(or ff_progress_frame_get_buffer() in case you have inter-frame dependencies and use the ProgressFrame API) to allocate frame buffers. Call ff_progress_frame_report() after some part of the current picture has decoded. A good place to put this is where draw_horiz_band() is called - add this if it isn 't called anywhere
FFVulkanDecodeDescriptor
Definition: vulkan_decode.h:29
FFVulkanShader::lg_size
uint32_t lg_size[3]
Definition: vulkan.h:200
ff_vk_update_thread_context
int ff_vk_update_thread_context(AVCodecContext *dst, const AVCodecContext *src)
Synchronize the contexts between 2 threads.
Definition: vulkan_decode.c:142
AV_PIX_FMT_YUV444P
@ AV_PIX_FMT_YUV444P
planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples)
Definition: pixfmt.h:78
DPXVulkanDecodePicture
Definition: vulkan_dpx.c:39
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:200
FFVulkanDecodePicture::slices_buf
AVBufferRef * slices_buf
Definition: vulkan_decode.h:99
mem.h
AVVkFrame::layout
VkImageLayout layout[AV_NUM_DATA_POINTERS]
Definition: hwcontext_vulkan.h:291
AVBufferRef
A reference to a data buffer.
Definition: buffer.h:82
DPXDecContext
Definition: dpx.h:60
vulkan_decode.h
ff_vk_count_images
static int ff_vk_count_images(AVVkFrame *f)
Definition: vulkan.h:329
FFALIGN
#define FFALIGN(x, a)
Definition: macros.h:78
vk_dpx_end_frame
static int vk_dpx_end_frame(AVCodecContext *avctx)
Definition: vulkan_dpx.c:99
AVCodecContext::priv_data
void * priv_data
Definition: avcodec.h:470
DPXDecContext::frame
AVFrame * frame
Definition: dpx.h:61
av_freep
#define av_freep(p)
Definition: tableprint_vlc.h:35
FFVkBuffer
Definition: vulkan.h:91
ff_vk_exec_submit
int ff_vk_exec_submit(FFVulkanContext *s, FFVkExecContext *e)
Definition: vulkan.c:925
ff_vk_decode_init
int ff_vk_decode_init(AVCodecContext *avctx)
Initialize decoder.
Definition: vulkan_decode.c:1264
FFVulkanFunctions
Definition: vulkan_functions.h:275
ff_vk_shader_load
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:2136
src
#define src
Definition: vp8dsp.c:248
vk_dpx_start_frame
static int vk_dpx_start_frame(AVCodecContext *avctx, const AVBufferRef *buffer_ref, av_unused const uint8_t *buffer, av_unused uint32_t size)
Definition: vulkan_dpx.c:58