| Index: media/base/video_color_space.h
|
| diff --git a/media/base/video_color_space.h b/media/base/video_color_space.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..c8a6a0ce4f728c0e5d82e6307d56de4c95f4f369
|
| --- /dev/null
|
| +++ b/media/base/video_color_space.h
|
| @@ -0,0 +1,102 @@
|
| +// Copyright 2017 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_VIDEO_COLOR_SPACE_H_
|
| +#define MEDIA_BASE_VIDEO_COLOR_SPACE_H_
|
| +
|
| +#include "media/base/media_export.h"
|
| +#include "ui/gfx/color_space.h"
|
| +
|
| +namespace media {
|
| +
|
| +// Described in ISO 23001-8:2016
|
| +class MEDIA_EXPORT VideoColorSpace {
|
| + public:
|
| + // Table 2
|
| + enum class PrimaryID : uint8_t {
|
| + INVALID = 0,
|
| + BT709 = 1,
|
| + UNSPECIFIED = 2,
|
| + BT470M = 4,
|
| + BT470BG = 5,
|
| + SMPTE170M = 6,
|
| + SMPTE240M = 7,
|
| + FILM = 8,
|
| + BT2020 = 9,
|
| + SMPTEST428_1 = 10,
|
| + SMPTEST431_2 = 11,
|
| + SMPTEST432_1 = 12,
|
| + EBU_3213_E = 22
|
| + };
|
| +
|
| + // Table 3
|
| + enum class TransferID : uint8_t {
|
| + INVALID = 0,
|
| + BT709 = 1,
|
| + UNSPECIFIED = 2,
|
| + GAMMA22 = 4,
|
| + GAMMA28 = 5,
|
| + SMPTE170M = 6,
|
| + SMPTE240M = 7,
|
| + LINEAR = 8,
|
| + LOG = 9,
|
| + LOG_SQRT = 10,
|
| + IEC61966_2_4 = 11,
|
| + BT1361_ECG = 12,
|
| + IEC61966_2_1 = 13,
|
| + BT2020_10 = 14,
|
| + BT2020_12 = 15,
|
| + SMPTEST2084 = 16,
|
| + SMPTEST428_1 = 17,
|
| +
|
| + // Not yet standardized
|
| + ARIB_STD_B67 = 18, // AKA hybrid-log gamma, HLG.
|
| + };
|
| +
|
| + // Table 4
|
| + enum class MatrixID : uint8_t {
|
| + RGB = 0,
|
| + BT709 = 1,
|
| + UNSPECIFIED = 2,
|
| + FCC = 4,
|
| + BT470BG = 5,
|
| + SMPTE170M = 6,
|
| + SMPTE240M = 7,
|
| + YCOCG = 8,
|
| + BT2020_NCL = 9,
|
| + BT2020_CL = 10,
|
| + YDZDX = 11,
|
| + INVALID = 255,
|
| + };
|
| +
|
| + VideoColorSpace();
|
| + VideoColorSpace(int primaries,
|
| + int transfer,
|
| + int matrix,
|
| + gfx::ColorSpace::RangeID range);
|
| + VideoColorSpace(PrimaryID primaries,
|
| + TransferID transfer,
|
| + MatrixID matrix,
|
| + gfx::ColorSpace::RangeID range);
|
| +
|
| + // These will return INVALID if the number you give it
|
| + // is not a valid enum value.
|
| + static PrimaryID GetPrimaryID(int primary);
|
| + static TransferID GetTransferID(int transfer);
|
| + static MatrixID GetMatrixID(int matrix);
|
| +
|
| + static VideoColorSpace BT709();
|
| +
|
| + gfx::ColorSpace ToGfxColorSpace() const;
|
| +
|
| + // Note, these are public variables.
|
| + PrimaryID primaries = PrimaryID::INVALID;
|
| + TransferID transfer = TransferID::INVALID;
|
| + MatrixID matrix = MatrixID::INVALID;
|
| + gfx::ColorSpace::RangeID range = gfx::ColorSpace::RangeID::INVALID;
|
| +};
|
| +
|
| +} // namespace media
|
| +
|
| +#endif
|
|
|