summaryrefslogtreecommitdiff
path: root/libavfilter/vf_gradfun.c
diff options
context:
space:
mode:
authorClément Bœsch <ubitux@gmail.com>2012-12-07 00:36:29 +0100
committerAnton Khirnov <anton@khirnov.net>2013-03-28 07:59:04 +0100
commit2d66fc543b01995d6146fc132a778d3e722ca665 (patch)
tree22aadf11effb0a211c7f10461baf1fa238ba4da3 /libavfilter/vf_gradfun.c
parent8b9a153ef3673d5847291987fa0dcddeac4a640b (diff)
lavfi/gradfun: fix rounding in MMX code.
Current code divides before increasing precision. Also reduce upper bound for strength from 255 to 64. This will prevent an overflow in the SSSE3 and MMX filter_line code: delta is expressed as an u16 being shifted by 2 to the left. If it overflows, having a strength not above 64 will make sure that m is set to 0 (making the m*m*delta >> 14 expression void). A value above 64 should not make any sense unless gradfun is used as a blur filter. Signed-off-by: Anton Khirnov <anton@khirnov.net>
Diffstat (limited to 'libavfilter/vf_gradfun.c')
-rw-r--r--libavfilter/vf_gradfun.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/libavfilter/vf_gradfun.c b/libavfilter/vf_gradfun.c
index 80b7e412e3..900ef604e8 100644
--- a/libavfilter/vf_gradfun.c
+++ b/libavfilter/vf_gradfun.c
@@ -128,7 +128,7 @@ static av_cold int init(AVFilterContext *ctx, const char *args)
if (args)
sscanf(args, "%f:%d", &thresh, &radius);
- thresh = av_clipf(thresh, 0.51, 255);
+ thresh = av_clipf(thresh, 0.51, 64);
gf->thresh = (1 << 15) / thresh;
gf->radius = av_clip((radius + 1) & ~1, 4, 32);