mirror of
https://github.com/mpv-player/mpv
synced 2025-03-20 10:17:31 +00:00
sd_lavc: fix some obscure UB
UB-sanitizer complains that we shift bits into the sign (when a is used). Change it to unsigned, which in theory is more correct and silences the warning. Doesn't matter in practice, both the "bug" and the fix have 0 impact.
This commit is contained in:
parent
5901c3ae0d
commit
075111c4d2
@ -147,10 +147,10 @@ static void convert_pal(uint32_t *colors, size_t count, bool gray)
|
||||
{
|
||||
for (int n = 0; n < count; n++) {
|
||||
uint32_t c = colors[n];
|
||||
int b = c & 0xFF;
|
||||
int g = (c >> 8) & 0xFF;
|
||||
int r = (c >> 16) & 0xFF;
|
||||
int a = (c >> 24) & 0xFF;
|
||||
uint32_t b = c & 0xFF;
|
||||
uint32_t g = (c >> 8) & 0xFF;
|
||||
uint32_t r = (c >> 16) & 0xFF;
|
||||
uint32_t a = (c >> 24) & 0xFF;
|
||||
if (gray)
|
||||
r = g = b = (r + g + b) / 3;
|
||||
// from straight to pre-multiplied alpha
|
||||
|
Loading…
Reference in New Issue
Block a user