[vlc-commits] demux:mkv: read the color matrix from the file

Steve Lhomme git at videolan.org
Wed Dec 12 12:45:43 CET 2018


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Wed Dec 12 12:43:58 2018 +0100| [874c60ac4303700f4461210b2bc431e63ba72dcd] | committer: Steve Lhomme

demux:mkv: read the color matrix from the file

And debug the value read.

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

 modules/demux/mkv/matroska_segment_parse.cpp | 36 ++++++++++++++++++++++++++++
 1 file changed, 36 insertions(+)

diff --git a/modules/demux/mkv/matroska_segment_parse.cpp b/modules/demux/mkv/matroska_segment_parse.cpp
index 7098358cd7..89b7c80a20 100644
--- a/modules/demux/mkv/matroska_segment_parse.cpp
+++ b/modules/demux/mkv/matroska_segment_parse.cpp
@@ -763,6 +763,42 @@ void matroska_segment_c::ParseTrackEntry( const KaxTrackEntry *m )
             else
                 debug( vars, "Colour Primaries=%s", name );
         }
+        E_CASE( KaxVideoColourMatrix, matrix )
+        {
+            vars.tk->fmt.video.space = iso_23001_8_mc_to_vlc_coeffs( static_cast<uint8>(matrix) );
+            const char *name = nullptr;
+            switch( static_cast<uint8>(matrix) )
+            {
+            case 1: name = "BT-709";
+                break;
+            case 6: name = "SMPTE 170M";
+                break;
+            case 7: name = "SMPTE 240M";
+                break;
+            case 9: name = "BT.2020 Non-constant Luminance";
+                break;
+            case 10: name = "BT.2020 Constant Luminance";
+                break;
+            case 0: // Identity
+            case 2: // unspecified
+            case 3: // reserved
+            case 4: // US FCC 73.682
+            case 5: // ITU-R BT.470BG
+            case 8: // YCoCg
+            case 11: // SMPTE ST 2085
+            case 12: // Chroma-derived Non-constant Luminance
+            case 13: // Chroma-derived Constant Luminance
+            case 14: // ITU-R BT.2100
+            default:
+                break;
+            }
+            if (vars.tk->fmt.video.space == COLOR_SPACE_UNDEF)
+                debug( vars, "Unsupported Colour Matrix=%d", static_cast<uint8>(matrix) );
+            else if (name == nullptr)
+                debug( vars, "Colour Matrix=%d", static_cast<uint8>(matrix) );
+            else
+                debug( vars, "Colour Matrix=%s", name );
+        }
         E_CASE( KaxVideoColourMaxCLL, maxCLL )
         {
             debug( vars, "Video Max Pixel Brightness");



More information about the vlc-commits mailing list