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

Rémi Denis-Courmont remi at remlab.net
Wed Mar 22 08:28:17 CET 2017


Le tiistaina 21. maaliskuuta 2017, 16.22.53 EET Steve Lhomme a écrit :
> 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); }
>          }

AFAICT, this would be simpler:
a += b - (a % b)

-- 
雷米‧德尼-库尔蒙
https://www.remlab.net/



More information about the vlc-devel mailing list