diff mbox series

[FFmpeg-devel,4/7] avcodec/v210dec: do not use accelerated code for the last pixels of a row

Message ID 20220612171845.8122-4-cus@passwd.hu
State Accepted
Commit 2e895edb5d2ae820e8ead0fbccea3fe2b5749287
Headers show
Series [FFmpeg-devel,1/7] avcodec/v210dec: properly support odd widths | expand

Checks

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

Commit Message

Marton Balint June 12, 2022, 5:18 p.m. UTC
ASM code tends to overwrite the buffers by 2-4 bytes and it can cause issues
with slice threads.

Signed-off-by: Marton Balint <cus@passwd.hu>
---
 libavcodec/v210dec.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/libavcodec/v210dec.c b/libavcodec/v210dec.c
index e97f43a8e6..4268b5b748 100644
--- a/libavcodec/v210dec.c
+++ b/libavcodec/v210dec.c
@@ -54,7 +54,7 @@  static void decode_row(const uint32_t *src, uint16_t *y, uint16_t *u, uint16_t *
                        void (*unpack_frame)(const uint32_t *src, uint16_t *y, uint16_t *u, uint16_t *v, int width))
 {
     uint32_t val;
-    int w = (width / 12) * 12;
+    int w = (FFMAX(0, width - 12) / 12) * 12;
 
     unpack_frame(src, y, u, v, w);
 
@@ -63,7 +63,7 @@  static void decode_row(const uint32_t *src, uint16_t *y, uint16_t *u, uint16_t *
     v += w >> 1;
     src += (w << 1) / 3;
 
-    if (w < width - 5) {
+    while (w < width - 5) {
         READ_PIXELS(u, y, v);
         READ_PIXELS(y, u, y);
         READ_PIXELS(v, y, u);