[vlc-devel] [PATCH] decoder: adjust the unknown colorimetry values because getting a vout

Rémi Denis-Courmont remi at remlab.net
Sun Apr 17 11:13:13 CEST 2016


Le 2016-04-17 10:56, Steve Lhomme a écrit :
> --
> fix after the vlc_es change
> replaces https://patches.videolan.org/patch/12966/
> https://patches.videolan.org/patch/12965/
> ---
>  src/input/decoder.c | 32 ++++++++++++++++++++++++++++++++
>  1 file changed, 32 insertions(+)
>
> diff --git a/src/input/decoder.c b/src/input/decoder.c
> index a1d7414..70647c7 100644
> --- a/src/input/decoder.c
> +++ b/src/input/decoder.c
> @@ -134,6 +134,9 @@ struct decoder_owner_sys_t
>  /* */
>  #define DECODER_SPU_VOUT_WAIT_DURATION ((int)(0.200*CLOCK_FREQ))
>
> +#define HD_MIN_HEIGHT     576
> +#define NTSC_HEIGHT       525
> +
>  /**
>   * Load a decoder module
>   */
> @@ -394,6 +397,35 @@ static int vout_update_format( decoder_t *p_dec 
> )
>          vlc_ureduce( &fmt.i_sar_num, &fmt.i_sar_den,
>                       fmt.i_sar_num, fmt.i_sar_den, 50000 );
>
> +        if ( fmt.primaries == COLOR_PRIMARIES_UNDEF )
> +        {
> +            if ( fmt.i_visible_height > HD_MIN_HEIGHT )
> +                fmt.primaries = COLOR_PRIMARIES_BT709;
> +            else if ( fmt.i_visible_height <= NTSC_HEIGHT )
> +                fmt.primaries = COLOR_PRIMARIES_BT601_525;
> +            else
> +                fmt.primaries = COLOR_PRIMARIES_BT601_625;

Nit: I would order more consistently (709, 601-625, 601-525)

> +            msg_Info( p_dec, "Forcing color primaries to %d",
> fmt.primaries  );

Nit:            ^
Also msg_Info -> msg_Dbg

> +        }
> +
> +        if ( fmt.transfer == TRANSFER_FUNC_UNDEF )
> +        {
> +            if ( fmt.i_visible_height > HD_MIN_HEIGHT )
> +                fmt.transfer = TRANSFER_FUNC_BT709;
> +            else
> +                fmt.transfer = TRANSFER_FUNC_SRGB;
> +            msg_Info( p_dec, "Forcing color transfer curve to %d",
> fmt.transfer  );
> +        }
> +
> +        if ( fmt.space == COLOR_SPACE_UNDEF )
> +        {
> +            if ( fmt.i_visible_height > HD_MIN_HEIGHT )
> +                fmt.space = COLOR_SPACE_BT709;
> +            else
> +                fmt.space = COLOR_SPACE_BT601;
> +            msg_Info( p_dec, "Forcing color range to %d", fmt.space  
> );
> +        }
> +
>          vlc_mutex_lock( &p_owner->lock );
>
>          p_vout = p_owner->p_vout;

-- 
Rémi Denis-Courmont
http://www.remlab.net/


More information about the vlc-devel mailing list