On 5/18/2025 5:52 PM, Ramiro Polla wrote:
Currently, packed16togbra16() always sets the alpha value to 0xFFFF, without taking the bit depth into consideration.This commit restricts the alpha value to the bit depth.
packed16togbra16() seems to only be called for BGR48 and BGRA64, both of which are 16bits, so this change is superfluous.
---
libswscale/swscale_unscaled.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/libswscale/swscale_unscaled.c b/libswscale/swscale_unscaled.c
index 8d71a88c23..488db43e0b 100644
--- a/libswscale/swscale_unscaled.c
+++ b/libswscale/swscale_unscaled.c
@@ -699,7 +699,7 @@ static void packed16togbra16(const uint8_t *src, int
srcStride,
dst[0][x] = av_bswap16(av_bswap16(*src_line++) >> shift);
dst[1][x] = av_bswap16(av_bswap16(*src_line++) >> shift);
dst[2][x] = av_bswap16(av_bswap16(*src_line++) >> shift);
- dst[3][x] = 0xFFFF;
+ dst[3][x] = av_bswap16(0xFFFF >> shift);
}
} else if (src_alpha) {
for (x = 0; x < width; x++) {
@@ -729,7 +729,7 @@ static void packed16togbra16(const uint8_t *src, int
srcStride,
dst[0][x] = av_bswap16(*src_line++ >> shift);
dst[1][x] = av_bswap16(*src_line++ >> shift);
dst[2][x] = av_bswap16(*src_line++ >> shift);
- dst[3][x] = 0xFFFF;
+ dst[3][x] = av_bswap16(0xFFFF >> shift);
}
} else if (src_alpha) {
for (x = 0; x < width; x++) {
@@ -759,7 +759,7 @@ static void packed16togbra16(const uint8_t *src, int
srcStride,
dst[0][x] = av_bswap16(*src_line++) >> shift;
dst[1][x] = av_bswap16(*src_line++) >> shift;
dst[2][x] = av_bswap16(*src_line++) >> shift;
- dst[3][x] = 0xFFFF;
+ dst[3][x] = 0xFFFF >> shift;
}
} else if (src_alpha) {
for (x = 0; x < width; x++) {
@@ -789,7 +789,7 @@ static void packed16togbra16(const uint8_t *src, int
srcStride,
dst[0][x] = *src_line++ >> shift;
dst[1][x] = *src_line++ >> shift;
dst[2][x] = *src_line++ >> shift;
- dst[3][x] = 0xFFFF;
+ dst[3][x] = 0xFFFF >> shift;
}
} else if (src_alpha) {
for (x = 0; x < width; x++) {
OpenPGP_signature.asc
Description: OpenPGP digital signature
_______________________________________________ ffmpeg-devel mailing list [email protected] https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email [email protected] with subject "unsubscribe".
