diff options
author | Andreas Rheinhardt <andreas.rheinhardt@gmail.com> | 2021-03-26 16:24:59 +0100 |
---|---|---|
committer | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2021-04-01 14:49:41 +0200 |
commit | 3c151e79991181c8b7b9f9b888ac46eba91c5012 (patch) | |
tree | e9f8412bc72796bf9e1ffa864ec0e425c6d08b73 /libavfilter/vf_codecview.c | |
parent | a86f3e983ec113689af48dd49ae043d85c8dc8bd (diff) | |
download | ffmpeg-3c151e79991181c8b7b9f9b888ac46eba91c5012.tar.gz |
avfilter/vf_codecview: Fix undefined left shifts of negative numbers
Affected the filter-codecview-mvs FATE-test.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Diffstat (limited to 'libavfilter/vf_codecview.c')
-rw-r--r-- | libavfilter/vf_codecview.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/libavfilter/vf_codecview.c b/libavfilter/vf_codecview.c index 197dc96136..28ac2df72f 100644 --- a/libavfilter/vf_codecview.c +++ b/libavfilter/vf_codecview.c @@ -141,7 +141,7 @@ static void draw_line(uint8_t *buf, int sx, int sy, int ex, int ey, } buf += sx + sy * stride; ex -= sx; - f = ((ey - sy) << 16) / ex; + f = ((ey - sy) * (1 << 16)) / ex; for (x = 0; x <= ex; x++) { y = (x * f) >> 16; fr = (x * f) & 0xFFFF; @@ -156,7 +156,7 @@ static void draw_line(uint8_t *buf, int sx, int sy, int ex, int ey, buf += sx + sy * stride; ey -= sy; if (ey) - f = ((ex - sx) << 16) / ey; + f = ((ex - sx) * (1 << 16)) / ey; else f = 0; for(y= 0; y <= ey; y++){ @@ -199,8 +199,8 @@ static void draw_arrow(uint8_t *buf, int sx, int sy, int ex, int length = sqrt((rx * rx + ry * ry) << 8); // FIXME subpixel accuracy - rx = ROUNDED_DIV(rx * 3 << 4, length); - ry = ROUNDED_DIV(ry * 3 << 4, length); + rx = ROUNDED_DIV(rx * (3 << 4), length); + ry = ROUNDED_DIV(ry * (3 << 4), length); if (tail) { rx = -rx; |