53 if (
s->vkctx.device_ref) {
54 if (
s->vkctx.device_ref->data == dev_ref->
data)
77 return s ?
s->vkctx.device_ref :
NULL;
80#define MAX_DITHER_BUFS 4
81#define MAX_FILT_BUFS 4
82#define MAX_DATA_BUFS (MAX_DITHER_BUFS + MAX_FILT_BUFS*4)
108 VK_PIPELINE_STAGE_2_ALL_COMMANDS_BIT,
109 VK_PIPELINE_STAGE_2_COMPUTE_SHADER_BIT);
113 VK_PIPELINE_STAGE_2_ALL_COMMANDS_BIT,
114 VK_PIPELINE_STAGE_2_COMPUTE_SHADER_BIT);
130 0, 0, VK_IMAGE_LAYOUT_GENERAL, VK_NULL_HANDLE);
132 0, 1, VK_IMAGE_LAYOUT_GENERAL, VK_NULL_HANDLE);
135 VkImageMemoryBarrier2 img_bar[8];
137 VK_PIPELINE_STAGE_2_ALL_COMMANDS_BIT,
138 VK_PIPELINE_STAGE_2_COMPUTE_SHADER_BIT,
139 VK_ACCESS_SHADER_READ_BIT,
140 VK_IMAGE_LAYOUT_GENERAL,
141 VK_QUEUE_FAMILY_IGNORED);
143 VK_PIPELINE_STAGE_2_ALL_COMMANDS_BIT,
144 VK_PIPELINE_STAGE_2_COMPUTE_SHADER_BIT,
145 VK_ACCESS_SHADER_WRITE_BIT,
146 VK_IMAGE_LAYOUT_GENERAL,
147 VK_QUEUE_FAMILY_IGNORED);
148 vk->CmdPipelineBarrier2(ec->
buf, &(VkDependencyInfo) {
149 .sType = VK_STRUCTURE_TYPE_DEPENDENCY_INFO,
150 .pImageMemoryBarriers = img_bar,
151 .imageMemoryBarrierCount = nb_img_bar,
157 VK_SHADER_STAGE_COMPUTE_BIT,
158 0,
sizeof(field), &field);
163 vk->CmdDispatch(ec->
buf,
164 FFALIGN(
dst->width, p->shd.lg_size[0])/p->shd.lg_size[0],
165 FFALIGN(
dst->height, p->shd.lg_size[1])/p->shd.lg_size[1],
187 for (
int i = 0;
i < p->nb_data_bufs;
i++)
202 VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT,
203 VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT |
204 VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT);
210 (uint8_t **)&weights_data, 0);
237 VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT,
238 VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT |
239 VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT);
248 for (
int i = 0;
i < rows*
size;
i++)
373 int *shift_id,
int *mask_id)
378 for (
int i = 0;
i < 4;
i++)
382 for (
int i = 0;
i < 4;
i++)
392 : spi_OpFAdd(spi, res_type,
a,
b);
398 : spi_OpFMul(spi, res_type,
a,
b);
402 int res_type,
int a,
int b)
409 int res_type,
int a,
int b)
422 : spi_OpConvertUToF(spi, res_type,
a);
448 id->u32_type = spi_OpTypeInt(spi, 32, 0);
449 id->i32_type = spi_OpTypeInt(spi, 32, 1);
451 id->f32_type = spi_OpTypeFloat(spi, 32);
455 id->bvec2_type = spi_OpTypeVector(spi,
id->b_type, 2);
456 id->u32vec2_type = spi_OpTypeVector(spi, u32_type, 2);
457 id->i32vec2_type = spi_OpTypeVector(spi,
id->i32_type, 2);
459 id->u32vec3_type = spi_OpTypeVector(spi, u32_type, 3);
461 id->u32vec4_type = spi_OpTypeVector(spi, u32_type, 4);
462 id->f32vec4_type = spi_OpTypeVector(spi, f32_type, 4);
463 id->f32mat4_type = spi_OpTypeMatrix(spi,
id->f32vec4_type, 4);
467 for (
int i = 0;
i < 5;
i++)
473 int in_img_count,
int out_img_count)
483 2, 0, 0, 0, 2, SpvImageFormatUnknown);
485 id->u32_cid[out_img_count]);
488 id->in_img_array_id = 0;
494 id->in_img_type = match ?
id->out_img_type :
496 2, 0, 0, 0, 2, SpvImageFormatUnknown);
498 id->u32_cid[in_img_count]);
505 id->out_img_array_id);
513 id->in_img_array_id);
520 SpvStorageClassInput, 0);
521 id->iface[
id->nb_iface++] =
id->gid_var;
523 SpvBuiltInGlobalInvocationId);
527 SpvStorageClassUniformConstant, 0);
528 id->iface[
id->nb_iface++] =
id->in_img_var;
535 SpvStorageClassUniformConstant, 0);
536 id->iface[
id->nb_iface++] =
id->out_img_var;
541 if (
id->interlaced) {
546 SpvDecorationOffset, 0);
548 id->push_const_struct_id);
552 id->push_const_ptr_id,
553 SpvStorageClassPushConstant, 0);
554 id->iface[
id->nb_iface++] =
id->push_const_var_id;
562 id->iface,
id->nb_iface);
572 for (
int j = 0; j < 4; j++) {
573 for (
int i = 0;
i < 4;
i++)
579 col[0], col[1], col[2], col[3]);
581 for (
int i = 0;
i < 4;
i++)
586 data = spi_OpMatrixTimesVector(spi,
id->f32vec4_type, mat,
data);
587 return spi_OpFAdd(spi,
id->f32vec4_type, off,
data);
608 for (
int j = 0; j < 4; j++) {
615 res[j] = acc ?
const_pixel(spi,
id, op_type, m[j][4])
617 for (
int i = 0;
i < 4;
i++) {
625 v =
emit_add(spi, op_type, type_s, res[j], v);
634 res[0], res[1], res[2], res[3]);
640 result = spi_OpBitwiseAnd(spi, type_v, result, mask_v);
650 .type = VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER,
651 .stages = VK_SHADER_STAGE_COMPUTE_BIT,
653 return p->nb_data_bufs++;
676 spi_OpDecorate(spi, arr_w_in, SpvDecorationArrayStride,
sizeof(
float));
694 id->iface[
id->nb_iface++] = buf;
708 int o =
spi_OpLoad(spi,
id->i32_type, o_ptr, SpvMemoryAccessMaskNone, 0);
716 if (src_interlaced && is_h) {
717 pos_y = spi_OpShiftLeftLogical(spi,
id->i32_type, pos_y,
id->u32_cid[1]);
718 pos_y = spi_OpIAdd(spi,
id->i32_type, pos_y,
id->field_i32);
722 int acc[4] = {
id->f32_0,
id->f32_0,
id->f32_0,
id->f32_0 };
729 id->u32_cid[0],
axis, tap);
731 SpvMemoryAccessMaskNone, 0);
734 int c = t ? spi_OpIAdd(spi,
id->i32_type, o, tap) : o;
737 if (src_interlaced && !is_h) {
738 c = spi_OpShiftLeftLogical(spi,
id->i32_type,
c,
id->u32_cid[1]);
739 c = spi_OpIAdd(spi,
id->i32_type,
c,
id->field_i32);
745 for (
int e = 0; e < 4; e++) {
750 SpvImageOperandsMaskNone);
753 px = spi_OpFMul(spi,
id->f32_type,
w, px);
754 acc[e] = spi_OpFAdd(spi,
id->f32_type, acc[e], px);
759 acc[0], acc[1], acc[2], acc[3]);
768 return VK_FORMAT_UNDEFINED;
770 switch (
op->rw.type) {
774 default:
return VK_FORMAT_UNDEFINED;
791 for (
int i = 0;
i < nb_planes;
i++) {
793 if (view_fmts[
i] == VK_FORMAT_UNDEFINED)
806 for (
int i = 0;
i < nb_planes;
i++)
826 id->src_gid, SpvImageOperandsMaskNone);
830 for (
int i = 0;
i < 4;
i++) {
835 SpvImageOperandsMaskNone);
858 SpvImageOperandsMaskNone);
861 for (
int i = 0;
i < 4;
i++) {
867 SpvImageOperandsMaskNone);
883 for (
int i = 0;
i < 4;
i++) {
920 spi_OpDecorate(spi, arr_1d, SpvDecorationArrayStride,
sizeof(
float));
933 id->iface[
id->nb_iface++] = buf;
938 x_id = spi_OpBitwiseAnd(spi,
id->u32_type, x_id, mask_id);
939 y_id = spi_OpBitwiseAnd(spi,
id->u32_type, y_id, mask_id);
940 for (
int i = 0;
i < 4;
i++) {
946 int row = spi_OpIAdd(spi,
id->u32_type, y_id, y_off);
949 id->u32_cid[0], row, x_id);
951 SpvMemoryAccessMaskNone, 0);
981 for (
int i = 1;
i < 4;
i++) {
983 val = spi_OpBitwiseOr(spi, type_s,
val,
tmp);
993 SPIRVIDs spid_data = { 0 }, *
id = &spid_data;
999 p->interlaced =
id->interlaced;
1002 (uint32_t []) { 32, 32, 1 }, 0);
1007 VK_SHADER_STAGE_COMPUTE_BIT);
1024 .type = VK_DESCRIPTOR_TYPE_STORAGE_IMAGE,
1025 .stages = VK_SHADER_STAGE_COMPUTE_BIT,
1029 .type = VK_DESCRIPTOR_TYPE_STORAGE_IMAGE,
1030 .stages = VK_SHADER_STAGE_COMPUTE_BIT,
1047 for (
int i = 0;
i < in_img_count;
i++) {
1050 id->in_img_var,
id->u32_cid[
i]);
1052 SpvMemoryAccessMaskNone, 0);
1056 for (
int i = 0;
i < out_img_count;
i++) {
1058 id->out_img_var,
id->u32_cid[
i]);
1060 SpvMemoryAccessMaskNone, 0);
1065 SpvMemoryAccessMaskNone, 0);
1069 id->gi2 = spi_OpBitcast(spi,
id->i32vec2_type,
id->gid);
1074 int dst_gi2 =
id->gi2;
1075 id->dst_gid =
id->src_gid =
id->gid;
1076 if (
id->interlaced) {
1078 id->push_const_var_id,
1080 int field_u32 =
spi_OpLoad(spi,
id->u32_type, field_u32_ptr,
1081 SpvMemoryAccessMaskNone, 0);
1082 id->field_i32 = spi_OpBitcast(spi,
id->i32_type, field_u32);
1084 int img_y_i32 = spi_OpShiftLeftLogical(spi,
id->i32_type,
1087 img_y_i32 = spi_OpIAdd(spi,
id->i32_type, img_y_i32,
id->field_i32);
1092 int mapped_gid = spi_OpBitcast(spi,
id->u32vec2_type, mapped_gi2);
1095 id->src_gid = mapped_gid;
1097 id->dst_gid = mapped_gid;
1098 dst_gi2 = mapped_gi2;
1103 int img1_s = spi_OpImageQuerySize(spi,
id->i32vec2_type,
id->out_img[0]);
1104 int scmp = spi_OpSGreaterThanEqual(spi,
id->bvec2_type, dst_gi2, img1_s);
1105 scmp = spi_OpAny(spi,
id->b_type, scmp);
1120 zero0, zero0, zero0, zero0);
1123 for (
int n = 0; n < uops->
num_ops; n++) {
1139 for (
int i = 0;
i < 4;
i++) {
1149 int idx[5] = { -1, 0, 1, 2, 3 };
1151 idx[move->
dst[
i] + 1] = idx[move->
src[
i] + 1];
1154 idx[1], idx[2], idx[3], idx[4]);
1173 data = spi_OpIMul(spi, type_v,
data, k_v);
1181 data = spi_OpShiftLeftLogical(spi, type_v,
data, shift_v);
1183 data = spi_OpShiftRightLogical(spi, type_v,
data, shift_v);
1193 for (
int i = 0;
i < 4;
i++) {
1236 if (p->nb_data_bufs)
1238 p->nb_data_bufs, 1);
1248 uint8_t *spvbuf =
NULL;
1249 SPICtx spi_context, *spi = &spi_context;
1308 for (
int i = 0;
i < p->nb_data_bufs;
i++)
1310 1,
i, 0, &p->data_bufs[
i],
1311 0, VK_WHOLE_SIZE, VK_FORMAT_UNDEFINED);
uint8_t ptrdiff_t const uint8_t ptrdiff_t int intptr_t intptr_t int int16_t * dst
static double val(void *priv, double ch)
#define av_assert1(cond)
assert() equivalent, that does not lie in speed critical code.
#define av_unreachable(msg)
Asserts that are used as compiler optimization hints depending upon ASSERT_LEVEL and NBDEBUG.
#define i(width, name, range_min, range_max)
#define AV_NUM_DATA_POINTERS
#define av_err2str(errnum)
Convenience macro, the return value should be used only directly in function arguments but never stan...
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
@ SWS_BACKEND_SPIRV
Vulkan SPIR-V backend.
const VkFormat * av_vkfmt_from_pixfmt(enum AVPixelFormat p)
Returns the optimal per-plane Vulkan format for a given sw_format, one for each plane.
static int zero(InterplayACMContext *s, unsigned ind, unsigned col)
static int op(uint8_t **dst, const uint8_t *dst_end, GetByteContext *gb, int pixel, int count, int *x, int width, int linesize)
Perform decode operation.
static int shift(int a, int b)
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.
void ff_vk_uninit(FFVulkanContext *s)
Frees main context.
VkFormat ff_vk_map_fmt_to_rep(VkFormat fmt, enum FFVkShaderRepFormat rep_fmt)
Returns the view format for the given representation of fmt, or VK_FORMAT_UNDEFINED if there is none.
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.
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.
FFVkExecContext * ff_vk_exec_get(FFVulkanContext *s, FFVkExecPool *pool)
Retrieve an execution 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_discard(FFVulkanContext *s, FFVkExecContext *e)
int ff_vk_create_imageviews_fmt(FFVulkanContext *s, FFVkExecContext *e, VkImageView views[AV_NUM_DATA_POINTERS], AVFrame *f, const VkFormat fmts[AV_NUM_DATA_POINTERS])
Same as ff_vk_create_imageviews(), but with an explicit view format for each plane,...
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.
@ SWS_FILTER_SCALE
14-bit coefficients are picked to fit comfortably within int16_t for efficient SIMD processing (e....
static const struct @257111027162314367033347246032313251342043035002 planes[]
static const uint16_t mask[17]
Memory handling functions.
const SwsOp * ff_sws_op_list_input(const SwsOpList *ops)
Returns the input operation for a given op list, or NULL if there is none (e.g.
int ff_sws_rw_op_planes(const SwsOp *op)
Return the number of planes involved in a read/write operation.
const SwsOp * ff_sws_op_list_output(const SwsOpList *ops)
Returns the output operation for a given op list, or NULL if there is none.
static void ff_sws_pack_decode(const uint8_t pattern[4], uint64_t mask[4], int shift[4])
int av_pix_fmt_count_planes(enum AVPixelFormat pix_fmt)
AVPixelFormat
Pixel format.
@ AV_PIX_FMT_VULKAN
Vulkan hardware images.
void av_refstruct_unref(void *objp)
Decrement the reference count of the underlying object and automatically free the object if there are...
void * av_refstruct_ref(void *obj)
Create a new reference to an object managed via this API, i.e.
static void * av_refstruct_alloc_ext(size_t size, unsigned flags, void *opaque, void(*free_cb)(AVRefStructOpaque opaque, void *obj))
A wrapper around av_refstruct_alloc_ext_c() for the common case of a non-const qualified opaque.
static void spi_uninit(SPICtx *spi)
static int spi_OpTypeFunction(SPICtx *spi, int return_type_id, const int *args, int nb_args)
static int spi_OpVariable(SPICtx *spi, int var_id, int ptr_type_id, SpvStorageClass storage_class, int initializer_id)
static int spi_OpConstantUInt(SPICtx *spi, int type_id, uint32_t val)
static void spi_OpCapability(SPICtx *spi, SpvCapability capability)
static void spi_OpMemoryModel(SPICtx *spi, SpvAddressingModel addressing_model, SpvMemoryModel memory_model)
#define spi_OpCompositeExtract(spi, res_type, src,...)
#define spi_OpExtInst(spi, res_type, instr_id, set_id,...)
static void spi_OpFunctionEnd(SPICtx *spi)
static void spi_OpReturn(SPICtx *spi)
static int spi_OpImageRead(SPICtx *spi, int result_type_id, int img_id, int pos_id, SpvImageOperandsMask image_operands)
static int spi_OpTypeArray(SPICtx *spi, int element_type_id, int id, int length_id)
#define spi_OpMemberDecorate(spi, type, target, deco,...)
#define spi_OpTypeStruct(spi, id,...)
#define spi_OpDecorate(spi, target, deco,...)
static void spi_OpBranchConditional(SPICtx *spi, int cond_id, int true_label, int false_label, uint32_t branch_weights)
static int spi_OpTypeImage(SPICtx *spi, int sampled_type_id, SpvDim dim, int depth, int arrayed, int ms, int sampled, SpvImageFormat image_format)
static int spi_end(const SPICtx *spi, uint8_t **out)
Allocates a buffer containing the module, and returns it in out.
static int spi_OpConstantFloat(SPICtx *spi, int type_id, float val)
#define spi_OpConstantComposite(spi, res_type, src,...)
static int spi_OpLoad(SPICtx *spi, int result_type_id, int ptr_id, SpvMemoryAccessMask memory_access, int align)
static void spi_OpExecutionMode(SPICtx *spi, int entry_point_id, SpvExecutionMode mode, int *s, int nb_s)
static int spi_OpConstantInt(SPICtx *spi, int type_id, int val)
static void spi_OpEntryPoint(SPICtx *spi, SpvExecutionModel execution_model, int entry_point_id, const char *name, const int *args, int nb_args)
static int spi_OpLabel(SPICtx *spi, int label_id)
#define spi_OpAccessChain(spi, res_type, ptr_id,...)
static void spi_init(SPICtx *spi)
static int spi_OpTypeBool(SPICtx *spi)
static int spi_OpTypePointer(SPICtx *spi, SpvStorageClass storage_class, int type_id)
#define spi_OpCompositeConstruct(spi, res_type, src,...)
static void spi_OpFunction(SPICtx *spi, int fn_id, int result_type_id, SpvFunctionControlMask function_control, int function_type_id)
#define spi_OpCompositeInsert(spi, res_type, src1, src2,...)
#define spi_OpVectorShuffle(spi, res_type, src1, src2,...)
static int spi_get_id(SPICtx *spi)
static int spi_OpExtInstImport(SPICtx *spi, const char *name)
static void spi_OpSelectionMerge(SPICtx *spi, int merge_block, SpvSelectionControlMask selection_control)
static int spi_OpTypeVoid(SPICtx *spi)
static void spi_OpImageWrite(SPICtx *spi, int img_id, int pos_id, int src_id, SpvImageOperandsMask image_operands)
A reference to a data buffer.
uint8_t * data
The data buffer.
This structure describes decoded (raw) audio or video data.
Copyright (C) 2026 Lynne.
int iface[3+MAX_DATA_BUFS+1]
FFVulkanDescriptorSetBinding buf_desc[MAX_DATA_BUFS]
int push_const_elem_ptr_id
Main external API structure.
unsigned flags
Bitmask of SWS_*.
Represents a computed filter kernel.
int * weights
The computed look-up table (LUT).
int filter_size
The number of source texels to convolve over for each row.
int * offsets
The computed source pixel positions for each row of the filter.
Represents a view into a single field of frame data.
int8_t src[SWS_UOP_MOVE_MAX]
int8_t dst[SWS_UOP_MOVE_MAX]
Helper struct for representing a list of operations.
Represents a single filter pass in the scaling graph.
SwsPixelType type
Examples: rgba = 4x u8 packed yuv444p = 3x u8 rgb565 = 1x u16 <- use SWS_OP_UNPACK to unpack monow = ...
SwsFilterWeights * kernel
union SwsUOp::@242237116251216327057105100216205033300341206345 data
FFVkBuffer data_bufs[MAX_DATA_BUFS]
VkFormat src_view_fmt[AV_NUM_DATA_POINTERS]
VkFormat dst_view_fmt[AV_NUM_DATA_POINTERS]
static SwsInternal * sws_internal(const SwsContext *sws)
static void error(const char *err)
RefStruct is an API for creating reference-counted objects with minimal overhead.
int ff_sws_ops_translate(SwsContext *ctx, const SwsOpList *ops, SwsUOpFlags flags, SwsUOpList *uops)
Translate a list of operations down to micro-ops, which can be further optimized and then directly ex...
int ff_sws_dither_height(const SwsDitherUOp *dither)
Computes (1 << size_log2) + MAX(y_offset).
SwsUOpList * ff_sws_uop_list_alloc(void)
void ff_sws_uop_list_free(SwsUOpList **p_ops)
void ff_sws_uop_list_print(void *log, int lev, const SwsUOpList *uops)
Print the micro-ops of a compiled list at the given log level.
#define SWS_COMP_TEST(mask, X)
static av_const bool ff_sws_pixel_type_is_int(SwsPixelType type)
AVBufferRef * ff_sws_vk_device_ref(SwsContext *sws)
Returns the Vulkan device reference associated with sws, or NULL if Vulkan has not been initialized f...
static void define_shader_consts(SPICtx *spi, SPIRVIDs *id)
static int create_filter_buf(FFVulkanOpsCtx *s, const SwsFilterWeights *wd, FFVkBuffer *buf)
static int insert_bitexact_linear(const SwsUOp *uop, SPICtx *spi, SPIRVIDs *id, int data)
static int add_buf_binding(SPIRVIDs *id)
static int compile_ops_spirv(SwsContext *sws, const SwsOpList *ops, SwsCompiledOp *out)
static int emit_add(SPICtx *spi, SwsPixelType type, int res_type, int a, int b)
static void spirv_free(void *priv)
static int emit_convert(SPICtx *spi, SwsPixelType from, SwsPixelType to, int res_type, int a)
static int create_dither_buf(FFVulkanOpsCtx *s, const SwsUOp *uop, FFVkBuffer *buf)
static void spirv_process(const SwsFrame *dst, const SwsFrame *src, int y, int h, const SwsPass *pass)
static int emit_dither(SPICtx *spi, SPIRVIDs *id, const SwsUOp *uop, int *data)
static int emit_min(SPICtx *spi, const SPIRVIDs *id, SwsPixelType type, int res_type, int a, int b)
static int insert_vmat_linear(const SwsUOp *uop, SPICtx *spi, SPIRVIDs *id, int data)
static int emit_pack(SPICtx *spi, SPIRVIDs *id, const SwsUOp *uop, int *data)
static int type_vec4(const SPIRVIDs *id, SwsPixelType type)
static void vk_ops_ctx_uninit(AVRefStructOpaque opaque, void *obj)
Copyright (C) 2026 Lynne.
static int emit_shader(SwsContext *sws, VulkanPriv *p, FFVulkanOpsCtx *s, const SwsOpList *ops, const SwsUOpList *uops, FFVulkanShader *shd, SPICtx *spi)
static int emit_read(SPICtx *spi, SPIRVIDs *id, const SwsUOp *uop, int *data)
static void define_shader_bindings(const SwsOpList *ops, SPICtx *spi, SPIRVIDs *id, int in_img_count, int out_img_count)
static int rw_op_img_count(const SwsOp *op, const uint8_t *planes)
static int emit_clamp(SPICtx *spi, SPIRVIDs *id, const SwsUOp *uop, int *data)
static void define_shader_header(SPICtx *spi, SPIRVIDs *id)
static int emit_max(SPICtx *spi, const SPIRVIDs *id, SwsPixelType type, int res_type, int a, int b)
static void define_pack_consts(SPICtx *spi, const SPIRVIDs *id, const SwsUOp *uop, int *shift_id, int *mask_id)
static int emit_linear(SPICtx *spi, SPIRVIDs *id, const SwsUOp *uop, int *data)
static int get_view_fmts(VkFormat view_fmts[AV_NUM_DATA_POINTERS], enum AVPixelFormat fmt, const SwsOp *op)
static int const_splat(SPICtx *spi, const SPIRVIDs *id, SwsPixelType type, SwsPixel px)
static void define_entry_point(FFVulkanShader *shd, SPICtx *spi, SPIRVIDs *id)
static int emit_write(SPICtx *spi, SPIRVIDs *id, const SwsUOp *uop, int *data)
static int type_scalar(const SPIRVIDs *id, SwsPixelType type)
static int emit_read_filtered(SPICtx *spi, SPIRVIDs *id, const SwsUOp *uop, int *data)
static int add_ops_spirv(SwsContext *sws, VulkanPriv *p, FFVulkanOpsCtx *s, const SwsOpList *ops, const SwsUOpList *uops, FFVulkanShader *shd)
int ff_sws_vk_init(SwsContext *sws, AVBufferRef *dev_ref)
static VkFormat packed_word_fmt(const SwsOp *op)
static int emit_mul(SPICtx *spi, SwsPixelType type, int res_type, int a, int b)
static int const_pixel(SPICtx *spi, const SPIRVIDs *id, SwsPixelType type, SwsPixel px)
static int const_zero(const SPIRVIDs *id, SwsPixelType type)
const SwsOpBackend backend_spirv
FFVkShaderRepFormat
Returns the format to use for images in shaders.
static int ff_vk_unmap_buffer(FFVulkanContext *s, FFVkBuffer *buf, int flush)
static int ff_vk_map_buffer(FFVulkanContext *s, FFVkBuffer *buf, uint8_t **mem, int invalidate)