diff mbox series

[FFmpeg-devel,3/7] avcodec/snowenc: Fix invalid left shift of negative numbers

Message ID AS8P250MB0744DA39A7AF38569090F3A08F2D9@AS8P250MB0744.EURP250.PROD.OUTLOOK.COM
State Accepted
Commit a14c5af58db7068536d3ce2331ea8507c5dc5a39
Headers show
Series [FFmpeg-devel,1/7] avcodec/snow_dwt: Fix left shifts of negative numbers | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished

Commit Message

Andreas Rheinhardt Oct. 21, 2022, 6:59 p.m. UTC
Affected the vsynth(1|2|_lena)-snow(|-hpel) tests.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavcodec/snowenc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Michael Niedermayer Oct. 22, 2022, 8:58 a.m. UTC | #1
On Fri, Oct 21, 2022 at 08:59:35PM +0200, Andreas Rheinhardt wrote:
> Affected the vsynth(1|2|_lena)-snow(|-hpel) tests.
> 
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
> ---
>  libavcodec/snowenc.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

LGTM

thx

[...]
diff mbox series

Patch

diff --git a/libavcodec/snowenc.c b/libavcodec/snowenc.c
index ea0d4fc27f..ada24f7895 100644
--- a/libavcodec/snowenc.c
+++ b/libavcodec/snowenc.c
@@ -935,7 +935,7 @@  static av_always_inline int check_block_inter(SnowContext *s, int mb_x, int mb_y
     av_assert2(mb_x < b_stride);
 
     index = (p0 + 31 * p1) & (ME_CACHE_SIZE-1);
-    value = s->me_cache_generation + (p0 >> 10) + (p1 << 6) + (block->ref << 12);
+    value = s->me_cache_generation + (p0 >> 10) + p1 * (1 << 6) + (block->ref << 12);
     if (s->me_cache[index] == value)
         return 0;
     s->me_cache[index] = value;