1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2026-06-19 19:03:00 +02:00

swscale/format: modify SwsSwizzleOp in-place in swizzle_inv()

This commit is contained in:
Ramiro Polla
2026-06-18 20:36:19 +02:00
parent d90645c4db
commit c00b5be5de
+9 -8
View File
@@ -939,14 +939,15 @@ static int test_format_ops(enum AVPixelFormat format, int output)
return ret == 0;
}
static SwsSwizzleOp swizzle_inv(SwsSwizzleOp swiz) {
static void swizzle_inv(SwsSwizzleOp *swiz)
{
/* Input[x] =: Output[swizzle.x] */
unsigned out[4];
out[swiz.x] = 0;
out[swiz.y] = 1;
out[swiz.z] = 2;
out[swiz.w] = 3;
return (SwsSwizzleOp) {{ .x = out[0], out[1], out[2], out[3] }};
unsigned tmp[4];
tmp[swiz->x] = 0;
tmp[swiz->y] = 1;
tmp[swiz->z] = 2;
tmp[swiz->w] = 3;
*swiz = (SwsSwizzleOp) {{ .x = tmp[0], tmp[1], tmp[2], tmp[3] }};
}
/**
@@ -996,7 +997,7 @@ int ff_sws_decode_pixfmt(SwsOpList *ops, enum AVPixelFormat fmt)
RET(fmt_analyze(fmt, &rw_op, &unpack, &swizzle, &shift,
&pixel_type, &raw_type));
swizzle = swizzle_inv(swizzle);
swizzle_inv(&swizzle);
/* Set baseline pixel content flags */
const int integer = ff_sws_pixel_type_is_int(raw_type);