[vlc-devel] [PATCH] decoder: adjust the unknown colorimetry values because getting a vout
Steve Lhomme
robux4 at videolabs.io
Sun Apr 17 11:43:45 CEST 2016
--
turn into in a function
fix after the vlc_es change
replaces https://patches.videolan.org/patch/12966/
https://patches.videolan.org/patch/12965/
---
include/vlc_es.h | 29 +++++++++++++++++++++++++++++
src/input/decoder.c | 2 ++
2 files changed, 31 insertions(+)
diff --git a/include/vlc_es.h b/include/vlc_es.h
index 751ea6f..566f31e 100644
--- a/include/vlc_es.h
+++ b/include/vlc_es.h
@@ -309,6 +309,35 @@ static inline int video_format_Copy( video_format_t *p_dst, const video_format_t
return VLC_SUCCESS;
}
+static inline void video_format_AdjustColorSpace( video_format_t *p_fmt )
+{
+ if ( p_fmt->primaries == COLOR_PRIMARIES_UNDEF )
+ {
+ if ( p_fmt->i_visible_height > 576 ) // HD
+ p_fmt->primaries = COLOR_PRIMARIES_BT709;
+ else if ( p_fmt->i_visible_height > 525 ) // PAL
+ p_fmt->primaries = COLOR_PRIMARIES_BT601_625;
+ else
+ p_fmt->primaries = COLOR_PRIMARIES_BT601_525;
+ }
+
+ if ( p_fmt->transfer == TRANSFER_FUNC_UNDEF )
+ {
+ if ( p_fmt->i_visible_height > 576 ) // HD
+ p_fmt->transfer = TRANSFER_FUNC_BT709;
+ else
+ p_fmt->transfer = TRANSFER_FUNC_SRGB;
+ }
+
+ if ( p_fmt->space == COLOR_SPACE_UNDEF )
+ {
+ if ( p_fmt->i_visible_height > 576 ) // HD
+ p_fmt->space = COLOR_SPACE_BT709;
+ else
+ p_fmt->space = COLOR_SPACE_BT601;
+ }
+}
+
/**
* Cleanup and free palette of this video_format_t
* \param p_src video_format_t structure to clean
diff --git a/src/input/decoder.c b/src/input/decoder.c
index a1d7414..a881a06 100644
--- a/src/input/decoder.c
+++ b/src/input/decoder.c
@@ -394,6 +394,8 @@ 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 );
+ video_format_AdjustColorSpace( &fmt );
+
vlc_mutex_lock( &p_owner->lock );
p_vout = p_owner->p_vout;
--
2.7.0
More information about the vlc-devel
mailing list