In case of undefined behaviour.
Showing the changes to libavfilter (1 of 1 file). Show all
Unified · Split
| @@ -178,12 +178,8 @@ static void maskedclamp##name(const uint8_t *bbsrc, uint8_t *ddst, · 177 unmodified lines | ||
| 178 | 178 | type *dst = (type *)ddst; \ |
| 179 | 179 | \ |
| 180 | 180 | for (int x = 0; x < w; x++) { \ |
| 181 | − if (bsrc[x] < darksrc[x] - undershoot) \ | |
| 182 | − dst[x] = darksrc[x] - undershoot; \ | |
| 183 | − else if (bsrc[x] > brightsrc[x] + overshoot) \ | |
| 184 | − dst[x] = brightsrc[x] + overshoot; \ | |
| 185 | − else \ | |
| 186 | − dst[x] = bsrc[x]; \ | |
| 181 | + dst[x] = FFMAX(bsrc[x], darksrc[x] - undershoot); \ | |
| 182 | + dst[x] = FFMIN(dst[x], brightsrc[x] + overshoot); \ | |
| 187 | 183 | } \ |
| 188 | 184 | } |
| 189 | 185 | |