160 .name =
"SliceBuffer",
161 .type = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER,
162 .stages = VK_SHADER_STAGE_COMPUTE_BIT,
166 .type = VK_DESCRIPTOR_TYPE_STORAGE_IMAGE,
167 .stages = VK_SHADER_STAGE_COMPUTE_BIT,
198 (uint32_t []) { 16, 16, 1 }, 0);
202 .name =
"SliceBuffer",
203 .type = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER,
204 .stages = VK_SHADER_STAGE_COMPUTE_BIT,
208 .type = VK_DESCRIPTOR_TYPE_STORAGE_IMAGE,
209 .stages = VK_SHADER_STAGE_COMPUTE_BIT,
231 VK_SHADER_STAGE_COMPUTE_BIT;
249 (uint32_t []) { dim_x, 1, 1 }, required ? dim_x : 0);
253 .name =
"SliceBuffer",
254 .type = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER,
255 .stages = VK_SHADER_STAGE_COMPUTE_BIT,
258 .name =
"SliceScores",
259 .type = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER,
260 .stages = VK_SHADER_STAGE_COMPUTE_BIT,
263 .name =
"ProresDataTables",
264 .type = VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER,
265 .stages = VK_SHADER_STAGE_COMPUTE_BIT,
299 .name =
"SliceScores",
300 .type = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER,
301 .stages = VK_SHADER_STAGE_COMPUTE_BIT,
332 (uint32_t []) { 64, 1, 1 }, 0);
336 .name =
"SliceBuffer",
337 .type = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER,
338 .stages = VK_SHADER_STAGE_COMPUTE_BIT,
341 .name =
"SliceScores",
342 .type = VK_DESCRIPTOR_TYPE_STORAGE_BUFFER,
343 .stages = VK_SHADER_STAGE_COMPUTE_BIT,
346 .name =
"ProresDataTables",
347 .type = VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER,
348 .stages = VK_SHADER_STAGE_COMPUTE_BIT,
373 int err = 0, nb_img_bar = 0,
i, is_chroma;
374 int min_quant =
ctx->profile_info->min_quant;
375 int max_quant =
ctx->profile_info->max_quant;
379 FFVkBuffer *pkt_vk_buf, *slice_data_buf, *slice_score_buf;
386 VK_BUFFER_USAGE_STORAGE_BUFFER_BIT |
387 VK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT,
NULL,
389 VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT));
396 VK_BUFFER_USAGE_STORAGE_BUFFER_BIT |
397 VK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT,
NULL,
398 (
ctx->slices_per_picture + 1) *
sizeof(uint32_t),
399 VK_MEMORY_PROPERTY_HOST_CACHED_BIT |
400 VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT |
401 VK_MEMORY_PROPERTY_HOST_COHERENT_BIT));
407 VK_BUFFER_USAGE_STORAGE_BUFFER_BIT |
408 VK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT,
NULL,
410 VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT |
417 VK_BUFFER_USAGE_STORAGE_BUFFER_BIT |
418 VK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT,
NULL,
420 VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT));
426 VK_BUFFER_USAGE_STORAGE_BUFFER_BIT |
427 VK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT,
NULL,
429 VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT));
435 VK_PIPELINE_STAGE_2_ALL_COMMANDS_BIT,
436 VK_PIPELINE_STAGE_2_COMPUTE_SHADER_BIT));
439 VK_PIPELINE_STAGE_2_ALL_COMMANDS_BIT,
440 VK_PIPELINE_STAGE_2_COMPUTE_SHADER_BIT,
441 VK_ACCESS_SHADER_READ_BIT,
442 VK_IMAGE_LAYOUT_GENERAL,
443 VK_QUEUE_FAMILY_IGNORED);
446 vk->CmdPipelineBarrier2(exec->
buf, &(VkDependencyInfo) {
447 .sType = VK_STRUCTURE_TYPE_DEPENDENCY_INFO,
448 .pImageMemoryBarriers = img_bar,
449 .imageMemoryBarrierCount = nb_img_bar,
456 for (
i = 0;
i <
ctx->num_planes;
i++) {
457 is_chroma = (
i == 1 ||
i == 2);
460 slice_data_info.
plane =
i;
463 slice_data_buf, 0, slice_data_buf->
size,
464 VK_FORMAT_UNDEFINED);
466 VK_IMAGE_LAYOUT_GENERAL, VK_NULL_HANDLE);
470 vk->CmdDispatch(exec->
buf,
ctx->slices_width,
ctx->mb_height, 1);
473 slice_data_buf, 0, slice_data_buf->
size,
474 VK_FORMAT_UNDEFINED);
476 VK_IMAGE_LAYOUT_GENERAL, VK_NULL_HANDLE);
478 vk->CmdDispatch(exec->
buf,
ctx->mb_width,
ctx->mb_height, 1);
483 vk->CmdPipelineBarrier2(exec->
buf, &(VkDependencyInfo) {
484 .sType = VK_STRUCTURE_TYPE_DEPENDENCY_INFO,
485 .pBufferMemoryBarriers = & (VkBufferMemoryBarrier2) {
486 .sType = VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER_2,
488 .srcStageMask = VK_PIPELINE_STAGE_2_COMPUTE_SHADER_BIT,
489 .srcAccessMask = VK_ACCESS_2_SHADER_WRITE_BIT,
490 .dstStageMask = VK_PIPELINE_STAGE_2_COMPUTE_SHADER_BIT,
491 .dstAccessMask = VK_ACCESS_2_SHADER_READ_BIT,
492 .srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED,
493 .dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED,
494 .buffer = slice_data_buf->buf,
496 .size = slice_data_buf->size,
498 .bufferMemoryBarrierCount = 1,
503 slice_data_buf, 0, slice_data_buf->size,
504 VK_FORMAT_UNDEFINED);
506 slice_score_buf, 0, slice_score_buf->size,
507 VK_FORMAT_UNDEFINED);
509 &pv->prores_data_tables_buf, 0, pv->prores_data_tables_buf.size,
510 VK_FORMAT_UNDEFINED);
512 vk->CmdDispatch(exec->buf, (
ctx->slices_per_picture + pv->estimate_slices_per_wg - 1) /
513 pv->estimate_slices_per_wg,
514 ctx->force_quant ? 1 : (max_quant - min_quant + 1), 1);
517 vk->CmdPipelineBarrier2(exec->buf, &(VkDependencyInfo) {
518 .sType = VK_STRUCTURE_TYPE_DEPENDENCY_INFO,
519 .pBufferMemoryBarriers = & (VkBufferMemoryBarrier2) {
520 .sType = VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER_2,
522 .srcStageMask = VK_PIPELINE_STAGE_2_COMPUTE_SHADER_BIT,
523 .srcAccessMask = VK_ACCESS_2_SHADER_WRITE_BIT | VK_ACCESS_2_SHADER_READ_BIT,
524 .dstStageMask = VK_PIPELINE_STAGE_2_COMPUTE_SHADER_BIT,
525 .dstAccessMask = VK_ACCESS_2_SHADER_WRITE_BIT | VK_ACCESS_2_SHADER_READ_BIT,
526 .srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED,
527 .dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED,
528 .buffer = slice_score_buf->buf,
530 .size = slice_score_buf->size,
532 .bufferMemoryBarrierCount = 1,
537 slice_score_buf, 0, slice_score_buf->size,
538 VK_FORMAT_UNDEFINED);
540 vk->CmdDispatch(exec->buf, 1, 1, 1);
543 vk->CmdPipelineBarrier2(exec->buf, &(VkDependencyInfo) {
544 .sType = VK_STRUCTURE_TYPE_DEPENDENCY_INFO,
545 .pBufferMemoryBarriers = & (VkBufferMemoryBarrier2) {
546 .sType = VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER_2,
548 .srcStageMask = VK_PIPELINE_STAGE_2_COMPUTE_SHADER_BIT,
549 .srcAccessMask = VK_ACCESS_2_SHADER_WRITE_BIT,
550 .dstStageMask = VK_PIPELINE_STAGE_2_COMPUTE_SHADER_BIT,
551 .dstAccessMask = VK_ACCESS_2_SHADER_WRITE_BIT | VK_ACCESS_2_SHADER_READ_BIT,
552 .srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED,
553 .dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED,
554 .buffer = slice_score_buf->buf,
556 .size = slice_score_buf->size,
558 .bufferMemoryBarrierCount = 1,
563 .bytestream = pkt_vk_buf->address,
564 .slice_sizes = pd->slice_sizes_ref[picture_idx]->address,
565 .slot_size = pv->slice_slot_size,
568 slice_data_buf, 0, slice_data_buf->size,
569 VK_FORMAT_UNDEFINED);
571 slice_score_buf, 0, slice_score_buf->size,
572 VK_FORMAT_UNDEFINED);
574 &pv->prores_data_tables_buf, 0, pv->prores_data_tables_buf.size,
575 VK_FORMAT_UNDEFINED);
578 VK_SHADER_STAGE_COMPUTE_BIT, 0,
sizeof(encode_info), &encode_info);
579 vk->CmdDispatch(exec->buf,
FFALIGN(
ctx->slices_per_picture, 64) / 64,
586 pd->slice_sizes_ref[picture_idx], 0,
ctx->slices_per_picture,
587 pkt_vk_buf, pv->slice_slot_size, pd->gathered_ref,
588 pv->payload_off + picture_idx * (8 +
ctx->slices_per_picture * 2),
589 picture_idx ? pd->slice_sizes_ref[0]->address +
590 ctx->slices_per_picture *
sizeof(uint32_t) : 0));
597 uint8_t **orig_buf,
int flags,
607 bytestream_put_be32 (orig_buf,
FRAME_ID);
613 bytestream_put_be16 (&buf,
ctx->chroma_factor !=
CFACTOR_Y422 ||
ctx->alpha_bits ? 1 : 0);
615 bytestream_put_be16 (&buf, avctx->
width);
616 bytestream_put_be16 (&buf, avctx->
height);
618 frame_flags =
ctx->chroma_factor << 6;
621 bytestream_put_byte (&buf, frame_flags);
623 bytestream_put_byte (&buf, 0);
625 bytestream_put_byte (&buf, color_trc);
626 bytestream_put_byte (&buf, colorspace);
627 bytestream_put_byte (&buf,
ctx->alpha_bits >> 3);
628 bytestream_put_byte (&buf, 0);
630 bytestream_put_byte (&buf, 0x03);
634 bytestream_put_byte (&buf, 0x00);
636 bytestream_put_be16 (&
tmp, buf - *orig_buf);
654 uint8_t *orig_buf, *buf;
655 uint8_t *picture_size_pos;
658 VkMappedMemoryRange invalidate_data;
664 invalidate_data = (VkMappedMemoryRange) {
665 .sType = VK_STRUCTURE_TYPE_MAPPED_MEMORY_RANGE,
667 .size = VK_WHOLE_SIZE,
669 if (!(wrap_buf->
flags & VK_MEMORY_PROPERTY_HOST_COHERENT_BIT)) {
670 invalidate_data.memory = wrap_buf->
mem;
671 vk->InvalidateMappedMemoryRanges(vkctx->
hwctx->
act_dev, 1, &invalidate_data);
680 for (picture_idx = 0; picture_idx <
ctx->pictures_per_frame; picture_idx++) {
682 const uint32_t *
sizes;
685 if (!(slice_sizes_buf->
flags & VK_MEMORY_PROPERTY_HOST_COHERENT_BIT)) {
686 invalidate_data.memory = slice_sizes_buf->
mem;
687 vk->InvalidateMappedMemoryRanges(vkctx->
hwctx->
act_dev, 1, &invalidate_data);
691 picture_size_pos = buf + 1;
692 bytestream_put_byte(&buf, 0x40);
694 bytestream_put_be16(&buf,
ctx->slices_per_picture);
695 bytestream_put_byte(&buf,
av_log2(
ctx->mbs_per_slice) << 4);
700 for (
int i = 0;
i <
ctx->slices_per_picture;
i++)
701 bytestream_put_be16(&buf,
sizes[
i]);
705 buf +=
sizes[
ctx->slices_per_picture];
708 picture_size = buf - (picture_size_pos - 1);
709 bytestream_put_be32(&picture_size_pos, picture_size);
804 for (
int j = 0; j < 2; j++) {
871 size_t samples =
ctx->mbs_per_slice *
876 (1 +
ctx->alpha_bits + 1) + 7) >> 3;
878 UINT16_MAX + 2 + 2 *
ctx->num_planes);
886 uint8_t *start =
tmp;
897 VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT |
898 VK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT,
899 VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT |
900 VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT));
902 for (q = 0; q < 128; ++q) {
903 for (
i = 0;
i < 64;
i++) {
913#define OFFSET(x) offsetof(ProresVulkanContext, x)
914#define VE AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM
917 {
"mbs_per_slice",
"macroblocks per slice",
OFFSET(
ctx.mbs_per_slice),
923 0, 0,
VE, .unit =
"profile" },
925 0, 0,
VE, .unit =
"profile" },
927 0, 0,
VE, .unit =
"profile" },
929 0, 0,
VE, .unit =
"profile" },
931 0, 0,
VE, .unit =
"profile" },
933 0, 0,
VE, .unit =
"profile" },
935 0, 0,
VE, .unit =
"profile" },
936 {
"vendor",
"vendor ID",
OFFSET(
ctx.vendor),
938 {
"bits_per_mb",
"desired bits per macroblock",
OFFSET(
ctx.bits_per_mb),
943 0, 0,
VE, .unit =
"quant_mat" },
945 0, 0,
VE, .unit =
"quant_mat" },
947 0, 0,
VE, .unit =
"quant_mat" },
949 0, 0,
VE, .unit =
"quant_mat" },
951 0, 0,
VE, .unit =
"quant_mat" },
953 0, 0,
VE, .unit =
"quant_mat" },
955 { .i64 = 16 }, 0, 16,
VE },
957 { .i64 = 2 }, 1, INT_MAX,
VE },
962 .class_name =
"ProRes vulkan encoder",
975 .p.name =
"prores_ks_vulkan",
const FFCodec ff_prores_ks_vulkan_encoder
static AVFormatContext * ctx
static av_cold void close(AVCodecParserContext *s)
static av_cold int encode_init(AVCodecContext *avctx)
simple assert() macros that are a bit more flexible than ISO C assert().
#define av_assert1(cond)
assert() equivalent, that does not lie in speed critical code.
Libavcodec external API header.
refcounted data buffer API
static av_always_inline void bytestream_put_buffer(uint8_t **b, const uint8_t *src, unsigned int size)
#define flags(name, subs,...)
#define i(width, name, range_min, range_max)
#define CODEC_PIXFMTS(...)
#define FF_CODEC_RECEIVE_PACKET_CB(func)
#define CODEC_LONG_NAME(str)
#define FF_CODEC_CAP_INIT_CLEANUP
The codec allows calling the close function for deallocation even if the init function returned a fai...
static const AVColorPrimariesDesc color_primaries[AVCOL_PRI_NB]
static av_cold int encode_close(AVCodecContext *avctx)
int(* init)(AVBSFContext *ctx)
#define FF_INPUT_BUFFER_MIN_SIZE
Used by some encoders as upper bound for the length of headers.
static int get_packet(AVCodecContext *avctx, FFVkExecContext *exec, AVPacket *pkt)
#define AV_NUM_DATA_POINTERS
static const uint8_t frame_size[4]
@ AV_OPT_TYPE_CONST
Special option type for declaring named constants.
@ AV_OPT_TYPE_INT
Underlying C type is int.
@ AV_OPT_TYPE_STRING
Underlying C type is a uint8_t* that is either NULL or points to a C string allocated with the av_mal...
#define AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE
This encoder can reorder user opaque values from input AVFrames and return them with corresponding ou...
#define AV_CODEC_CAP_ENCODER_FLUSH
This encoder can be flushed using avcodec_flush_buffers().
#define AV_CODEC_CAP_DELAY
Encoder or decoder requires flushing with NULL input at the end in order to give the complete and cor...
#define AV_CODEC_FLAG_INTERLACED_DCT
Use interlaced DCT.
#define AV_CODEC_CAP_HARDWARE
Codec is backed by a hardware implementation.
#define AV_INPUT_BUFFER_PADDING_SIZE
Required number of additionally allocated bytes at the end of the input bitstream for decoding.
AVBufferRef * av_buffer_create(uint8_t *data, size_t size, void(*free)(void *opaque, uint8_t *data), void *opaque, int flags)
Create an AVBuffer from an existing array.
#define AV_FRAME_FLAG_TOP_FIELD_FIRST
A flag to mark frames where the top field is displayed first if the content is interlaced.
#define AV_LOG_VERBOSE
Detailed information.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
const char * av_default_item_name(void *ptr)
Return the context name.
#define LIBAVUTIL_VERSION_INT
#define HW_CONFIG_ENCODER_DEVICE(format, device_type_)
#define HW_CONFIG_ENCODER_FRAMES(format, device_type_)
API-specific header for AV_HWDEVICE_TYPE_VULKAN.
static const int sizes[][2]
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
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.
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.
void ff_vk_shader_add_descriptor_set(FFVulkanContext *s, FFVulkanShader *shd, const FFVulkanDescriptorSetBinding *desc, int nb, int singular)
Add descriptor to a shader.
void ff_vk_exec_pool_free(FFVulkanContext *s, FFVkExecPool *pool)
int ff_vk_create_buf(FFVulkanContext *s, FFVkBuffer *buf, size_t size, void *pNext, void *alloc_pNext, VkBufferUsageFlags usage, VkMemoryPropertyFlagBits flags)
int ff_vk_exec_pool_init(FFVulkanContext *s, AVVulkanDeviceQueueFamily *qf, FFVkExecPool *pool, int nb_contexts, int nb_queries, VkQueryType query_type, int query_64bit, const void *query_create_pnext)
Allocates/frees an execution pool.
void ff_vk_exec_wait(FFVulkanContext *s, FFVkExecContext *e)
int ff_vk_shader_add_push_const(FFVulkanShader *shd, int offset, int size, VkShaderStageFlagBits stage)
Add/update push constants for execution.
int ff_vk_shader_update_img(FFVulkanContext *s, FFVkExecContext *e, FFVulkanShader *shd, int set, int bind, int offs, VkImageView view, VkImageLayout layout, VkSampler sampler)
Sets an image descriptor for specified shader and binding.
void ff_vk_uninit(FFVulkanContext *s)
Frees main context.
int ff_vk_init(FFVulkanContext *s, void *log_parent, AVBufferRef *device_ref, AVBufferRef *frames_ref)
Initializes the AVClass, in case this context is not used as the main user's context.
void ff_vk_free_buf(FFVulkanContext *s, FFVkBuffer *buf)
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)
int ff_vk_exec_start(FFVulkanContext *s, FFVkExecContext *e)
Start/submit/wait an execution.
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 ff_vk_shader_free(FFVulkanContext *s, FFVulkanShader *shd)
Free a shader.
int ff_vk_shader_register_exec(FFVulkanContext *s, FFVkExecPool *pool, FFVulkanShader *shd)
Register a shader with an exec pool.
int ff_vk_exec_submit(FFVulkanContext *s, FFVkExecContext *e)
void ff_vk_exec_bind_shader(FFVulkanContext *s, FFVkExecContext *e, const FFVulkanShader *shd)
Bind a shader.
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.
AVVulkanDeviceQueueFamily * ff_vk_qf_find(FFVulkanContext *s, VkQueueFlagBits dev_family, VkVideoCodecOperationFlagBitsKHR vid_ops)
Chooses an appropriate QF.
void ff_vk_exec_add_dep_refstruct(FFVulkanContext *s, FFVkExecContext *e, void *obj)
Execution dependency management.
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.
void ff_vk_exec_discard(FFVulkanContext *s, FFVkExecContext *e)
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.
int ff_vk_exec_add_dep_frame(FFVulkanContext *s, FFVkExecContext *e, AVFrame *f, VkPipelineStageFlagBits2 wait_stage, VkPipelineStageFlagBits2 signal_stage)
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.
Utility Preprocessor macros.
void * av_calloc(size_t nmemb, size_t size)
Memory handling functions.
int av_pix_fmt_count_planes(enum AVPixelFormat pix_fmt)
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
@ AVCOL_RANGE_MPEG
Narrow or limited range content.
@ AV_PIX_FMT_VULKAN
Vulkan hardware images.
AVColorPrimaries
Chromaticity coordinates of the source primaries.
AVColorTransferCharacteristic
Color Transfer Characteristic.
AVColorSpace
YUV colorspace type.
const AVProfile ff_prores_profiles[]
static const AVClass proresenc_class
av_cold int ff_prores_kostya_encode_init(AVCodecContext *avctx, ProresContext *ctx, enum AVPixelFormat pix_fmt)
@ PRORES_PROFILE_STANDARD
#define MAX_MBS_PER_SLICE
const unsigned int ff_prores_ks_alpha_data_comp_spv_len
const unsigned char ff_prores_ks_alpha_data_comp_spv_data[]
static int init_estimate_slice_pipeline(ProresVulkanContext *pv, FFVulkanShader *shd)
static int get_packet(AVCodecContext *avctx, FFVkExecContext *exec, AVPacket *pkt)
const unsigned int ff_prores_ks_slice_data_comp_spv_len
const unsigned int ff_prores_ks_encode_slice_comp_spv_len
static int encode_picture(AVCodecContext *avctx, FFVkExecContext *exec, AVFrame *frame, int picture_idx)
static av_cold int encode_init(AVCodecContext *avctx)
static av_cold int encode_close(AVCodecContext *avctx)
const unsigned int ff_prores_ks_trellis_node_comp_spv_len
static int init_alpha_data_pipeline(ProresVulkanContext *pv, FFVulkanShader *shd)
static const AVCodecHWConfigInternal *const prores_ks_hw_configs[]
static int vulkan_encode_prores_receive_packet(AVCodecContext *avctx, AVPacket *pkt)
static int init_trellis_node_pipeline(ProresVulkanContext *pv, FFVulkanShader *shd)
static void prores_vk_packet_free(void *opaque, uint8_t *data)
static av_cold void vulkan_encode_prores_flush(AVCodecContext *avctx)
static int vulkan_encode_prores_submit_frame(AVCodecContext *avctx, FFVkExecContext *exec, AVFrame *frame)
static int init_slice_data_pipeline(ProresVulkanContext *pv, FFVulkanShader *shd, int blocks_per_mb)
const unsigned char ff_prores_ks_trellis_node_comp_spv_data[]
static uint8_t * write_frame_header(AVCodecContext *avctx, ProresContext *ctx, uint8_t **orig_buf, int flags, enum AVColorPrimaries color_primaries, enum AVColorTransferCharacteristic color_trc, enum AVColorSpace colorspace)
const unsigned int ff_prores_ks_estimate_slice_comp_spv_len
static int init_encode_slice_pipeline(ProresVulkanContext *pv, FFVulkanShader *shd)
const unsigned char ff_prores_ks_estimate_slice_comp_spv_data[]
const unsigned char ff_prores_ks_slice_data_comp_spv_data[]
const unsigned char ff_prores_ks_encode_slice_comp_spv_data[]
void av_refstruct_unref(void *objp)
Decrement the reference count of the underlying object and automatically free the object if there are...
static void av_refstruct_pool_uninit(AVRefStructPool **poolp)
Mark the pool as being available for freeing.
Describe the class of an AVClass context structure.
main external API structure.
int width
picture width / height.
AVBufferRef * hw_frames_ctx
A reference to the AVHWFramesContext describing the input (for encoding) or output (decoding) frames.
int flags
AV_CODEC_FLAG_*.
This structure describes decoded (raw) audio or video data.
enum AVPixelFormat sw_format
The pixel format identifying the actual data layout of the hardware frames.
This structure stores compressed data.
Descriptor that unambiguously describes how the bits of a pixel are stored in the up to 4 data planes...
AVRefStructPool is an API for a thread-safe pool of objects managed via the RefStruct API.
VkDevice act_dev
Active device.
VkDeviceAddress slice_sizes
VkDeviceAddress bytestream
VkMemoryPropertyFlagBits flags
Frame loop for compute encoders.
FFVkExecContext * contexts
AVHWFramesContext * frames
AVVulkanDeviceContext * hwctx
VkMemoryPropertyFlagBits host_cached_flag
VkPhysicalDeviceSubgroupSizeControlProperties subgroup_props
unsigned mb_height
height of the current picture in mb
const struct prores_profile * profile_info
unsigned mb_width
width of the current picture in mb
int16_t qmat_chroma[128][64]
AVRefStructPool * slice_data_buf_pool
int estimate_slices_per_wg
FFVulkanShader alpha_data_shd
FFVulkanShader gather_shd
AVRefStructPool * gathered_buf_pool
FFVkBuffer prores_data_tables_buf
AVRefStructPool * slice_sizes_buf_pool
AVVulkanDeviceQueueFamily * qf
VulkanEncodeProresFrameData * exec_ctx_info
FFVulkanShader trellis_node_shd
FFVulkanShader slice_data_shd[2]
ProresDataTables * tables
AVRefStructPool * pkt_buf_pool
AVRefStructPool * slice_score_buf_pool
FFVulkanShader encode_slice_shd
FFVulkanShader estimate_slice_shd
int16_t rows[MAX_PLANES *MAX_MBS_PER_SLICE *256]
int error[MAX_STORED_Q][4]
int total_bits[MAX_STORED_Q]
int total_error[MAX_STORED_Q]
int bits[MAX_STORED_Q][4]
FFVkBuffer * slice_sizes_ref[2]
FFVkBuffer * slice_score_ref[2]
FFVkBuffer * out_data_ref[2]
enum AVColorPrimaries color_primaries
enum AVColorTransferCharacteristic color_trc
FFVkBuffer * slice_data_ref[2]
FFVkBuffer * gathered_ref
enum AVColorSpace colorspace
#define SPEC_LIST_ADD(name, idx, val_bits, val)
#define SPEC_LIST_CREATE(name, max_length, max_size)
static int ff_vk_map_buffer(FFVulkanContext *s, FFVkBuffer *buf, uint8_t **mem, int invalidate)
int ff_vk_encode_loop_receive_packet(AVCodecContext *avctx, FFVkEncodeLoop *l, AVPacket *pkt)
Call from FFCodec.cb.receive_packet; the packet metadata is carried from the submitted frame to its p...
void ff_vk_encode_loop_uninit(FFVkEncodeLoop *l)
void ff_vk_encode_loop_flush(AVCodecContext *avctx, FFVkEncodeLoop *l)
Waits for and discards every frame in flight.
int ff_vk_encode_loop_init(FFVulkanContext *s, FFVkExecPool *pool, FFVkEncodeLoop *l, int(*submit_frame)(AVCodecContext *avctx, FFVkExecContext *exec, AVFrame *frame), int(*get_packet)(AVCodecContext *avctx, FFVkExecContext *exec, AVPacket *pkt))
int ff_vk_seg_gather_init(FFVulkanContext *s, FFVkExecPool *pool, FFVulkanShader *shd)
Packs fixed-stride segment slots back to back into a contiguous buffer.
int ff_vk_seg_gather(FFVulkanContext *s, FFVkExecContext *exec, FFVulkanShader *shd, FFVkBuffer *sizes, size_t sizes_offset, uint32_t nb_segs, FFVkBuffer *sparse, uint32_t slot_size, FFVkBuffer *compacted, size_t compacted_offset, VkDeviceAddress offset_addr)
Gathers nb_segs slots of slot_size bytes from sparse into compacted, with the segment sizes given as ...