[FFmpeg-devel] [PATCH 1/2] lavc/texturedsp: fix premult2straight inversion
Connor Worley
connorbworley at gmail.com
Fri Feb 2 02:33:59 EET 2024
This function should convert premultiplied alpha to straight, but does the opposite.
Signed-off-by: Connor Worley <connorbworley at gmail.com>
---
libavcodec/texturedsp.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/libavcodec/texturedsp.c b/libavcodec/texturedsp.c
index 5fb79937da..1b8237e9f7 100644
--- a/libavcodec/texturedsp.c
+++ b/libavcodec/texturedsp.c
@@ -175,9 +175,9 @@ static av_always_inline void premult2straight(uint8_t *src)
int b = src[2];
int a = src[3]; /* unchanged */
- src[0] = (uint8_t) r * a / 255;
- src[1] = (uint8_t) g * a / 255;
- 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);
}
/**
--
2.40.1
More information about the ffmpeg-devel
mailing list