FFmpeg
vulkan_ffv1.c
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2024 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 "vulkan_decode.h"
22 #include "hwaccel_internal.h"
23 
24 #include "ffv1.h"
25 #include "ffv1_vulkan.h"
26 #include "libavutil/mem.h"
27 
28 #define RGB_LINECACHE 2
29 
30 extern const unsigned char ff_ffv1_dec_setup_comp_spv_data[];
31 extern const unsigned int ff_ffv1_dec_setup_comp_spv_len;
32 
33 extern const unsigned char ff_ffv1_dec_reset_comp_spv_data[];
34 extern const unsigned int ff_ffv1_dec_reset_comp_spv_len;
35 
36 extern const unsigned char ff_ffv1_dec_reset_golomb_comp_spv_data[];
37 extern const unsigned int ff_ffv1_dec_reset_golomb_comp_spv_len;
38 
39 extern const unsigned char ff_ffv1_dec_comp_spv_data[];
40 extern const unsigned int ff_ffv1_dec_comp_spv_len;
41 
42 extern const unsigned char ff_ffv1_dec_rgb_comp_spv_data[];
43 extern const unsigned int ff_ffv1_dec_rgb_comp_spv_len;
44 
45 extern const unsigned char ff_ffv1_dec_golomb_comp_spv_data[];
46 extern const unsigned int ff_ffv1_dec_golomb_comp_spv_len;
47 
48 extern const unsigned char ff_ffv1_dec_rgb_golomb_comp_spv_data[];
49 extern const unsigned int ff_ffv1_dec_rgb_golomb_comp_spv_len;
50 
51 extern const unsigned char ff_ffv1_dec_rgb_float_comp_spv_data[];
52 extern const unsigned int ff_ffv1_dec_rgb_float_comp_spv_len;
53 
54 extern const unsigned char ff_ffv1_dec_rgb_float_golomb_comp_spv_data[];
55 extern const unsigned int ff_ffv1_dec_rgb_float_golomb_comp_spv_len;
56 
57 extern const unsigned char ff_ffv1_dec_bayer_comp_spv_data[];
58 extern const unsigned int ff_ffv1_dec_bayer_comp_spv_len;
59 
60 extern const unsigned char ff_ffv1_dec_bayer_golomb_comp_spv_data[];
61 extern const unsigned int ff_ffv1_dec_bayer_golomb_comp_spv_len;
62 
65  .queue_flags = VK_QUEUE_COMPUTE_BIT,
66 };
67 
68 typedef struct FFv1VulkanDecodePicture {
70 
72  uint32_t plane_state_size;
73  uint32_t slice_state_size;
74  uint32_t slice_data_size;
75 
78  uint32_t *slice_offset;
79  int slice_num;
81 
82  /* The context-less free callback waits for the decode before reading
83  * back the slice feedback */
84  PFN_vkWaitSemaphores wait_semaphores;
86 
87 typedef struct FFv1VulkanDecodeContext {
89 
93 
95 
100 
102  const AVBufferRef *buffer_ref,
103  av_unused const uint8_t *buffer,
104  av_unused uint32_t size)
105 {
106  int err;
109  FFv1VulkanDecodeContext *fv = ctx->sd_ctx;
110  FFV1Context *f = avctx->priv_data;
111 
112  FFv1VulkanDecodePicture *fp = f->hwaccel_picture_private;
113  FFVulkanDecodePicture *vp = &fp->vp;
114 
116  enum AVPixelFormat sw_format = hwfc->sw_format;
117 
118  int max_contexts;
119  int is_rgb = !(f->colorspace == 0 && sw_format != AV_PIX_FMT_YA8) &&
120  !(sw_format == AV_PIX_FMT_YA8);
121 
122  fp->slice_num = 0;
123 
124  max_contexts = 0;
125  for (int i = 0; i < f->quant_table_count; i++)
126  max_contexts = FFMAX(f->context_count[i], max_contexts);
127 
128  /* Allocate slice buffer data */
129  if (f->ac == AC_GOLOMB_RICE)
130  fp->plane_state_size = 8;
131  else
133 
134  fp->plane_state_size *= max_contexts;
135  fp->slice_state_size = fp->plane_state_size*f->plane_count;
136 
137  fp->slice_data_size = 256; /* Overestimation for the SliceContext struct */
140 
141  fp->crc_checked = f->ec && (avctx->err_recognition & AV_EF_CRCCHECK);
142 
143  /* The context-less free callback needs these device functions, which
144  * prepare_frame_sdr() used to set. vp->sem is kept for the next
145  * non-keyframe's wait and the free callback's CRC readback. */
146  fp->wait_semaphores = ctx->s.vkfn.WaitSemaphores;
147  vp->invalidate_memory_ranges = ctx->s.vkfn.InvalidateMappedMemoryRanges;
148 
149  /* Host map the input slices data if supported */
150  if (ctx->s.extensions & FF_VK_EXT_EXTERNAL_HOST_MEMORY)
151  ff_vk_host_map_buffer(&ctx->s, &vp->slices_buf, buffer_ref->data,
152  VK_WHOLE_SIZE, buffer_ref,
153  VK_BUFFER_USAGE_STORAGE_BUFFER_BIT |
154  VK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT);
155 
156  /* Allocate slice state data */
157  if (f->picture.f->flags & AV_FRAME_FLAG_KEY) {
159  &fp->slice_state,
160  VK_BUFFER_USAGE_STORAGE_BUFFER_BIT,
161  NULL, f->slice_count*fp->slice_state_size,
162  VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT);
163  if (err < 0)
164  return err;
165  } else {
166  FFv1VulkanDecodePicture *fpl = f->hwaccel_last_picture_private;
167 
168  /* The previous frame's setup may have failed partway */
169  if (!fpl || !fpl->slice_state)
170  return AVERROR_INVALIDDATA;
171 
173  }
174 
175  /* Allocate slice offsets/status buffer */
177  &fp->slice_feedback_buf,
178  VK_BUFFER_USAGE_STORAGE_BUFFER_BIT,
179  NULL, 2*(2*f->slice_count*sizeof(uint32_t)),
180  VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT |
181  VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT);
182  if (err < 0)
183  return err;
184 
185  /* Allocate slice offsets/status buffer (note, for integer+remap, we don't need it) */
186  if (f->version >=4 && f->micro_version >= 9 &&
189  &fp->slice_fltmap_buf,
190  VK_BUFFER_USAGE_STORAGE_BUFFER_BIT,
191  NULL, 65536*4*f->slice_count*sizeof(uint32_t),
192  VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT |
193  VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT);
194  /* A megabyte per slice; fall back if there is no BAR space left */
195  if (err < 0)
197  &fp->slice_fltmap_buf,
198  VK_BUFFER_USAGE_STORAGE_BUFFER_BIT,
199  NULL, 65536*4*f->slice_count*sizeof(uint32_t),
200  VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT);
201  if (err < 0)
202  return err;
203  }
204 
205  /* Create a temporaty frame for RGB */
206  if (is_rgb) {
207  vp->dpb_frame = av_frame_alloc();
208  if (!vp->dpb_frame)
209  return AVERROR(ENOMEM);
210 
212  vp->dpb_frame, 0);
213  if (err < 0)
214  return err;
215  }
216 
217  return 0;
218 }
219 
221  const uint8_t *data,
222  uint32_t size)
223 {
224  FFV1Context *f = avctx->priv_data;
225 
226  FFv1VulkanDecodePicture *fp = f->hwaccel_picture_private;
227  FFVulkanDecodePicture *vp = &fp->vp;
228 
229  FFVkBuffer *slice_offset = fp->slice_feedback_buf;
230  FFVkBuffer *slices_buf = vp->slices_buf;
231 
232  if (slices_buf && slices_buf->host_ref) {
233  AV_WN32(slice_offset->mapped_mem + (2*fp->slice_num + 0)*sizeof(uint32_t),
234  data - slices_buf->mapped_mem);
235  AV_WN32(slice_offset->mapped_mem + (2*fp->slice_num + 1)*sizeof(uint32_t),
236  size);
237 
238  fp->slice_num++;
239  } else {
240  int err = ff_vk_decode_add_slice(avctx, vp, data, size, 0,
241  &fp->slice_num,
242  (const uint32_t **)&fp->slice_offset);
243  if (err < 0)
244  return err;
245 
246  AV_WN32(slice_offset->mapped_mem + (2*(fp->slice_num - 1) + 0)*sizeof(uint32_t),
247  fp->slice_offset[fp->slice_num - 1]);
248  AV_WN32(slice_offset->mapped_mem + (2*(fp->slice_num - 1) + 1)*sizeof(uint32_t),
249  size);
250  }
251 
252  return 0;
253 }
254 
256 {
257  int err;
260  FFVulkanFunctions *vk = &ctx->s.vkfn;
261 
262  FFV1Context *f = avctx->priv_data;
263  FFv1VulkanDecodeContext *fv = ctx->sd_ctx;
264 
266  enum AVPixelFormat sw_format = hwfc->sw_format;
267 
268  int is_rgb = !(f->colorspace == 0 && sw_format != AV_PIX_FMT_YA8) &&
269  !(sw_format == AV_PIX_FMT_YA8);
270  int color_planes = av_pix_fmt_desc_get(avctx->sw_pix_fmt)->nb_components;
271 
272  FFv1VulkanDecodePicture *fp = f->hwaccel_picture_private;
273  FFVulkanDecodePicture *vp = &fp->vp;
274 
275  FFVkBuffer *slices_buf = vp->slices_buf;
276  FFVkBuffer *slice_state = fp->slice_state;
277  FFVkBuffer *slice_feedback = fp->slice_feedback_buf;
278  FFVkBuffer *fltmap_buf = NULL;
279  if (fp->slice_fltmap_buf)
280  fltmap_buf = fp->slice_fltmap_buf;
281 
282  VkImageView output_views[AV_NUM_DATA_POINTERS];
283  VkImageView rct_image_views[AV_NUM_DATA_POINTERS];
284 
285  VkImageMemoryBarrier2 img_bar[37];
286  int nb_img_bar = 0;
287  VkBufferMemoryBarrier2 buf_bar[8];
288  int nb_buf_bar = 0;
289 
290  FFVkExecContext *exec = ff_vk_exec_get(&ctx->s, &ctx->exec_pool);
291  ff_vk_exec_start(&ctx->s, exec);
292 
293  /* Prepare deps */
294  RET(ff_vk_exec_add_dep_frame(&ctx->s, exec, f->picture.f,
295  VK_PIPELINE_STAGE_2_ALL_COMMANDS_BIT,
296  VK_PIPELINE_STAGE_2_COMPUTE_SHADER_BIT));
297 
298  err = ff_vk_exec_mirror_sem_value(&ctx->s, exec, &vp->sem, &vp->sem_value,
299  f->picture.f);
300  if (err < 0)
301  return err;
302 
303  /* Exec-owned output views (vp->sem is still mirrored above, for the next
304  * frame's dependency and the free callback's CRC readback). */
305  RET(ff_vk_create_imageviews(&ctx->s, exec, output_views, f->picture.f,
307 
308  if (is_rgb) {
309  RET(ff_vk_create_imageviews(&ctx->s, exec, rct_image_views,
311  RET(ff_vk_exec_add_dep_frame(&ctx->s, exec, vp->dpb_frame,
312  VK_PIPELINE_STAGE_2_ALL_COMMANDS_BIT,
313  VK_PIPELINE_STAGE_2_CLEAR_BIT));
314  }
315 
316  if (!(f->picture.f->flags & AV_FRAME_FLAG_KEY)) {
317  FFv1VulkanDecodePicture *fpl = f->hwaccel_last_picture_private;
318  FFVulkanDecodePicture *vpl = &fpl->vp;
319 
320  /* Wait on the previous frame, if its decode was ever submitted */
321  if (vpl->sem)
322  ff_vk_exec_add_dep_wait_sem(&ctx->s, exec, vpl->sem, vpl->sem_value,
323  VK_PIPELINE_STAGE_2_ALL_COMMANDS_BIT);
324  }
325 
329 
330  if (fp->slice_fltmap_buf)
332 
333  AVVkFrame *vkf = (AVVkFrame *)f->picture.f->data[0];
334  for (int i = 0; i < ff_vk_count_images(vkf); i++) {
335  vkf->layout[i] = VK_IMAGE_LAYOUT_UNDEFINED;
336  vkf->access[i] = VK_ACCESS_2_NONE;
337  }
338 
339  /* Setup shader */
340  ff_vk_shader_update_desc_buffer(&ctx->s, exec, &fv->setup,
341  1, 0, 0,
342  slice_state,
343  0, fp->slice_data_size*f->slice_count,
344  VK_FORMAT_UNDEFINED);
345  ff_vk_shader_update_desc_buffer(&ctx->s, exec, &fv->setup,
346  1, 1, 0,
347  slice_feedback,
348  0, 2*f->slice_count*sizeof(uint32_t),
349  VK_FORMAT_UNDEFINED);
350  ff_vk_shader_update_desc_buffer(&ctx->s, exec, &fv->setup,
351  1, 2, 0,
352  slice_feedback,
353  2*f->slice_count*sizeof(uint32_t),
354  VK_WHOLE_SIZE,
355  VK_FORMAT_UNDEFINED);
356  /* The binding is statically used by the shader, so it must always hold
357  * a valid buffer. */
358  ff_vk_shader_update_desc_buffer(&ctx->s, exec, &fv->setup,
359  1, 3, 0,
360  fltmap_buf ? fltmap_buf : slice_feedback,
361  0,
362  VK_WHOLE_SIZE,
363  VK_FORMAT_UNDEFINED);
364 
365  ff_vk_exec_bind_shader(&ctx->s, exec, &fv->setup);
366 
367  FFv1ShaderParams pd = {
368  .slice_data = slices_buf->address,
369 
370  .img_size[0] = f->picture.f->width,
371  .img_size[1] = f->picture.f->height,
372 
373  .plane_state_size = fp->plane_state_size,
374  .key_frame = f->picture.f->flags & AV_FRAME_FLAG_KEY,
375  .crcref = f->crcref,
376  .micro_version = f->micro_version,
377  .remap_allowed = !!fltmap_buf,
378  };
379 
380  for (int i = 0; i < f->quant_table_count; i++) {
381  pd.context_count[i] = f->context_count[i];
382  pd.extend_lookup[i] = f->quant_tables[i][3][127] ||
383  f->quant_tables[i][4][127];
384  }
385 
386  /* For some reason the C FFv1 encoder/decoder treats these differently */
387  if (sw_format == AV_PIX_FMT_GBRP10 || sw_format == AV_PIX_FMT_GBRP12 ||
388  sw_format == AV_PIX_FMT_GBRP14)
389  memcpy(pd.fmt_lut, (int [4]) { 2, 1, 0, 3 }, 4*sizeof(int));
390  else
391  ff_vk_set_perm(sw_format, pd.fmt_lut, 0);
392 
393  ff_vk_shader_update_push_const(&ctx->s, exec, &fv->setup,
394  VK_SHADER_STAGE_COMPUTE_BIT,
395  0, sizeof(FFv1ShaderParams), &pd);
396 
397  vk->CmdDispatch(exec->buf, f->num_h_slices, f->num_v_slices, 1);
398 
399  if (is_rgb) {
400  vkf = (AVVkFrame *)vp->dpb_frame->data[0];
401  for (int i = 0; i < 4; i++) {
402  vkf->layout[i] = VK_IMAGE_LAYOUT_UNDEFINED;
403  vkf->access[i] = VK_ACCESS_2_NONE;
404  }
405 
406  ff_vk_frame_barrier(&ctx->s, exec, vp->dpb_frame, img_bar, &nb_img_bar,
407  VK_PIPELINE_STAGE_2_ALL_COMMANDS_BIT,
408  VK_PIPELINE_STAGE_2_CLEAR_BIT,
409  VK_ACCESS_2_TRANSFER_WRITE_BIT,
410  VK_IMAGE_LAYOUT_GENERAL,
411  VK_QUEUE_FAMILY_IGNORED);
412 
413  vk->CmdPipelineBarrier2(exec->buf, &(VkDependencyInfo) {
414  .sType = VK_STRUCTURE_TYPE_DEPENDENCY_INFO,
415  .pImageMemoryBarriers = img_bar,
416  .imageMemoryBarrierCount = nb_img_bar,
417  .pBufferMemoryBarriers = buf_bar,
418  .bufferMemoryBarrierCount = nb_buf_bar,
419  });
420  nb_img_bar = 0;
421  nb_buf_bar = 0;
422 
423  /* The intermediate frame has 4 planes (GBRAP16/32). Clear all of
424  * them since the bayer decoder uses all four. */
425  int n_dec_planes = f->bayer ? 4 : color_planes;
426  for (int i = 0; i < n_dec_planes; i++)
427  vk->CmdClearColorImage(exec->buf, vkf->img[i], VK_IMAGE_LAYOUT_GENERAL,
428  &((VkClearColorValue) { 0 }),
429  1, &((VkImageSubresourceRange) {
430  .aspectMask = VK_IMAGE_ASPECT_COLOR_BIT,
431  .levelCount = 1,
432  .layerCount = 1,
433  }));
434  }
435 
436  /* Sync between setup and reset shaders */
437  ff_vk_buf_barrier(buf_bar[nb_buf_bar++], slice_state,
438  COMPUTE_SHADER_BIT, SHADER_STORAGE_READ_BIT,
439  SHADER_STORAGE_WRITE_BIT,
440  COMPUTE_SHADER_BIT, SHADER_STORAGE_READ_BIT, NONE_KHR,
441  0, fp->slice_data_size*f->slice_count);
442 
443  /* Probability data barrier for P-frames */
444  if (!(f->picture.f->flags & AV_FRAME_FLAG_KEY))
445  ff_vk_buf_barrier(buf_bar[nb_buf_bar++], slice_state,
446  COMPUTE_SHADER_BIT, SHADER_STORAGE_READ_BIT,
447  SHADER_STORAGE_WRITE_BIT,
448  COMPUTE_SHADER_BIT, SHADER_STORAGE_WRITE_BIT, NONE_KHR,
449  fp->slice_data_size*f->slice_count, VK_WHOLE_SIZE);
450 
451  vk->CmdPipelineBarrier2(exec->buf, &(VkDependencyInfo) {
452  .sType = VK_STRUCTURE_TYPE_DEPENDENCY_INFO,
453  .pImageMemoryBarriers = img_bar,
454  .imageMemoryBarrierCount = nb_img_bar,
455  .pBufferMemoryBarriers = buf_bar,
456  .bufferMemoryBarrierCount = nb_buf_bar,
457  });
458  nb_buf_bar = 0;
459  nb_img_bar = 0;
460 
461  /* Reset shader */
462  ff_vk_shader_update_desc_buffer(&ctx->s, exec, &fv->reset,
463  1, 0, 0,
464  slice_state,
465  0, fp->slice_data_size*f->slice_count,
466  VK_FORMAT_UNDEFINED);
467  ff_vk_shader_update_desc_buffer(&ctx->s, exec, &fv->reset,
468  1, 1, 0,
469  slice_state,
470  f->slice_count*fp->slice_data_size,
471  VK_WHOLE_SIZE,
472  VK_FORMAT_UNDEFINED);
473 
474  ff_vk_exec_bind_shader(&ctx->s, exec, &fv->reset);
475  ff_vk_shader_update_push_const(&ctx->s, exec, &fv->reset,
476  VK_SHADER_STAGE_COMPUTE_BIT,
477  0, sizeof(FFv1ShaderParams), &pd);
478 
479  vk->CmdDispatch(exec->buf, f->num_h_slices, f->num_v_slices,
480  f->plane_count);
481 
482  /* Sync probabilities between reset and decode shaders */
483  ff_vk_buf_barrier(buf_bar[nb_buf_bar++], slice_state,
484  COMPUTE_SHADER_BIT, SHADER_STORAGE_WRITE_BIT, NONE_KHR,
485  COMPUTE_SHADER_BIT, SHADER_STORAGE_READ_BIT,
486  SHADER_STORAGE_WRITE_BIT,
487  fp->slice_data_size*f->slice_count, VK_WHOLE_SIZE);
488 
489  /* Input frame barrier */
490  ff_vk_frame_barrier(&ctx->s, exec, f->picture.f, img_bar, &nb_img_bar,
491  VK_PIPELINE_STAGE_2_ALL_COMMANDS_BIT,
492  VK_PIPELINE_STAGE_2_COMPUTE_SHADER_BIT,
493  VK_ACCESS_SHADER_WRITE_BIT |
494  (!is_rgb ? VK_ACCESS_SHADER_READ_BIT : 0),
495  VK_IMAGE_LAYOUT_GENERAL,
496  VK_QUEUE_FAMILY_IGNORED);
497  if (is_rgb)
498  ff_vk_frame_barrier(&ctx->s, exec, vp->dpb_frame, img_bar, &nb_img_bar,
499  VK_PIPELINE_STAGE_2_CLEAR_BIT,
500  VK_PIPELINE_STAGE_2_COMPUTE_SHADER_BIT,
501  VK_ACCESS_SHADER_READ_BIT | VK_ACCESS_SHADER_WRITE_BIT,
502  VK_IMAGE_LAYOUT_GENERAL,
503  VK_QUEUE_FAMILY_IGNORED);
504 
505  vk->CmdPipelineBarrier2(exec->buf, &(VkDependencyInfo) {
506  .sType = VK_STRUCTURE_TYPE_DEPENDENCY_INFO,
507  .pImageMemoryBarriers = img_bar,
508  .imageMemoryBarrierCount = nb_img_bar,
509  .pBufferMemoryBarriers = buf_bar,
510  .bufferMemoryBarrierCount = nb_buf_bar,
511  });
512  nb_img_bar = 0;
513  nb_buf_bar = 0;
514 
515  /* Decode */
517  1, 0, 0,
518  slice_state,
519  0, fp->slice_data_size*f->slice_count,
520  VK_FORMAT_UNDEFINED);
522  1, 1, 0,
523  slice_feedback,
524  0, 2*f->slice_count*sizeof(uint32_t),
525  VK_FORMAT_UNDEFINED);
527  1, 2, 0,
528  slice_feedback,
529  2*f->slice_count*sizeof(uint32_t),
530  VK_WHOLE_SIZE,
531  VK_FORMAT_UNDEFINED);
533  1, 3, 0,
534  slice_state,
535  f->slice_count*fp->slice_data_size,
536  VK_WHOLE_SIZE,
537  VK_FORMAT_UNDEFINED);
538 
539  AVFrame *decode_dst = is_rgb ? vp->dpb_frame : f->picture.f;
540  VkImageView *decode_dst_view = is_rgb ? rct_image_views : output_views;
541  ff_vk_shader_update_img_array(&ctx->s, exec, &fv->decode,
542  decode_dst, decode_dst_view,
543  1, 4,
544  VK_IMAGE_LAYOUT_GENERAL,
545  VK_NULL_HANDLE);
546  if (is_rgb)
547  ff_vk_shader_update_img_array(&ctx->s, exec, &fv->decode,
548  f->picture.f, output_views,
549  1, 5,
550  VK_IMAGE_LAYOUT_GENERAL,
551  VK_NULL_HANDLE);
552  if (fltmap_buf)
554  1, 6, 0,
555  fltmap_buf,
556  0,
557  VK_WHOLE_SIZE,
558  VK_FORMAT_UNDEFINED);
559 
560  ff_vk_exec_bind_shader(&ctx->s, exec, &fv->decode);
561  ff_vk_shader_update_push_const(&ctx->s, exec, &fv->decode,
562  VK_SHADER_STAGE_COMPUTE_BIT,
563  0, sizeof(FFv1ShaderParams), &pd);
564 
565  vk->CmdDispatch(exec->buf, f->num_h_slices, f->num_v_slices, 1);
566 
567  err = ff_vk_exec_submit(&ctx->s, exec);
568  if (err < 0)
569  return err;
570 
571  /* We don't need the temporary frame after decoding */
572  av_frame_free(&vp->dpb_frame);
573 
574 fail:
575  return 0;
576 }
577 
579  FFVkExecPool *pool, FFVulkanShader *shd,
580  VkSpecializationInfo *sl)
581 {
582  int err;
583 
584  ff_vk_shader_load(shd, VK_SHADER_STAGE_COMPUTE_BIT, sl,
585  (uint32_t []) { 1, 1, 1 }, 0);
586 
588  VK_SHADER_STAGE_COMPUTE_BIT);
589 
590  const FFVulkanDescriptorSetBinding desc_set_const[] = {
591  { /* rangecoder_buf */
592  .type = VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER,
593  .stages = VK_SHADER_STAGE_COMPUTE_BIT,
594  },
595  { /* crc_ieee_buf */
596  .type = VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER,
597  .stages = VK_SHADER_STAGE_COMPUTE_BIT,
598  },
599  };
600  ff_vk_shader_add_descriptor_set(s, shd, desc_set_const, 2, 1);
601 
602  const FFVulkanDescriptorSetBinding desc_set[] = {
603  { /* slice_data_buf */
604  .type = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER,
605  .stages = VK_SHADER_STAGE_COMPUTE_BIT,
606  },
607  { /* slice_offsets_buf */
608  .type = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER,
609  .stages = VK_SHADER_STAGE_COMPUTE_BIT,
610  },
611  { /* slice_status_buf */
612  .type = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER,
613  .stages = VK_SHADER_STAGE_COMPUTE_BIT,
614  },
615  { /* fltmap_buf */
616  .type = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER,
617  .stages = VK_SHADER_STAGE_COMPUTE_BIT,
618  },
619  };
620  ff_vk_shader_add_descriptor_set(s, shd, desc_set, 4, 0);
621 
622  RET(ff_vk_shader_link(s, shd,
625 
626  RET(ff_vk_shader_register_exec(s, pool, shd));
627 
628 fail:
629  return err;
630 }
631 
633  FFVkExecPool *pool, FFVulkanShader *shd,
634  VkSpecializationInfo *sl, int ac)
635 {
636  int err;
637  int wg_dim = FFMIN(s->props.properties.limits.maxComputeWorkGroupSize[0], 1024);
638 
639  ff_vk_shader_load(shd, VK_SHADER_STAGE_COMPUTE_BIT, sl,
640  (uint32_t []) { wg_dim, 1, 1 }, 0);
641 
643  VK_SHADER_STAGE_COMPUTE_BIT);
644 
645  const FFVulkanDescriptorSetBinding desc_set_const[] = {
646  { /* rangecoder_buf */
647  .type = VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER,
648  .stages = VK_SHADER_STAGE_COMPUTE_BIT,
649  },
650  };
651  ff_vk_shader_add_descriptor_set(s, shd, desc_set_const, 1, 1);
652 
653  const FFVulkanDescriptorSetBinding desc_set[] = {
654  { /* slice_data_buf */
655  .type = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER,
656  .stages = VK_SHADER_STAGE_COMPUTE_BIT,
657  },
658  { /* slice_state_buf */
659  .type = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER,
660  .stages = VK_SHADER_STAGE_COMPUTE_BIT,
661  },
662  };
663  ff_vk_shader_add_descriptor_set(s, shd, desc_set, 2, 0);
664 
665  if (ac == AC_GOLOMB_RICE)
666  RET(ff_vk_shader_link(s, shd,
669  else
670  RET(ff_vk_shader_link(s, shd,
673 
674  RET(ff_vk_shader_register_exec(s, pool, shd));
675 
676 fail:
677  return err;
678 }
679 
681  FFVkExecPool *pool, FFVulkanShader *shd,
682  AVHWFramesContext *dec_frames_ctx,
683  AVHWFramesContext *out_frames_ctx,
684  VkSpecializationInfo *sl, int ac, int rgb,
685  int bayer)
686 {
687  int err;
688 
689  uint32_t wg_x = ac != AC_GOLOMB_RICE ? CONTEXT_SIZE : 1;
690  ff_vk_shader_load(shd, VK_SHADER_STAGE_COMPUTE_BIT, sl,
691  (uint32_t []) { wg_x, 1, 1 }, 0);
692 
694  VK_SHADER_STAGE_COMPUTE_BIT);
695 
696  const FFVulkanDescriptorSetBinding desc_set_const[] = {
697  { /* rangecoder_buf */
698  .type = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER,
699  .stages = VK_SHADER_STAGE_COMPUTE_BIT,
700  },
701  { /* quant_buf */
702  .type = VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER,
703  .stages = VK_SHADER_STAGE_COMPUTE_BIT,
704  },
705  };
706  ff_vk_shader_add_descriptor_set(s, shd, desc_set_const, 2, 1);
707 
708  const FFVulkanDescriptorSetBinding desc_set[] = {
709  { /* slice_data_buf */
710  .type = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER,
711  .stages = VK_SHADER_STAGE_COMPUTE_BIT,
712  },
713  { /* slice_offsets_buf */
714  .type = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER,
715  .stages = VK_SHADER_STAGE_COMPUTE_BIT,
716  },
717  { /* slice_status_buf */
718  .type = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER,
719  .stages = VK_SHADER_STAGE_COMPUTE_BIT,
720  },
721  { /* slice_state_buf */
722  .type = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER,
723  .stages = VK_SHADER_STAGE_COMPUTE_BIT,
724  },
725  { /* dec */
726  .type = VK_DESCRIPTOR_TYPE_STORAGE_IMAGE,
727  .stages = VK_SHADER_STAGE_COMPUTE_BIT,
728  .elems = av_pix_fmt_count_planes(dec_frames_ctx->sw_format),
729  },
730  { /* dst */
731  .type = VK_DESCRIPTOR_TYPE_STORAGE_IMAGE,
732  .stages = VK_SHADER_STAGE_COMPUTE_BIT,
733  .elems = av_pix_fmt_count_planes(out_frames_ctx->sw_format),
734  },
735  { /* fltmap_buf */
736  .type = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER,
737  .stages = VK_SHADER_STAGE_COMPUTE_BIT,
738  },
739  };
740  /* Detect a float output from the pixfmt descriptor instead of f->flt:
741  * the encoder side does not (yet) write f->flt to the extradata, so the
742  * parsed value is unreliable for some v4m4+ streams. The descriptor's
743  * FLOAT flag is set by the pixfmt selection logic and is accurate */
744  int is_float = !!(av_pix_fmt_desc_get(out_frames_ctx->sw_format)->flags &
746 
747  /* Bindings 5 (dst) and 6 (fltmap_buf) are conditional */
748  ff_vk_shader_add_descriptor_set(s, shd, desc_set,
749  5 + rgb + (is_float && !bayer),
750  0);
751 
752  if (bayer) {
753  if (ac == AC_GOLOMB_RICE)
754  ff_vk_shader_link(s, shd,
757  else
758  ff_vk_shader_link(s, shd,
761  } else if (is_float) {
762  if (ac == AC_GOLOMB_RICE)
763  ff_vk_shader_link(s, shd,
766  else
767  ff_vk_shader_link(s, shd,
770  } else if (ac == AC_GOLOMB_RICE) {
771  if (rgb)
772  ff_vk_shader_link(s, shd,
775  else
776  ff_vk_shader_link(s, shd,
779  } else {
780  if (rgb)
781  ff_vk_shader_link(s, shd,
784  else
785  ff_vk_shader_link(s, shd,
787  ff_ffv1_dec_comp_spv_len, "main");
788  }
789 
790  RET(ff_vk_shader_register_exec(s, pool, shd));
791 
792 fail:
793  return err;
794 }
795 
797  AVBufferRef **dst, enum AVPixelFormat sw_format)
798 {
799  int err;
800  AVHWFramesContext *frames_ctx;
801  AVVulkanFramesContext *vk_frames;
802  FFV1Context *f = avctx->priv_data;
803 
804  *dst = av_hwframe_ctx_alloc(s->device_ref);
805  if (!(*dst))
806  return AVERROR(ENOMEM);
807 
808  frames_ctx = (AVHWFramesContext *)((*dst)->data);
809  frames_ctx->format = AV_PIX_FMT_VULKAN;
810  frames_ctx->sw_format = sw_format;
811  frames_ctx->width = s->frames->width;
812  frames_ctx->height = f->num_v_slices*RGB_LINECACHE;
813 
814  vk_frames = frames_ctx->hwctx;
815  vk_frames->tiling = VK_IMAGE_TILING_OPTIMAL;
816  vk_frames->img_flags = VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT;
817  vk_frames->usage = VK_IMAGE_USAGE_STORAGE_BIT |
818  VK_IMAGE_USAGE_TRANSFER_DST_BIT;
819 
820  err = av_hwframe_ctx_init(*dst);
821  if (err < 0) {
822  av_log(avctx, AV_LOG_ERROR,
823  "Unable to initialize frame pool with format %s: %s\n",
824  av_get_pix_fmt_name(sw_format), av_err2str(err));
826  return err;
827  }
828 
829  return 0;
830 }
831 
833 {
834  FFv1VulkanDecodeContext *fv = ctx->sd_ctx;
835 
837 
838  ff_vk_shader_free(&ctx->s, &fv->setup);
839  ff_vk_shader_free(&ctx->s, &fv->reset);
840  ff_vk_shader_free(&ctx->s, &fv->decode);
841 
842  ff_vk_free_buf(&ctx->s, &fv->consts_buf);
843 
847 
848  av_freep(&fv);
849 }
850 
852 {
853  int err;
854  FFV1Context *f = avctx->priv_data;
858 
859  if (f->version < 3)
860  return AVERROR(ENOTSUP);
861 
862  /* Streams with a low amount of slices will usually be much slower
863  * to decode, so warn the user. Use the slice structure from the
864  * extradata: slice_count is only set during frame decoding. */
865  if (f->num_h_slices * f->num_v_slices < 16)
866  av_log(avctx, AV_LOG_WARNING, "Stream has a low number of slices (%i), "
867  "decoding may be very slow\n", f->num_h_slices * f->num_v_slices);
868 
869  err = ff_vk_decode_init(avctx);
870  if (err < 0)
871  return err;
872  ctx = dec->shared_ctx;
873 
874  fv = ctx->sd_ctx = av_mallocz(sizeof(*fv));
875  if (!fv) {
876  err = AVERROR(ENOMEM);
877  goto fail;
878  }
879 
880  ctx->sd_ctx_free = &vk_decode_ffv1_uninit;
881 
883  AVHWFramesContext *dctx = hwfc;
884  enum AVPixelFormat sw_format = hwfc->sw_format;
885  int is_rgb = !(f->colorspace == 0 && sw_format != AV_PIX_FMT_YA8) &&
886  !(sw_format == AV_PIX_FMT_YA8);
887 
888  /* Intermediate frame pool for RCT */
889  if (is_rgb) {
890  RET(init_indirect(avctx, &ctx->s, &fv->intermediate_frames_ref,
891  f->use32bit ? AV_PIX_FMT_GBRAP32 : AV_PIX_FMT_GBRAP16));
893  }
894 
895  SPEC_LIST_CREATE(sl, 15, 15*sizeof(uint32_t))
896  ff_ffv1_vk_set_common_sl(avctx, f, sl, sw_format);
897 
898  if (RGB_LINECACHE != 2)
899  SPEC_LIST_ADD(sl, 0, 32, RGB_LINECACHE);
900 
901  if (f->ec && !!(avctx->err_recognition & AV_EF_CRCCHECK))
902  SPEC_LIST_ADD(sl, 1, 32, 1);
903 
904  /* Setup shader */
905  RET(init_setup_shader(f, &ctx->s, &ctx->exec_pool, &fv->setup, sl));
906 
907  /* Reset shader */
908  RET(init_reset_shader(f, &ctx->s, &ctx->exec_pool, &fv->reset, sl, f->ac));
909 
910  /* Decode shaders */
911  RET(init_decode_shader(f, &ctx->s, &ctx->exec_pool, &fv->decode,
912  dctx, hwfc, sl, f->ac, is_rgb, f->bayer));
913 
914  /* Init static data */
916 
917  /* Update setup global descriptors */
918  RET(ff_vk_shader_update_desc_buffer(&ctx->s, &ctx->exec_pool.contexts[0],
919  &fv->setup, 0, 0, 0,
920  &fv->consts_buf,
921  256*sizeof(uint32_t), 512*sizeof(uint8_t),
922  VK_FORMAT_UNDEFINED));
923  RET(ff_vk_shader_update_desc_buffer(&ctx->s, &ctx->exec_pool.contexts[0],
924  &fv->setup, 0, 1, 0,
925  &fv->consts_buf,
926  0, 256*sizeof(uint32_t),
927  VK_FORMAT_UNDEFINED));
928 
929  /* Update decode global descriptors */
930  RET(ff_vk_shader_update_desc_buffer(&ctx->s, &ctx->exec_pool.contexts[0],
931  &fv->decode, 0, 0, 0,
932  &fv->consts_buf,
933  256*sizeof(uint32_t), 512*sizeof(uint8_t),
934  VK_FORMAT_UNDEFINED));
935  RET(ff_vk_shader_update_desc_buffer(&ctx->s, &ctx->exec_pool.contexts[0],
936  &fv->decode, 0, 1, 0,
937  &fv->consts_buf,
938  256*sizeof(uint32_t) + 512*sizeof(uint8_t),
939  VK_WHOLE_SIZE,
940  VK_FORMAT_UNDEFINED));
941 
942 fail:
943  return err;
944 }
945 
947 {
948  AVHWDeviceContext *dev_ctx = _hwctx.nc;
949  AVVulkanDeviceContext *hwctx = dev_ctx->hwctx;
950 
952  FFVulkanDecodePicture *vp = &fp->vp;
953 
954  /* The feedback below is read back on the host: wait for the decode.
955  * The generic free path no longer waits for anything. */
956  if (vp->sem) {
957  VkSemaphoreWaitInfo sem_wait = {
958  .sType = VK_STRUCTURE_TYPE_SEMAPHORE_WAIT_INFO,
959  .pSemaphores = &vp->sem,
960  .pValues = &vp->sem_value,
961  .semaphoreCount = 1,
962  };
963  fp->wait_semaphores(hwctx->act_dev, &sem_wait, UINT64_MAX);
964  }
965 
966  ff_vk_decode_free_frame(dev_ctx, vp);
967 
968  /* No feedback to read if setup failed or the decode was never submitted */
969  if (fp->slice_feedback_buf && vp->sem) {
970  FFVkBuffer *slice_feedback = fp->slice_feedback_buf;
971  uint8_t *ssp = slice_feedback->mapped_mem + 2*fp->slice_num*sizeof(uint32_t);
972 
973  /* Invalidate slice/output data if needed */
974  if (!(slice_feedback->flags & VK_MEMORY_PROPERTY_HOST_COHERENT_BIT)) {
975  VkMappedMemoryRange invalidate_data = {
976  .sType = VK_STRUCTURE_TYPE_MAPPED_MEMORY_RANGE,
977  .memory = slice_feedback->mem,
978  .offset = 0,
979  .size = 2*fp->slice_num*sizeof(uint32_t),
980  };
982  1, &invalidate_data);
983  }
984 
985  int slice_error_cnt = 0;
986  int crc_mismatch_cnt = 0;
987  uint32_t max_overread = 0;
988  for (int i = 0; i < fp->slice_num; i++) {
989  uint32_t crc_res = 0;
990  if (fp->crc_checked)
991  crc_res = AV_RN32(ssp + 2*i*sizeof(uint32_t) + 0);
992  uint32_t overread = AV_RN32(ssp + 2*i*sizeof(uint32_t) + 4);
993  max_overread = FFMAX(overread, max_overread);
994  slice_error_cnt += !!overread;
995  crc_mismatch_cnt += !!crc_res;
996  }
997  if (slice_error_cnt || crc_mismatch_cnt)
998  av_log(dev_ctx, AV_LOG_ERROR, "Decode status: %i slices overread (%i bytes max), "
999  "%i CRCs mismatched\n",
1000  slice_error_cnt, max_overread, crc_mismatch_cnt);
1001  }
1002 
1005 }
1006 
1008  .p.name = "ffv1_vulkan",
1009  .p.type = AVMEDIA_TYPE_VIDEO,
1010  .p.id = AV_CODEC_ID_FFV1,
1011  .p.pix_fmt = AV_PIX_FMT_VULKAN,
1012  .start_frame = &vk_ffv1_start_frame,
1013  .decode_slice = &vk_ffv1_decode_slice,
1014  .end_frame = &vk_ffv1_end_frame,
1015  .free_frame_priv = &vk_ffv1_free_frame_priv,
1016  .frame_priv_data_size = sizeof(FFv1VulkanDecodePicture),
1020  .frame_params = &ff_vk_frame_params,
1021  .priv_data_size = sizeof(FFVulkanDecodeContext),
1023 };
AVHWDeviceContext::hwctx
void * hwctx
The format-specific data, allocated and freed by libavutil along with this context.
Definition: hwcontext.h:88
ff_ffv1_dec_reset_comp_spv_len
const unsigned int ff_ffv1_dec_reset_comp_spv_len
AV_PIX_FMT_GBRAP16
#define AV_PIX_FMT_GBRAP16
Definition: pixfmt.h:571
FFv1VulkanDecodePicture::wait_semaphores
PFN_vkWaitSemaphores wait_semaphores
Definition: vulkan_ffv1.c:84
AV_LOG_WARNING
#define AV_LOG_WARNING
Something somehow does not look correct.
Definition: log.h:216
AVPixelFormat
AVPixelFormat
Pixel format.
Definition: pixfmt.h:71
ff_ffv1_dec_reset_golomb_comp_spv_data
const unsigned char ff_ffv1_dec_reset_golomb_comp_spv_data[]
ff_ffv1_dec_rgb_golomb_comp_spv_data
const unsigned char ff_ffv1_dec_rgb_golomb_comp_spv_data[]
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
AV_PIX_FMT_YA8
@ AV_PIX_FMT_YA8
8 bits gray, 8 bits alpha
Definition: pixfmt.h:140
ff_vk_shader_free
void ff_vk_shader_free(FFVulkanContext *s, FFVulkanShader *shd)
Free a shader.
Definition: vulkan.c:2614
ff_vk_exec_add_dep_refstruct
void ff_vk_exec_add_dep_refstruct(FFVulkanContext *s, FFVkExecContext *e, void *obj)
Execution dependency management.
Definition: vulkan.c:687
av_pix_fmt_desc_get
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
Definition: pixdesc.c:3460
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:37
AVRefStructOpaque
RefStruct is an API for creating reference-counted objects with minimal overhead.
Definition: refstruct.h:58
FFv1ShaderParams::fmt_lut
int fmt_lut[4]
Definition: ffv1_vulkan.h:39
AVHWFramesContext::format
enum AVPixelFormat format
The pixel format identifying the underlying HW surface type.
Definition: hwcontext.h:200
AVCodecContext::err_recognition
int err_recognition
Error recognition; may misdetect some more or less valid parts as errors.
Definition: avcodec.h:1416
FFv1VulkanDecodeContext::slice_feedback_pool
AVRefStructPool * slice_feedback_pool
Definition: vulkan_ffv1.c:98
AV_PIX_FMT_FLAG_FLOAT
#define AV_PIX_FMT_FLAG_FLOAT
The pixel format contains IEEE-754 floating point values.
Definition: pixdesc.h:158
AVRefStructOpaque::nc
void * nc
Definition: refstruct.h:59
FFVulkanDecodePicture::invalidate_memory_ranges
PFN_vkInvalidateMappedMemoryRanges invalidate_memory_ranges
Definition: vulkan_decode.h:105
FFHWAccel::p
AVHWAccel p
The public AVHWAccel.
Definition: hwaccel_internal.h:38
av_frame_free
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
Definition: frame.c:64
FFVkBuffer::host_ref
AVBufferRef * host_ref
Definition: vulkan.h:111
av_hwframe_ctx_init
int av_hwframe_ctx_init(AVBufferRef *ref)
Finalize the context before use.
Definition: hwcontext.c:337
AVFrame
This structure describes decoded (raw) audio or video data.
Definition: frame.h:472
av_hwframe_ctx_alloc
AVBufferRef * av_hwframe_ctx_alloc(AVBufferRef *device_ref_in)
Allocate an AVHWFramesContext tied to a given device context.
Definition: hwcontext.c:263
FFv1VulkanDecodePicture::slice_data_size
uint32_t slice_data_size
Definition: vulkan_ffv1.c:74
data
const char data[16]
Definition: mxf.c:149
FFVulkanDecodeDescriptor::codec_id
enum AVCodecID codec_id
Definition: vulkan_decode.h:30
FFVkBuffer::address
VkDeviceAddress address
Definition: vulkan.h:99
ff_vk_exec_get
FFVkExecContext * ff_vk_exec_get(FFVulkanContext *s, FFVkExecPool *pool)
Retrieve an execution pool.
Definition: vulkan.c:571
FF_VK_REP_NATIVE
@ FF_VK_REP_NATIVE
Definition: vulkan.h:429
FFMAX
#define FFMAX(a, b)
Definition: macros.h:47
SPEC_LIST_ADD
#define SPEC_LIST_ADD(name, idx, val_bits, val)
Definition: vulkan.h:55
ff_ffv1_dec_rgb_float_golomb_comp_spv_data
const unsigned char ff_ffv1_dec_rgb_float_golomb_comp_spv_data[]
AVHWFramesContext::width
int width
The allocated dimensions of the frames in this pool.
Definition: hwcontext.h:220
ff_vk_exec_bind_shader
void ff_vk_exec_bind_shader(FFVulkanContext *s, FFVkExecContext *e, const FFVulkanShader *shd)
Bind a shader.
Definition: vulkan.c:2591
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:777
ff_ffv1_dec_bayer_golomb_comp_spv_data
const unsigned char ff_ffv1_dec_bayer_golomb_comp_spv_data[]
FFv1VulkanDecodeContext::slice_state_pool
AVRefStructPool * slice_state_pool
Definition: vulkan_ffv1.c:96
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:3500
rgb
Definition: rpzaenc.c:60
AV_PIX_FMT_GBRP14
#define AV_PIX_FMT_GBRP14
Definition: pixfmt.h:566
FFHWAccel
Definition: hwaccel_internal.h:34
AVVkFrame::img
VkImage img[AV_NUM_DATA_POINTERS]
Vulkan images to which the memory is bound to.
Definition: hwcontext_vulkan.h:266
ff_ffv1_dec_rgb_float_golomb_comp_spv_len
const unsigned int ff_ffv1_dec_rgb_float_golomb_comp_spv_len
FFv1VulkanDecodeContext::reset
FFVulkanShader reset
Definition: vulkan_ffv1.c:91
FFVulkanDecodePicture::sem_value
uint64_t sem_value
Definition: vulkan_decode.h:84
AV_PIX_FMT_GBRP10
#define AV_PIX_FMT_GBRP10
Definition: pixfmt.h:564
init_indirect
static int init_indirect(AVCodecContext *avctx, FFVulkanContext *s, AVBufferRef **dst, enum AVPixelFormat sw_format)
Definition: vulkan_ffv1.c:796
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:2542
AVVulkanFramesContext
Allocated as AVHWFramesContext.hwctx, used to set pool-specific options.
Definition: hwcontext_vulkan.h:171
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:2027
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:2407
CONTEXT_SIZE
#define CONTEXT_SIZE
Definition: ffv1.h:45
FFv1VulkanDecodeContext::consts_buf
FFVkBuffer consts_buf
Definition: vulkan_ffv1.c:94
FFVulkanDecodeShared
Definition: vulkan_decode.h:38
FFv1VulkanDecodePicture::slice_feedback_buf
FFVkBuffer * slice_feedback_buf
Definition: vulkan_ffv1.c:77
ff_ffv1_dec_setup_comp_spv_data
const unsigned char ff_ffv1_dec_setup_comp_spv_data[]
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
av_frame_alloc
AVFrame * av_frame_alloc(void)
Allocate an AVFrame and set its fields to default values.
Definition: frame.c:52
FFVulkanDescriptorSetBinding::type
VkDescriptorType type
Definition: vulkan.h:83
ff_ffv1_dec_bayer_comp_spv_data
const unsigned char ff_ffv1_dec_bayer_comp_spv_data[]
FFVulkanDecodePicture::slices_buf
FFVkBuffer * slices_buf
Definition: vulkan_decode.h:101
AV_LOG_ERROR
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:210
AVHWFramesContext::height
int height
Definition: hwcontext.h:220
AV_FRAME_FLAG_KEY
#define AV_FRAME_FLAG_KEY
A flag to mark frames that are keyframes.
Definition: frame.h:687
flags
#define flags(name, subs,...)
Definition: cbs_av1.c:504
init_reset_shader
static int init_reset_shader(FFV1Context *f, FFVulkanContext *s, FFVkExecPool *pool, FFVulkanShader *shd, VkSpecializationInfo *sl, int ac)
Definition: vulkan_ffv1.c:632
FFVulkanDecodePicture
Definition: vulkan_decode.h:73
ff_vk_exec_mirror_sem_value
int ff_vk_exec_mirror_sem_value(FFVulkanContext *s, FFVkExecContext *e, VkSemaphore *dst, uint64_t *dst_val, AVFrame *f)
Definition: vulkan.c:856
ff_ffv1_dec_setup_comp_spv_len
const unsigned int ff_ffv1_dec_setup_comp_spv_len
FFv1VulkanDecodeContext
Definition: vulkan_ffv1.c:87
ff_vk_set_perm
void ff_vk_set_perm(enum AVPixelFormat pix_fmt, int lut[4], int inv)
Since storage images may not be swizzled, we have to do this in the shader itself.
Definition: vulkan.c:1526
AVVulkanFramesContext::img_flags
VkImageCreateFlags img_flags
Flags to set during image creation.
Definition: hwcontext_vulkan.h:224
AV_PIX_FMT_GBRAP32
#define AV_PIX_FMT_GBRAP32
Definition: pixfmt.h:572
AVRefStructPool
AVRefStructPool is an API for a thread-safe pool of objects managed via the RefStruct API.
Definition: refstruct.c:183
ctx
static AVFormatContext * ctx
Definition: movenc.c:49
FFv1VulkanDecodePicture::vp
FFVulkanDecodePicture vp
Definition: vulkan_ffv1.c:69
vk_ffv1_decode_slice
static int vk_ffv1_decode_slice(AVCodecContext *avctx, const uint8_t *data, uint32_t size)
Definition: vulkan_ffv1.c:220
FFv1VulkanDecodePicture
Definition: vulkan_ffv1.c:68
av_mallocz
#define av_mallocz(s)
Definition: tableprint_vlc.h:31
vk_decode_ffv1_uninit
static void vk_decode_ffv1_uninit(FFVulkanDecodeShared *ctx)
Definition: vulkan_ffv1.c:832
ff_vk_exec_move_dep_refstruct
void ff_vk_exec_move_dep_refstruct(FFVulkanContext *s, FFVkExecContext *e, void *obj)
Definition: vulkan.c:694
FFv1VulkanDecodePicture::plane_state_size
uint32_t plane_state_size
Definition: vulkan_ffv1.c:72
FFv1ShaderParams::extend_lookup
uint32_t extend_lookup[8]
Definition: ffv1_vulkan.h:36
ff_vk_get_pooled_buffer
int ff_vk_get_pooled_buffer(FFVulkanContext *ctx, AVRefStructPool **buf_pool, FFVkBuffer **buf, VkBufferUsageFlags usage, void *create_pNext, size_t size, VkMemoryPropertyFlagBits mem_props)
Initialize a pool and create AVBufferRefs containing FFVkBuffer.
Definition: vulkan.c:1256
ff_ffv1_dec_golomb_comp_spv_len
const unsigned int ff_ffv1_dec_golomb_comp_spv_len
fail
#define fail
Definition: test.h:479
AVVulkanDeviceContext
Main Vulkan context, allocated as AVHWDeviceContext.hwctx.
Definition: hwcontext_vulkan.h:59
ff_ffv1_vk_init_consts
int ff_ffv1_vk_init_consts(FFVulkanContext *s, FFVkBuffer *vkb, FFV1Context *f)
Definition: ffv1_vulkan.c:85
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
AC_GOLOMB_RICE
#define AC_GOLOMB_RICE
Definition: ffv1.h:52
FFv1VulkanDecodeContext::slice_fltmap_pool
AVRefStructPool * slice_fltmap_pool
Definition: vulkan_ffv1.c:97
av_buffer_unref
void av_buffer_unref(AVBufferRef **buf)
Free a given reference and automatically free the buffer if there are no more references to it.
Definition: buffer.c:139
AVPixFmtDescriptor::nb_components
uint8_t nb_components
The number of components each pixel has, (1-4)
Definition: pixdesc.h:71
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:639
AVCodecContext::internal
struct AVCodecInternal * internal
Private context used for internal data.
Definition: avcodec.h:478
vk_ffv1_end_frame
static int vk_ffv1_end_frame(AVCodecContext *avctx)
Definition: vulkan_ffv1.c:255
AV_RN32
#define AV_RN32(p)
Definition: intreadwrite.h:360
ff_vk_decode_uninit
int ff_vk_decode_uninit(AVCodecContext *avctx)
Free decoder.
Definition: vulkan_decode.c:1220
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:2267
AVVulkanFramesContext::usage
VkImageUsageFlagBits usage
Defines extra usage of output frames.
Definition: hwcontext_vulkan.h:191
SPEC_LIST_CREATE
#define SPEC_LIST_CREATE(name, max_length, max_size)
Definition: vulkan.h:45
ffv1_vulkan.h
AVVkFrame::access
VkAccessFlagBits2 access[AV_NUM_DATA_POINTERS]
Updated after every barrier.
Definition: hwcontext_vulkan.h:290
FFVkBuffer::mapped_mem
uint8_t * mapped_mem
Definition: vulkan.h:103
FFVulkanContext
Definition: vulkan.h:290
ff_ffv1_dec_rgb_float_comp_spv_len
const unsigned int ff_ffv1_dec_rgb_float_comp_spv_len
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:1083
AV_EF_CRCCHECK
#define AV_EF_CRCCHECK
Verify checksums embedded in the bitstream (could be of either encoded or decoded data,...
Definition: defs.h:48
AVPixFmtDescriptor::flags
uint64_t flags
Combination of AV_PIX_FMT_FLAG_...
Definition: pixdesc.h:94
ff_ffv1_dec_rgb_float_comp_spv_data
const unsigned char ff_ffv1_dec_rgb_float_comp_spv_data[]
ff_ffv1_dec_golomb_comp_spv_data
const unsigned char ff_ffv1_dec_golomb_comp_spv_data[]
AV_CODEC_ID_FFV1
@ AV_CODEC_ID_FFV1
Definition: codec_id.h:83
f
f
Definition: af_crystalizer.c:122
ff_vk_buf_barrier
#define ff_vk_buf_barrier(dst, vkb, s_stage, s_access, s_access2, d_stage, d_access, d_access2, offs, bsz)
Definition: vulkan.h:562
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:2581
FFVulkanDescriptorSetBinding
Definition: vulkan.h:81
sem_wait
#define sem_wait(psem)
Definition: semaphore.h:27
AV_WN32
#define AV_WN32(p, v)
Definition: intreadwrite.h:372
AVCodecInternal::hwaccel_priv_data
void * hwaccel_priv_data
hwaccel-specific private data
Definition: internal.h:130
dst
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
Definition: dsp.h:87
AVVkFrame
Definition: hwcontext_vulkan.h:261
i
#define i(width, name, range_min, range_max)
Definition: cbs_h264.c:63
av_err2str
#define av_err2str(errnum)
Convenience macro, the return value should be used only directly in function arguments but never stan...
Definition: error.h:122
for
for(k=2;k<=8;++k)
Definition: h264pred_template.c:424
vk_ffv1_free_frame_priv
static void vk_ffv1_free_frame_priv(AVRefStructOpaque _hwctx, void *data)
Definition: vulkan_ffv1.c:946
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:206
FFVkBuffer::flags
VkMemoryPropertyFlagBits flags
Definition: vulkan.h:97
FFv1VulkanDecodeContext::intermediate_frames_ref
AVBufferRef * intermediate_frames_ref
Definition: vulkan_ffv1.c:88
av_refstruct_ref
void * av_refstruct_ref(void *obj)
Create a new reference to an object managed via this API, i.e.
Definition: refstruct.c:140
ff_ffv1_dec_rgb_comp_spv_len
const unsigned int ff_ffv1_dec_rgb_comp_spv_len
FFVkExecContext
Definition: vulkan.h:128
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:2555
ff_ffv1_dec_comp_spv_data
const unsigned char ff_ffv1_dec_comp_spv_data[]
ff_vk_exec_add_dep_wait_sem
void ff_vk_exec_add_dep_wait_sem(FFVulkanContext *s, FFVkExecContext *e, VkSemaphore sem, uint64_t val, VkPipelineStageFlagBits2 stage)
Definition: vulkan.c:735
ff_ffv1_vk_set_common_sl
void ff_ffv1_vk_set_common_sl(AVCodecContext *avctx, FFV1Context *f, VkSpecializationInfo *sl, enum AVPixelFormat sw_format)
Definition: ffv1_vulkan.c:24
av_refstruct_unref
void av_refstruct_unref(void *objp)
Decrement the reference count of the underlying object and automatically free the object if there are...
Definition: refstruct.c:120
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
ff_ffv1_dec_comp_spv_len
const unsigned int ff_ffv1_dec_comp_spv_len
ff_vk_exec_start
int ff_vk_exec_start(FFVulkanContext *s, FFVkExecContext *e)
Start/submit/wait an execution.
Definition: vulkan.c:599
FFv1VulkanDecodePicture::slice_state_size
uint32_t slice_state_size
Definition: vulkan_ffv1.c:73
AV_PIX_FMT_GBRP12
#define AV_PIX_FMT_GBRP12
Definition: pixfmt.h:565
s
uint8_t s
Definition: llvidencdsp.c:39
FFMIN
#define FFMIN(a, b)
Definition: macros.h:49
ffv1.h
FFVkBuffer::mem
VkDeviceMemory mem
Definition: vulkan.h:96
FFVulkanDecodePicture::sem
VkSemaphore sem
Definition: vulkan_decode.h:83
init_decode_shader
static int init_decode_shader(FFV1Context *f, FFVulkanContext *s, FFVkExecPool *pool, FFVulkanShader *shd, AVHWFramesContext *dec_frames_ctx, AVHWFramesContext *out_frames_ctx, VkSpecializationInfo *sl, int ac, int rgb, int bayer)
Definition: vulkan_ffv1.c:680
uninit
static av_cold void uninit(AVBitStreamFilterContext *ctx)
Definition: lcevc_merge.c:135
ff_vk_free_buf
void ff_vk_free_buf(FFVulkanContext *s, FFVkBuffer *buf)
Definition: vulkan.c:1230
ff_ffv1_dec_reset_golomb_comp_spv_len
const unsigned int ff_ffv1_dec_reset_golomb_comp_spv_len
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:2373
FFv1VulkanDecodePicture::slice_state
FFVkBuffer * slice_state
Definition: vulkan_ffv1.c:71
ff_ffv1_vulkan_hwaccel
const FFHWAccel ff_ffv1_vulkan_hwaccel
Definition: vulkan_ffv1.c:1007
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:1958
AVHWFramesContext::hwctx
void * hwctx
The format-specific data, allocated and freed automatically along with this context.
Definition: hwcontext.h:153
FFVkExecPool
Definition: vulkan.h:268
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:1443
FFVkExecContext::buf
VkCommandBuffer buf
Definition: vulkan.h:139
init_setup_shader
static int init_setup_shader(FFV1Context *f, FFVulkanContext *s, FFVkExecPool *pool, FFVulkanShader *shd, VkSpecializationInfo *sl)
Definition: vulkan_ffv1.c:578
AVCodecContext
main external API structure.
Definition: avcodec.h:443
FFv1VulkanDecodeContext::decode
FFVulkanShader decode
Definition: vulkan_ffv1.c:92
ff_vk_dec_ffv1_desc
const FFVulkanDecodeDescriptor ff_vk_dec_ffv1_desc
Definition: vulkan_ffv1.c:63
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
ff_ffv1_dec_bayer_golomb_comp_spv_len
const unsigned int ff_ffv1_dec_bayer_golomb_comp_spv_len
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
FFv1VulkanDecodePicture::slice_offset
uint32_t * slice_offset
Definition: vulkan_ffv1.c:78
ff_ffv1_dec_reset_comp_spv_data
const unsigned char ff_ffv1_dec_reset_comp_spv_data[]
FFVulkanDecodePicture::dpb_frame
AVFrame * dpb_frame
Definition: vulkan_decode.h:74
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
AVVulkanFramesContext::tiling
VkImageTiling tiling
Controls the tiling of allocated frames.
Definition: hwcontext_vulkan.h:180
AVMEDIA_TYPE_VIDEO
@ AVMEDIA_TYPE_VIDEO
Definition: avutil.h:200
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
AVVulkanDeviceContext::act_dev
VkDevice act_dev
Active device.
Definition: hwcontext_vulkan.h:84
vulkan_decode.h
FFV1Context
Definition: ffv1.h:122
av_refstruct_pool_uninit
static void av_refstruct_pool_uninit(AVRefStructPool **poolp)
Mark the pool as being available for freeing.
Definition: refstruct.h:292
FFv1ShaderParams
Definition: ffv1_vulkan.h:33
ff_vk_count_images
static int ff_vk_count_images(AVVkFrame *f)
Definition: vulkan.h:346
FFALIGN
#define FFALIGN(x, a)
Definition: macros.h:78
AVCodecContext::priv_data
void * priv_data
Definition: avcodec.h:470
FFv1VulkanDecodeContext::setup
FFVulkanShader setup
Definition: vulkan_ffv1.c:90
ff_ffv1_dec_bayer_comp_spv_len
const unsigned int ff_ffv1_dec_bayer_comp_spv_len
av_freep
#define av_freep(p)
Definition: tableprint_vlc.h:35
FFVkBuffer
Definition: vulkan.h:94
FFv1ShaderParams::context_count
uint16_t context_count[8]
Definition: ffv1_vulkan.h:37
ff_vk_exec_submit
int ff_vk_exec_submit(FFVulkanContext *s, FFVkExecContext *e)
Definition: vulkan.c:881
ff_ffv1_dec_rgb_golomb_comp_spv_len
const unsigned int ff_ffv1_dec_rgb_golomb_comp_spv_len
av_log
#define av_log(a,...)
Definition: tableprint_vlc.h:27
AVERROR_INVALIDDATA
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
Definition: error.h:61
ff_vk_decode_init
int ff_vk_decode_init(AVCodecContext *avctx)
Initialize decoder.
Definition: vulkan_decode.c:1231
AVCodecContext::sw_pix_fmt
enum AVPixelFormat sw_pix_fmt
Nominal unaccelerated pixel format, see AV_PIX_FMT_xxx.
Definition: avcodec.h:650
FFv1VulkanDecodePicture::slice_fltmap_buf
FFVkBuffer * slice_fltmap_buf
Definition: vulkan_ffv1.c:76
FFv1ShaderParams::slice_data
VkDeviceAddress slice_data
Definition: ffv1_vulkan.h:34
FFv1VulkanDecodePicture::crc_checked
int crc_checked
Definition: vulkan_ffv1.c:80
ff_ffv1_dec_rgb_comp_spv_data
const unsigned char ff_ffv1_dec_rgb_comp_spv_data[]
RGB_LINECACHE
#define RGB_LINECACHE
Definition: vulkan_ffv1.c:28
av_hwframe_get_buffer
int av_hwframe_get_buffer(AVBufferRef *hwframe_ref, AVFrame *frame, int flags)
Allocate a new frame attached to the given AVHWFramesContext.
Definition: hwcontext.c:506
ff_vk_host_map_buffer
int ff_vk_host_map_buffer(FFVulkanContext *s, FFVkBuffer **dst, uint8_t *src_data, VkDeviceSize size, const AVBufferRef *src_buf, VkBufferUsageFlags usage)
Maps a system RAM buffer into a Vulkan buffer.
Definition: vulkan.c:1352
FFVulkanFunctions
Definition: vulkan_functions.h:276
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:2070
vk_ffv1_start_frame
static int vk_ffv1_start_frame(AVCodecContext *avctx, const AVBufferRef *buffer_ref, av_unused const uint8_t *buffer, av_unused uint32_t size)
Definition: vulkan_ffv1.c:101
vk_decode_ffv1_init
static int vk_decode_ffv1_init(AVCodecContext *avctx)
Definition: vulkan_ffv1.c:851
av_get_pix_fmt_name
const char * av_get_pix_fmt_name(enum AVPixelFormat pix_fmt)
Return the short name for a pixel format, NULL in case pix_fmt is unknown.
Definition: pixdesc.c:3380
FFv1VulkanDecodePicture::slice_num
int slice_num
Definition: vulkan_ffv1.c:79