[vlc-devel] [PATCH 4/4] picture: do not lose the last U/V lines for 4:2:0 chromas

Steve Lhomme robux4 at ycbcr.xyz
Tue Apr 17 14:57:03 CEST 2018


Fixes #20290
---
 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 7506e47725..02d61160d7 100644
--- a/src/misc/picture.c
+++ b/src/misc/picture.c
@@ -156,13 +156,13 @@ int picture_Setup( picture_t *p_picture, const video_format_t *restrict fmt )
 
         /* A plane cannot be over-sampled. This could lead to overflow. */
         assert(h->den >= h->num);
-        assert(w->den >= w->num);
+        assert(p_dsc->plane_count == 2 || w->den >= w->num);
 
         p->i_lines = height * h->num / h->den;
-        p->i_visible_lines = fmt->i_visible_height * h->num / h->den;
+        p->i_visible_lines = (fmt->i_visible_height + (h->den - 1)) * h->num / h->den;
 
         p->i_pitch = width * w->num / w->den * p_dsc->pixel_size;
-        p->i_visible_pitch = fmt->i_visible_width * w->num / w->den
+        p->i_visible_pitch = (fmt->i_visible_width + (w->den - 1)) * w->num / w->den
                              * p_dsc->pixel_size;
         p->i_pixel_pitch = p_dsc->pixel_size;
 
-- 
2.16.2



More information about the vlc-devel mailing list