[vlc-commits] demux: mp4: simplify colr lookup

Francois Cartegnie git at videolan.org
Wed Mar 14 18:03:50 CET 2018


vlc/vlc-3.0 | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Wed Mar 14 17:33:24 2018 +0100| [01e8462a8027d74182603112efd241a639976cf5] | committer: Francois Cartegnie

demux: mp4: simplify colr lookup

Some were missing, and that's a subset of
ISO/IEC 23001-8:2016

(cherry picked from commit c84e8acb59f36779aeb41f4222d30910b18f63be)

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

 modules/demux/mp4/essetup.c | 21 ++++++---------------
 1 file changed, 6 insertions(+), 15 deletions(-)

diff --git a/modules/demux/mp4/essetup.c b/modules/demux/mp4/essetup.c
index 3377373874..30076dc3b3 100644
--- a/modules/demux/mp4/essetup.c
+++ b/modules/demux/mp4/essetup.c
@@ -497,21 +497,12 @@ int SetupVideoES( demux_t *p_demux, mp4_track_t *p_track, MP4_Box_t *p_sample )
         if ( BOXDATA(p_colr)->i_type == VLC_FOURCC( 'n', 'c', 'l', 'c' ) ||
              BOXDATA(p_colr)->i_type == VLC_FOURCC( 'n', 'c', 'l', 'x' ) )
         {
-            switch ( BOXDATA( p_colr )->nclc.i_primary_idx )
-            {
-            case 1: p_track->fmt.video.primaries = COLOR_PRIMARIES_BT709; break;
-            case 5: p_track->fmt.video.primaries = COLOR_PRIMARIES_BT601_625; break;
-            case 6: p_track->fmt.video.primaries = COLOR_PRIMARIES_BT601_525; break;
-            }
-            switch ( BOXDATA( p_colr )->nclc.i_transfer_function_idx )
-            {
-            case 1: p_track->fmt.video.transfer = TRANSFER_FUNC_BT709; break;
-            }
-            switch ( BOXDATA( p_colr )->nclc.i_matrix_idx )
-            {
-            case 1: p_track->fmt.video.space = COLOR_SPACE_BT709; break;
-            case 2: p_track->fmt.video.space = COLOR_SPACE_BT601; break;
-            }
+            p_track->fmt.video.primaries =
+                    iso_23001_8_cp_to_vlc_primaries( BOXDATA( p_colr )->nclc.i_primary_idx );
+            p_track->fmt.video.transfer =
+                    iso_23001_8_tc_to_vlc_xfer( BOXDATA( p_colr )->nclc.i_transfer_function_idx );
+            p_track->fmt.video.space =
+                    iso_23001_8_mc_to_vlc_coeffs( BOXDATA( p_colr )->nclc.i_matrix_idx );
             p_track->fmt.video.b_color_range_full = BOXDATA(p_colr)->i_type == VLC_FOURCC( 'n', 'c', 'l', 'x' ) &&
                     (BOXDATA(p_colr)->nclc.i_full_range >> 7) != 0;
         }



More information about the vlc-commits mailing list