mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-01-24 13:56:33 +02:00
avfilter/vf_premultiply : fix unpremultiply_offset for rgb input
This commit is contained in:
parent
b2bb1cb68b
commit
3e7fa34d3b
@ -272,7 +272,7 @@ static void unpremultiply8offset(const uint8_t *msrc, const uint8_t *asrc,
|
||||
for (y = 0; y < h; y++) {
|
||||
for (x = 0; x < w; x++) {
|
||||
if (asrc[x] > 0 && asrc[x] < 255)
|
||||
dst[x] = FFMIN((msrc[x] - offset) * 255 / asrc[x] + offset, 255);
|
||||
dst[x] = FFMIN(FFMAX(msrc[x] - offset, 0) * 255 / asrc[x] + offset, 255);
|
||||
else
|
||||
dst[x] = msrc[x];
|
||||
}
|
||||
@ -350,7 +350,7 @@ static void unpremultiply16offset(const uint8_t *mmsrc, const uint8_t *aasrc,
|
||||
for (y = 0; y < h; y++) {
|
||||
for (x = 0; x < w; x++) {
|
||||
if (asrc[x] > 0 && asrc[x] < max)
|
||||
dst[x] = FFMAX(FFMIN((msrc[x] - offset) * (unsigned)max / asrc[x] + offset, max), 0);
|
||||
dst[x] = FFMAX(FFMIN(FFMAX(msrc[x] - offset, 0) * (unsigned)max / asrc[x] + offset, max), 0);
|
||||
else
|
||||
dst[x] = msrc[x];
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user