diff mbox series

[FFmpeg-devel] avcodec/vvc/vvc_inter_template: Fix left shift of negative number

Message ID GV1P250MB07373373AA9DF9941942FFD58F3C2@GV1P250MB0737.EURP250.PROD.OUTLOOK.COM
State Accepted
Commit 9309b5bc64a9c18eb5973953532ef6029be384de
Headers show
Series [FFmpeg-devel] avcodec/vvc/vvc_inter_template: Fix left shift of negative number | expand

Checks

Context Check Description
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Andreas Rheinhardt April 4, 2024, 2 a.m. UTC
Affected the vvc-conformance-WP_A_3 FATE test.

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

Comments

Nuo Mi April 4, 2024, 3:48 a.m. UTC | #1
On Thu, Apr 4, 2024 at 10:00 AM Andreas Rheinhardt <
andreas.rheinhardt@outlook.com> wrote:

> Affected the vvc-conformance-WP_A_3 FATE test.
>
> Applied.
Thank you, Andreas.
diff mbox series

Patch

diff --git a/libavcodec/vvc/vvc_inter_template.c b/libavcodec/vvc/vvc_inter_template.c
index e5cff079fb..e2fbfd4fc0 100644
--- a/libavcodec/vvc/vvc_inter_template.c
+++ b/libavcodec/vvc/vvc_inter_template.c
@@ -46,7 +46,7 @@  static void FUNC(w_avg)(uint8_t *_dst, const ptrdiff_t _dst_stride,
     pixel *dst                  = (pixel*)_dst;
     const ptrdiff_t dst_stride  = _dst_stride / sizeof(pixel);
     const int shift             = denom + FFMAX(3, 15 - BIT_DEPTH);
-    const int offset            = (((o0 + o1) << (BIT_DEPTH - 8)) + 1) << (shift - 1);
+    const int offset            = ((o0 + o1) * (1 << (BIT_DEPTH - 8)) + 1) * (1 << (shift - 1));
 
     for (int y = 0; y < height; y++) {
         for (int x = 0; x < width; x++)