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

Steve Lhomme git at videolan.org
Sun Apr 17 10:39:56 CEST 2016


vlc | branch: master | Steve Lhomme <robUx4 at videolabs.io> | Sat Apr 16 18:47:33 2016 +0300| [70891fb7aaf76dbed99821cfa12aabd5590e5b48] | committer: Jean-Baptiste Kempf

decoder: adjust the unknown colorimetry values because getting a vout

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=70891fb7aaf76dbed99821cfa12aabd5590e5b48
---

 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;



More information about the vlc-commits mailing list