Index: media/base/hdr_metadata.h |
diff --git a/media/base/hdr_metadata.h b/media/base/hdr_metadata.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..befe0e27a63810a21dceb22e28b1f3e14370d14e |
--- /dev/null |
+++ b/media/base/hdr_metadata.h |
@@ -0,0 +1,309 @@ |
+// Copyright 2016 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef MEDIA_BASE_HDR_METADATA_H_ |
+#define MEDIA_BASE_HDR_METADATA_H_ |
+ |
+#include <cstdint> |
+#include "media/base/media_export.h" |
+ |
+namespace media { |
+ |
+// The definitions below are copied from the current libwebm top-of-tree. |
+// Chromium's third_party/libwebm doesn't have these yet. We can probably just |
+// include libwebm header directly in the future. |
+// ---- Begin copy/paste from libwebm/webm_parser/include/webm/dom_types.h ---- |
+ |
+/** |
+ A parsed \WebMID{MatrixCoefficients} element. |
+ |
+ Matroska/WebM adopted these values from Table 4 of ISO/IEC 23001-8:2013/DCOR1. |
+ See that document for further details. |
+ */ |
+enum class MatrixCoefficients : std::uint64_t { |
hubbe
2016/09/14 17:34:16
Plase use gfx::ColorSpace
servolk
2016/09/14 22:34:35
Ah, ok, thank for the pointer I didn't know about
hubbe
2016/09/14 22:41:25
We made the range an enum specifically so that we
|
+ /** |
+ The identity matrix. |
+ |
+ Typically used for GBR (often referred to as RGB); however, may also be used |
+ for YZX (often referred to as XYZ). |
+ */ |
+ kRgb = 0, |
+ |
+ /** |
+ Rec. ITU-R BT.709-5. |
+ */ |
+ kBt709 = 1, |
+ |
+ /** |
+ Image characteristics are unknown or are determined by the application. |
+ */ |
+ kUnspecified = 2, |
+ |
+ /** |
+ United States Federal Communications Commission Title 47 Code of Federal |
+ Regulations (2003) 73.682 (a) (20). |
+ */ |
+ kFcc = 4, |
+ |
+ /** |
+ Rec. ITU-R BT.470‑6 System B, G (historical). |
+ */ |
+ kBt470Bg = 5, |
+ |
+ /** |
+ Society of Motion Picture and Television Engineers 170M (2004). |
+ */ |
+ kSmpte170M = 6, |
+ |
+ /** |
+ Society of Motion Picture and Television Engineers 240M (1999). |
+ */ |
+ kSmpte240M = 7, |
+ |
+ /** |
+ YCgCo. |
+ */ |
+ kYCgCo = 8, |
+ |
+ /** |
+ Rec. ITU-R BT.2020 (non-constant luminance). |
+ */ |
+ kBt2020NonconstantLuminance = 9, |
+ |
+ /** |
+ Rec. ITU-R BT.2020 (constant luminance). |
+ */ |
+ kBt2020ConstantLuminance = 10, |
+}; |
+ |
+/** |
+ A parsed \WebMID{Range} element. |
+ */ |
+enum class Range : std::uint64_t { |
+ /** |
+ Unspecified. |
+ */ |
+ kUnspecified = 0, |
+ |
+ /** |
+ Broadcast range. |
+ */ |
+ kBroadcast = 1, |
+ |
+ /** |
+ Full range (no clipping). |
+ */ |
+ kFull = 2, |
+ |
+ /** |
+ Defined by MatrixCoefficients/TransferCharacteristics. |
+ */ |
+ kDerived = 3, |
+}; |
+ |
+/** |
+ A parsed \WebMID{TransferCharacteristics} element. |
+ |
+ Matroska/WebM adopted these values from Table 3 of ISO/IEC 23001-8:2013/DCOR1. |
+ See that document for further details. |
+ */ |
+enum class TransferCharacteristics : std::uint64_t { |
+ /** |
+ Rec. ITU-R BT.709-6. |
+ */ |
+ kBt709 = 1, |
+ |
+ /** |
+ Image characteristics are unknown or are determined by the application. |
+ */ |
+ kUnspecified = 2, |
+ |
+ /** |
+ Rec. ITU‑R BT.470‑6 System M (historical) with assumed display gamma 2.2. |
+ */ |
+ kGamma22curve = 4, |
+ |
+ /** |
+ Rec. ITU‑R BT.470-6 System B, G (historical) with assumed display gamma 2.8. |
+ */ |
+ kGamma28curve = 5, |
+ |
+ /** |
+ Society of Motion Picture and Television Engineers 170M (2004). |
+ */ |
+ kSmpte170M = 6, |
+ |
+ /** |
+ Society of Motion Picture and Television Engineers 240M (1999). |
+ */ |
+ kSmpte240M = 7, |
+ |
+ /** |
+ Linear transfer characteristics. |
+ */ |
+ kLinear = 8, |
+ |
+ /** |
+ Logarithmic transfer characteristic (100:1 range). |
+ */ |
+ kLog = 9, |
+ |
+ /** |
+ Logarithmic transfer characteristic (100 * Sqrt(10) : 1 range). |
+ */ |
+ kLogSqrt = 10, |
+ |
+ /** |
+ IEC 61966-2-4. |
+ */ |
+ kIec6196624 = 11, |
+ |
+ /** |
+ Rec. ITU‑R BT.1361-0 extended colour gamut system (historical). |
+ */ |
+ kBt1361ExtendedColourGamut = 12, |
+ |
+ /** |
+ IEC 61966-2-1 sRGB or sYCC. |
+ */ |
+ kIec6196621 = 13, |
+ |
+ /** |
+ Rec. ITU-R BT.2020-2 (10-bit system). |
+ */ |
+ k10BitBt2020 = 14, |
+ |
+ /** |
+ Rec. ITU-R BT.2020-2 (12-bit system). |
+ */ |
+ k12BitBt2020 = 15, |
+ |
+ /** |
+ Society of Motion Picture and Television Engineers ST 2084. |
+ */ |
+ kSmpteSt2084 = 16, |
+ |
+ /** |
+ Society of Motion Picture and Television Engineers ST 428-1. |
+ */ |
+ kSmpteSt4281 = 17, |
+ |
+ /** |
+ Association of Radio Industries and Businesses (ARIB) STD-B67. |
+ */ |
+ kAribStdB67Hlg = 18, |
+}; |
+ |
+/** |
+ A parsed \WebMID{Primaries} element. |
+ |
+ Matroska/WebM adopted these values from Table 2 of ISO/IEC 23001-8:2013/DCOR1. |
+ See that document for further details. |
+ */ |
+enum class Primaries : std::uint64_t { |
+ /** |
+ Rec. ITU‑R BT.709-6. |
+ */ |
+ kBt709 = 1, |
+ |
+ /** |
+ Image characteristics are unknown or are determined by the application. |
+ */ |
+ kUnspecified = 2, |
+ |
+ /** |
+ Rec. ITU‑R BT.470‑6 System M (historical). |
+ */ |
+ kBt470M = 4, |
+ |
+ /** |
+ Rec. ITU‑R BT.470‑6 System B, G (historical). |
+ */ |
+ kBt470Bg = 5, |
+ |
+ /** |
+ Society of Motion Picture and Television Engineers 170M (2004). |
+ */ |
+ kSmpte170M = 6, |
+ |
+ /** |
+ Society of Motion Picture and Television Engineers 240M (1999). |
+ */ |
+ kSmpte240M = 7, |
+ |
+ /** |
+ Generic film. |
+ */ |
+ kFilm = 8, |
+ |
+ /** |
+ Rec. ITU-R BT.2020-2. |
+ */ |
+ kBt2020 = 9, |
+ |
+ /** |
+ Society of Motion Picture and Television Engineers ST 428-1. |
+ */ |
+ kSmpteSt4281 = 10, |
+ |
+ /** |
+ JEDEC P22 phosphors/EBU Tech. 3213-E (1975). |
+ */ |
+ kJedecP22Phosphors = 22, |
+}; |
+ |
+// ---- End copy/paste from libwebm/webm_parser/include/webm/dom_types.h ---- |
+ |
+// SMPTE ST 2086 mastering metadata. |
+struct MEDIA_EXPORT MasteringMetadata { |
+ float PrimaryRChromaticityX = 0; |
halliwell
2016/09/14 18:58:40
nit: here and below, not following standard for me
servolk
2016/09/15 01:50:03
Done.
|
+ float PrimaryRChromaticityY = 0; |
+ float PrimaryGChromaticityX = 0; |
+ float PrimaryGChromaticityY = 0; |
+ float PrimaryBChromaticityX = 0; |
+ float PrimaryBChromaticityY = 0; |
+ float WhitePointChromaticityX = 0; |
+ float WhitePointChromaticityY = 0; |
+ float LuminanceMax = 0; |
+ float LuminanceMin = 0; |
+ |
+ MasteringMetadata(); |
+ MasteringMetadata(const MasteringMetadata& rhs); |
+}; |
+ |
+// HDR metadata common for HDR10 and WebM/VP9-based HDR formats. |
+struct MEDIA_EXPORT HDRMetadata { |
+ MasteringMetadata mastering_metadata; |
+ unsigned MaxCLL = 0; |
+ unsigned MaxFALL = 0; |
+ |
+ HDRMetadata(); |
+ HDRMetadata(const HDRMetadata& rhs); |
+}; |
+ |
+// WebM color information, containing HDR metadata: |
+// http://www.webmproject.org/docs/container/#Colour |
+struct MEDIA_EXPORT ColorMetadata { |
halliwell
2016/09/14 18:58:40
nit, shouldn't the file be called color_metadata?
servolk
2016/09/14 22:34:35
I'm actually not sure about it yes, since this Col
|
+ MatrixCoefficients matrix_coefficients = MatrixCoefficients::kUnspecified; |
+ unsigned BitsPerChannel = 0; |
+ unsigned ChromaSubsamplingHorz = 0; |
+ unsigned ChromaSubsamplingVert = 0; |
+ unsigned CbSubsamplingHorz = 0; |
+ unsigned CbSubsamplingVert = 0; |
+ unsigned ChromaSitingHorz = 0; |
+ unsigned ChromaSitingVert = 0; |
+ Range range = Range::kUnspecified; |
+ TransferCharacteristics transfer_characteristics = |
+ TransferCharacteristics::kUnspecified; |
+ Primaries primaries = Primaries::kUnspecified; |
+ |
+ HDRMetadata hdr_metadata; |
+ |
+ ColorMetadata(); |
+ ColorMetadata(const ColorMetadata& rhs); |
+}; |
+ |
+} // namespace media |
+ |
+#endif // MEDIA_BASE_HDR_METADATA_H_ |