[vlc-devel] [PATCH] core: only add extra height if there wasn't enough added for the modulo

Steve Lhomme robux4 at videolabs.io
Tue Mar 31 13:40:35 CEST 2015


This hack is already done in FFMpeg and libav. So do we still need it ?

http://git.videolan.org/?p=ffmpeg.git;a=blob;f=libavcodec/utils.c;h=99f254b6b45ba4a5f43711e90cb16199a98a99ef;hb=HEAD#l425
https://git.libav.org/?p=libav.git;a=blob;f=libavcodec/utils.c;h=f1acd780dc12f631dff6f7f3ba055234c180996f;hb=HEAD#l272

On Tue, Mar 31, 2015 at 1:30 PM, Steve Lhomme <robUx4 at videolabs.io> wrote:
> --
> this whole hack may even be useless
> ---
>  src/misc/picture.c | 10 +++++++---
>  1 file changed, 7 insertions(+), 3 deletions(-)
>
> diff --git a/src/misc/picture.c b/src/misc/picture.c
> index 8b4e0bf..a625f2d 100644
> --- a/src/misc/picture.c
> +++ b/src/misc/picture.c
> @@ -181,13 +181,17 @@ int picture_Setup( picture_t *p_picture, const video_format_t *restrict fmt )
>      i_modulo_h = LCM( i_modulo_h, 32 );
>
>      const int i_width_aligned  = ( fmt->i_width  + i_modulo_w - 1 ) / i_modulo_w * i_modulo_w;
> -    const int i_height_aligned = ( fmt->i_height + i_modulo_h - 1 ) / i_modulo_h * i_modulo_h;
> -    const int i_height_extra   = 2 * i_ratio_h; /* This one is a hack for some ASM functions */
> +    int i_height_aligned = ( fmt->i_height + i_modulo_h - 1 ) / i_modulo_h * i_modulo_h;
> +    if( i_height_aligned - fmt->i_height < 2 * i_ratio_h )
> +    {
> +        /* This one is a hack for some ASM functions */
> +        i_height_aligned += 2 * i_ratio_h;
> +    }
>      for( unsigned i = 0; i < p_dsc->plane_count; i++ )
>      {
>          plane_t *p = &p_picture->p[i];
>
> -        p->i_lines         = (i_height_aligned + i_height_extra ) * p_dsc->p[i].h.num / p_dsc->p[i].h.den;
> +        p->i_lines         = i_height_aligned * p_dsc->p[i].h.num / p_dsc->p[i].h.den;
>          p->i_visible_lines = fmt->i_visible_height * p_dsc->p[i].h.num / p_dsc->p[i].h.den;
>          p->i_pitch         = i_width_aligned * p_dsc->p[i].w.num / p_dsc->p[i].w.den * p_dsc->pixel_size;
>          p->i_visible_pitch = fmt->i_visible_width * p_dsc->p[i].w.num / p_dsc->p[i].w.den * p_dsc->pixel_size;
> --
> 2.3.2
>
> _______________________________________________
> 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