[vlc-commits] packetizer: vc1: handle color spaces

Francois Cartegnie git at videolan.org
Sun Dec 25 19:04:20 CET 2016


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Sun Dec 25 17:58:36 2016 +0100| [8fb43520e3056225381cabf500e228c01a1f1318] | committer: Francois Cartegnie

packetizer: vc1: handle color spaces

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

 modules/packetizer/vc1.c | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)

diff --git a/modules/packetizer/vc1.c b/modules/packetizer/vc1.c
index 51849dc..fab961b 100644
--- a/modules/packetizer/vc1.c
+++ b/modules/packetizer/vc1.c
@@ -575,6 +575,36 @@ static block_t *ParseIDU( decoder_t *p_dec, bool *pb_ts_used, block_t *p_frag )
                 if( !p_sys->b_sequence_header )
                     msg_Dbg( p_dec, "frame rate %d/%d", p_es->video.i_frame_rate, p_es->video.i_frame_rate_base );
             }
+            if( bs_read1( &s ) ) /* Color Format */
+            {
+                switch( bs_read( &s, 8 ) ) /* Color Primaries */
+                {
+                    case 1:  p_es->video.primaries = COLOR_PRIMARIES_BT709; break;
+                    case 4:  p_es->video.primaries = COLOR_PRIMARIES_BT470_M; break;
+                    case 5:  p_es->video.primaries = COLOR_PRIMARIES_BT470_BG; break;
+                    case 6:  p_es->video.primaries = COLOR_PRIMARIES_SMTPE_RP145; break;
+                    default: p_es->video.primaries = COLOR_PRIMARIES_UNDEF; break;
+                }
+
+                switch( bs_read( &s, 8 ) ) /* Transfert Chars */
+                {
+                    case 1:  p_es->video.transfer = TRANSFER_FUNC_BT709; break;
+                    case 4:  p_es->video.transfer = TRANSFER_FUNC_BT470_M; break;
+                    case 5:  p_es->video.transfer = TRANSFER_FUNC_BT470_BG; break;
+                    case 6:  p_es->video.transfer = TRANSFER_FUNC_SMPTE_170; break;
+                    case 7:  p_es->video.transfer = TRANSFER_FUNC_SMPTE_240; break;
+                    case 8:  p_es->video.transfer = TRANSFER_FUNC_LINEAR; break;
+                    default: p_es->video.transfer = TRANSFER_FUNC_UNDEF; break;
+                }
+
+                switch( bs_read( &s, 8 ) ) /* Matrix Coef */
+                {
+                    case 1:  p_es->video.space = COLOR_SPACE_BT709; break;
+                    case 6:  p_es->video.space = COLOR_SPACE_BT601; break;
+                    case 7:  p_es->video.space = COLOR_SPACE_SMPTE_240; break;
+                    default: p_es->video.space = COLOR_SPACE_UNDEF; break;
+                }
+            }
         }
         else
         {



More information about the vlc-commits mailing list