summaryrefslogtreecommitdiff
path: root/libavcodec
diff options
context:
space:
mode:
authorCarl Eugen Hoyos <cehoyos@ag.or.at>2017-04-18 11:02:30 +0200
committerCarl Eugen Hoyos <cehoyos@ag.or.at>2017-04-19 23:33:33 +0200
commitb6a83962453463aa814bb79aeaa7145732158f02 (patch)
tree344f3758fae21be7dab8708bc9d957836230904f /libavcodec
parent87071478b4a70d3651ce73ee6b9a95a525074403 (diff)
lavc/motion_est: Fix undefined negative left shifts.
Diffstat (limited to 'libavcodec')
-rw-r--r--libavcodec/motion_est.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/libavcodec/motion_est.c b/libavcodec/motion_est.c
index 25b606f819..316d16a77b 100644
--- a/libavcodec/motion_est.c
+++ b/libavcodec/motion_est.c
@@ -956,10 +956,10 @@ void ff_estimate_p_frame_motion(MpegEncContext * s,
P_TOPRIGHT[1] = s->current_picture.motion_val[0][mot_xy - mot_stride + 2][1];
if (P_TOP[1] > (c->ymax << shift))
P_TOP[1] = c->ymax << shift;
- if (P_TOPRIGHT[0] < (c->xmin << shift))
- P_TOPRIGHT[0] = c->xmin << shift;
- if (P_TOPRIGHT[1] > (c->ymax << shift))
- P_TOPRIGHT[1] = c->ymax << shift;
+ if (P_TOPRIGHT[0] < (c->xmin * (1 << shift)))
+ P_TOPRIGHT[0] = c->xmin * (1 << shift);
+ if (P_TOPRIGHT[1] > (c->ymax * (1 << shift)))
+ P_TOPRIGHT[1] = c->ymax * (1 << shift);
P_MEDIAN[0] = mid_pred(P_LEFT[0], P_TOP[0], P_TOPRIGHT[0]);
P_MEDIAN[1] = mid_pred(P_LEFT[1], P_TOP[1], P_TOPRIGHT[1]);