Go to the documentation of this file.
28 #define RGB_LINECACHE 2
53 .queue_flags = VK_QUEUE_COMPUTE_BIT,
107 for (
int i = 0;
i <
f->quant_table_count;
i++)
108 max_contexts =
FFMAX(
f->context_count[
i], max_contexts);
129 VK_BUFFER_USAGE_STORAGE_BUFFER_BIT |
130 VK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT);
136 VK_BUFFER_USAGE_STORAGE_BUFFER_BIT,
138 VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT);
151 VK_BUFFER_USAGE_STORAGE_BUFFER_BIT,
152 NULL, 2*(2*
f->slice_count*
sizeof(uint32_t)),
153 VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT |
154 VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT);
191 if (slices_buf && slices_buf->host_ref) {
193 data - slices_buf->mapped_mem);
240 VkImageMemoryBarrier2 img_bar[37];
242 VkBufferMemoryBarrier2 buf_bar[8];
250 VK_PIPELINE_STAGE_2_ALL_COMMANDS_BIT,
251 VK_PIPELINE_STAGE_2_COMPUTE_SHADER_BIT));
262 VK_PIPELINE_STAGE_2_ALL_COMMANDS_BIT,
263 VK_PIPELINE_STAGE_2_CLEAR_BIT));
272 VK_PIPELINE_STAGE_2_ALL_COMMANDS_BIT));
282 vkf->
layout[
i] = VK_IMAGE_LAYOUT_UNDEFINED;
283 vkf->
access[
i] = VK_ACCESS_2_NONE;
291 VK_FORMAT_UNDEFINED);
295 0, 2*
f->slice_count*
sizeof(uint32_t),
296 VK_FORMAT_UNDEFINED);
300 2*
f->slice_count*
sizeof(uint32_t),
302 VK_FORMAT_UNDEFINED);
309 .img_size[0] =
f->picture.f->width,
310 .img_size[1] =
f->picture.f->height,
315 .micro_version =
f->micro_version,
318 for (
int i = 0;
i <
f->quant_table_count;
i++) {
321 f->quant_tables[
i][4][127];
327 memcpy(pd.
fmt_lut, (
int [4]) { 2, 1, 0, 3 }, 4*
sizeof(
int));
332 VK_SHADER_STAGE_COMPUTE_BIT,
335 vk->CmdDispatch(exec->buf,
f->num_h_slices,
f->num_v_slices, 1);
339 for (
int i = 0;
i < 4;
i++) {
340 vkf->
layout[
i] = VK_IMAGE_LAYOUT_UNDEFINED;
341 vkf->
access[
i] = VK_ACCESS_2_NONE;
345 VK_PIPELINE_STAGE_2_ALL_COMMANDS_BIT,
346 VK_PIPELINE_STAGE_2_CLEAR_BIT,
347 VK_ACCESS_2_TRANSFER_WRITE_BIT,
348 VK_IMAGE_LAYOUT_GENERAL,
349 VK_QUEUE_FAMILY_IGNORED);
351 vk->CmdPipelineBarrier2(exec->buf, &(VkDependencyInfo) {
352 .sType = VK_STRUCTURE_TYPE_DEPENDENCY_INFO,
353 .pImageMemoryBarriers = img_bar,
354 .imageMemoryBarrierCount = nb_img_bar,
355 .pBufferMemoryBarriers = buf_bar,
356 .bufferMemoryBarrierCount = nb_buf_bar,
361 for (
int i = 0;
i < color_planes;
i++)
362 vk->CmdClearColorImage(exec->buf, vkf->
img[
i], VK_IMAGE_LAYOUT_GENERAL,
363 &((VkClearColorValue) { 0 }),
364 1, &((VkImageSubresourceRange) {
365 .aspectMask = VK_IMAGE_ASPECT_COLOR_BIT,
373 COMPUTE_SHADER_BIT, SHADER_STORAGE_READ_BIT,
374 SHADER_STORAGE_WRITE_BIT,
375 COMPUTE_SHADER_BIT, SHADER_STORAGE_READ_BIT, NONE_KHR,
381 COMPUTE_SHADER_BIT, SHADER_STORAGE_READ_BIT,
382 SHADER_STORAGE_WRITE_BIT,
383 COMPUTE_SHADER_BIT, SHADER_STORAGE_WRITE_BIT, NONE_KHR,
386 vk->CmdPipelineBarrier2(exec->buf, &(VkDependencyInfo) {
387 .sType = VK_STRUCTURE_TYPE_DEPENDENCY_INFO,
388 .pImageMemoryBarriers = img_bar,
389 .imageMemoryBarrierCount = nb_img_bar,
390 .pBufferMemoryBarriers = buf_bar,
391 .bufferMemoryBarrierCount = nb_buf_bar,
401 VK_FORMAT_UNDEFINED);
407 VK_FORMAT_UNDEFINED);
411 VK_SHADER_STAGE_COMPUTE_BIT,
414 vk->CmdDispatch(exec->buf,
f->num_h_slices,
f->num_v_slices,
419 COMPUTE_SHADER_BIT, SHADER_STORAGE_WRITE_BIT, NONE_KHR,
420 COMPUTE_SHADER_BIT, SHADER_STORAGE_READ_BIT,
421 SHADER_STORAGE_WRITE_BIT,
426 VK_PIPELINE_STAGE_2_ALL_COMMANDS_BIT,
427 VK_PIPELINE_STAGE_2_COMPUTE_SHADER_BIT,
428 VK_ACCESS_SHADER_WRITE_BIT |
429 (!is_rgb ? VK_ACCESS_SHADER_READ_BIT : 0),
430 VK_IMAGE_LAYOUT_GENERAL,
431 VK_QUEUE_FAMILY_IGNORED);
434 VK_PIPELINE_STAGE_2_CLEAR_BIT,
435 VK_PIPELINE_STAGE_2_COMPUTE_SHADER_BIT,
436 VK_ACCESS_SHADER_READ_BIT | VK_ACCESS_SHADER_WRITE_BIT,
437 VK_IMAGE_LAYOUT_GENERAL,
438 VK_QUEUE_FAMILY_IGNORED);
440 vk->CmdPipelineBarrier2(exec->buf, &(VkDependencyInfo) {
441 .sType = VK_STRUCTURE_TYPE_DEPENDENCY_INFO,
442 .pImageMemoryBarriers = img_bar,
443 .imageMemoryBarrierCount = nb_img_bar,
444 .pBufferMemoryBarriers = buf_bar,
445 .bufferMemoryBarrierCount = nb_buf_bar,
455 VK_FORMAT_UNDEFINED);
459 0, 2*
f->slice_count*
sizeof(uint32_t),
460 VK_FORMAT_UNDEFINED);
464 2*
f->slice_count*
sizeof(uint32_t),
466 VK_FORMAT_UNDEFINED);
472 VK_FORMAT_UNDEFINED);
475 VkImageView *decode_dst_view = is_rgb ? rct_image_views : vp->
view.
out;
477 decode_dst, decode_dst_view,
479 VK_IMAGE_LAYOUT_GENERAL,
485 VK_IMAGE_LAYOUT_GENERAL,
490 VK_SHADER_STAGE_COMPUTE_BIT,
493 vk->CmdDispatch(exec->buf,
f->num_h_slices,
f->num_v_slices, 1);
508 VkSpecializationInfo *sl)
513 (uint32_t []) { 1, 1, 1 }, 0);
516 VK_SHADER_STAGE_COMPUTE_BIT);
520 .
type = VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER,
521 .stages = VK_SHADER_STAGE_COMPUTE_BIT,
524 .type = VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER,
525 .stages = VK_SHADER_STAGE_COMPUTE_BIT,
532 .
type = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER,
533 .stages = VK_SHADER_STAGE_COMPUTE_BIT,
536 .type = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER,
537 .stages = VK_SHADER_STAGE_COMPUTE_BIT,
540 .type = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER,
541 .stages = VK_SHADER_STAGE_COMPUTE_BIT,
558 VkSpecializationInfo *sl,
int ac)
561 int wg_dim =
FFMIN(
s->props.properties.limits.maxComputeWorkGroupSize[0], 1024);
564 (uint32_t []) { wg_dim, 1, 1 }, 0);
567 VK_SHADER_STAGE_COMPUTE_BIT);
571 .
type = VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER,
572 .stages = VK_SHADER_STAGE_COMPUTE_BIT,
579 .
type = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER,
580 .stages = VK_SHADER_STAGE_COMPUTE_BIT,
583 .type = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER,
584 .stages = VK_SHADER_STAGE_COMPUTE_BIT,
608 VkSpecializationInfo *sl,
int ac,
int rgb)
614 (uint32_t []) { wg_x, 1, 1 }, 0);
617 VK_SHADER_STAGE_COMPUTE_BIT);
621 .
type = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER,
622 .stages = VK_SHADER_STAGE_COMPUTE_BIT,
625 .type = VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER,
626 .stages = VK_SHADER_STAGE_COMPUTE_BIT,
633 .
type = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER,
634 .stages = VK_SHADER_STAGE_COMPUTE_BIT,
637 .type = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER,
638 .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,
649 .type = VK_DESCRIPTOR_TYPE_STORAGE_IMAGE,
650 .stages = VK_SHADER_STAGE_COMPUTE_BIT,
654 .type = VK_DESCRIPTOR_TYPE_STORAGE_IMAGE,
655 .stages = VK_SHADER_STAGE_COMPUTE_BIT,
702 frames_ctx->
width =
s->frames->width;
705 vk_frames = frames_ctx->
hwctx;
706 vk_frames->
tiling = VK_IMAGE_TILING_OPTIMAL;
707 vk_frames->
img_flags = VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT;
708 vk_frames->
usage = VK_IMAGE_USAGE_STORAGE_BIT |
709 VK_IMAGE_USAGE_TRANSFER_DST_BIT;
714 "Unable to initialize frame pool with format %s: %s\n",
749 if (
f->version < 3 ||
750 (
f->version == 4 &&
f->micro_version > 3))
796 dctx, hwfc, sl,
f->ac, is_rgb));
805 256*
sizeof(uint32_t), 512*
sizeof(uint8_t),
806 VK_FORMAT_UNDEFINED));
810 0, 256*
sizeof(uint32_t),
811 VK_FORMAT_UNDEFINED));
817 256*
sizeof(uint32_t), 512*
sizeof(uint8_t),
818 VK_FORMAT_UNDEFINED));
822 256*
sizeof(uint32_t) + 512*
sizeof(uint8_t),
824 VK_FORMAT_UNDEFINED));
843 if (!(slice_feedback->
flags & VK_MEMORY_PROPERTY_HOST_COHERENT_BIT)) {
844 VkMappedMemoryRange invalidate_data = {
845 .sType = VK_STRUCTURE_TYPE_MAPPED_MEMORY_RANGE,
846 .memory = slice_feedback->
mem,
848 .size = 2*fp->
slice_num*
sizeof(uint32_t),
851 1, &invalidate_data);
854 int slice_error_cnt = 0;
855 int crc_mismatch_cnt = 0;
856 uint32_t max_overread = 0;
858 uint32_t crc_res = 0;
860 crc_res =
AV_RN32(ssp + 2*
i*
sizeof(uint32_t) + 0);
861 uint32_t overread =
AV_RN32(ssp + 2*
i*
sizeof(uint32_t) + 4);
862 max_overread =
FFMAX(overread, max_overread);
863 slice_error_cnt += !!overread;
864 crc_mismatch_cnt += !!crc_res;
866 if (slice_error_cnt || crc_mismatch_cnt)
868 "%i CRCs mismatched\n",
869 slice_error_cnt, max_overread, crc_mismatch_cnt);
876 .
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
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.
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.
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)
int width
The allocated dimensions of the frames in this pool.
@ 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 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.
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.
#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.
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
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)
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,...
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)
VkAccessFlagBits access[AV_NUM_DATA_POINTERS]
Updated after every barrier.
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)
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)
#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
static void uninit(AVBSFContext *ctx)
const unsigned int ff_ffv1_dec_comp_spv_len
VkImageView out[AV_NUM_DATA_POINTERS]
struct FFVulkanDecodePicture::@332 view
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_free_buf(FFVulkanContext *s, FFVkBuffer *buf)
const unsigned int ff_ffv1_dec_reset_golomb_comp_spv_len
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.
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
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)
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.