[vlc-commits] [Git][videolan/vlc][master] rawvid: fix rounding division when calculating pitch

Steve Lhomme (@robUx4) gitlab at videolan.org
Fri Feb 17 15:12:24 UTC 2023



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
128f7ff6 by Pierre Lamot at 2023-02-17T14:55:58+00:00
rawvid: fix rounding division when calculating pitch

formats like NV12 where num and den are 2 had the wrong pitch

size is divided then multiplied, consistently with `rawvideo` decoder

- - - - -


1 changed file:

- modules/demux/rawvid.c


Changes:

=====================================
modules/demux/rawvid.c
=====================================
@@ -353,10 +353,10 @@ valid:
     p_sys->frame_size = 0;
     for (unsigned i=0; i<dsc->plane_count; i++)
     {
-        unsigned pitch = (i_width + (dsc->p[i].w.den - 1))
-                         * dsc->p[i].w.num / dsc->p[i].w.den * dsc->pixel_size;
-        unsigned lines = (i_height + (dsc->p[i].h.den - 1))
-                         * dsc->p[i].h.num / dsc->p[i].h.den;
+        unsigned pitch = ((i_width + (dsc->p[i].w.den - 1)) / dsc->p[i].w.den)
+                          * dsc->p[i].w.num * dsc->pixel_size;
+        unsigned lines = ((i_height + (dsc->p[i].h.den - 1)) / dsc->p[i].h.den)
+                         * dsc->p[i].h.num;
         p_sys->frame_size += pitch * lines;
     }
     p_sys->p_es_video = es_out_Add( p_demux->out, &p_sys->fmt_video );



View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/128f7ff6e9ee3c33098c2cc9896116374f04eb56

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/128f7ff6e9ee3c33098c2cc9896116374f04eb56
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list