[vlc-devel] [PATCH] png:decoder: use png_set_scale_16

Jean-Baptiste Kempf jb at videolan.org
Tue Nov 7 19:24:12 CET 2017


No objection :)

On Mon, 6 Nov 2017, at 23:38, Tristan Matthews wrote:
> It's supposedly more accurate than png_set_strip_16 and available since
> libpng 1.5.4
> The fallback may be overkill (contrib expects at least 1.5.4 already).
> 
> ---
>  modules/codec/png.c | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
> 
> diff --git a/modules/codec/png.c b/modules/codec/png.c
> index 645577f7ca..af9e7fcdbf 100644
> --- a/modules/codec/png.c
> +++ b/modules/codec/png.c
> @@ -264,7 +264,14 @@ static int DecodeBlock( decoder_t *p_dec, block_t
> *p_block )
>          png_set_alpha_mode( p_png, PNG_ALPHA_OPTIMIZED, PNG_DEFAULT_sRGB
>          );
>  
>      /* Strip to 8 bits per channel */
> -    if( i_bit_depth == 16 ) png_set_strip_16( p_png );
> +    if( i_bit_depth == 16 )
> +    {
> +#if PNG_LIBPNG_VER >= 10504
> +        png_set_scale_16( p_png );
> +#else
> +        png_set_strip_16( p_png );
> +#endif
> +    }
>  
>      if( png_get_valid( p_png, p_info, PNG_INFO_tRNS ) )
>      {
> -- 
> 2.15.0
> 
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel


-- 
Jean-Baptiste Kempf -  President
+33 672 704 734


More information about the vlc-devel mailing list