[vlc-devel] [PATCH] es: auto-detect BT2020 if undefined

Jean-Baptiste Kempf jb at videolan.org
Fri Oct 13 00:57:59 CEST 2017


I disagree with this patch. BT2020 should be explicit.

On Wed, 13 Sep 2017, at 03:52, Thomas Guillem wrote:
> ---
>  include/vlc_es.h | 16 ++++++++++++++--
>  1 file changed, 14 insertions(+), 2 deletions(-)
> 
> diff --git a/include/vlc_es.h b/include/vlc_es.h
> index 0617bb72fe..1157a84a74 100644
> --- a/include/vlc_es.h
> +++ b/include/vlc_es.h
> @@ -400,10 +400,20 @@ static inline int video_format_Copy( video_format_t
> *p_dst, const video_format_t
>  
>  static inline void video_format_AdjustColorSpace( video_format_t *p_fmt
>  )
>  {
> +    bool b_uhd_10b = false;
> +    if ( p_fmt->i_visible_height >= 2160 )
> +    {
> +        const vlc_chroma_description_t *desc =
> +            vlc_fourcc_GetChromaDescription( p_fmt->i_chroma );
> +        if( desc && desc->pixel_bits >= 10 )
> +            b_uhd_10b = true;
> +    }
> +
>      if ( p_fmt->primaries == COLOR_PRIMARIES_UNDEF )
>      {
>          if ( p_fmt->i_visible_height > 576 ) // HD
> -            p_fmt->primaries = COLOR_PRIMARIES_BT709;
> +            p_fmt->primaries = b_uhd_10b ? COLOR_PRIMARIES_BT2020
> +                                         : COLOR_PRIMARIES_BT709;
>          else if ( p_fmt->i_visible_height > 525 ) // PAL
>              p_fmt->primaries = COLOR_PRIMARIES_BT601_625;
>          else
> @@ -421,7 +431,9 @@ static inline void video_format_AdjustColorSpace(
> video_format_t *p_fmt )
>      if ( p_fmt->space == COLOR_SPACE_UNDEF )
>      {
>          if ( p_fmt->i_visible_height > 576 ) // HD
> -            p_fmt->space = COLOR_SPACE_BT709;
> +        {
> +            p_fmt->space = b_uhd_10b ? COLOR_SPACE_BT2020 :
> COLOR_SPACE_BT709;
> +        }
>          else
>              p_fmt->space = COLOR_SPACE_BT601;
>      }
> -- 
> 2.11.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