diff mbox series

[FFmpeg-devel,4/5] avfilter/vf_spp: Fix left-shift of negative value

Message ID GV1P250MB0737BC3674A3C715DF123AAD8F3A2@GV1P250MB0737.EURP250.PROD.OUTLOOK.COM
State Accepted
Commit 3ed23dab98a1c6246e9b3cf575ec29d245e39f94
Headers show
Series [FFmpeg-devel,1/5] avcodec/ppc/hpeldsp_altivec: Fix left-shift of negative number | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Andreas Rheinhardt March 29, 2024, 3:24 a.m. UTC
Affected the vf-spp FATE-test (on x86 only when MMX
is disabled).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavfilter/vf_spp.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/libavfilter/vf_spp.c b/libavfilter/vf_spp.c
index 5c6495612b..c8366ae319 100644
--- a/libavfilter/vf_spp.c
+++ b/libavfilter/vf_spp.c
@@ -171,7 +171,7 @@  static void store_slice_c(uint8_t *dst, const int16_t *src,
     int y, x;
 
 #define STORE(pos) do {                                                     \
-    temp = ((src[x + y*src_linesize + pos] << log2_scale) + d[pos]) >> 6;   \
+    temp = (src[x + y*src_linesize + pos] * (1 << log2_scale) + d[pos]) >> 6;\
     if (temp & 0x100)                                                       \
         temp = ~(temp >> 31);                                               \
     dst[x + y*dst_linesize + pos] = temp;                                   \
@@ -202,7 +202,7 @@  static void store_slice16_c(uint16_t *dst, const int16_t *src,
     unsigned int mask = -1<<depth;
 
 #define STORE16(pos) do {                                                   \
-    temp = ((src[x + y*src_linesize + pos] << log2_scale) + (d[pos]>>1)) >> 5;   \
+    temp = (src[x + y*src_linesize + pos] * (1 << log2_scale) + (d[pos]>>1)) >> 5; \
     if (temp & mask )                                                       \
         temp = ~(temp >> 31);                                               \
     dst[x + y*dst_linesize + pos] = temp;                                   \