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

Steve Lhomme robux4 at gmail.com
Wed Mar 22 14:20:25 CET 2017


On Wed, Mar 22, 2017 at 8:28 AM, Rémi Denis-Courmont <remi at remlab.net> wrote:
> 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)

I like Francois's version: a = (a + d-1) & ~(d-1)
It's probably more efficient.

But it works only for powers of 2. Which I think is the case with
pixel subsampling (?).

> --
> 雷米‧德尼-库尔蒙
> https://www.remlab.net/
>
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel


More information about the vlc-devel mailing list