[vlc-devel] [PATCH] [RFC] picture: integrate the 2 extra lines in the height padding

Steve Lhomme robux4 at ycbcr.xyz
Thu Apr 5 08:51:54 CEST 2018


No need for extra lines when there's already padding. Plus it may break the
alignment of the secondary planes.
---
 src/misc/picture.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/misc/picture.c b/src/misc/picture.c
index 7506e47725..7ce1170702 100644
--- a/src/misc/picture.c
+++ b/src/misc/picture.c
@@ -133,17 +133,17 @@ int picture_Setup( picture_t *p_picture, const video_format_t *restrict fmt )
 
     unsigned width, height;
 
+    /* Hack: append two scan lines for some SIMD assembler */
+    if (unlikely(add_overflow(fmt->i_height, 2 * i_ratio_h, &height)))
+        return VLC_EGENERIC;
+
     if (unlikely(add_overflow(fmt->i_width, i_modulo_w - 1, &width))
-     || unlikely(add_overflow(fmt->i_height, i_modulo_h - 1, &height)))
+     || unlikely(add_overflow(height, i_modulo_h - 1, &height)))
         return VLC_EGENERIC;
 
     width = width / i_modulo_w * i_modulo_w;
     height = height / i_modulo_h * i_modulo_h;
 
-    /* Hack: append two scan lines for some SIMD assembler */
-    if (unlikely(add_overflow(height, 2 * i_ratio_h, &height)))
-        return VLC_EGENERIC;
-
     /* plane_t uses 'int'. */
     if (unlikely(width > INT_MAX) || unlikely(height > INT_MAX))
         return VLC_EGENERIC;
-- 
2.16.2



More information about the vlc-devel mailing list