[vlc-commits] packetizer: vc1: use tables for color matching

Francois Cartegnie git at videolan.org
Thu Oct 3 12:41:53 CEST 2019


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Tue Oct  1 09:32:51 2019 +0200| [ff11419a431d02209ad05ad2ee6450c59709ebea] | committer: Francois Cartegnie

packetizer: vc1: use tables for color matching

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

 modules/packetizer/Makefile.am |  3 ++-
 modules/packetizer/vc1.c       | 31 ++++---------------------------
 2 files changed, 6 insertions(+), 28 deletions(-)

diff --git a/modules/packetizer/Makefile.am b/modules/packetizer/Makefile.am
index 8d9006c117..491426ec8f 100644
--- a/modules/packetizer/Makefile.am
+++ b/modules/packetizer/Makefile.am
@@ -23,7 +23,8 @@ libpacketizer_h264_plugin_la_SOURCES = \
         packetizer/iso_color_tables.h
 libpacketizer_vc1_plugin_la_SOURCES = packetizer/vc1.c \
         packetizer/hxxx_ep3b.h \
-        packetizer/hxxx_nal.h
+        packetizer/hxxx_nal.h \
+        packetizer/iso_color_tables.h
 libpacketizer_mlp_plugin_la_SOURCES = packetizer/mlp.c
 libpacketizer_flac_plugin_la_SOURCES = packetizer/flac.c \
         packetizer/flac.h
diff --git a/modules/packetizer/vc1.c b/modules/packetizer/vc1.c
index 08c5ffed60..4204350ddc 100644
--- a/modules/packetizer/vc1.c
+++ b/modules/packetizer/vc1.c
@@ -41,6 +41,7 @@
 #include "hxxx_nal.h"
 #include "hxxx_ep3b.h"
 #include "startcode_helper.h"
+#include "iso_color_tables.h"
 
 /*****************************************************************************
  * Module descriptor
@@ -583,33 +584,9 @@ static block_t *ParseIDU( decoder_t *p_dec, bool *pb_ts_used, block_t *p_frag )
             }
             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;
-                }
+                p_es->video.primaries = iso_23001_8_cp_to_vlc_primaries( bs_read( &s, 8 ) );
+                p_es->video.transfer = iso_23001_8_tc_to_vlc_xfer( bs_read( &s, 8 ) );
+                p_es->video.space = iso_23001_8_mc_to_vlc_coeffs( bs_read( &s, 8 ) );
             }
         }
         else



More information about the vlc-commits mailing list