[vlc-devel] [PATCH] decoder: simplify the plane constraints processing

Steve Lhomme robux4 at videolabs.io
Tue Mar 21 16:22:53 CET 2017


This is really rounding to the upper modulo.
---
 src/input/decoder.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/input/decoder.c b/src/input/decoder.c
index 9f95bb824c..fee2a4b8e7 100644
--- a/src/input/decoder.c
+++ b/src/input/decoder.c
@@ -403,10 +403,10 @@ static int vout_update_format( decoder_t *p_dec )
             const vlc_chroma_description_t *dsc = vlc_fourcc_GetChromaDescription( fmt.i_chroma );
             for( unsigned int i = 0; dsc && i < dsc->plane_count; i++ )
             {
-                while( fmt.i_width % dsc->p[i].w.den )
-                    fmt.i_width++;
-                while( fmt.i_height % dsc->p[i].h.den )
-                    fmt.i_height++;
+                fmt.i_width  = dsc->p[i].w.den *
+                        ((fmt.i_width  + dsc->p[i].w.den - 1) / dsc->p[i].w.den);
+                fmt.i_height = dsc->p[i].h.den *
+                        ((fmt.i_height + dsc->p[i].h.den - 1) / dsc->p[i].h.den);
             }
         }
 
-- 
2.11.1



More information about the vlc-devel mailing list