summaryrefslogtreecommitdiffstats
path: root/libavfilter
diff options
context:
space:
mode:
authorMartin Vignali <martin.vignali@gmail.com>2018-03-17 22:20:34 +0100
committerMartin Vignali <martin.vignali@gmail.com>2018-03-18 13:45:04 +0100
commit3e7fa34d3b688b9b4b5b22344e8fc27c4b53286d (patch)
tree31e953dc66a0c0895d68f98e9978947e9069a627 /libavfilter
parentb2bb1cb68be2627f4873ae1203197e1fca768650 (diff)
downloadffmpeg-streaming-3e7fa34d3b688b9b4b5b22344e8fc27c4b53286d.zip
ffmpeg-streaming-3e7fa34d3b688b9b4b5b22344e8fc27c4b53286d.tar.gz
avfilter/vf_premultiply : fix unpremultiply_offset for rgb input
Diffstat (limited to 'libavfilter')
-rw-r--r--libavfilter/vf_premultiply.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/libavfilter/vf_premultiply.c b/libavfilter/vf_premultiply.c
index df4f265..4f250df 100644
--- a/libavfilter/vf_premultiply.c
+++ b/libavfilter/vf_premultiply.c
@@ -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];
}
OpenPOWER on IntegriCloud