Go to the documentation of this file.
40 .queue_flags = VK_QUEUE_COMPUTE_BIT,
107 GLSLC(0,
layout(push_constant, scalar) uniform pushConstants { );
108 GLSLC(1, u8buf slice_data; );
109 GLSLC(1, u8buf slice_state; );
111 GLSLC(1, ivec4 fmt_lut; );
112 GLSLC(1, uvec2 img_size; );
113 GLSLC(1, uvec2 chroma_shift; );
115 GLSLC(1, uint plane_state_size; );
116 GLSLC(1, uint32_t crcref; );
117 GLSLC(1,
int rct_offset; );
119 GLSLC(1, uint8_t extend_lookup[8]; );
120 GLSLC(1, uint8_t bits_per_raw_sample; );
121 GLSLC(1, uint8_t quant_table_count; );
123 GLSLC(1, uint8_t micro_version; );
124 GLSLC(1, uint8_t key_frame; );
126 GLSLC(1, uint8_t codec_planes; );
127 GLSLC(1, uint8_t color_planes; );
128 GLSLC(1, uint8_t transparency; );
129 GLSLC(1, uint8_t planar_rgb; );
130 GLSLC(1, uint8_t colorspace; );
131 GLSLC(1, uint8_t ec; );
132 GLSLC(1, uint8_t golomb; );
133 GLSLC(1, uint8_t check_crc; );
134 GLSLC(1, uint8_t padding[3]; );
137 VK_SHADER_STAGE_COMPUTE_BIT);
164 for (
int i = 0;
i <
f->quant_table_count;
i++)
165 max_contexts =
FFMAX(
f->context_count[
i], max_contexts);
186 VK_BUFFER_USAGE_STORAGE_BUFFER_BIT |
187 VK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT);
193 VK_BUFFER_USAGE_STORAGE_BUFFER_BIT |
194 VK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT,
196 VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT);
209 VK_BUFFER_USAGE_STORAGE_BUFFER_BIT |
210 VK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT,
211 NULL, 2*
f->slice_count*
sizeof(uint32_t),
212 VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT |
213 VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT);
220 VK_BUFFER_USAGE_STORAGE_BUFFER_BIT |
221 VK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT,
222 NULL,
f->slice_count*
sizeof(uint32_t),
223 VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT |
224 VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT);
261 if (slices_buf && slices_buf->host_ref) {
263 data - slices_buf->mapped_mem);
299 int bits =
f->avctx->bits_per_raw_sample > 0 ?
f->avctx->bits_per_raw_sample : 8;
318 VkImageView *decode_dst_view = is_rgb ? rct_image_views : vp->
view.
out;
320 VkImageMemoryBarrier2 img_bar[37];
322 VkBufferMemoryBarrier2 buf_bar[8];
330 VK_PIPELINE_STAGE_2_ALL_COMMANDS_BIT,
331 VK_PIPELINE_STAGE_2_COMPUTE_SHADER_BIT));
342 VK_PIPELINE_STAGE_2_ALL_COMMANDS_BIT,
343 VK_PIPELINE_STAGE_2_CLEAR_BIT));
345 VK_PIPELINE_STAGE_2_ALL_COMMANDS_BIT,
346 VK_PIPELINE_STAGE_2_ALL_COMMANDS_BIT,
347 VK_ACCESS_2_TRANSFER_WRITE_BIT,
348 VK_IMAGE_LAYOUT_GENERAL,
349 VK_QUEUE_FAMILY_IGNORED);
358 VK_PIPELINE_STAGE_2_ALL_COMMANDS_BIT));
369 buf_bar[nb_buf_bar++] = (VkBufferMemoryBarrier2) {
370 .sType = VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER_2,
371 .srcStageMask = slice_state->stage,
372 .dstStageMask = VK_PIPELINE_STAGE_2_COMPUTE_SHADER_BIT,
373 .srcAccessMask = slice_state->access,
374 .dstAccessMask = VK_ACCESS_2_SHADER_STORAGE_READ_BIT |
375 VK_ACCESS_2_SHADER_STORAGE_WRITE_BIT,
376 .srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED,
377 .dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED,
378 .buffer = slice_state->buf,
383 vk->CmdPipelineBarrier2(exec->
buf, &(VkDependencyInfo) {
384 .sType = VK_STRUCTURE_TYPE_DEPENDENCY_INFO,
385 .pImageMemoryBarriers = img_bar,
386 .imageMemoryBarrierCount = nb_img_bar,
387 .pBufferMemoryBarriers = buf_bar,
388 .bufferMemoryBarrierCount = nb_buf_bar,
390 slice_state->stage = buf_bar[0].dstStageMask;
391 slice_state->access = buf_bar[0].dstAccessMask;
400 VK_FORMAT_UNDEFINED);
404 0, 2*
f->slice_count*
sizeof(uint32_t),
405 VK_FORMAT_UNDEFINED);
409 0,
f->slice_count*
sizeof(uint32_t),
410 VK_FORMAT_UNDEFINED);
417 .img_size[0] =
f->picture.f->width,
418 .img_size[1] =
f->picture.f->height,
419 .chroma_shift[0] =
f->chroma_h_shift,
420 .chroma_shift[1] =
f->chroma_v_shift,
424 .rct_offset = 1 <<
bits,
426 .bits_per_raw_sample =
bits,
427 .quant_table_count =
f->quant_table_count,
428 .version =
f->version,
429 .micro_version =
f->micro_version,
432 .codec_planes =
f->plane_count,
433 .color_planes = color_planes,
434 .transparency =
f->transparency,
437 .colorspace =
f->colorspace,
442 for (
int i = 0;
i <
f->quant_table_count;
i++)
444 (
f->quant_tables[
i][4][127] != 0);
450 memcpy(pd.
fmt_lut, (
int [4]) { 2, 1, 0, 3 }, 4*
sizeof(
int));
452 memcpy(pd.
fmt_lut, (
int [4]) { 0, 2, 1, 3 }, 4*
sizeof(
int));
457 VK_SHADER_STAGE_COMPUTE_BIT,
460 vk->CmdDispatch(exec->
buf,
f->num_h_slices,
f->num_v_slices, 1);
464 for (
int i = 0;
i < color_planes;
i++)
465 vk->CmdClearColorImage(exec->
buf, vkf->
img[
i], VK_IMAGE_LAYOUT_GENERAL,
466 &((VkClearColorValue) { 0 }),
467 1, &((VkImageSubresourceRange) {
468 .aspectMask = VK_IMAGE_ASPECT_COLOR_BIT,
480 VK_FORMAT_UNDEFINED);
487 .codec_planes =
f->plane_count,
489 .version =
f->version,
490 .micro_version =
f->micro_version,
492 for (
int i = 0;
i <
f->quant_table_count;
i++)
496 VK_SHADER_STAGE_COMPUTE_BIT,
497 0,
sizeof(pd_reset), &pd_reset);
500 buf_bar[nb_buf_bar++] = (VkBufferMemoryBarrier2) {
501 .sType = VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER_2,
502 .srcStageMask = slice_state->stage,
503 .dstStageMask = VK_PIPELINE_STAGE_2_COMPUTE_SHADER_BIT,
504 .srcAccessMask = slice_state->access,
505 .dstAccessMask = VK_ACCESS_2_SHADER_STORAGE_READ_BIT,
506 .srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED,
507 .dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED,
508 .buffer = slice_state->buf,
512 vk->CmdPipelineBarrier2(exec->
buf, &(VkDependencyInfo) {
513 .sType = VK_STRUCTURE_TYPE_DEPENDENCY_INFO,
514 .pImageMemoryBarriers = img_bar,
515 .imageMemoryBarrierCount = nb_img_bar,
516 .pBufferMemoryBarriers = buf_bar,
517 .bufferMemoryBarrierCount = nb_buf_bar,
519 slice_state->stage = buf_bar[0].dstStageMask;
520 slice_state->access = buf_bar[0].dstAccessMask;
524 vk->CmdDispatch(exec->
buf,
f->num_h_slices,
f->num_v_slices,
533 VK_FORMAT_UNDEFINED);
535 decode_dst, decode_dst_view,
537 VK_IMAGE_LAYOUT_GENERAL,
543 VK_IMAGE_LAYOUT_GENERAL,
548 VK_SHADER_STAGE_COMPUTE_BIT,
552 buf_bar[nb_buf_bar++] = (VkBufferMemoryBarrier2) {
553 .sType = VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER_2,
554 .srcStageMask = slice_state->stage,
555 .dstStageMask = VK_PIPELINE_STAGE_2_COMPUTE_SHADER_BIT,
556 .srcAccessMask = slice_state->access,
557 .dstAccessMask = VK_ACCESS_2_SHADER_STORAGE_READ_BIT |
558 VK_ACCESS_2_SHADER_STORAGE_WRITE_BIT,
559 .srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED,
560 .dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED,
561 .buffer = slice_state->buf,
568 VK_PIPELINE_STAGE_2_ALL_COMMANDS_BIT,
569 VK_PIPELINE_STAGE_2_COMPUTE_SHADER_BIT,
570 VK_ACCESS_SHADER_WRITE_BIT |
571 (!is_rgb ? VK_ACCESS_SHADER_READ_BIT : 0),
572 VK_IMAGE_LAYOUT_GENERAL,
573 VK_QUEUE_FAMILY_IGNORED);
576 VK_PIPELINE_STAGE_2_ALL_COMMANDS_BIT,
577 VK_PIPELINE_STAGE_2_COMPUTE_SHADER_BIT,
578 VK_ACCESS_SHADER_READ_BIT | VK_ACCESS_SHADER_WRITE_BIT,
579 VK_IMAGE_LAYOUT_GENERAL,
580 VK_QUEUE_FAMILY_IGNORED);
582 vk->CmdPipelineBarrier2(exec->
buf, &(VkDependencyInfo) {
583 .sType = VK_STRUCTURE_TYPE_DEPENDENCY_INFO,
584 .pImageMemoryBarriers = img_bar,
585 .imageMemoryBarrierCount = nb_img_bar,
586 .pBufferMemoryBarriers = buf_bar,
587 .bufferMemoryBarrierCount = nb_buf_bar,
589 slice_state->stage = buf_bar[0].dstStageMask;
590 slice_state->access = buf_bar[0].dstAccessMask;
594 vk->CmdDispatch(exec->
buf,
f->num_h_slices,
f->num_v_slices, 1);
609 int smp_bits = use32bit ? 32 : 16;
616 GLSLF(0, #define
TYPE int%i_t ,smp_bits);
617 GLSLF(0, #define VTYPE2
i%ivec2 ,smp_bits);
618 GLSLF(0, #define VTYPE3
i%ivec3 ,smp_bits);
632 void *spv_opaque =
NULL;
635 VK_SHADER_STAGE_COMPUTE_BIT,
636 (
const char *[]) {
"GL_EXT_buffer_reference",
637 "GL_EXT_buffer_reference2" }, 2,
652 .
name =
"rangecoder_static_buf",
653 .type = VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER,
654 .stages = VK_SHADER_STAGE_COMPUTE_BIT,
655 .mem_layout =
"scalar",
656 .buf_content =
"uint8_t zero_one_state[512];",
659 .name =
"crc_ieee_buf",
660 .type = VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER,
661 .stages = VK_SHADER_STAGE_COMPUTE_BIT,
662 .mem_layout =
"scalar",
663 .buf_content =
"uint32_t crc_ieee[256];",
667 .type = VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER,
668 .stages = VK_SHADER_STAGE_COMPUTE_BIT,
669 .mem_layout =
"scalar",
670 .buf_content =
"int16_t quant_table[MAX_QUANT_TABLES]"
671 "[MAX_CONTEXT_INPUTS][MAX_QUANT_TABLE_SIZE];",
681 .
name =
"slice_data_buf",
682 .type = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER,
683 .stages = VK_SHADER_STAGE_COMPUTE_BIT,
684 .buf_content =
"SliceContext slice_ctx",
685 .buf_elems =
f->max_slice_count,
688 .name =
"slice_offsets_buf",
689 .type = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER,
690 .stages = VK_SHADER_STAGE_COMPUTE_BIT,
691 .mem_quali =
"readonly",
692 .buf_content =
"uint32_t slice_offsets",
693 .buf_elems = 2*
f->max_slice_count,
696 .name =
"slice_status_buf",
697 .type = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER,
698 .stages = VK_SHADER_STAGE_COMPUTE_BIT,
699 .mem_quali =
"writeonly",
700 .buf_content =
"uint32_t slice_crc_mismatch",
701 .buf_elems =
f->max_slice_count,
730 void *spv_opaque =
NULL;
731 int wg_dim =
FFMIN(
s->props.properties.limits.maxComputeWorkGroupSize[0], 1024);
734 VK_SHADER_STAGE_COMPUTE_BIT,
735 (
const char *[]) {
"GL_EXT_buffer_reference",
736 "GL_EXT_buffer_reference2" }, 2,
746 GLSLC(0,
layout(push_constant, scalar) uniform pushConstants { );
748 GLSLC(1, u8buf slice_state; );
749 GLSLC(1, uint plane_state_size; );
750 GLSLC(1, uint8_t codec_planes; );
751 GLSLC(1, uint8_t key_frame; );
753 GLSLC(1, uint8_t micro_version; );
754 GLSLC(1, uint8_t padding[1]; );
757 VK_SHADER_STAGE_COMPUTE_BIT);
765 .
name =
"rangecoder_static_buf",
766 .type = VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER,
767 .stages = VK_SHADER_STAGE_COMPUTE_BIT,
768 .mem_layout =
"scalar",
769 .buf_content =
"uint8_t zero_one_state[512];",
773 .type = VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER,
774 .stages = VK_SHADER_STAGE_COMPUTE_BIT,
775 .mem_layout =
"scalar",
776 .buf_content =
"int16_t quant_table[MAX_QUANT_TABLES]"
777 "[MAX_CONTEXT_INPUTS][MAX_QUANT_TABLE_SIZE];",
788 .
name =
"slice_data_buf",
789 .type = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER,
790 .mem_quali =
"readonly",
791 .stages = VK_SHADER_STAGE_COMPUTE_BIT,
792 .buf_content =
"SliceContext slice_ctx",
793 .buf_elems =
f->max_slice_count,
818 int use32bit,
int ac,
int rgb)
825 void *spv_opaque =
NULL;
827 s->driver_props.driverID == VK_DRIVER_ID_MESA_RADV;
830 VK_SHADER_STAGE_COMPUTE_BIT,
831 (
const char *[]) {
"GL_EXT_buffer_reference",
832 "GL_EXT_buffer_reference2" }, 2,
842 if (use_cached_reader)
856 .
name =
"rangecoder_static_buf",
857 .type = VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER,
858 .stages = VK_SHADER_STAGE_COMPUTE_BIT,
859 .mem_layout =
"scalar",
860 .buf_content =
"uint8_t zero_one_state[512];",
864 .type = VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER,
865 .stages = VK_SHADER_STAGE_COMPUTE_BIT,
866 .mem_layout =
"scalar",
867 .buf_content =
"int16_t quant_table[MAX_QUANT_TABLES]"
868 "[MAX_CONTEXT_INPUTS][MAX_QUANT_TABLE_SIZE];",
880 .
name =
"slice_data_buf",
881 .type = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER,
882 .stages = VK_SHADER_STAGE_COMPUTE_BIT,
883 .buf_content =
"SliceContext slice_ctx",
884 .buf_elems =
f->max_slice_count,
888 .type = VK_DESCRIPTOR_TYPE_STORAGE_IMAGE,
893 .stages = VK_SHADER_STAGE_COMPUTE_BIT,
897 .type = VK_DESCRIPTOR_TYPE_STORAGE_IMAGE,
901 .mem_quali =
"writeonly",
903 .stages = VK_SHADER_STAGE_COMPUTE_BIT,
938 frames_ctx->
width =
s->frames->width;
939 frames_ctx->
height =
f->num_v_slices*2;
941 vk_frames = frames_ctx->
hwctx;
942 vk_frames->
tiling = VK_IMAGE_TILING_OPTIMAL;
943 vk_frames->
img_flags = VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT;
944 vk_frames->
usage = VK_IMAGE_USAGE_STORAGE_BIT |
945 VK_IMAGE_USAGE_TRANSFER_DST_BIT;
964 for (
int i = 0;
i < 2;
i++)
967 for (
int i = 0;
i < 2;
i++)
970 for (
int i = 0;
i < 2;
i++)
971 for (
int j = 0; j < 2; j++)
972 for (
int k = 0; k < 2; k++)
993 if (
f->version < 3 ||
994 (
f->version == 4 &&
f->micro_version > 3))
997 spv = ff_vk_spirv_init();
1017 for (
int i = 0;
i < 2;
i++) {
1030 for (
int i = 0;
i < 2;
i++) {
1038 for (
int i = 0;
i < 2;
i++) {
1039 for (
int j = 0; j < 2; j++) {
1040 for (
int k = 0; k < 2; k++) {
1080 &fv->
setup, 0, 0, 0,
1083 VK_FORMAT_UNDEFINED));
1085 &fv->
setup, 0, 1, 0,
1088 VK_FORMAT_UNDEFINED));
1091 for (
int i = 0;
i < 2;
i++) {
1092 for (
int j = 0; j < 2; j++) {
1093 for (
int k = 0; k < 2; k++) {
1095 &fv->
decode[
i][j][k], 0, 0, 0,
1098 VK_FORMAT_UNDEFINED));
1100 &fv->
decode[
i][j][k], 0, 1, 0,
1103 VK_FORMAT_UNDEFINED));
1139 .
p.
name =
"ffv1_vulkan",
#define AV_PIX_FMT_GBRAP16
uint32_t context_count[MAX_QUANT_TABLES]
AVPixelFormat
Pixel format.
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
8 bits gray, 8 bits alpha
const char * ff_source_ffv1_dec_setup_comp
void ff_vk_shader_free(FFVulkanContext *s, FFVulkanShader *shd)
Free a shader.
FFVkBuffer rangecoder_static_buf
int ff_vk_shader_init(FFVulkanContext *s, FFVulkanShader *shd, const char *name, VkPipelineStageFlags stage, const char *extensions[], int nb_extensions, int lg_x, int lg_y, int lg_z, uint32_t required_subgroup_size)
Initialize a shader object, with a specific set of extensions, type+bind, local group size,...
int ff_vk_decode_prepare_frame_sdr(FFVulkanDecodeContext *dec, AVFrame *pic, FFVulkanDecodePicture *vkpic, int is_current, enum FFVkShaderRepFormat rep_fmt, int alloc_dpb)
Software-defined decoder version of ff_vk_decode_prepare_frame.
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
uint8_t * data
The data buffer.
FFVulkanDecodeShared * shared_ctx
RefStruct is an API for creating reference-counted objects with minimal overhead.
enum AVPixelFormat format
The pixel format identifying the underlying HW surface type.
int err_recognition
Error recognition; may misdetect some more or less valid parts as errors.
VkDeviceAddress slice_data
AVHWAccel p
The public AVHWAccel.
void av_frame_free(AVFrame **frame)
Free the frame and any dynamically allocated objects in it, e.g.
int av_hwframe_ctx_init(AVBufferRef *ref)
Finalize the context before use.
int ff_ffv1_vk_init_quant_table_data(FFVulkanContext *s, FFVkBuffer *vkb, FFV1Context *f)
This structure describes decoded (raw) audio or video data.
VkDeviceAddress slice_state
AVBufferRef * av_hwframe_ctx_alloc(AVBufferRef *device_ref_in)
Allocate an AVHWFramesContext tied to a given device context.
#define MAX_QUANT_TABLE_SIZE
const char * ff_source_ffv1_vlc_comp
VkDeviceAddress slice_state
const char * ff_source_ffv1_common_comp
FFVkExecContext * ff_vk_exec_get(FFVulkanContext *s, FFVkExecPool *pool)
Retrieve an execution pool.
AVBufferRef * av_buffer_ref(const AVBufferRef *buf)
Create a new reference to an AVBuffer.
int width
The allocated dimensions of the frames in this pool.
#define AC_RANGE_CUSTOM_TAB
AVBufferRef * slice_status_buf
@ AV_PIX_FMT_VULKAN
Vulkan hardware images.
int ff_vk_exec_add_dep_frame(FFVulkanContext *s, FFVkExecContext *e, AVFrame *f, VkPipelineStageFlagBits2 wait_stage, VkPipelineStageFlagBits2 signal_stage)
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
AVBufferPool * slice_state_pool
int av_pix_fmt_count_planes(enum AVPixelFormat pix_fmt)
#define MAX_QUANT_TABLE_MASK
#define AV_PIX_FMT_GBRP14
VkImage img[AV_NUM_DATA_POINTERS]
Vulkan images to which the memory is bound to.
#define AV_PIX_FMT_GBRP10
static int init_indirect(AVCodecContext *avctx, FFVulkanContext *s, AVBufferRef **dst, enum AVPixelFormat sw_format)
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.
Allocated as AVHWFramesContext.hwctx, used to set pool-specific options.
#define HWACCEL_CAP_THREAD_SAFE
int ff_vk_shader_register_exec(FFVulkanContext *s, FFVkExecPool *pool, FFVulkanShader *shd)
Register a shader with an exec pool.
static int init_setup_shader(FFV1Context *f, FFVulkanContext *s, FFVkExecPool *pool, FFVkSPIRVCompiler *spv, FFVulkanShader *shd)
uint32_t plane_state_size
int ff_vk_host_map_buffer(FFVulkanContext *s, AVBufferRef **dst, uint8_t *src_data, const AVBufferRef *src_buf, VkBufferUsageFlags usage)
Maps a system RAM buffer into a Vulkan buffer.
int ff_vk_shader_add_descriptor_set(FFVulkanContext *s, FFVulkanShader *shd, FFVulkanDescriptorSetBinding *desc, int nb, int singular, int print_to_shader_only)
Add descriptor to a shader.
static void add_push_data(FFVulkanShader *shd)
This struct aggregates all the (hardware/vendor-specific) "high-level" state, i.e.
AVFrame * av_frame_alloc(void)
Allocate an AVFrame and set its fields to default values.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
AVBufferPool * slice_status_pool
#define AV_FRAME_FLAG_KEY
A flag to mark frames that are keyframes.
static void define_shared_code(FFVulkanShader *shd, int use32bit)
int ff_vk_exec_mirror_sem_value(FFVulkanContext *s, FFVkExecContext *e, VkSemaphore *dst, uint64_t *dst_val, AVFrame *f)
uint8_t bits_per_raw_sample
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.
VkImageCreateFlags img_flags
Flags to set during image creation.
#define AV_PIX_FMT_GBRAP32
static int vk_ffv1_decode_slice(AVCodecContext *avctx, const uint8_t *data, uint32_t size)
int ff_vk_exec_add_dep_buf(FFVulkanContext *s, FFVkExecContext *e, AVBufferRef **deps, int nb_deps, int ref)
Execution dependency management.
static void vk_decode_ffv1_uninit(FFVulkanDecodeShared *ctx)
static int init_reset_shader(FFV1Context *f, FFVulkanContext *s, FFVkExecPool *pool, FFVkSPIRVCompiler *spv, FFVulkanShader *shd, int ac)
AVBufferRef * slice_state
uint32_t plane_state_size
int ff_vk_exec_add_dep_wait_sem(FFVulkanContext *s, FFVkExecContext *e, VkSemaphore sem, uint64_t val, VkPipelineStageFlagBits2 stage)
#define HWACCEL_CAP_ASYNC_SAFE
Header providing the internals of AVHWAccel.
const char * ff_vk_shader_rep_fmt(enum AVPixelFormat pix_fmt, enum FFVkShaderRepFormat rep_fmt)
enum AVPixelFormat sw_format
The pixel format identifying the actual data layout of the hardware frames.
void av_buffer_unref(AVBufferRef **buf)
Free a given reference and automatically free the buffer if there are no more references to it.
uint8_t nb_components
The number of components each pixel has, (1-4)
void ff_vk_decode_free_frame(AVHWDeviceContext *dev_ctx, FFVulkanDecodePicture *vp)
Free a frame and its state.
const char * ff_source_rangecoder_comp
struct AVCodecInternal * internal
Private context used for internal data.
static int vk_ffv1_end_frame(AVCodecContext *avctx)
void av_buffer_pool_uninit(AVBufferPool **ppool)
Mark the pool as being available for freeing.
int ff_vk_decode_uninit(AVCodecContext *avctx)
Free decoder.
void(* flush)(AVBSFContext *ctx)
VkImageUsageFlagBits usage
Defines extra usage of output frames.
const char * ff_source_ffv1_dec_comp
AVBufferPool * slice_offset_pool
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...
#define AV_EF_CRCCHECK
Verify checksums embedded in the bitstream (could be of either encoded or decoded data,...
#define AV_PIX_FMT_X2BGR10
int(* init)(AVBSFContext *ctx)
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.
void * hwaccel_priv_data
hwaccel-specific private data
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
#define av_err2str(errnum)
Convenience macro, the return value should be used only directly in function arguments but never stan...
static void vk_ffv1_free_frame_priv(AVRefStructOpaque _hwctx, void *data)
#define AV_NUM_DATA_POINTERS
uint8_t quant_table_count
#define FF_VK_EXT_PUSH_DESCRIPTOR
const char * ff_source_ffv1_reset_comp
int ff_ffv1_vk_init_crc_table_data(FFVulkanContext *s, FFVkBuffer *vkb, FFV1Context *f)
#define DECODE(size, endian, src, dst, n, shift, offset)
Read PCM samples macro.
int(* compile_shader)(FFVulkanContext *s, struct FFVkSPIRVCompiler *ctx, FFVulkanShader *shd, uint8_t **data, size_t *size, const char *entrypoint, void **opaque)
#define AVERROR_EXTERNAL
Generic error in an external library.
static int init_decode_shader(FFV1Context *f, FFVulkanContext *s, FFVkExecPool *pool, FFVkSPIRVCompiler *spv, FFVulkanShader *shd, AVHWFramesContext *dec_frames_ctx, AVHWFramesContext *out_frames_ctx, int use32bit, int ac, int rgb)
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.
int ff_vk_mt_is_np_rgb(enum AVPixelFormat pix_fmt)
Returns 1 if pixfmt is a usable RGB format.
AVBufferRef * intermediate_frames_ref[2]
const char * name
Name of the hardware accelerated codec.
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 layout
#define FF_VK_EXT_EXTERNAL_HOST_MEMORY
static void uninit(AVBSFContext *ctx)
VkImageView out[AV_NUM_DATA_POINTERS]
int ff_vk_exec_start(FFVulkanContext *s, FFVkExecContext *e)
Start/submit/wait an execution.
#define i(width, name, range_min, range_max)
uint32_t slice_state_size
#define AV_PIX_FMT_GBRP12
void ff_vk_frame_barrier(FFVulkanContext *s, FFVkExecContext *e, AVFrame *pic, VkImageMemoryBarrier2 *bar, int *nb_bar, VkPipelineStageFlags src_stage, VkPipelineStageFlags dst_stage, VkAccessFlagBits new_access, VkImageLayout new_layout, uint32_t new_qf)
int ff_vk_shader_link(FFVulkanContext *s, FFVulkanShader *shd, uint8_t *spirv, size_t spirv_len, const char *entrypoint)
Link a shader into an executable.
void * av_mallocz(size_t size)
Allocate a memory block with alignment suitable for all memory accesses (including vectors if availab...
static const struct @493 planes[]
void ff_vk_free_buf(FFVulkanContext *s, FFVkBuffer *buf)
#define MAX_CONTEXT_INPUTS
void(* free_shader)(struct FFVkSPIRVCompiler *ctx, void **opaque)
void ff_vk_exec_bind_shader(FFVulkanContext *s, FFVkExecContext *e, FFVulkanShader *shd)
Bind a shader.
AVBufferRef * hw_frames_ctx
A reference to the AVHWFramesContext describing the input (for encoding) or output (decoding) frames.
This struct describes a set or pool of "hardware" frames (i.e.
void ff_vk_decode_flush(AVCodecContext *avctx)
Flush decoder.
const FFHWAccel ff_ffv1_vulkan_hwaccel
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.
void * hwctx
The format-specific data, allocated and freed automatically along with this context.
struct FFVulkanDecodePicture::@302 view
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.
void av_bprintf(AVBPrint *buf, const char *fmt,...)
int ff_vk_shader_add_push_const(FFVulkanShader *shd, int offset, int size, VkShaderStageFlagBits stage)
Add/update push constants for execution.
main external API structure.
int ff_ffv1_vk_init_state_transition_data(FFVulkanContext *s, FFVkBuffer *vkb, FFV1Context *f)
const FFVulkanDecodeDescriptor ff_vk_dec_ffv1_desc
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
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
int ff_vk_params_invalidate(AVCodecContext *avctx, int t, const uint8_t *b, uint32_t s)
Removes current session parameters to recreate them.
FFVulkanShader decode[2][2][2]
int ff_vk_update_thread_context(AVCodecContext *dst, const AVCodecContext *src)
Synchronize the contexts between 2 threads.
VkImageTiling tiling
Controls the tiling of allocated frames.
A reference to a data buffer.
static int ff_vk_count_images(AVVkFrame *f)
int ff_vk_exec_submit(FFVulkanContext *s, FFVkExecContext *e)
int ff_vk_decode_init(AVCodecContext *avctx)
Initialize decoder.
enum AVPixelFormat sw_pix_fmt
Nominal unaccelerated pixel format, see AV_PIX_FMT_xxx.
AVBufferRef * slice_offset_buf
int av_hwframe_get_buffer(AVBufferRef *hwframe_ref, AVFrame *frame, int flags)
Allocate a new frame attached to the given AVHWFramesContext.
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.
const char * ff_source_common_comp
static int vk_ffv1_start_frame(AVCodecContext *avctx, const AVBufferRef *buffer_ref, av_unused const uint8_t *buffer, av_unused uint32_t size)
static int vk_decode_ffv1_init(AVCodecContext *avctx)
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.