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;
82 
83 typedef struct FFv1VulkanDecodeContext {
85 
89 
91 
96 
98  const AVBufferRef *buffer_ref,
99  av_unused const uint8_t *buffer,
100  av_unused uint32_t size)
101 {
102  int err;
105  FFv1VulkanDecodeContext *fv = ctx->sd_ctx;
106  FFV1Context *f = avctx->priv_data;
107 
108  FFv1VulkanDecodePicture *fp = f->hwaccel_picture_private;
109  FFVulkanDecodePicture *vp = &fp->vp;
110 
112  enum AVPixelFormat sw_format = hwfc->sw_format;
113 
114  int max_contexts;
115  int is_rgb = !(f->colorspace == 0 && sw_format != AV_PIX_FMT_YA8) &&
116  !(sw_format == AV_PIX_FMT_YA8);
117 
118  fp->slice_num = 0;
119 
120  max_contexts = 0;
121  for (int i = 0; i < f->quant_table_count; i++)
122  max_contexts = FFMAX(f->context_count[i], max_contexts);
123 
124  /* Allocate slice buffer data */
125  if (f->ac == AC_GOLOMB_RICE)
126  fp->plane_state_size = 8;
127  else
129 
130  fp->plane_state_size *= max_contexts;
131  fp->slice_state_size = fp->plane_state_size*f->plane_count;
132 
133  fp->slice_data_size = 256; /* Overestimation for the SliceContext struct */
136 
137  fp->crc_checked = f->ec && (avctx->err_recognition & AV_EF_CRCCHECK);
138 
139  /* The context-less free callback needs these device functions, which
140  * prepare_frame_sdr() used to set. vp->sem is kept for the next
141  * non-keyframe's wait and the free callback's CRC readback. */
142  vp->wait_semaphores = ctx->s.vkfn.WaitSemaphores;
143  vp->invalidate_memory_ranges = ctx->s.vkfn.InvalidateMappedMemoryRanges;
144 
145  /* Host map the input slices data if supported */
146  if (ctx->s.extensions & FF_VK_EXT_EXTERNAL_HOST_MEMORY)
147  ff_vk_host_map_buffer(&ctx->s, &vp->slices_buf, buffer_ref->data,
148  VK_WHOLE_SIZE, buffer_ref,
149  VK_BUFFER_USAGE_STORAGE_BUFFER_BIT |
150  VK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT);
151 
152  /* Allocate slice state data */
153  if (f->picture.f->flags & AV_FRAME_FLAG_KEY) {
155  &fp->slice_state,
156  VK_BUFFER_USAGE_STORAGE_BUFFER_BIT,
157  NULL, f->slice_count*fp->slice_state_size,
158  VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT);
159  if (err < 0)
160  return err;
161  } else {
162  FFv1VulkanDecodePicture *fpl = f->hwaccel_last_picture_private;
163 
164  /* The previous frame's setup may have failed partway */
165  if (!fpl || !fpl->slice_state)
166  return AVERROR_INVALIDDATA;
167 
169  if (!fp->slice_state)
170  return AVERROR(ENOMEM);
171  }
172 
173  /* Allocate slice offsets/status buffer */
175  &fp->slice_feedback_buf,
176  VK_BUFFER_USAGE_STORAGE_BUFFER_BIT,
177  NULL, 2*(2*f->slice_count*sizeof(uint32_t)),
178  VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT |
179  VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT);
180  if (err < 0)
181  return err;
182 
183  /* Allocate slice offsets/status buffer (note, for integer+remap, we don't need it) */
184  if (f->version >=4 && f->micro_version >= 9 &&
187  &fp->slice_fltmap_buf,
188  VK_BUFFER_USAGE_STORAGE_BUFFER_BIT,
189  NULL, 65536*4*f->slice_count*sizeof(uint32_t),
190  VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT |
191  VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT);
192  if (err < 0)
193  return err;
194  }
195 
196  /* Create a temporaty frame for RGB */
197  if (is_rgb) {
198  vp->dpb_frame = av_frame_alloc();
199  if (!vp->dpb_frame)
200  return AVERROR(ENOMEM);
201 
203  vp->dpb_frame, 0);
204  if (err < 0)
205  return err;
206  }
207 
208  return 0;
209 }
210 
212  const uint8_t *data,
213  uint32_t size)
214 {
215  FFV1Context *f = avctx->priv_data;
216 
217  FFv1VulkanDecodePicture *fp = f->hwaccel_picture_private;
218  FFVulkanDecodePicture *vp = &fp->vp;
219 
220  FFVkBuffer *slice_offset = (FFVkBuffer *)fp->slice_feedback_buf->data;
221  FFVkBuffer *slices_buf = vp->slices_buf ? (FFVkBuffer *)vp->slices_buf->data : NULL;
222 
223  if (slices_buf && slices_buf->host_ref) {
224  AV_WN32(slice_offset->mapped_mem + (2*fp->slice_num + 0)*sizeof(uint32_t),
225  data - slices_buf->mapped_mem);
226  AV_WN32(slice_offset->mapped_mem + (2*fp->slice_num + 1)*sizeof(uint32_t),
227  size);
228 
229  fp->slice_num++;
230  } else {
231  int err = ff_vk_decode_add_slice(avctx, vp, data, size, 0,
232  &fp->slice_num,
233  (const uint32_t **)&fp->slice_offset);
234  if (err < 0)
235  return err;
236 
237  AV_WN32(slice_offset->mapped_mem + (2*(fp->slice_num - 1) + 0)*sizeof(uint32_t),
238  fp->slice_offset[fp->slice_num - 1]);
239  AV_WN32(slice_offset->mapped_mem + (2*(fp->slice_num - 1) + 1)*sizeof(uint32_t),
240  size);
241  }
242 
243  return 0;
244 }
245 
247 {
248  int err;
251  FFVulkanFunctions *vk = &ctx->s.vkfn;
252 
253  FFV1Context *f = avctx->priv_data;
254  FFv1VulkanDecodeContext *fv = ctx->sd_ctx;
255 
257  enum AVPixelFormat sw_format = hwfc->sw_format;
258 
259  int is_rgb = !(f->colorspace == 0 && sw_format != AV_PIX_FMT_YA8) &&
260  !(sw_format == AV_PIX_FMT_YA8);
261  int color_planes = av_pix_fmt_desc_get(avctx->sw_pix_fmt)->nb_components;
262 
263  FFv1VulkanDecodePicture *fp = f->hwaccel_picture_private;
264  FFVulkanDecodePicture *vp = &fp->vp;
265 
266  FFVkBuffer *slices_buf = (FFVkBuffer *)vp->slices_buf->data;
267  FFVkBuffer *slice_state = (FFVkBuffer *)fp->slice_state->data;
268  FFVkBuffer *slice_feedback = (FFVkBuffer *)fp->slice_feedback_buf->data;
269  FFVkBuffer *fltmap_buf = NULL;
270  if (fp->slice_fltmap_buf)
271  fltmap_buf = (FFVkBuffer *)fp->slice_fltmap_buf->data;
272 
273  VkImageView output_views[AV_NUM_DATA_POINTERS];
274  VkImageView rct_image_views[AV_NUM_DATA_POINTERS];
275 
276  VkImageMemoryBarrier2 img_bar[37];
277  int nb_img_bar = 0;
278  VkBufferMemoryBarrier2 buf_bar[8];
279  int nb_buf_bar = 0;
280 
281  FFVkExecContext *exec = ff_vk_exec_get(&ctx->s, &ctx->exec_pool);
282  ff_vk_exec_start(&ctx->s, exec);
283 
284  /* Prepare deps */
285  RET(ff_vk_exec_add_dep_frame(&ctx->s, exec, f->picture.f,
286  VK_PIPELINE_STAGE_2_ALL_COMMANDS_BIT,
287  VK_PIPELINE_STAGE_2_COMPUTE_SHADER_BIT));
288 
289  err = ff_vk_exec_mirror_sem_value(&ctx->s, exec, &vp->sem, &vp->sem_value,
290  f->picture.f);
291  if (err < 0)
292  return err;
293 
294  /* Exec-owned output views (vp->sem is still mirrored above, for the next
295  * frame's dependency and the free callback's CRC readback). */
296  RET(ff_vk_create_imageviews(&ctx->s, exec, output_views, f->picture.f,
298 
299  if (is_rgb) {
300  RET(ff_vk_create_imageviews(&ctx->s, exec, rct_image_views,
302  RET(ff_vk_exec_add_dep_frame(&ctx->s, exec, vp->dpb_frame,
303  VK_PIPELINE_STAGE_2_ALL_COMMANDS_BIT,
304  VK_PIPELINE_STAGE_2_CLEAR_BIT));
305  }
306 
307  if (!(f->picture.f->flags & AV_FRAME_FLAG_KEY)) {
308  FFv1VulkanDecodePicture *fpl = f->hwaccel_last_picture_private;
309  FFVulkanDecodePicture *vpl = &fpl->vp;
310 
311  /* Wait on the previous frame, if its decode was ever submitted */
312  if (vpl->sem)
313  RET(ff_vk_exec_add_dep_wait_sem(&ctx->s, exec, vpl->sem, vpl->sem_value,
314  VK_PIPELINE_STAGE_2_ALL_COMMANDS_BIT));
315  }
316 
317  RET(ff_vk_exec_add_dep_buf(&ctx->s, exec, &fp->slice_state, 1, 1));
318  RET(ff_vk_exec_add_dep_buf(&ctx->s, exec, &fp->slice_feedback_buf, 1, 1));
319  RET(ff_vk_exec_add_dep_buf(&ctx->s, exec, &vp->slices_buf, 1, 0));
320  vp->slices_buf = NULL;
321 
322  if (fp->slice_fltmap_buf) {
323  RET(ff_vk_exec_add_dep_buf(&ctx->s, exec, &fp->slice_fltmap_buf, 1, 0));
324  fp->slice_fltmap_buf = NULL;
325  }
326 
327  AVVkFrame *vkf = (AVVkFrame *)f->picture.f->data[0];
328  for (int i = 0; i < ff_vk_count_images(vkf); i++) {
329  vkf->layout[i] = VK_IMAGE_LAYOUT_UNDEFINED;
330  vkf->access[i] = VK_ACCESS_2_NONE;
331  }
332 
333  /* Setup shader */
334  ff_vk_shader_update_desc_buffer(&ctx->s, exec, &fv->setup,
335  1, 0, 0,
336  slice_state,
337  0, fp->slice_data_size*f->slice_count,
338  VK_FORMAT_UNDEFINED);
339  ff_vk_shader_update_desc_buffer(&ctx->s, exec, &fv->setup,
340  1, 1, 0,
341  slice_feedback,
342  0, 2*f->slice_count*sizeof(uint32_t),
343  VK_FORMAT_UNDEFINED);
344  ff_vk_shader_update_desc_buffer(&ctx->s, exec, &fv->setup,
345  1, 2, 0,
346  slice_feedback,
347  2*f->slice_count*sizeof(uint32_t),
348  VK_WHOLE_SIZE,
349  VK_FORMAT_UNDEFINED);
350  /* The binding is statically used by the shader, so it must always hold
351  * a valid buffer. */
352  ff_vk_shader_update_desc_buffer(&ctx->s, exec, &fv->setup,
353  1, 3, 0,
354  fltmap_buf ? fltmap_buf : slice_feedback,
355  0,
356  VK_WHOLE_SIZE,
357  VK_FORMAT_UNDEFINED);
358 
359  ff_vk_exec_bind_shader(&ctx->s, exec, &fv->setup);
360 
361  FFv1ShaderParams pd = {
362  .slice_data = slices_buf->address,
363 
364  .img_size[0] = f->picture.f->width,
365  .img_size[1] = f->picture.f->height,
366 
367  .plane_state_size = fp->plane_state_size,
368  .key_frame = f->picture.f->flags & AV_FRAME_FLAG_KEY,
369  .crcref = f->crcref,
370  .micro_version = f->micro_version,
371  .remap_allowed = !!fltmap_buf,
372  };
373 
374  for (int i = 0; i < f->quant_table_count; i++) {
375  pd.context_count[i] = f->context_count[i];
376  pd.extend_lookup[i] = f->quant_tables[i][3][127] ||
377  f->quant_tables[i][4][127];
378  }
379 
380  /* For some reason the C FFv1 encoder/decoder treats these differently */
381  if (sw_format == AV_PIX_FMT_GBRP10 || sw_format == AV_PIX_FMT_GBRP12 ||
382  sw_format == AV_PIX_FMT_GBRP14)
383  memcpy(pd.fmt_lut, (int [4]) { 2, 1, 0, 3 }, 4*sizeof(int));
384  else
385  ff_vk_set_perm(sw_format, pd.fmt_lut, 0);
386 
387  ff_vk_shader_update_push_const(&ctx->s, exec, &fv->setup,
388  VK_SHADER_STAGE_COMPUTE_BIT,
389  0, sizeof(FFv1ShaderParams), &pd);
390 
391  vk->CmdDispatch(exec->buf, f->num_h_slices, f->num_v_slices, 1);
392 
393  if (is_rgb) {
394  vkf = (AVVkFrame *)vp->dpb_frame->data[0];
395  for (int i = 0; i < 4; i++) {
396  vkf->layout[i] = VK_IMAGE_LAYOUT_UNDEFINED;
397  vkf->access[i] = VK_ACCESS_2_NONE;
398  }
399 
400  ff_vk_frame_barrier(&ctx->s, exec, vp->dpb_frame, img_bar, &nb_img_bar,
401  VK_PIPELINE_STAGE_2_ALL_COMMANDS_BIT,
402  VK_PIPELINE_STAGE_2_CLEAR_BIT,
403  VK_ACCESS_2_TRANSFER_WRITE_BIT,
404  VK_IMAGE_LAYOUT_GENERAL,
405  VK_QUEUE_FAMILY_IGNORED);
406 
407  vk->CmdPipelineBarrier2(exec->buf, &(VkDependencyInfo) {
408  .sType = VK_STRUCTURE_TYPE_DEPENDENCY_INFO,
409  .pImageMemoryBarriers = img_bar,
410  .imageMemoryBarrierCount = nb_img_bar,
411  .pBufferMemoryBarriers = buf_bar,
412  .bufferMemoryBarrierCount = nb_buf_bar,
413  });
414  nb_img_bar = 0;
415  nb_buf_bar = 0;
416 
417  /* The intermediate frame has 4 planes (GBRAP16/32). Clear all of
418  * them since the bayer decoder uses all four. */
419  int n_dec_planes = f->bayer ? 4 : color_planes;
420  for (int i = 0; i < n_dec_planes; i++)
421  vk->CmdClearColorImage(exec->buf, vkf->img[i], VK_IMAGE_LAYOUT_GENERAL,
422  &((VkClearColorValue) { 0 }),
423  1, &((VkImageSubresourceRange) {
424  .aspectMask = VK_IMAGE_ASPECT_COLOR_BIT,
425  .levelCount = 1,
426  .layerCount = 1,
427  }));
428  }
429 
430  /* Sync between setup and reset shaders */
431  ff_vk_buf_barrier(buf_bar[nb_buf_bar++], slice_state,
432  COMPUTE_SHADER_BIT, SHADER_STORAGE_READ_BIT,
433  SHADER_STORAGE_WRITE_BIT,
434  COMPUTE_SHADER_BIT, SHADER_STORAGE_READ_BIT, NONE_KHR,
435  0, fp->slice_data_size*f->slice_count);
436 
437  /* Probability data barrier for P-frames */
438  if (!(f->picture.f->flags & AV_FRAME_FLAG_KEY))
439  ff_vk_buf_barrier(buf_bar[nb_buf_bar++], slice_state,
440  COMPUTE_SHADER_BIT, SHADER_STORAGE_READ_BIT,
441  SHADER_STORAGE_WRITE_BIT,
442  COMPUTE_SHADER_BIT, SHADER_STORAGE_WRITE_BIT, NONE_KHR,
443  fp->slice_data_size*f->slice_count, VK_WHOLE_SIZE);
444 
445  vk->CmdPipelineBarrier2(exec->buf, &(VkDependencyInfo) {
446  .sType = VK_STRUCTURE_TYPE_DEPENDENCY_INFO,
447  .pImageMemoryBarriers = img_bar,
448  .imageMemoryBarrierCount = nb_img_bar,
449  .pBufferMemoryBarriers = buf_bar,
450  .bufferMemoryBarrierCount = nb_buf_bar,
451  });
452  nb_buf_bar = 0;
453  nb_img_bar = 0;
454 
455  /* Reset shader */
456  ff_vk_shader_update_desc_buffer(&ctx->s, exec, &fv->reset,
457  1, 0, 0,
458  slice_state,
459  0, fp->slice_data_size*f->slice_count,
460  VK_FORMAT_UNDEFINED);
461  ff_vk_shader_update_desc_buffer(&ctx->s, exec, &fv->reset,
462  1, 1, 0,
463  slice_state,
464  f->slice_count*fp->slice_data_size,
465  VK_WHOLE_SIZE,
466  VK_FORMAT_UNDEFINED);
467 
468  ff_vk_exec_bind_shader(&ctx->s, exec, &fv->reset);
469  ff_vk_shader_update_push_const(&ctx->s, exec, &fv->reset,
470  VK_SHADER_STAGE_COMPUTE_BIT,
471  0, sizeof(FFv1ShaderParams), &pd);
472 
473  vk->CmdDispatch(exec->buf, f->num_h_slices, f->num_v_slices,
474  f->plane_count);
475 
476  /* Sync probabilities between reset and decode shaders */
477  ff_vk_buf_barrier(buf_bar[nb_buf_bar++], slice_state,
478  COMPUTE_SHADER_BIT, SHADER_STORAGE_WRITE_BIT, NONE_KHR,
479  COMPUTE_SHADER_BIT, SHADER_STORAGE_READ_BIT,
480  SHADER_STORAGE_WRITE_BIT,
481  fp->slice_data_size*f->slice_count, VK_WHOLE_SIZE);
482 
483  /* Input frame barrier */
484  ff_vk_frame_barrier(&ctx->s, exec, f->picture.f, img_bar, &nb_img_bar,
485  VK_PIPELINE_STAGE_2_ALL_COMMANDS_BIT,
486  VK_PIPELINE_STAGE_2_COMPUTE_SHADER_BIT,
487  VK_ACCESS_SHADER_WRITE_BIT |
488  (!is_rgb ? VK_ACCESS_SHADER_READ_BIT : 0),
489  VK_IMAGE_LAYOUT_GENERAL,
490  VK_QUEUE_FAMILY_IGNORED);
491  if (is_rgb)
492  ff_vk_frame_barrier(&ctx->s, exec, vp->dpb_frame, img_bar, &nb_img_bar,
493  VK_PIPELINE_STAGE_2_CLEAR_BIT,
494  VK_PIPELINE_STAGE_2_COMPUTE_SHADER_BIT,
495  VK_ACCESS_SHADER_READ_BIT | VK_ACCESS_SHADER_WRITE_BIT,
496  VK_IMAGE_LAYOUT_GENERAL,
497  VK_QUEUE_FAMILY_IGNORED);
498 
499  vk->CmdPipelineBarrier2(exec->buf, &(VkDependencyInfo) {
500  .sType = VK_STRUCTURE_TYPE_DEPENDENCY_INFO,
501  .pImageMemoryBarriers = img_bar,
502  .imageMemoryBarrierCount = nb_img_bar,
503  .pBufferMemoryBarriers = buf_bar,
504  .bufferMemoryBarrierCount = nb_buf_bar,
505  });
506  nb_img_bar = 0;
507  nb_buf_bar = 0;
508 
509  /* Decode */
511  1, 0, 0,
512  slice_state,
513  0, fp->slice_data_size*f->slice_count,
514  VK_FORMAT_UNDEFINED);
516  1, 1, 0,
517  slice_feedback,
518  0, 2*f->slice_count*sizeof(uint32_t),
519  VK_FORMAT_UNDEFINED);
521  1, 2, 0,
522  slice_feedback,
523  2*f->slice_count*sizeof(uint32_t),
524  VK_WHOLE_SIZE,
525  VK_FORMAT_UNDEFINED);
527  1, 3, 0,
528  slice_state,
529  f->slice_count*fp->slice_data_size,
530  VK_WHOLE_SIZE,
531  VK_FORMAT_UNDEFINED);
532 
533  AVFrame *decode_dst = is_rgb ? vp->dpb_frame : f->picture.f;
534  VkImageView *decode_dst_view = is_rgb ? rct_image_views : output_views;
535  ff_vk_shader_update_img_array(&ctx->s, exec, &fv->decode,
536  decode_dst, decode_dst_view,
537  1, 4,
538  VK_IMAGE_LAYOUT_GENERAL,
539  VK_NULL_HANDLE);
540  if (is_rgb)
541  ff_vk_shader_update_img_array(&ctx->s, exec, &fv->decode,
542  f->picture.f, output_views,
543  1, 5,
544  VK_IMAGE_LAYOUT_GENERAL,
545  VK_NULL_HANDLE);
546  if (fltmap_buf)
548  1, 6, 0,
549  fltmap_buf,
550  0,
551  VK_WHOLE_SIZE,
552  VK_FORMAT_UNDEFINED);
553 
554  ff_vk_exec_bind_shader(&ctx->s, exec, &fv->decode);
555  ff_vk_shader_update_push_const(&ctx->s, exec, &fv->decode,
556  VK_SHADER_STAGE_COMPUTE_BIT,
557  0, sizeof(FFv1ShaderParams), &pd);
558 
559  vk->CmdDispatch(exec->buf, f->num_h_slices, f->num_v_slices, 1);
560 
561  err = ff_vk_exec_submit(&ctx->s, exec);
562  if (err < 0)
563  return err;
564 
565  /* We don't need the temporary frame after decoding */
566  av_frame_free(&vp->dpb_frame);
567 
568 fail:
569  return 0;
570 }
571 
573  FFVkExecPool *pool, FFVulkanShader *shd,
574  VkSpecializationInfo *sl)
575 {
576  int err;
577 
578  ff_vk_shader_load(shd, VK_SHADER_STAGE_COMPUTE_BIT, sl,
579  (uint32_t []) { 1, 1, 1 }, 0);
580 
582  VK_SHADER_STAGE_COMPUTE_BIT);
583 
584  const FFVulkanDescriptorSetBinding desc_set_const[] = {
585  { /* rangecoder_buf */
586  .type = VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER,
587  .stages = VK_SHADER_STAGE_COMPUTE_BIT,
588  },
589  { /* crc_ieee_buf */
590  .type = VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER,
591  .stages = VK_SHADER_STAGE_COMPUTE_BIT,
592  },
593  };
594  ff_vk_shader_add_descriptor_set(s, shd, desc_set_const, 2, 1);
595 
596  const FFVulkanDescriptorSetBinding desc_set[] = {
597  { /* slice_data_buf */
598  .type = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER,
599  .stages = VK_SHADER_STAGE_COMPUTE_BIT,
600  },
601  { /* slice_offsets_buf */
602  .type = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER,
603  .stages = VK_SHADER_STAGE_COMPUTE_BIT,
604  },
605  { /* slice_status_buf */
606  .type = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER,
607  .stages = VK_SHADER_STAGE_COMPUTE_BIT,
608  },
609  { /* fltmap_buf */
610  .type = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER,
611  .stages = VK_SHADER_STAGE_COMPUTE_BIT,
612  },
613  };
614  ff_vk_shader_add_descriptor_set(s, shd, desc_set, 4, 0);
615 
616  RET(ff_vk_shader_link(s, shd,
619 
620  RET(ff_vk_shader_register_exec(s, pool, shd));
621 
622 fail:
623  return err;
624 }
625 
627  FFVkExecPool *pool, FFVulkanShader *shd,
628  VkSpecializationInfo *sl, int ac)
629 {
630  int err;
631  int wg_dim = FFMIN(s->props.properties.limits.maxComputeWorkGroupSize[0], 1024);
632 
633  ff_vk_shader_load(shd, VK_SHADER_STAGE_COMPUTE_BIT, sl,
634  (uint32_t []) { wg_dim, 1, 1 }, 0);
635 
637  VK_SHADER_STAGE_COMPUTE_BIT);
638 
639  const FFVulkanDescriptorSetBinding desc_set_const[] = {
640  { /* rangecoder_buf */
641  .type = VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER,
642  .stages = VK_SHADER_STAGE_COMPUTE_BIT,
643  },
644  };
645  ff_vk_shader_add_descriptor_set(s, shd, desc_set_const, 1, 1);
646 
647  const FFVulkanDescriptorSetBinding desc_set[] = {
648  { /* slice_data_buf */
649  .type = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER,
650  .stages = VK_SHADER_STAGE_COMPUTE_BIT,
651  },
652  { /* slice_state_buf */
653  .type = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER,
654  .stages = VK_SHADER_STAGE_COMPUTE_BIT,
655  },
656  };
657  ff_vk_shader_add_descriptor_set(s, shd, desc_set, 2, 0);
658 
659  if (ac == AC_GOLOMB_RICE)
660  RET(ff_vk_shader_link(s, shd,
663  else
664  RET(ff_vk_shader_link(s, shd,
667 
668  RET(ff_vk_shader_register_exec(s, pool, shd));
669 
670 fail:
671  return err;
672 }
673 
675  FFVkExecPool *pool, FFVulkanShader *shd,
676  AVHWFramesContext *dec_frames_ctx,
677  AVHWFramesContext *out_frames_ctx,
678  VkSpecializationInfo *sl, int ac, int rgb,
679  int bayer)
680 {
681  int err;
682 
683  uint32_t wg_x = ac != AC_GOLOMB_RICE ? CONTEXT_SIZE : 1;
684  ff_vk_shader_load(shd, VK_SHADER_STAGE_COMPUTE_BIT, sl,
685  (uint32_t []) { wg_x, 1, 1 }, 0);
686 
688  VK_SHADER_STAGE_COMPUTE_BIT);
689 
690  const FFVulkanDescriptorSetBinding desc_set_const[] = {
691  { /* rangecoder_buf */
692  .type = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER,
693  .stages = VK_SHADER_STAGE_COMPUTE_BIT,
694  },
695  { /* quant_buf */
696  .type = VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER,
697  .stages = VK_SHADER_STAGE_COMPUTE_BIT,
698  },
699  };
700  ff_vk_shader_add_descriptor_set(s, shd, desc_set_const, 2, 1);
701 
702  const FFVulkanDescriptorSetBinding desc_set[] = {
703  { /* slice_data_buf */
704  .type = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER,
705  .stages = VK_SHADER_STAGE_COMPUTE_BIT,
706  },
707  { /* slice_offsets_buf */
708  .type = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER,
709  .stages = VK_SHADER_STAGE_COMPUTE_BIT,
710  },
711  { /* slice_status_buf */
712  .type = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER,
713  .stages = VK_SHADER_STAGE_COMPUTE_BIT,
714  },
715  { /* slice_state_buf */
716  .type = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER,
717  .stages = VK_SHADER_STAGE_COMPUTE_BIT,
718  },
719  { /* dec */
720  .type = VK_DESCRIPTOR_TYPE_STORAGE_IMAGE,
721  .stages = VK_SHADER_STAGE_COMPUTE_BIT,
722  .elems = av_pix_fmt_count_planes(dec_frames_ctx->sw_format),
723  },
724  { /* dst */
725  .type = VK_DESCRIPTOR_TYPE_STORAGE_IMAGE,
726  .stages = VK_SHADER_STAGE_COMPUTE_BIT,
727  .elems = av_pix_fmt_count_planes(out_frames_ctx->sw_format),
728  },
729  { /* fltmap_buf */
730  .type = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER,
731  .stages = VK_SHADER_STAGE_COMPUTE_BIT,
732  },
733  };
734  /* Detect a float output from the pixfmt descriptor instead of f->flt:
735  * the encoder side does not (yet) write f->flt to the extradata, so the
736  * parsed value is unreliable for some v4m4+ streams. The descriptor's
737  * FLOAT flag is set by the pixfmt selection logic and is accurate */
738  int is_float = !!(av_pix_fmt_desc_get(out_frames_ctx->sw_format)->flags &
740 
741  /* Bindings 5 (dst) and 6 (fltmap_buf) are conditional */
742  ff_vk_shader_add_descriptor_set(s, shd, desc_set,
743  5 + rgb + (is_float && !bayer),
744  0);
745 
746  if (bayer) {
747  if (ac == AC_GOLOMB_RICE)
748  ff_vk_shader_link(s, shd,
751  else
752  ff_vk_shader_link(s, shd,
755  } else if (is_float) {
756  if (ac == AC_GOLOMB_RICE)
757  ff_vk_shader_link(s, shd,
760  else
761  ff_vk_shader_link(s, shd,
764  } else if (ac == AC_GOLOMB_RICE) {
765  if (rgb)
766  ff_vk_shader_link(s, shd,
769  else
770  ff_vk_shader_link(s, shd,
773  } else {
774  if (rgb)
775  ff_vk_shader_link(s, shd,
778  else
779  ff_vk_shader_link(s, shd,
781  ff_ffv1_dec_comp_spv_len, "main");
782  }
783 
784  RET(ff_vk_shader_register_exec(s, pool, shd));
785 
786 fail:
787  return err;
788 }
789 
791  AVBufferRef **dst, enum AVPixelFormat sw_format)
792 {
793  int err;
794  AVHWFramesContext *frames_ctx;
795  AVVulkanFramesContext *vk_frames;
796  FFV1Context *f = avctx->priv_data;
797 
798  *dst = av_hwframe_ctx_alloc(s->device_ref);
799  if (!(*dst))
800  return AVERROR(ENOMEM);
801 
802  frames_ctx = (AVHWFramesContext *)((*dst)->data);
803  frames_ctx->format = AV_PIX_FMT_VULKAN;
804  frames_ctx->sw_format = sw_format;
805  frames_ctx->width = s->frames->width;
806  frames_ctx->height = f->num_v_slices*RGB_LINECACHE;
807 
808  vk_frames = frames_ctx->hwctx;
809  vk_frames->tiling = VK_IMAGE_TILING_OPTIMAL;
810  vk_frames->img_flags = VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT;
811  vk_frames->usage = VK_IMAGE_USAGE_STORAGE_BIT |
812  VK_IMAGE_USAGE_TRANSFER_DST_BIT;
813 
814  err = av_hwframe_ctx_init(*dst);
815  if (err < 0) {
816  av_log(avctx, AV_LOG_ERROR,
817  "Unable to initialize frame pool with format %s: %s\n",
818  av_get_pix_fmt_name(sw_format), av_err2str(err));
820  return err;
821  }
822 
823  return 0;
824 }
825 
827 {
828  FFv1VulkanDecodeContext *fv = ctx->sd_ctx;
829 
831 
832  ff_vk_shader_free(&ctx->s, &fv->setup);
833  ff_vk_shader_free(&ctx->s, &fv->reset);
834  ff_vk_shader_free(&ctx->s, &fv->decode);
835 
836  ff_vk_free_buf(&ctx->s, &fv->consts_buf);
837 
841 
842  av_freep(&fv);
843 }
844 
846 {
847  int err;
848  FFV1Context *f = avctx->priv_data;
852 
853  if (f->version < 3)
854  return AVERROR(ENOTSUP);
855 
856  /* Streams with a low amount of slices will usually be much slower
857  * to decode, so warn the user. Use the slice structure from the
858  * extradata: slice_count is only set during frame decoding. */
859  if (f->num_h_slices * f->num_v_slices < 16)
860  av_log(avctx, AV_LOG_WARNING, "Stream has a low number of slices (%i), "
861  "decoding may be very slow\n", f->num_h_slices * f->num_v_slices);
862 
863  err = ff_vk_decode_init(avctx);
864  if (err < 0)
865  return err;
866  ctx = dec->shared_ctx;
867 
868  fv = ctx->sd_ctx = av_mallocz(sizeof(*fv));
869  if (!fv) {
870  err = AVERROR(ENOMEM);
871  goto fail;
872  }
873 
874  ctx->sd_ctx_free = &vk_decode_ffv1_uninit;
875 
877  AVHWFramesContext *dctx = hwfc;
878  enum AVPixelFormat sw_format = hwfc->sw_format;
879  int is_rgb = !(f->colorspace == 0 && sw_format != AV_PIX_FMT_YA8) &&
880  !(sw_format == AV_PIX_FMT_YA8);
881 
882  /* Intermediate frame pool for RCT */
883  if (is_rgb) {
884  RET(init_indirect(avctx, &ctx->s, &fv->intermediate_frames_ref,
885  f->use32bit ? AV_PIX_FMT_GBRAP32 : AV_PIX_FMT_GBRAP16));
887  }
888 
889  SPEC_LIST_CREATE(sl, 15, 15*sizeof(uint32_t))
890  ff_ffv1_vk_set_common_sl(avctx, f, sl, sw_format);
891 
892  if (RGB_LINECACHE != 2)
893  SPEC_LIST_ADD(sl, 0, 32, RGB_LINECACHE);
894 
895  if (f->ec && !!(avctx->err_recognition & AV_EF_CRCCHECK))
896  SPEC_LIST_ADD(sl, 1, 32, 1);
897 
898  /* Setup shader */
899  RET(init_setup_shader(f, &ctx->s, &ctx->exec_pool, &fv->setup, sl));
900 
901  /* Reset shader */
902  RET(init_reset_shader(f, &ctx->s, &ctx->exec_pool, &fv->reset, sl, f->ac));
903 
904  /* Decode shaders */
905  RET(init_decode_shader(f, &ctx->s, &ctx->exec_pool, &fv->decode,
906  dctx, hwfc, sl, f->ac, is_rgb, f->bayer));
907 
908  /* Init static data */
910 
911  /* Update setup global descriptors */
912  RET(ff_vk_shader_update_desc_buffer(&ctx->s, &ctx->exec_pool.contexts[0],
913  &fv->setup, 0, 0, 0,
914  &fv->consts_buf,
915  256*sizeof(uint32_t), 512*sizeof(uint8_t),
916  VK_FORMAT_UNDEFINED));
917  RET(ff_vk_shader_update_desc_buffer(&ctx->s, &ctx->exec_pool.contexts[0],
918  &fv->setup, 0, 1, 0,
919  &fv->consts_buf,
920  0, 256*sizeof(uint32_t),
921  VK_FORMAT_UNDEFINED));
922 
923  /* Update decode global descriptors */
924  RET(ff_vk_shader_update_desc_buffer(&ctx->s, &ctx->exec_pool.contexts[0],
925  &fv->decode, 0, 0, 0,
926  &fv->consts_buf,
927  256*sizeof(uint32_t), 512*sizeof(uint8_t),
928  VK_FORMAT_UNDEFINED));
929  RET(ff_vk_shader_update_desc_buffer(&ctx->s, &ctx->exec_pool.contexts[0],
930  &fv->decode, 0, 1, 0,
931  &fv->consts_buf,
932  256*sizeof(uint32_t) + 512*sizeof(uint8_t),
933  VK_WHOLE_SIZE,
934  VK_FORMAT_UNDEFINED));
935 
936 fail:
937  return err;
938 }
939 
941 {
942  AVHWDeviceContext *dev_ctx = _hwctx.nc;
943  AVVulkanDeviceContext *hwctx = dev_ctx->hwctx;
944 
946  FFVulkanDecodePicture *vp = &fp->vp;
947 
948  ff_vk_decode_free_frame(dev_ctx, vp);
949 
950  /* No feedback to read if setup failed or the decode was never submitted */
951  if (fp->slice_feedback_buf && vp->sem) {
952  FFVkBuffer *slice_feedback = (FFVkBuffer *)fp->slice_feedback_buf->data;
953  uint8_t *ssp = slice_feedback->mapped_mem + 2*fp->slice_num*sizeof(uint32_t);
954 
955  /* Invalidate slice/output data if needed */
956  if (!(slice_feedback->flags & VK_MEMORY_PROPERTY_HOST_COHERENT_BIT)) {
957  VkMappedMemoryRange invalidate_data = {
958  .sType = VK_STRUCTURE_TYPE_MAPPED_MEMORY_RANGE,
959  .memory = slice_feedback->mem,
960  .offset = 0,
961  .size = 2*fp->slice_num*sizeof(uint32_t),
962  };
964  1, &invalidate_data);
965  }
966 
967  int slice_error_cnt = 0;
968  int crc_mismatch_cnt = 0;
969  uint32_t max_overread = 0;
970  for (int i = 0; i < fp->slice_num; i++) {
971  uint32_t crc_res = 0;
972  if (fp->crc_checked)
973  crc_res = AV_RN32(ssp + 2*i*sizeof(uint32_t) + 0);
974  uint32_t overread = AV_RN32(ssp + 2*i*sizeof(uint32_t) + 4);
975  max_overread = FFMAX(overread, max_overread);
976  slice_error_cnt += !!overread;
977  crc_mismatch_cnt += !!crc_res;
978  }
979  if (slice_error_cnt || crc_mismatch_cnt)
980  av_log(dev_ctx, AV_LOG_ERROR, "Decode status: %i slices overread (%i bytes max), "
981  "%i CRCs mismatched\n",
982  slice_error_cnt, max_overread, crc_mismatch_cnt);
983  }
984 
987 }
988 
990  .p.name = "ffv1_vulkan",
991  .p.type = AVMEDIA_TYPE_VIDEO,
992  .p.id = AV_CODEC_ID_FFV1,
993  .p.pix_fmt = AV_PIX_FMT_VULKAN,
994  .start_frame = &vk_ffv1_start_frame,
995  .decode_slice = &vk_ffv1_decode_slice,
996  .end_frame = &vk_ffv1_end_frame,
997  .free_frame_priv = &vk_ffv1_free_frame_priv,
998  .frame_priv_data_size = sizeof(FFv1VulkanDecodePicture),
1002  .frame_params = &ff_vk_frame_params,
1003  .priv_data_size = sizeof(FFVulkanDecodeContext),
1005 };
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
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[]
FFv1VulkanDecodeContext::slice_feedback_pool
AVBufferPool * slice_feedback_pool
Definition: vulkan_ffv1.c:94
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:2681
AVBufferPool
The buffer pool.
Definition: buffer_internal.h:88
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:34
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
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
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:96
FFv1VulkanDecodePicture::slice_feedback_buf
AVBufferRef * slice_feedback_buf
Definition: vulkan_ffv1.c:77
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
FFMAX
#define FFMAX(a, b)
Definition: macros.h:47
av_buffer_ref
AVBufferRef * av_buffer_ref(const AVBufferRef *buf)
Create a new reference to an AVBuffer.
Definition: buffer.c:103
SPEC_LIST_ADD
#define SPEC_LIST_ADD(name, idx, val_bits, val)
Definition: vulkan.h:52
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:2658
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
ff_ffv1_dec_bayer_golomb_comp_spv_data
const unsigned char ff_ffv1_dec_bayer_golomb_comp_spv_data[]
AVFrame::data
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
Definition: frame.h:493
FFv1VulkanDecodeContext::slice_state_pool
AVBufferPool * slice_state_pool
Definition: vulkan_ffv1.c:92
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:87
FFVulkanDecodePicture::sem_value
uint64_t sem_value
Definition: vulkan_decode.h:85
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:790
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:2609
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:2094
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:2474
CONTEXT_SIZE
#define CONTEXT_SIZE
Definition: ffv1.h:45
FFv1VulkanDecodeContext::consts_buf
FFVkBuffer consts_buf
Definition: vulkan_ffv1.c:90
FFVulkanDecodeShared
Definition: vulkan_decode.h:38
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:80
ff_ffv1_dec_bayer_comp_spv_data
const unsigned char ff_ffv1_dec_bayer_comp_spv_data[]
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:626
FFVulkanDecodePicture::wait_semaphores
PFN_vkWaitSemaphores wait_semaphores
Definition: vulkan_decode.h:103
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:899
ff_ffv1_dec_setup_comp_spv_len
const unsigned int ff_ffv1_dec_setup_comp_spv_len
FFv1VulkanDecodeContext
Definition: vulkan_ffv1.c:83
FFv1VulkanDecodePicture::slice_fltmap_buf
AVBufferRef * slice_fltmap_buf
Definition: vulkan_ffv1.c:76
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:1593
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
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:211
FFv1VulkanDecodePicture
Definition: vulkan_ffv1.c:68
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
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:826
FFv1VulkanDecodePicture::slice_state
AVBufferRef * slice_state
Definition: vulkan_ffv1.c:71
FFv1VulkanDecodePicture::plane_state_size
uint32_t plane_state_size
Definition: vulkan_ffv1.c:72
if
if(ret)
Definition: filter_design.txt:179
FFv1ShaderParams::extend_lookup
uint32_t extend_lookup[8]
Definition: ffv1_vulkan.h:36
ff_ffv1_dec_golomb_comp_spv_len
const unsigned int ff_ffv1_dec_golomb_comp_spv_len
ff_vk_exec_add_dep_wait_sem
int ff_vk_exec_add_dep_wait_sem(FFVulkanContext *s, FFVkExecContext *e, VkSemaphore sem, uint64_t val, VkPipelineStageFlagBits2 stage)
Definition: vulkan.c:717
fail
#define fail
Definition: test.h:478
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
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:647
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:246
AV_RN32
#define AV_RN32(p)
Definition: intreadwrite.h:360
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:2334
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:42
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:100
FFVulkanContext
Definition: vulkan.h:275
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:1112
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:514
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:2648
FFVulkanDescriptorSetBinding
Definition: vulkan.h:78
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
ff_vk_host_map_buffer
int ff_vk_host_map_buffer(FFVulkanContext *s, AVBufferRef **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:1411
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:940
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
FFVkBuffer::flags
VkMemoryPropertyFlagBits flags
Definition: vulkan.h:94
FFv1VulkanDecodeContext::intermediate_frames_ref
AVBufferRef * intermediate_frames_ref
Definition: vulkan_ffv1.c:84
ff_ffv1_dec_rgb_comp_spv_len
const unsigned int ff_ffv1_dec_rgb_comp_spv_len
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:2622
ff_ffv1_dec_comp_spv_data
const unsigned char ff_ffv1_dec_comp_spv_data[]
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
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:580
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:93
FFVulkanDecodePicture::sem
VkSemaphore sem
Definition: vulkan_decode.h:84
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:674
uninit
static av_cold void uninit(AVBitStreamFilterContext *ctx)
Definition: lcevc_merge.c:135
FFv1VulkanDecodeContext::slice_fltmap_pool
AVBufferPool * slice_fltmap_pool
Definition: vulkan_ffv1.c:93
ff_vk_free_buf
void ff_vk_free_buf(FFVulkanContext *s, FFVkBuffer *buf)
Definition: vulkan.c:1264
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:2440
ff_ffv1_vulkan_hwaccel
const FFHWAccel ff_ffv1_vulkan_hwaccel
Definition: vulkan_ffv1.c:989
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:2011
AVHWFramesContext::hwctx
void * hwctx
The format-specific data, allocated and freed automatically along with this context.
Definition: hwcontext.h:153
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:1510
init_setup_shader
static int init_setup_shader(FFV1Context *f, FFVulkanContext *s, FFVkExecPool *pool, FFVulkanShader *shd, VkSpecializationInfo *sl)
Definition: vulkan_ffv1.c:572
AVCodecContext
main external API structure.
Definition: avcodec.h:443
FFv1VulkanDecodeContext::decode
FFVulkanShader decode
Definition: vulkan_ffv1.c:88
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
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
AVVulkanDeviceContext::act_dev
VkDevice act_dev
Active device.
Definition: hwcontext_vulkan.h:84
vulkan_decode.h
FFV1Context
Definition: ffv1.h:122
FFv1ShaderParams
Definition: ffv1_vulkan.h:33
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
AVCodecContext::priv_data
void * priv_data
Definition: avcodec.h:470
FFv1VulkanDecodeContext::setup
FFVulkanShader setup
Definition: vulkan_ffv1.c:86
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:91
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:925
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:1264
AVCodecContext::sw_pix_fmt
enum AVPixelFormat sw_pix_fmt
Nominal unaccelerated pixel format, see AV_PIX_FMT_xxx.
Definition: avcodec.h:650
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
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:2137
ff_vk_get_pooled_buffer
int ff_vk_get_pooled_buffer(FFVulkanContext *ctx, AVBufferPool **buf_pool, AVBufferRef **buf, VkBufferUsageFlags usage, void *create_pNext, size_t size, VkMemoryPropertyFlagBits mem_props)
Initialize a pool and create AVBufferRefs containing FFVkBuffer.
Definition: vulkan.c:1306
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:97
vk_decode_ffv1_init
static int vk_decode_ffv1_init(AVCodecContext *avctx)
Definition: vulkan_ffv1.c:845
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