[vlc-devel] [PATCH 3/3] picture: no need to setup to new picture format twice

Zhao Zhili quinkblack at foxmail.com
Mon Sep 17 11:17:44 CEST 2018



On 2018年09月17日 16:51, Steve Lhomme wrote:
> It's done in picture_Setup().
> ---
>   src/misc/picture.c | 13 +------------
>   1 file changed, 1 insertion(+), 12 deletions(-)
>
> diff --git a/src/misc/picture.c b/src/misc/picture.c
> index b08ac56a11..8f0b1a106b 100644
> --- a/src/misc/picture.c
> +++ b/src/misc/picture.c
> @@ -183,16 +183,6 @@ static picture_priv_t *picture_NewPrivate(const video_format_t *restrict p_fmt)
>       video_format_t fmt = *p_fmt;
>   
>       /* It is needed to be sure all information are filled */
> -    video_format_Setup( &fmt, p_fmt->i_chroma,
> -                              p_fmt->i_width, p_fmt->i_height,
> -                              p_fmt->i_visible_width, p_fmt->i_visible_height,
> -                              p_fmt->i_sar_num, p_fmt->i_sar_den );
> -    if( p_fmt->i_x_offset < p_fmt->i_width &&
> -        p_fmt->i_y_offset < p_fmt->i_height &&
> -        p_fmt->i_visible_width  > 0 && p_fmt->i_x_offset + p_fmt->i_visible_width  <= p_fmt->i_width &&
> -        p_fmt->i_visible_height > 0 && p_fmt->i_y_offset + p_fmt->i_visible_height <= p_fmt->i_height )
> -        video_format_CopyCrop( &fmt, p_fmt );
> -
In my opinion the comments should be removed or updated along with the code.

>       /* */
>       picture_priv_t *priv = malloc( sizeof (*priv) );
>       if( unlikely(priv == NULL) )
> @@ -201,10 +191,9 @@ static picture_priv_t *picture_NewPrivate(const video_format_t *restrict p_fmt)
>       picture_t *p_picture = &priv->picture;
>   
>       memset( p_picture, 0, sizeof( *p_picture ) );
> -    p_picture->format = fmt;
>   
>       /* Make sure the real dimensions are a multiple of 16 */
> -    if( picture_Setup( p_picture, &fmt ) )
> +    if( picture_Setup( p_picture, p_fmt ) )
>       {
>           free( p_picture );
>           return NULL;



More information about the vlc-devel mailing list