1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

lavc/texturedsp: fix premult2straight inversion

This function should convert premultiplied alpha to straight, but does the opposite.

Signed-off-by: Connor Worley <connorbworley@gmail.com>
This commit is contained in:
Connor Worley 2024-02-08 11:07:08 -08:00 committed by Lynne
parent f6ec01147f
commit c4e9556cf5
3 changed files with 8 additions and 5 deletions

View File

@ -175,9 +175,12 @@ static av_always_inline void premult2straight(uint8_t *src)
int b = src[2]; int b = src[2];
int a = src[3]; /* unchanged */ int a = src[3]; /* unchanged */
src[0] = (uint8_t) r * a / 255; if (a == 0)
src[1] = (uint8_t) g * a / 255; return;
src[2] = (uint8_t) b * a / 255;
src[0] = (uint8_t) FFMIN(r * 255 / a, 255);
src[1] = (uint8_t) FFMIN(g * 255 / a, 255);
src[2] = (uint8_t) FFMIN(b * 255 / a, 255);
} }
/** /**

View File

@ -3,4 +3,4 @@
#codec_id 0: rawvideo #codec_id 0: rawvideo
#dimensions 0: 64x64 #dimensions 0: 64x64
#sar 0: 0/1 #sar 0: 0/1
0, 0, 0, 1, 16384, 0x11cebeb0 0, 0, 0, 1, 16384, 0xd7f7241b

View File

@ -3,4 +3,4 @@
#codec_id 0: rawvideo #codec_id 0: rawvideo
#dimensions 0: 64x64 #dimensions 0: 64x64
#sar 0: 0/1 #sar 0: 0/1
0, 0, 0, 1, 16384, 0x31aaacd6 0, 0, 0, 1, 16384, 0xf18d4216