This is an automated email from the git hooks/post-receive script. Git pushed a commit to branch master in repository ffmpeg.
commit fd8a1bb0367c58c071f7871fd4b67c172c5d10fb Author: Niklas Haas <[email protected]> AuthorDate: Wed Oct 21 02:39:36 2026 +0200 Commit: Niklas Haas <[email protected]> CommitDate: Sat Oct 24 19:10:48 2026 +0000 swscale/vulkan/ops: define (un)pack constants at the point of use Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: Niklas Haas <[email protected]> --- libswscale/vulkan/ops.c | 48 +++++++++++++++++++++++++++--------------------- 1 file changed, 27 insertions(+), 21 deletions(-) diff --git a/libswscale/vulkan/ops.c b/libswscale/vulkan/ops.c index 6ea6d71fdc..ee6be4e3b5 100644 --- a/libswscale/vulkan/ops.c +++ b/libswscale/vulkan/ops.c @@ -332,7 +332,6 @@ typedef struct OpIDs { union { int vec; /* LSHIFT, RSHIFT, SCALE */ int comp[4]; /* CLEAR, MIN, MAX, DITHER */ - struct { int shift, mask; } pack; /* PACK, UNPACK */ LinearIDs lin; /* LINEAR */ }; int buf; /* index into dither[] or filt[] */ @@ -439,6 +438,23 @@ static int const_pixel(SPICtx *spi, const SPIRVIDs *id, SwsPixelType type, return spi_OpConstantUInt(spi, id->u32_type, val.num); } +/* Shift and mask vectors for (un)packing each component */ +static void define_pack_consts(SPICtx *spi, const SPIRVIDs *id, const SwsOp *op, + int *shift_id, int *mask_id) +{ + uint64_t mask[4]; + int shift[4], tmp[4]; + ff_sws_pack_decode(op->pack.pattern, mask, shift); + for (int i = 0; i < 4; i++) + tmp[i] = spi_OpConstantUInt(spi, id->u32_type, shift[i]); + *shift_id = spi_OpConstantComposite(spi, id->u32vec4_type, + tmp[0], tmp[1], tmp[2], tmp[3]); + for (int i = 0; i < 4; i++) + tmp[i] = spi_OpConstantUInt(spi, id->u32_type, mask[i]); + *mask_id = spi_OpConstantComposite(spi, id->u32vec4_type, + tmp[0], tmp[1], tmp[2], tmp[3]); +} + /* Arithmetic on operands of the given pixel type */ static int emit_mul(SPICtx *spi, SwsPixelType type, int res_type, int a, int b) { @@ -550,21 +566,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_PACK: - case SWS_OP_UNPACK: { - uint64_t mask[4]; - int shift[4], tmp[4]; - ff_sws_pack_decode(op->pack.pattern, mask, shift); - for (int i = 0; i < 4; i++) - tmp[i] = spi_OpConstantUInt(spi, u32_type, shift[i]); - oid->pack.shift = spi_OpConstantComposite(spi, id->u32vec4_type, - tmp[0], tmp[1], tmp[2], tmp[3]); - for (int i = 0; i < 4; i++) - tmp[i] = spi_OpConstantUInt(spi, u32_type, mask[i]); - oid->pack.mask = spi_OpConstantComposite(spi, id->u32vec4_type, - tmp[0], tmp[1], tmp[2], tmp[3]); - break; - } case SWS_OP_LSHIFT: case SWS_OP_RSHIFT: { int tmp = spi_OpConstantUInt(spi, u32_type, op->shift.amount); @@ -1260,14 +1261,19 @@ static int emit_shader(SwsContext *sws, VulkanPriv *p, FFVulkanOpsCtx *s, data = insert_vmat_linear(spi, id, &oid->lin, data); break; } - case SWS_OP_UNPACK: + case SWS_OP_UNPACK: { + int shift, mask; + define_pack_consts(spi, id, op, &shift, &mask); data = spi_OpVectorShuffle(spi, type_v, data, data, 0, 0, 0, 0); - data = spi_OpShiftRightLogical(spi, type_v, data, oid->pack.shift); - data = spi_OpBitwiseAnd(spi, type_v, data, oid->pack.mask); + data = spi_OpShiftRightLogical(spi, type_v, data, shift); + data = spi_OpBitwiseAnd(spi, type_v, data, mask); break; + } case SWS_OP_PACK: { - data = spi_OpBitwiseAnd(spi, type_v, data, oid->pack.mask); - data = spi_OpShiftLeftLogical(spi, type_v, data, oid->pack.shift); + int shift, mask; + define_pack_consts(spi, id, op, &shift, &mask); + data = spi_OpBitwiseAnd(spi, type_v, data, mask); + data = spi_OpShiftLeftLogical(spi, type_v, data, shift); int val = spi_OpCompositeExtract(spi, type_s, data, 0); for (int i = 1; i < 4; i++) { int tmp = spi_OpCompositeExtract(spi, type_s, data, 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]
