[vlc-commits] rawvideo: fix the picth/line computation for odd lines/heights

Steve Lhomme git at videolan.org
Tue Apr 17 16:13:07 CEST 2018


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Tue Apr 17 16:10:52 2018 +0200| [9d12c0827930eb023db54570b2cc9299594c6e04] | committer: Steve Lhomme

rawvideo: fix the picth/line computation for odd lines/heights

Fixes #20303

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=9d12c0827930eb023db54570b2cc9299594c6e04
---

 modules/codec/rawvideo.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/modules/codec/rawvideo.c b/modules/codec/rawvideo.c
index b616ddfdd4..e98061dc60 100644
--- a/modules/codec/rawvideo.c
+++ b/modules/codec/rawvideo.c
@@ -116,10 +116,10 @@ static int OpenCommon( decoder_t *p_dec )
 
     for( unsigned i = 0; i < dsc->plane_count; i++ )
     {
-        unsigned pitch = p_dec->fmt_in.video.i_width * dsc->pixel_size
-                         * dsc->p[i].w.num / dsc->p[i].w.den;
-        unsigned lines = p_dec->fmt_in.video.i_height
-                         * dsc->p[i].h.num / dsc->p[i].h.den;
+        unsigned pitch = ((p_dec->fmt_in.video.i_width + (dsc->p[i].w.den - 1)) / dsc->p[i].w.den)
+                         * dsc->p[i].w.num * dsc->pixel_size;
+        unsigned lines = ((p_dec->fmt_in.video.i_height + (dsc->p[i].h.den - 1)) / dsc->p[i].h.den)
+                         * dsc->p[i].h.num;
 
         p_sys->pitches[i] = pitch;
         p_sys->lines[i] = lines;



More information about the vlc-commits mailing list