[vlc-devel] [PATCH 3/5] decoder: adjust the unknown colorimetry values because getting a vout
Steve Lhomme
robux4 at videolabs.io
Sat Apr 16 17:47:33 CEST 2016
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..5942870 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;
+ msg_Info( p_dec, "Forcing color primaries to %d", fmt.primaries );
+ }
+
+ 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_LIMITED;
+ else
+ fmt.space = COLOR_SPACE_BT601_LIMITED;
+ msg_Info( p_dec, "Forcing color range to %d", fmt.space );
+ }
+
vlc_mutex_lock( &p_owner->lock );
p_vout = p_owner->p_vout;
--
2.7.0
More information about the vlc-devel
mailing list