diff --git a/libswscale/ops.h b/libswscale/ops.h index 6392d0ffdf..6fc7e60a02 100644 --- a/libswscale/ops.h +++ b/libswscale/ops.h @@ -109,6 +109,10 @@ typedef struct SwsReadWriteOp { } SwsReadWriteOp; typedef struct SwsPackOp { + /** + * Packed bits are assumed to be LSB-aligned within the underlying + * integer type; i.e. (msb) 0 ... X Y Z W (lsb). + */ uint8_t pattern[4]; /* bit depth pattern, from MSB to LSB */ } SwsPackOp; diff --git a/libswscale/ops_internal.h b/libswscale/ops_internal.h index 0071f78558..ba4c9b39da 100644 --- a/libswscale/ops_internal.h +++ b/libswscale/ops_internal.h @@ -39,7 +39,9 @@ static inline AVRational ff_sws_pixel_expand(SwsPixelType from, SwsPixelType to) static inline void ff_sws_pack_op_decode(const SwsOp *op, uint64_t mask[4], int shift[4]) { - const int size = ff_sws_pixel_type_size(op->type) * 8; + int size = 0; + for (int i = 0; i < 4; i++) + size += op->pack.pattern[i]; for (int i = 0; i < 4; i++) { const int bits = op->pack.pattern[i]; mask[i] = (UINT64_C(1) << bits) - 1; diff --git a/tests/ref/fate/sws-ops-list b/tests/ref/fate/sws-ops-list index b49f944794..a7d6149d8b 100644 --- a/tests/ref/fate/sws-ops-list +++ b/tests/ref/fate/sws-ops-list @@ -1 +1 @@ -e910ff7ceaeb64bfdbac3f652b67403f +ef1dd10af970984495f6008e43d0fe1b