Commit bf7c698bb2 for ffmpeg
commit bf7c698bb21c6f36fad0274bc8cf1be0ec5caf4c
Author: Niklas Haas <git@haasn.dev>
Date: Tue Nov 3 20:50:08 2026 +0100
swscale/aarch64/ops: pack kernel private data
The clear/min/max kernels always load a full 128-bit vector, so pad the
packed constants to 16 bytes.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Niklas Haas <git@haasn.dev>
diff --git a/libswscale/aarch64/ops.c b/libswscale/aarch64/ops.c
index 4ee93329a7..599b39d1a5 100644
--- a/libswscale/aarch64/ops.c
+++ b/libswscale/aarch64/ops.c
@@ -99,14 +99,14 @@ static int aarch64_setup_linear(const SwsAArch64OpImplParams *p,
}
}
- res->ref = res->priv.ptr = coeffs;
+ ff_sws_op_priv_pack_refptr(res, coeffs);
return 0;
}
/*********************************************************************/
static int aarch64_setup_dither(const SwsUOp *uop, SwsImplResult *res)
{
- res->ref = res->priv.ptr = av_refstruct_ref(uop->data.ptr);
+ ff_sws_op_priv_pack_refptr(res, av_refstruct_ref(uop->data.ptr));
return 0;
}
@@ -115,28 +115,35 @@ static int aarch64_setup(const SwsUOp *uop, const SwsAArch64OpImplParams *p,
SwsImplResult *out)
{
switch (uop->uop) {
- case SWS_UOP_READ_BIT:
+ case SWS_UOP_READ_BIT: {
/* Negative shift values to perform right shift using ushl. */
- out->priv = (SwsOpPriv) {
- .u8 = {
- -7, -6, -5, -4, -3, -2, -1, 0,
- -7, -6, -5, -4, -3, -2, -1, 0,
- }
+ static const int8_t shift[16] = {
+ -7, -6, -5, -4, -3, -2, -1, 0,
+ -7, -6, -5, -4, -3, -2, -1, 0,
};
+ SWS_OP_PRIV_PACK(out, shift);
break;
- case SWS_UOP_WRITE_BIT:
+ }
+ case SWS_UOP_WRITE_BIT: {
/* Shift values for ushl. */
- out->priv = (SwsOpPriv) {
- .u8 = {
- 7, 6, 5, 4, 3, 2, 1, 0,
- 7, 6, 5, 4, 3, 2, 1, 0,
- }
+ static const uint8_t shift[16] = {
+ 7, 6, 5, 4, 3, 2, 1, 0,
+ 7, 6, 5, 4, 3, 2, 1, 0,
};
+ SWS_OP_PRIV_PACK(out, shift);
break;
+ }
case SWS_UOP_CLEAR:
case SWS_UOP_MIN:
- case SWS_UOP_MAX:
- return ff_sws_setup_vec4(&(const SwsImplParams) { .uop = uop }, out);
+ case SWS_UOP_MAX: {
+ int ret = ff_sws_setup_vec4(&(const SwsImplParams) { .uop = uop }, out);
+ if (ret < 0)
+ return ret;
+ /* Pad to the full vector register loaded by the kernel */
+ static const uint8_t zero[16];
+ ff_sws_op_priv_pack(out, zero, sizeof(zero) - out->priv_size);
+ return 0;
+ }
case SWS_UOP_SCALE:
return ff_sws_setup_scalar(&(const SwsImplParams) { .uop = uop }, out);
case SWS_UOP_LINEAR: