This is an automated email from the git hooks/post-receive script. Git pushed a commit to branch master in repository ffmpeg.
commit cc6003d5f5b197fb13a305accbd93d923259de7f Author: TADANO Tokumei <[email protected]> AuthorDate: Sun Aug 23 21:59:05 2026 +0900 Commit: Lynne <[email protected]> CommitDate: Thu Oct 1 14:57:38 2026 +0000 avfilter/v360_vulkan: reduce size of Push Constants Remove `in_img_size[][]` from PushData. Even though it is constant through a filter process, it occupies 128 bites of Push Constants. It may exceed limit of some hardware. The information is passed via Specialization Constants. In addition to `in_img_size`, number of planes is passed via Specialization Constants, that was hard-coded with magic number. `m_pi4` is for later enhancement. Signed-off-by: TADANO Tokumei <[email protected]> --- libavfilter/vf_v360_vulkan.c | 21 ++++++++++----------- libavfilter/vulkan/v360.comp.glsl | 17 +++++++++++++++-- 2 files changed, 25 insertions(+), 13 deletions(-) diff --git a/libavfilter/vf_v360_vulkan.c b/libavfilter/vf_v360_vulkan.c index c4651fd62c..85b4c6bfb5 100644 --- a/libavfilter/vf_v360_vulkan.c +++ b/libavfilter/vf_v360_vulkan.c @@ -29,7 +29,6 @@ extern const unsigned int ff_v360_comp_spv_len; /* Push constants */ struct PushData { float rot_mat[4][4]; - int in_img_size[4][2]; float iflat_range[2]; float flat_range[2]; }; @@ -428,13 +427,6 @@ static av_cold int init_filter(AVFilterContext *ctx, AVFrame *in) const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(s->vkctx.output_format); const int planes = av_pix_fmt_count_planes(s->vkctx.output_format); - s->pd.in_img_size[0][0] = s->pd.in_img_size[3][0] = in->width; - s->pd.in_img_size[0][1] = s->pd.in_img_size[3][1] = in->height; - s->pd.in_img_size[1][0] = s->pd.in_img_size[2][0] = - FF_CEIL_RSHIFT(in->width, desc->log2_chroma_w); - s->pd.in_img_size[1][1] = s->pd.in_img_size[2][1] = - FF_CEIL_RSHIFT(in->height, desc->log2_chroma_h); - RET(ff_vk_init_sampler(vkctx, &s->sampler, 0, VK_FILTER_LINEAR)); s->qf = ff_vk_qf_find(vkctx, VK_QUEUE_COMPUTE_BIT, 0); @@ -444,15 +436,22 @@ static av_cold int init_filter(AVFilterContext *ctx, AVFrame *in) goto fail; } - RET(ff_vk_exec_pool_init(vkctx, s->qf, &s->e, 2, 0, 0, 0, NULL)); + RET(ff_vk_exec_pool_init(vkctx, s->qf, &s->e, FF_VK_DEFAULT_EXEC_CONTEXTS, 0, 0, 0, NULL)); - SPEC_LIST_CREATE(sl, 4, 2*sizeof(int) + 2*sizeof(float)) + SPEC_LIST_CREATE(sl, 10, 7*sizeof(int) + 3*sizeof(float)) SPEC_LIST_ADD(sl, 0, 32, s->out); SPEC_LIST_ADD(sl, 1, 32, s->in); - const float m_pi = M_PI, m_pi2 = M_PI_2; + const float m_pi = M_PI, m_pi2 = M_PI_2, m_pi4 = M_PI_4; SPEC_LIST_ADD(sl, 2, 32, av_float2int(m_pi)); SPEC_LIST_ADD(sl, 3, 32, av_float2int(m_pi2)); + SPEC_LIST_ADD(sl, 4, 32, av_float2int(m_pi4)); + + SPEC_LIST_ADD(sl, 5, 32, planes); + SPEC_LIST_ADD(sl, 6, 32, in->width); + SPEC_LIST_ADD(sl, 7, 32, in->height); + SPEC_LIST_ADD(sl, 8, 32, FF_CEIL_RSHIFT(in->width, desc->log2_chroma_w)); + SPEC_LIST_ADD(sl, 9, 32, FF_CEIL_RSHIFT(in->height, desc->log2_chroma_h)); ff_vk_shader_load(&s->shd, VK_SHADER_STAGE_COMPUTE_BIT, sl, (uint32_t []) { 16, 16, 1 }, 0); diff --git a/libavfilter/vulkan/v360.comp.glsl b/libavfilter/vulkan/v360.comp.glsl index 74b83b232f..131b10e3b2 100644 --- a/libavfilter/vulkan/v360.comp.glsl +++ b/libavfilter/vulkan/v360.comp.glsl @@ -34,17 +34,30 @@ layout (constant_id = 1) const int in_transform = 0; layout (constant_id = 2) const float m_pi = 0; layout (constant_id = 3) const float m_pi2 = 0; +layout (constant_id = 4) const float m_pi4 = 0; + +layout (constant_id = 5) const int planes = 0; +layout (constant_id = 6) const int in_w = 0; +layout (constant_id = 7) const int in_h = 0; +layout (constant_id = 8) const int in_chroma_w = 0; +layout (constant_id = 9) const int in_chroma_h = 0; layout (set = 0, binding = 0) uniform sampler2D input_img[]; layout (set = 0, binding = 1) uniform writeonly image2D output_img[]; layout (push_constant, scalar) uniform pushConstants { mat4 rot_mat; - ivec2 in_img_size[4]; vec2 iflat_range; vec2 flat_range; }; +ivec2 in_img_size[4] = { + ivec2(in_w, in_h), + ivec2(in_chroma_w, in_chroma_h), + ivec2(in_chroma_w, in_chroma_h), + ivec2(in_w, in_h) +}; + #define IS_WITHIN(v1, v2) any(lessThan(v1, v2)) void xyz_to_flat(uint idx, in vec3 v, in ivec2 pos, in ivec2 in_size) @@ -157,7 +170,7 @@ void main() { ivec2 pos = ivec2(gl_GlobalInvocationID.xy); - for (int i = 0; i < 3; i++) { + for (int i = 0; i < planes; i++) { ivec2 in_size = in_img_size[i]; ivec2 out_size = imageSize(output_img[i]); -- To stop receiving notification emails like this one, please contact [email protected]. _______________________________________________ ffmpeg-cvslog mailing list -- [email protected] To unsubscribe send an email to [email protected]
