[vlc-devel] [PATCH] [RFC] picture: integrate the 2 extra lines in the height padding
Rémi Denis-Courmont
remi at remlab.net
Thu Apr 5 10:05:58 CEST 2018
Le 5 avril 2018 09:55:25 GMT+03:00, Steve Lhomme <robux4 at ycbcr.xyz> a écrit :
>This is a rebased/reworked version of
>https://patches.videolan.org/patch/19128/
>
>Also since this is done in picture_Setup() I wonder if we should also
>update the i_width/i_height of the picture accordingly. Right now a
>picture that has its height modified for padding has its plane lines
>correct but the height reported doesn't match. Leading to potential
>misdetection of padding/alignment.
>
>
>Le 05/04/2018 à 08:51, Steve Lhomme a écrit :
>> No need for extra lines when there's already padding. Plus it may
>break the
>> alignment of the secondary planes.
>> ---
>> src/misc/picture.c | 10 +++++-----
>> 1 file changed, 5 insertions(+), 5 deletions(-)
>>
>> diff --git a/src/misc/picture.c b/src/misc/picture.c
>> index 7506e47725..7ce1170702 100644
>> --- a/src/misc/picture.c
>> +++ b/src/misc/picture.c
>> @@ -133,17 +133,17 @@ int picture_Setup( picture_t *p_picture, const
>video_format_t *restrict fmt )
>>
>> unsigned width, height;
>>
>> + /* Hack: append two scan lines for some SIMD assembler */
>> + if (unlikely(add_overflow(fmt->i_height, 2 * i_ratio_h,
>&height)))
>> + return VLC_EGENERIC;
>> +
>> if (unlikely(add_overflow(fmt->i_width, i_modulo_w - 1,
>&width))
>> - || unlikely(add_overflow(fmt->i_height, i_modulo_h - 1,
>&height)))
>> + || unlikely(add_overflow(height, i_modulo_h - 1, &height)))
>> return VLC_EGENERIC;
>>
>> width = width / i_modulo_w * i_modulo_w;
>> height = height / i_modulo_h * i_modulo_h;
>>
>> - /* Hack: append two scan lines for some SIMD assembler */
>> - if (unlikely(add_overflow(height, 2 * i_ratio_h, &height)))
>> - return VLC_EGENERIC;
>> -
>> /* plane_t uses 'int'. */
>> if (unlikely(width > INT_MAX) || unlikely(height > INT_MAX))
>> return VLC_EGENERIC;
>
>_______________________________________________
>vlc-devel mailing list
>To unsubscribe or modify your subscription options:
>https://mailman.videolan.org/listinfo/vlc-devel
This works if SIMD simply assumes two extra lines after visible lines. But it does not work if SIMD assumes two extra lines after the aligned visible lines. This could be an algorithm operating on macro blocks and expecting some extra padding...
Basically, this patch assumes that either lines count must be over-aligned or there must be extra lines, but not both for any given algorithm. Not that I'd know if there is or ever will be such a case in underlying libraries.
Regardless, I don't see how this fixes anything. The alignment of next planes should not be dependent on the number of lines of the previous planes. IMO, all planes should be individually page-aligned.
--
Envoyé de mon appareil Android avec Courriel K-9 Mail. Veuillez excuser ma brièveté.
More information about the vlc-devel
mailing list