Commit 5f04b20c5c for ffmpeg
commit 5f04b20c5c93782604114a085ab473b9f989018f
Author: Niklas Haas <git@haasn.dev>
Date: Wed Oct 21 02:41:05 2026 +0200
swscale/vulkan/ops: define scale constants at the point of use
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Niklas Haas <git@haasn.dev>
diff --git a/libswscale/vulkan/ops.c b/libswscale/vulkan/ops.c
index 16c87e60fb..821c6ffe16 100644
--- a/libswscale/vulkan/ops.c
+++ b/libswscale/vulkan/ops.c
@@ -330,7 +330,6 @@ typedef struct LinearIDs {
/* Constants and buffers used by a single op */
typedef struct OpIDs {
union {
- int vec; /* LSHIFT, RSHIFT, SCALE */
int comp[4]; /* CLEAR, MIN, MAX, DITHER */
LinearIDs lin; /* LINEAR */
};
@@ -573,22 +572,6 @@ static void define_shader_consts(SwsContext *sws, const SwsOpList *ops,
OpIDs *oid = &id->op[n];
SwsPixelType type_in = ff_sws_op_input_type(op);
switch (op->op) {
- case SWS_OP_SCALE: {
- int tmp;
- if (type_in == SWS_PIXEL_F32) {
- float q = op->scale.factor.num/(float)op->scale.factor.den;
- tmp = spi_OpConstantFloat(spi, f32_type, q);
- tmp = spi_OpConstantComposite(spi, id->f32vec4_type,
- tmp, tmp, tmp, tmp);
- } else {
- av_assert0(op->scale.factor.den == 1);
- tmp = spi_OpConstantUInt(spi, u32_type, op->scale.factor.num);
- tmp = spi_OpConstantComposite(spi, id->u32vec4_type,
- tmp, tmp, tmp, tmp);
- }
- oid->vec = tmp;
- break;
- }
case SWS_OP_MIN:
case SWS_OP_MAX:
for (int i = 0; i < 4; i++) {
@@ -1216,7 +1199,8 @@ static int emit_shader(SwsContext *sws, VulkanPriv *p, FFVulkanOpsCtx *s,
Q(op->shift.amount)));
break;
case SWS_OP_SCALE:
- data = emit_mul(spi, type_in, type_v, data, oid->vec);
+ data = emit_mul(spi, type_in, type_v, data,
+ const_splat(spi, id, type_in, op->scale.factor));
break;
case SWS_OP_MIN:
case SWS_OP_MAX: