summaryrefslogtreecommitdiff
path: root/libavfilter/vf_maskedclamp.c
diff options
context:
space:
mode:
authorPaul B Mahol <onemda@gmail.com>2020-02-08 10:44:38 +0100
committerPaul B Mahol <onemda@gmail.com>2020-02-08 10:46:37 +0100
commit68416e4ba7e26965fa567249bbec1057f68ca9cf (patch)
tree91999aa0ce8ba37a0a25ef16f28b479e8430ccfd /libavfilter/vf_maskedclamp.c
parent3b860bfd6fc9de9748a8d99b944d8de8194dd9e9 (diff)
downloadffmpeg-68416e4ba7e26965fa567249bbec1057f68ca9cf.tar.gz
avfilter/vf_maskedclamp: make C version consistent with ASM one
In case of undefined behaviour.
Diffstat (limited to 'libavfilter/vf_maskedclamp.c')
-rw-r--r--libavfilter/vf_maskedclamp.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/libavfilter/vf_maskedclamp.c b/libavfilter/vf_maskedclamp.c
index b0dc8a3550..52392c4c86 100644
--- a/libavfilter/vf_maskedclamp.c
+++ b/libavfilter/vf_maskedclamp.c
@@ -178,12 +178,8 @@ static void maskedclamp##name(const uint8_t *bbsrc, uint8_t *ddst,
type *dst = (type *)ddst; \
\
for (int x = 0; x < w; x++) { \
- if (bsrc[x] < darksrc[x] - undershoot) \
- dst[x] = darksrc[x] - undershoot; \
- else if (bsrc[x] > brightsrc[x] + overshoot) \
- dst[x] = brightsrc[x] + overshoot; \
- else \
- dst[x] = bsrc[x]; \
+ dst[x] = FFMAX(bsrc[x], darksrc[x] - undershoot); \
+ dst[x] = FFMIN(dst[x], brightsrc[x] + overshoot); \
} \
}