[vlc-commits] picture: fix the order of operation for the visible pitch
    Steve Lhomme 
    git at videolan.org
       
    Wed Apr 18 11:54:16 CEST 2018
    
    
  
vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Wed Apr 18 11:54:02 2018 +0200| [edc139506f9c5c226a874e98c63e9f9fd982d1ae] | committer: Steve Lhomme
picture: fix the order of operation for the visible pitch
We round the value to the upper multiple first and then multiply and divide it.
Otherwise with semiplanar we end up with odd values for an even source.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=edc139506f9c5c226a874e98c63e9f9fd982d1ae
---
 src/misc/picture.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/misc/picture.c b/src/misc/picture.c
index 731d4ac492..f6abd6016a 100644
--- a/src/misc/picture.c
+++ b/src/misc/picture.c
@@ -159,10 +159,10 @@ int picture_Setup( picture_t *p_picture, const video_format_t *restrict fmt )
         assert(w->den >= w->num);
 
         p->i_lines = height * h->num / h->den;
-        p->i_visible_lines = (fmt->i_visible_height + (h->den - 1)) * h->num / h->den;
+        p->i_visible_lines = (fmt->i_visible_height + (h->den - 1)) / h->den * h->num;
 
         p->i_pitch = width * w->num / w->den * p_dsc->pixel_size;
-        p->i_visible_pitch = (fmt->i_visible_width + (w->den - 1)) * w->num / w->den
+        p->i_visible_pitch = (fmt->i_visible_width + (w->den - 1)) / w->den * w->num
                              * p_dsc->pixel_size;
         p->i_pixel_pitch = p_dsc->pixel_size;
 
    
    
More information about the vlc-commits
mailing list