[FFmpeg-cvslog] hevc: avoid invalid shifts of negative values

Anton Khirnov git at videolan.org
Mon Aug 24 10:29:56 CEST 2015


ffmpeg | branch: master | Anton Khirnov <anton at khirnov.net> | Sat Jul 11 20:19:51 2015 +0200| [a1926a29fb4325afa46842883f197c74d4535c36] | committer: Anton Khirnov

hevc: avoid invalid shifts of negative values

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a1926a29fb4325afa46842883f197c74d4535c36
---

 libavcodec/hevc.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c
index 0dfe7a2..6395563 100644
--- a/libavcodec/hevc.c
+++ b/libavcodec/hevc.c
@@ -1494,7 +1494,7 @@ static void luma_mc(HEVCContext *s, int16_t *dst, ptrdiff_t dststride,
 
     x_off += mv->x >> 2;
     y_off += mv->y >> 2;
-    src   += y_off * srcstride + (x_off << s->ps.sps->pixel_shift);
+    src   += y_off * srcstride + (x_off * (1 << s->ps.sps->pixel_shift));
 
     if (x_off < extra_left || y_off < extra_top ||
         x_off >= pic_width - block_w - ff_hevc_qpel_extra_after[mx] ||
@@ -1548,8 +1548,8 @@ static void chroma_mc(HEVCContext *s, int16_t *dst1, int16_t *dst2,
 
     x_off += mv->x >> 3;
     y_off += mv->y >> 3;
-    src1  += y_off * src1stride + (x_off << s->ps.sps->pixel_shift);
-    src2  += y_off * src2stride + (x_off << s->ps.sps->pixel_shift);
+    src1  += y_off * src1stride + (x_off * (1 << s->ps.sps->pixel_shift));
+    src2  += y_off * src2stride + (x_off * (1 << s->ps.sps->pixel_shift));
 
     if (x_off < EPEL_EXTRA_BEFORE || y_off < EPEL_EXTRA_AFTER ||
         x_off >= pic_width - block_w - EPEL_EXTRA_AFTER ||



More information about the ffmpeg-cvslog mailing list