diff options
author | wolfbeast <mcwerewolf@wolfbeast.com> | 2019-01-21 13:09:32 +0100 |
---|---|---|
committer | wolfbeast <mcwerewolf@wolfbeast.com> | 2019-01-21 13:09:32 +0100 |
commit | d1a0bfe221b91ea37a34d0b0360f347d2a6394e5 (patch) | |
tree | 5bba8c28b5415c90e90156bfa59a641a99118b99 /media/libwebp/utils/quant_levels_dec_utils.c | |
parent | 9a954e2d1619788f658f6ec30c7dbd89b3d48b0d (diff) | |
download | UXP-d1a0bfe221b91ea37a34d0b0360f347d2a6394e5.tar UXP-d1a0bfe221b91ea37a34d0b0360f347d2a6394e5.tar.gz UXP-d1a0bfe221b91ea37a34d0b0360f347d2a6394e5.tar.lz UXP-d1a0bfe221b91ea37a34d0b0360f347d2a6394e5.tar.xz UXP-d1a0bfe221b91ea37a34d0b0360f347d2a6394e5.zip |
Update libwebp to version 1.0.2
This resolves #939.
Diffstat (limited to 'media/libwebp/utils/quant_levels_dec_utils.c')
-rw-r--r-- | media/libwebp/utils/quant_levels_dec_utils.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/media/libwebp/utils/quant_levels_dec_utils.c b/media/libwebp/utils/quant_levels_dec_utils.c index 5c498382d..a60de3444 100644 --- a/media/libwebp/utils/quant_levels_dec_utils.c +++ b/media/libwebp/utils/quant_levels_dec_utils.c @@ -261,9 +261,15 @@ static void CleanupParams(SmoothParams* const p) { int WebPDequantizeLevels(uint8_t* const data, int width, int height, int stride, int strength) { - const int radius = 4 * strength / 100; + int radius = 4 * strength / 100; + if (strength < 0 || strength > 100) return 0; if (data == NULL || width <= 0 || height <= 0) return 0; // bad params + + // limit the filter size to not exceed the image dimensions + if (2 * radius + 1 > width) radius = (width - 1) >> 1; + if (2 * radius + 1 > height) radius = (height - 1) >> 1; + if (radius > 0) { SmoothParams p; memset(&p, 0, sizeof(p)); |