Go to the documentation of this file.
28 #define RGB_LINECACHE 2
65 .queue_flags = VK_QUEUE_COMPUTE_BIT,
125 for (
int i = 0;
i <
f->quant_table_count;
i++)
126 max_contexts =
FFMAX(
f->context_count[
i], max_contexts);
152 VK_WHOLE_SIZE, buffer_ref,
153 VK_BUFFER_USAGE_STORAGE_BUFFER_BIT |
154 VK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT);
160 VK_BUFFER_USAGE_STORAGE_BUFFER_BIT,
162 VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT);
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);
186 if (
f->version >=4 &&
f->micro_version >= 9 &&
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);
198 VK_BUFFER_USAGE_STORAGE_BUFFER_BIT,
199 NULL, 65536*4*
f->slice_count*
sizeof(uint32_t),
200 VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT);
232 if (slices_buf && slices_buf->
host_ref) {
285 VkImageMemoryBarrier2 img_bar[37];
287 VkBufferMemoryBarrier2 buf_bar[8];
295 VK_PIPELINE_STAGE_2_ALL_COMMANDS_BIT,
296 VK_PIPELINE_STAGE_2_COMPUTE_SHADER_BIT));
312 VK_PIPELINE_STAGE_2_ALL_COMMANDS_BIT,
313 VK_PIPELINE_STAGE_2_CLEAR_BIT));
323 VK_PIPELINE_STAGE_2_ALL_COMMANDS_BIT);
335 vkf->
layout[
i] = VK_IMAGE_LAYOUT_UNDEFINED;
336 vkf->
access[
i] = VK_ACCESS_2_NONE;
344 VK_FORMAT_UNDEFINED);
348 0, 2*
f->slice_count*
sizeof(uint32_t),
349 VK_FORMAT_UNDEFINED);
353 2*
f->slice_count*
sizeof(uint32_t),
355 VK_FORMAT_UNDEFINED);
360 fltmap_buf ? fltmap_buf : slice_feedback,
363 VK_FORMAT_UNDEFINED);
370 .img_size[0] =
f->picture.f->width,
371 .img_size[1] =
f->picture.f->height,
376 .micro_version =
f->micro_version,
377 .remap_allowed = !!fltmap_buf,
380 for (
int i = 0;
i <
f->quant_table_count;
i++) {
383 f->quant_tables[
i][4][127];
389 memcpy(pd.
fmt_lut, (
int [4]) { 2, 1, 0, 3 }, 4*
sizeof(
int));
394 VK_SHADER_STAGE_COMPUTE_BIT,
397 vk->CmdDispatch(exec->
buf,
f->num_h_slices,
f->num_v_slices, 1);
401 for (
int i = 0;
i < 4;
i++) {
402 vkf->
layout[
i] = VK_IMAGE_LAYOUT_UNDEFINED;
403 vkf->
access[
i] = VK_ACCESS_2_NONE;
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);
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,
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,
438 COMPUTE_SHADER_BIT, SHADER_STORAGE_READ_BIT,
439 SHADER_STORAGE_WRITE_BIT,
440 COMPUTE_SHADER_BIT, SHADER_STORAGE_READ_BIT, NONE_KHR,
446 COMPUTE_SHADER_BIT, SHADER_STORAGE_READ_BIT,
447 SHADER_STORAGE_WRITE_BIT,
448 COMPUTE_SHADER_BIT, SHADER_STORAGE_WRITE_BIT, NONE_KHR,
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,
466 VK_FORMAT_UNDEFINED);
472 VK_FORMAT_UNDEFINED);
476 VK_SHADER_STAGE_COMPUTE_BIT,
479 vk->CmdDispatch(exec->
buf,
f->num_h_slices,
f->num_v_slices,
484 COMPUTE_SHADER_BIT, SHADER_STORAGE_WRITE_BIT, NONE_KHR,
485 COMPUTE_SHADER_BIT, SHADER_STORAGE_READ_BIT,
486 SHADER_STORAGE_WRITE_BIT,
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);
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);
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,
520 VK_FORMAT_UNDEFINED);
524 0, 2*
f->slice_count*
sizeof(uint32_t),
525 VK_FORMAT_UNDEFINED);
529 2*
f->slice_count*
sizeof(uint32_t),
531 VK_FORMAT_UNDEFINED);
537 VK_FORMAT_UNDEFINED);
540 VkImageView *decode_dst_view = is_rgb ? rct_image_views : output_views;
542 decode_dst, decode_dst_view,
544 VK_IMAGE_LAYOUT_GENERAL,
548 f->picture.f, output_views,
550 VK_IMAGE_LAYOUT_GENERAL,
558 VK_FORMAT_UNDEFINED);
562 VK_SHADER_STAGE_COMPUTE_BIT,
565 vk->CmdDispatch(exec->
buf,
f->num_h_slices,
f->num_v_slices, 1);
580 VkSpecializationInfo *sl)
585 (uint32_t []) { 1, 1, 1 }, 0);
588 VK_SHADER_STAGE_COMPUTE_BIT);
592 .
type = VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER,
593 .stages = VK_SHADER_STAGE_COMPUTE_BIT,
596 .type = VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER,
597 .stages = VK_SHADER_STAGE_COMPUTE_BIT,
604 .
type = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER,
605 .stages = VK_SHADER_STAGE_COMPUTE_BIT,
608 .type = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER,
609 .stages = VK_SHADER_STAGE_COMPUTE_BIT,
612 .type = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER,
613 .stages = VK_SHADER_STAGE_COMPUTE_BIT,
616 .type = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER,
617 .stages = VK_SHADER_STAGE_COMPUTE_BIT,
634 VkSpecializationInfo *sl,
int ac)
637 int wg_dim =
FFMIN(
s->props.properties.limits.maxComputeWorkGroupSize[0], 1024);
640 (uint32_t []) { wg_dim, 1, 1 }, 0);
643 VK_SHADER_STAGE_COMPUTE_BIT);
647 .
type = VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER,
648 .stages = VK_SHADER_STAGE_COMPUTE_BIT,
655 .
type = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER,
656 .stages = VK_SHADER_STAGE_COMPUTE_BIT,
659 .type = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER,
660 .stages = VK_SHADER_STAGE_COMPUTE_BIT,
684 VkSpecializationInfo *sl,
int ac,
int rgb,
691 (uint32_t []) { wg_x, 1, 1 }, 0);
694 VK_SHADER_STAGE_COMPUTE_BIT);
698 .
type = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER,
699 .stages = VK_SHADER_STAGE_COMPUTE_BIT,
702 .type = VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER,
703 .stages = VK_SHADER_STAGE_COMPUTE_BIT,
710 .
type = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER,
711 .stages = VK_SHADER_STAGE_COMPUTE_BIT,
714 .type = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER,
715 .stages = VK_SHADER_STAGE_COMPUTE_BIT,
718 .type = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER,
719 .stages = VK_SHADER_STAGE_COMPUTE_BIT,
722 .type = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER,
723 .stages = VK_SHADER_STAGE_COMPUTE_BIT,
726 .type = VK_DESCRIPTOR_TYPE_STORAGE_IMAGE,
727 .stages = VK_SHADER_STAGE_COMPUTE_BIT,
731 .type = VK_DESCRIPTOR_TYPE_STORAGE_IMAGE,
732 .stages = VK_SHADER_STAGE_COMPUTE_BIT,
736 .type = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER,
737 .stages = VK_SHADER_STAGE_COMPUTE_BIT,
749 5 +
rgb + (is_float && !bayer),
761 }
else if (is_float) {
811 frames_ctx->
width =
s->frames->width;
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;
823 "Unable to initialize frame pool with format %s: %s\n",
865 if (
f->num_h_slices *
f->num_v_slices < 16)
867 "decoding may be very slow\n",
f->num_h_slices *
f->num_v_slices);
912 dctx, hwfc, sl,
f->ac, is_rgb,
f->bayer));
921 256*
sizeof(uint32_t), 512*
sizeof(uint8_t),
922 VK_FORMAT_UNDEFINED));
926 0, 256*
sizeof(uint32_t),
927 VK_FORMAT_UNDEFINED));
933 256*
sizeof(uint32_t), 512*
sizeof(uint8_t),
934 VK_FORMAT_UNDEFINED));
938 256*
sizeof(uint32_t) + 512*
sizeof(uint8_t),
940 VK_FORMAT_UNDEFINED));
958 .sType = VK_STRUCTURE_TYPE_SEMAPHORE_WAIT_INFO,
959 .pSemaphores = &vp->
sem,
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,
979 .size = 2*fp->
slice_num*
sizeof(uint32_t),
982 1, &invalidate_data);
985 int slice_error_cnt = 0;
986 int crc_mismatch_cnt = 0;
987 uint32_t max_overread = 0;
989 uint32_t crc_res = 0;
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;
997 if (slice_error_cnt || crc_mismatch_cnt)
999 "%i CRCs mismatched\n",
1000 slice_error_cnt, max_overread, crc_mismatch_cnt);
1008 .
p.
name =
"ffv1_vulkan",
void * hwctx
The format-specific data, allocated and freed by libavutil along with this context.
const unsigned int ff_ffv1_dec_reset_comp_spv_len
#define AV_PIX_FMT_GBRAP16
PFN_vkWaitSemaphores wait_semaphores
#define AV_LOG_WARNING
Something somehow does not look correct.
AVPixelFormat
Pixel format.
const unsigned char ff_ffv1_dec_reset_golomb_comp_spv_data[]
const unsigned char ff_ffv1_dec_rgb_golomb_comp_spv_data[]
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
void ff_vk_shader_free(FFVulkanContext *s, FFVulkanShader *shd)
Free a shader.
void ff_vk_exec_add_dep_refstruct(FFVulkanContext *s, FFVkExecContext *e, void *obj)
Execution dependency management.
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.
AVRefStructPool * slice_feedback_pool
#define AV_PIX_FMT_FLAG_FLOAT
The pixel format contains IEEE-754 floating point values.
PFN_vkInvalidateMappedMemoryRanges invalidate_memory_ranges
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.
This structure describes decoded (raw) audio or video data.
AVBufferRef * av_hwframe_ctx_alloc(AVBufferRef *device_ref_in)
Allocate an AVHWFramesContext tied to a given device context.
FFVkExecContext * ff_vk_exec_get(FFVulkanContext *s, FFVkExecPool *pool)
Retrieve an execution pool.
#define SPEC_LIST_ADD(name, idx, val_bits, val)
const unsigned char ff_ffv1_dec_rgb_float_golomb_comp_spv_data[]
int width
The allocated dimensions of the frames in this pool.
void ff_vk_exec_bind_shader(FFVulkanContext *s, FFVkExecContext *e, const FFVulkanShader *shd)
Bind a shader.
@ 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)
const unsigned char ff_ffv1_dec_bayer_golomb_comp_spv_data[]
AVRefStructPool * slice_state_pool
uint8_t * data[AV_NUM_DATA_POINTERS]
pointer to the picture/channel planes.
int av_pix_fmt_count_planes(enum AVPixelFormat pix_fmt)
#define AV_PIX_FMT_GBRP14
VkImage img[AV_NUM_DATA_POINTERS]
Vulkan images to which the memory is bound to.
const unsigned int ff_ffv1_dec_rgb_float_golomb_comp_spv_len
#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.
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)
#define HWACCEL_CAP_THREAD_SAFE
int ff_vk_shader_register_exec(FFVulkanContext *s, FFVkExecPool *pool, FFVulkanShader *shd)
Register a shader with an exec pool.
FFVkBuffer * slice_feedback_buf
const unsigned char ff_ffv1_dec_setup_comp_spv_data[]
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.
const unsigned char ff_ffv1_dec_bayer_comp_spv_data[]
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
#define AV_FRAME_FLAG_KEY
A flag to mark frames that are keyframes.
#define flags(name, subs,...)
static int init_reset_shader(FFV1Context *f, FFVulkanContext *s, FFVkExecPool *pool, FFVulkanShader *shd, VkSpecializationInfo *sl, int ac)
int ff_vk_exec_mirror_sem_value(FFVulkanContext *s, FFVkExecContext *e, VkSemaphore *dst, uint64_t *dst_val, AVFrame *f)
const unsigned int ff_ffv1_dec_setup_comp_spv_len
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
AVRefStructPool is an API for a thread-safe pool of objects managed via the RefStruct API.
static AVFormatContext * ctx
static int vk_ffv1_decode_slice(AVCodecContext *avctx, const uint8_t *data, uint32_t size)
static void vk_decode_ffv1_uninit(FFVulkanDecodeShared *ctx)
void ff_vk_exec_move_dep_refstruct(FFVulkanContext *s, FFVkExecContext *e, void *obj)
uint32_t plane_state_size
uint32_t extend_lookup[8]
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.
const unsigned int ff_ffv1_dec_golomb_comp_spv_len
Main Vulkan context, allocated as AVHWDeviceContext.hwctx.
int ff_ffv1_vk_init_consts(FFVulkanContext *s, FFVkBuffer *vkb, FFV1Context *f)
#define HWACCEL_CAP_ASYNC_SAFE
Header providing the internals of AVHWAccel.
enum AVPixelFormat sw_format
The pixel format identifying the actual data layout of the hardware frames.
AVRefStructPool * slice_fltmap_pool
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.
struct AVCodecInternal * internal
Private context used for internal data.
static int vk_ffv1_end_frame(AVCodecContext *avctx)
int ff_vk_decode_uninit(AVCodecContext *avctx)
Free decoder.
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.
VkImageUsageFlagBits usage
Defines extra usage of output frames.
#define SPEC_LIST_CREATE(name, max_length, max_size)
VkAccessFlagBits2 access[AV_NUM_DATA_POINTERS]
Updated after every barrier.
const unsigned int ff_ffv1_dec_rgb_float_comp_spv_len
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,...
uint64_t flags
Combination of AV_PIX_FMT_FLAG_...
const unsigned char ff_ffv1_dec_rgb_float_comp_spv_data[]
const unsigned char ff_ffv1_dec_golomb_comp_spv_data[]
#define ff_vk_buf_barrier(dst, vkb, s_stage, s_access, s_access2, d_stage, d_access, d_access2, offs, bsz)
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 i(width, name, range_min, range_max)
#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
VkMemoryPropertyFlagBits flags
AVBufferRef * intermediate_frames_ref
void * av_refstruct_ref(void *obj)
Create a new reference to an object managed via this API, i.e.
const unsigned int ff_ffv1_dec_rgb_comp_spv_len
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.
const unsigned char ff_ffv1_dec_comp_spv_data[]
void ff_vk_exec_add_dep_wait_sem(FFVulkanContext *s, FFVkExecContext *e, VkSemaphore sem, uint64_t val, VkPipelineStageFlagBits2 stage)
void ff_ffv1_vk_set_common_sl(AVCodecContext *avctx, FFV1Context *f, VkSpecializationInfo *sl, enum AVPixelFormat sw_format)
void av_refstruct_unref(void *objp)
Decrement the reference count of the underlying object and automatically free the object if there are...
const char * name
Name of the hardware accelerated codec.
#define FF_VK_EXT_EXTERNAL_HOST_MEMORY
const unsigned int ff_ffv1_dec_comp_spv_len
int ff_vk_exec_start(FFVulkanContext *s, FFVkExecContext *e)
Start/submit/wait an execution.
uint32_t slice_state_size
#define AV_PIX_FMT_GBRP12
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)
static av_cold void uninit(AVBitStreamFilterContext *ctx)
void ff_vk_free_buf(FFVulkanContext *s, FFVkBuffer *buf)
const unsigned int ff_ffv1_dec_reset_golomb_comp_spv_len
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_shader_add_descriptor_set(FFVulkanContext *s, FFVulkanShader *shd, const FFVulkanDescriptorSetBinding *desc, int nb, int singular)
Add descriptor to a shader.
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.
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.
int ff_vk_shader_add_push_const(FFVulkanShader *shd, int offset, int size, VkShaderStageFlagBits stage)
Add/update push constants for execution.
static int init_setup_shader(FFV1Context *f, FFVulkanContext *s, FFVkExecPool *pool, FFVulkanShader *shd, VkSpecializationInfo *sl)
main external API structure.
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
const unsigned int ff_ffv1_dec_bayer_golomb_comp_spv_len
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
const unsigned char ff_ffv1_dec_reset_comp_spv_data[]
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.
VkImageLayout layout[AV_NUM_DATA_POINTERS]
A reference to a data buffer.
VkDevice act_dev
Active device.
static void av_refstruct_pool_uninit(AVRefStructPool **poolp)
Mark the pool as being available for freeing.
static int ff_vk_count_images(AVVkFrame *f)
const unsigned int ff_ffv1_dec_bayer_comp_spv_len
uint16_t context_count[8]
int ff_vk_exec_submit(FFVulkanContext *s, FFVkExecContext *e)
const unsigned int ff_ffv1_dec_rgb_golomb_comp_spv_len
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
int ff_vk_decode_init(AVCodecContext *avctx)
Initialize decoder.
enum AVPixelFormat sw_pix_fmt
Nominal unaccelerated pixel format, see AV_PIX_FMT_xxx.
FFVkBuffer * slice_fltmap_buf
VkDeviceAddress slice_data
const unsigned char ff_ffv1_dec_rgb_comp_spv_data[]
int av_hwframe_get_buffer(AVBufferRef *hwframe_ref, AVFrame *frame, int flags)
Allocate a new frame attached to the given AVHWFramesContext.
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.
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.
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.