diff mbox series

[FFmpeg-devel,2/3] libswscale/x86/swscale: Only call ff_yuv2yuvX functions if the input size is > 0

Message ID 20210223134047.1834787-2-alankelly@google.com
State New
Headers show
Series [FFmpeg-devel,1/3] libswscale/x86/yuv2yuvX: Removes unrolling for mmx and mmxext
Related show

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished
andriy/PPC64_make success Make finished
andriy/PPC64_make_fate success Make fate finished

Commit Message

Alan Kelly Feb. 23, 2021, 1:40 p.m. UTC
---
 libswscale/x86/swscale.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/libswscale/x86/swscale.c b/libswscale/x86/swscale.c
index 1e865914cb..71961a9ae0 100644
--- a/libswscale/x86/swscale.c
+++ b/libswscale/x86/swscale.c
@@ -206,7 +206,8 @@  static void yuv2yuvX_ ##opt(const int16_t *filter, int filterSize, \
                            const int16_t **src, uint8_t *dest, int dstW, \
                            const uint8_t *dither, int offset) \
 { \
-    ff_yuv2yuvX_ ##opt(filter, filterSize - 1, 0, dest - offset, dstW + offset, dither, offset); \
+    if(dstW > 0) \
+        ff_yuv2yuvX_ ##opt(filter, filterSize - 1, 0, dest - offset, dstW + offset, dither, offset); \
     return; \
 }
 
@@ -224,7 +225,8 @@  static void yuv2yuvX_ ##opt(const int16_t *filter, int filterSize, \
         yuv2yuvX_mmx(filter, filterSize, src, dest, dstW, dither, offset); \
         return; \
     } \
-    ff_yuv2yuvX_ ##opt(filter, filterSize - 1, 0, dest - offset, pixelsProcessed + offset, dither, offset); \
+    if(pixelsProcessed > 0) \
+        ff_yuv2yuvX_ ##opt(filter, filterSize - 1, 0, dest - offset, pixelsProcessed + offset, dither, offset); \
     if(remainder > 0){ \
       ff_yuv2yuvX_mmx(filter, filterSize - 1, pixelsProcessed, dest - offset, pixelsProcessed + remainder + offset, dither, offset); \
     } \