OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef MEDIA_BASE_VIDEO_COLOR_SPACE_H_ |
| 6 #define MEDIA_BASE_VIDEO_COLOR_SPACE_H_ |
| 7 |
| 8 #include "media/base/media_export.h" |
| 9 #include "ui/gfx/color_space.h" |
| 10 |
| 11 namespace media { |
| 12 |
| 13 // Described in ISO 23001-8:2016 |
| 14 class MEDIA_EXPORT VideoColorSpace { |
| 15 public: |
| 16 // Table 2 |
| 17 enum class PrimaryID : uint8_t { |
| 18 INVALID = 0, |
| 19 BT709 = 1, |
| 20 UNSPECIFIED = 2, |
| 21 BT470M = 4, |
| 22 BT470BG = 5, |
| 23 SMPTE170M = 6, |
| 24 SMPTE240M = 7, |
| 25 FILM = 8, |
| 26 BT2020 = 9, |
| 27 SMPTEST428_1 = 10, |
| 28 SMPTEST431_2 = 11, |
| 29 SMPTEST432_1 = 12, |
| 30 EBU_3213_E = 22 |
| 31 }; |
| 32 |
| 33 // Table 3 |
| 34 enum class TransferID : uint8_t { |
| 35 INVALID = 0, |
| 36 BT709 = 1, |
| 37 UNSPECIFIED = 2, |
| 38 GAMMA22 = 4, |
| 39 GAMMA28 = 5, |
| 40 SMPTE170M = 6, |
| 41 SMPTE240M = 7, |
| 42 LINEAR = 8, |
| 43 LOG = 9, |
| 44 LOG_SQRT = 10, |
| 45 IEC61966_2_4 = 11, |
| 46 BT1361_ECG = 12, |
| 47 IEC61966_2_1 = 13, |
| 48 BT2020_10 = 14, |
| 49 BT2020_12 = 15, |
| 50 SMPTEST2084 = 16, |
| 51 SMPTEST428_1 = 17, |
| 52 |
| 53 // Not yet standardized |
| 54 ARIB_STD_B67 = 18, // AKA hybrid-log gamma, HLG. |
| 55 }; |
| 56 |
| 57 // Table 4 |
| 58 enum class MatrixID : uint8_t { |
| 59 RGB = 0, |
| 60 BT709 = 1, |
| 61 UNSPECIFIED = 2, |
| 62 FCC = 4, |
| 63 BT470BG = 5, |
| 64 SMPTE170M = 6, |
| 65 SMPTE240M = 7, |
| 66 YCOCG = 8, |
| 67 BT2020_NCL = 9, |
| 68 BT2020_CL = 10, |
| 69 YDZDX = 11, |
| 70 INVALID = 255, |
| 71 }; |
| 72 |
| 73 VideoColorSpace(); |
| 74 VideoColorSpace(int primaries, |
| 75 int transfer, |
| 76 int matrix, |
| 77 gfx::ColorSpace::RangeID range); |
| 78 VideoColorSpace(PrimaryID primaries, |
| 79 TransferID transfer, |
| 80 MatrixID matrix, |
| 81 gfx::ColorSpace::RangeID range); |
| 82 |
| 83 // These will return INVALID if the number you give it |
| 84 // is not a valid enum value. |
| 85 static PrimaryID GetPrimaryID(int primary); |
| 86 static TransferID GetTransferID(int transfer); |
| 87 static MatrixID GetMatrixID(int matrix); |
| 88 |
| 89 static VideoColorSpace BT709(); |
| 90 |
| 91 gfx::ColorSpace ToGfxColorSpace() const; |
| 92 |
| 93 // Note, these are public variables. |
| 94 PrimaryID primaries = PrimaryID::INVALID; |
| 95 TransferID transfer = TransferID::INVALID; |
| 96 MatrixID matrix = MatrixID::INVALID; |
| 97 gfx::ColorSpace::RangeID range = gfx::ColorSpace::RangeID::INVALID; |
| 98 }; |
| 99 |
| 100 } // namespace media |
| 101 |
| 102 #endif |
OLD | NEW |