Go to the documentation of this file.
28 #define RGB_LINECACHE 2
65 .queue_flags = VK_QUEUE_COMPUTE_BIT,
121 for (
int i = 0;
i <
f->quant_table_count;
i++)
122 max_contexts =
FFMAX(
f->context_count[
i], max_contexts);
143 VK_BUFFER_USAGE_STORAGE_BUFFER_BIT |
144 VK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT);
150 VK_BUFFER_USAGE_STORAGE_BUFFER_BIT,
152 VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT);
165 VK_BUFFER_USAGE_STORAGE_BUFFER_BIT,
166 NULL, 2*(2*
f->slice_count*
sizeof(uint32_t)),
167 VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT |
168 VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT);
173 if (
f->version >=4 &&
f->micro_version >= 9 &&
177 VK_BUFFER_USAGE_STORAGE_BUFFER_BIT,
178 NULL, 65536*4*
f->slice_count*
sizeof(uint32_t),
179 VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT |
180 VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT);
218 if (slices_buf && slices_buf->host_ref) {
220 data - slices_buf->mapped_mem);
271 VkImageMemoryBarrier2 img_bar[37];
273 VkBufferMemoryBarrier2 buf_bar[8];
281 VK_PIPELINE_STAGE_2_ALL_COMMANDS_BIT,
282 VK_PIPELINE_STAGE_2_COMPUTE_SHADER_BIT));
298 VK_PIPELINE_STAGE_2_ALL_COMMANDS_BIT,
299 VK_PIPELINE_STAGE_2_CLEAR_BIT));
308 VK_PIPELINE_STAGE_2_ALL_COMMANDS_BIT));
323 vkf->
layout[
i] = VK_IMAGE_LAYOUT_UNDEFINED;
324 vkf->
access[
i] = VK_ACCESS_2_NONE;
332 VK_FORMAT_UNDEFINED);
336 0, 2*
f->slice_count*
sizeof(uint32_t),
337 VK_FORMAT_UNDEFINED);
341 2*
f->slice_count*
sizeof(uint32_t),
343 VK_FORMAT_UNDEFINED);
350 VK_FORMAT_UNDEFINED);
357 .img_size[0] =
f->picture.f->width,
358 .img_size[1] =
f->picture.f->height,
363 .micro_version =
f->micro_version,
366 for (
int i = 0;
i <
f->quant_table_count;
i++) {
369 f->quant_tables[
i][4][127];
375 memcpy(pd.
fmt_lut, (
int [4]) { 2, 1, 0, 3 }, 4*
sizeof(
int));
380 VK_SHADER_STAGE_COMPUTE_BIT,
383 vk->CmdDispatch(exec->buf,
f->num_h_slices,
f->num_v_slices, 1);
387 for (
int i = 0;
i < 4;
i++) {
388 vkf->
layout[
i] = VK_IMAGE_LAYOUT_UNDEFINED;
389 vkf->
access[
i] = VK_ACCESS_2_NONE;
393 VK_PIPELINE_STAGE_2_ALL_COMMANDS_BIT,
394 VK_PIPELINE_STAGE_2_CLEAR_BIT,
395 VK_ACCESS_2_TRANSFER_WRITE_BIT,
396 VK_IMAGE_LAYOUT_GENERAL,
397 VK_QUEUE_FAMILY_IGNORED);
399 vk->CmdPipelineBarrier2(exec->buf, &(VkDependencyInfo) {
400 .sType = VK_STRUCTURE_TYPE_DEPENDENCY_INFO,
401 .pImageMemoryBarriers = img_bar,
402 .imageMemoryBarrierCount = nb_img_bar,
403 .pBufferMemoryBarriers = buf_bar,
404 .bufferMemoryBarrierCount = nb_buf_bar,
411 int n_dec_planes =
f->bayer ? 4 : color_planes;
412 for (
int i = 0;
i < n_dec_planes;
i++)
413 vk->CmdClearColorImage(exec->buf, vkf->
img[
i], VK_IMAGE_LAYOUT_GENERAL,
414 &((VkClearColorValue) { 0 }),
415 1, &((VkImageSubresourceRange) {
416 .aspectMask = VK_IMAGE_ASPECT_COLOR_BIT,
424 COMPUTE_SHADER_BIT, SHADER_STORAGE_READ_BIT,
425 SHADER_STORAGE_WRITE_BIT,
426 COMPUTE_SHADER_BIT, SHADER_STORAGE_READ_BIT, NONE_KHR,
432 COMPUTE_SHADER_BIT, SHADER_STORAGE_READ_BIT,
433 SHADER_STORAGE_WRITE_BIT,
434 COMPUTE_SHADER_BIT, SHADER_STORAGE_WRITE_BIT, NONE_KHR,
437 vk->CmdPipelineBarrier2(exec->buf, &(VkDependencyInfo) {
438 .sType = VK_STRUCTURE_TYPE_DEPENDENCY_INFO,
439 .pImageMemoryBarriers = img_bar,
440 .imageMemoryBarrierCount = nb_img_bar,
441 .pBufferMemoryBarriers = buf_bar,
442 .bufferMemoryBarrierCount = nb_buf_bar,
452 VK_FORMAT_UNDEFINED);
458 VK_FORMAT_UNDEFINED);
462 VK_SHADER_STAGE_COMPUTE_BIT,
465 vk->CmdDispatch(exec->buf,
f->num_h_slices,
f->num_v_slices,
470 COMPUTE_SHADER_BIT, SHADER_STORAGE_WRITE_BIT, NONE_KHR,
471 COMPUTE_SHADER_BIT, SHADER_STORAGE_READ_BIT,
472 SHADER_STORAGE_WRITE_BIT,
477 VK_PIPELINE_STAGE_2_ALL_COMMANDS_BIT,
478 VK_PIPELINE_STAGE_2_COMPUTE_SHADER_BIT,
479 VK_ACCESS_SHADER_WRITE_BIT |
480 (!is_rgb ? VK_ACCESS_SHADER_READ_BIT : 0),
481 VK_IMAGE_LAYOUT_GENERAL,
482 VK_QUEUE_FAMILY_IGNORED);
485 VK_PIPELINE_STAGE_2_CLEAR_BIT,
486 VK_PIPELINE_STAGE_2_COMPUTE_SHADER_BIT,
487 VK_ACCESS_SHADER_READ_BIT | VK_ACCESS_SHADER_WRITE_BIT,
488 VK_IMAGE_LAYOUT_GENERAL,
489 VK_QUEUE_FAMILY_IGNORED);
491 vk->CmdPipelineBarrier2(exec->buf, &(VkDependencyInfo) {
492 .sType = VK_STRUCTURE_TYPE_DEPENDENCY_INFO,
493 .pImageMemoryBarriers = img_bar,
494 .imageMemoryBarrierCount = nb_img_bar,
495 .pBufferMemoryBarriers = buf_bar,
496 .bufferMemoryBarrierCount = nb_buf_bar,
506 VK_FORMAT_UNDEFINED);
510 0, 2*
f->slice_count*
sizeof(uint32_t),
511 VK_FORMAT_UNDEFINED);
515 2*
f->slice_count*
sizeof(uint32_t),
517 VK_FORMAT_UNDEFINED);
523 VK_FORMAT_UNDEFINED);
526 VkImageView *decode_dst_view = is_rgb ? rct_image_views : output_views;
528 decode_dst, decode_dst_view,
530 VK_IMAGE_LAYOUT_GENERAL,
534 f->picture.f, output_views,
536 VK_IMAGE_LAYOUT_GENERAL,
544 VK_FORMAT_UNDEFINED);
548 VK_SHADER_STAGE_COMPUTE_BIT,
551 vk->CmdDispatch(exec->buf,
f->num_h_slices,
f->num_v_slices, 1);
566 VkSpecializationInfo *sl)
571 (uint32_t []) { 1, 1, 1 }, 0);
574 VK_SHADER_STAGE_COMPUTE_BIT);
578 .
type = VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER,
579 .stages = VK_SHADER_STAGE_COMPUTE_BIT,
582 .type = VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER,
583 .stages = VK_SHADER_STAGE_COMPUTE_BIT,
590 .
type = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER,
591 .stages = VK_SHADER_STAGE_COMPUTE_BIT,
594 .type = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER,
595 .stages = VK_SHADER_STAGE_COMPUTE_BIT,
598 .type = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER,
599 .stages = VK_SHADER_STAGE_COMPUTE_BIT,
602 .type = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER,
603 .stages = VK_SHADER_STAGE_COMPUTE_BIT,
620 VkSpecializationInfo *sl,
int ac)
623 int wg_dim =
FFMIN(
s->props.properties.limits.maxComputeWorkGroupSize[0], 1024);
626 (uint32_t []) { wg_dim, 1, 1 }, 0);
629 VK_SHADER_STAGE_COMPUTE_BIT);
633 .
type = VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER,
634 .stages = VK_SHADER_STAGE_COMPUTE_BIT,
641 .
type = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER,
642 .stages = VK_SHADER_STAGE_COMPUTE_BIT,
645 .type = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER,
646 .stages = VK_SHADER_STAGE_COMPUTE_BIT,
670 VkSpecializationInfo *sl,
int ac,
int rgb,
677 (uint32_t []) { wg_x, 1, 1 }, 0);
680 VK_SHADER_STAGE_COMPUTE_BIT);
684 .
type = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER,
685 .stages = VK_SHADER_STAGE_COMPUTE_BIT,
688 .type = VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER,
689 .stages = VK_SHADER_STAGE_COMPUTE_BIT,
696 .
type = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER,
697 .stages = VK_SHADER_STAGE_COMPUTE_BIT,
700 .type = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER,
701 .stages = VK_SHADER_STAGE_COMPUTE_BIT,
704 .type = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER,
705 .stages = VK_SHADER_STAGE_COMPUTE_BIT,
708 .type = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER,
709 .stages = VK_SHADER_STAGE_COMPUTE_BIT,
712 .type = VK_DESCRIPTOR_TYPE_STORAGE_IMAGE,
713 .stages = VK_SHADER_STAGE_COMPUTE_BIT,
717 .type = VK_DESCRIPTOR_TYPE_STORAGE_IMAGE,
718 .stages = VK_SHADER_STAGE_COMPUTE_BIT,
722 .type = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER,
723 .stages = VK_SHADER_STAGE_COMPUTE_BIT,
735 5 +
rgb + (is_float && !bayer),
747 }
else if (is_float) {
797 frames_ctx->
width =
s->frames->width;
800 vk_frames = frames_ctx->
hwctx;
801 vk_frames->
tiling = VK_IMAGE_TILING_OPTIMAL;
802 vk_frames->
img_flags = VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT;
803 vk_frames->
usage = VK_IMAGE_USAGE_STORAGE_BIT |
804 VK_IMAGE_USAGE_TRANSFER_DST_BIT;
809 "Unable to initialize frame pool with format %s: %s\n",
850 if (
f->slice_count < 16)
852 "decoding may be very slow\n",
f->slice_count);
897 dctx, hwfc, sl,
f->ac, is_rgb,
f->bayer));
906 256*
sizeof(uint32_t), 512*
sizeof(uint8_t),
907 VK_FORMAT_UNDEFINED));
911 0, 256*
sizeof(uint32_t),
912 VK_FORMAT_UNDEFINED));
918 256*
sizeof(uint32_t), 512*
sizeof(uint8_t),
919 VK_FORMAT_UNDEFINED));
923 256*
sizeof(uint32_t) + 512*
sizeof(uint8_t),
925 VK_FORMAT_UNDEFINED));
944 if (!(slice_feedback->
flags & VK_MEMORY_PROPERTY_HOST_COHERENT_BIT)) {
945 VkMappedMemoryRange invalidate_data = {
946 .sType = VK_STRUCTURE_TYPE_MAPPED_MEMORY_RANGE,
947 .memory = slice_feedback->
mem,
949 .size = 2*fp->
slice_num*
sizeof(uint32_t),
952 1, &invalidate_data);
955 int slice_error_cnt = 0;
956 int crc_mismatch_cnt = 0;
957 uint32_t max_overread = 0;
959 uint32_t crc_res = 0;
961 crc_res =
AV_RN32(ssp + 2*
i*
sizeof(uint32_t) + 0);
962 uint32_t overread =
AV_RN32(ssp + 2*
i*
sizeof(uint32_t) + 4);
963 max_overread =
FFMAX(overread, max_overread);
964 slice_error_cnt += !!overread;
965 crc_mismatch_cnt += !!crc_res;
967 if (slice_error_cnt || crc_mismatch_cnt)
969 "%i CRCs mismatched\n",
970 slice_error_cnt, max_overread, crc_mismatch_cnt);
977 .
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
#define AV_LOG_WARNING
Something somehow does not look correct.
AVPixelFormat
Pixel format.
const unsigned char ff_ffv1_dec_reset_golomb_comp_spv_data[]
AVBufferPool * slice_feedback_pool
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.
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.
#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.
AVBufferRef * slice_feedback_buf
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.
#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[]
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 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.
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.
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)
PFN_vkWaitSemaphores wait_semaphores
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
AVBufferRef * slice_fltmap_buf
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 AVFormatContext * ctx
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)
AVBufferRef * slice_state
uint32_t plane_state_size
uint32_t extend_lookup[8]
const unsigned int ff_ffv1_dec_golomb_comp_spv_len
int ff_vk_exec_add_dep_wait_sem(FFVulkanContext *s, FFVkExecContext *e, VkSemaphore sem, uint64_t val, VkPipelineStageFlagBits2 stage)
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.
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)
void av_buffer_pool_uninit(AVBufferPool **ppool)
Mark the pool as being available for freeing.
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
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_ffv1_vk_set_common_sl(AVCodecContext *avctx, FFV1Context *f, VkSpecializationInfo *sl, enum AVPixelFormat sw_format)
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)
AVBufferPool * slice_fltmap_pool
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.
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.
int ff_vk_shader_add_descriptor_set(FFVulkanContext *s, FFVulkanShader *shd, const FFVulkanDescriptorSetBinding *desc, int nb, int singular, int print_to_shader_only)
Add descriptor to a shader.
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 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
int ff_vk_decode_init(AVCodecContext *avctx)
Initialize decoder.
enum AVPixelFormat sw_pix_fmt
Nominal unaccelerated pixel format, see AV_PIX_FMT_xxx.
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_shader_load(FFVulkanShader *shd, VkPipelineStageFlags stage, VkSpecializationInfo *spec, uint32_t wg_size[3], uint32_t required_subgroup_size)
Initialize a shader object.
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.
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.