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

Steve Lhomme robux4 at videolabs.io
Fri Dec 15 13:10:27 CET 2017


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

diff --git a/src/misc/picture.c b/src/misc/picture.c
index f6671edd51..fd1aaa38f5 100644
--- a/src/misc/picture.c
+++ b/src/misc/picture.c
@@ -185,13 +185,13 @@ int picture_Setup( picture_t *p_picture, const video_format_t *restrict fmt )
     i_modulo_h = LCM( i_modulo_h, 32 );
 
     const int i_width_aligned  = ( fmt->i_width  + i_modulo_w - 1 ) / i_modulo_w * i_modulo_w;
-    const int i_height_aligned = ( fmt->i_height + i_modulo_h - 1 ) / i_modulo_h * i_modulo_h;
-    const int i_height_extra   = 2 * i_ratio_h; /* This one is a hack for some ASM functions */
+    /* make sure we have 2(i_ratio_h) extra lines for some ASM functions */
+    const int i_height_aligned = ( fmt->i_height + (2 * i_ratio_h) + i_modulo_h - 1 ) / i_modulo_h * i_modulo_h;
     for( unsigned i = 0; i < p_dsc->plane_count; i++ )
     {
         plane_t *p = &p_picture->p[i];
 
-        p->i_lines         = (i_height_aligned + i_height_extra ) * p_dsc->p[i].h.num / p_dsc->p[i].h.den;
+        p->i_lines         = i_height_aligned * p_dsc->p[i].h.num / p_dsc->p[i].h.den;
         p->i_visible_lines = fmt->i_visible_height * p_dsc->p[i].h.num / p_dsc->p[i].h.den;
         p->i_pitch         = i_width_aligned * p_dsc->p[i].w.num / p_dsc->p[i].w.den * p_dsc->pixel_size;
         p->i_visible_pitch = fmt->i_visible_width * p_dsc->p[i].w.num / p_dsc->p[i].w.den * p_dsc->pixel_size;
-- 
2.14.2



More information about the vlc-devel mailing list