Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(959)

Unified Diff: ui/gfx/color_space.h

Issue 2697863003: color: Clarify default behaviors (Closed)
Patch Set: Incorporate review feedback Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « media/formats/webm/webm_colour_parser.cc ('k') | ui/gfx/color_space.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/color_space.h
diff --git a/ui/gfx/color_space.h b/ui/gfx/color_space.h
index 798b9305a19b28d5941eae06812167aa77fd23ae..6e424f762a10ae8d4ce3e84e604178f4a59d3e28 100644
--- a/ui/gfx/color_space.h
+++ b/ui/gfx/color_space.h
@@ -28,26 +28,17 @@ class ICCProfile;
class GFX_EXPORT ColorSpace {
public:
enum class PrimaryID : uint16_t {
- // The first 0-255 values should match the H264 specification (see Table E-3
- // Colour Primaries in https://www.itu.int/rec/T-REC-H.264/en).
- RESERVED0 = 0,
- BT709 = 1,
- UNSPECIFIED = 2,
- RESERVED = 3,
- BT470M = 4,
- BT470BG = 5,
- SMPTE170M = 6,
- SMPTE240M = 7,
- FILM = 8,
- BT2020 = 9,
- SMPTEST428_1 = 10,
- SMPTEST431_2 = 11,
- SMPTEST432_1 = 12,
-
- LAST_STANDARD_VALUE = SMPTEST432_1,
-
- // Chrome-specific values start at 1000.
- UNKNOWN = 1000,
+ INVALID,
+ BT709,
+ BT470M,
+ BT470BG,
+ SMPTE170M,
+ SMPTE240M,
+ FILM,
+ BT2020,
+ SMPTEST428_1,
+ SMPTEST431_2,
+ SMPTEST432_1,
XYZ_D50,
ADOBE_RGB,
CUSTOM,
@@ -55,87 +46,58 @@ class GFX_EXPORT ColorSpace {
};
enum class TransferID : uint16_t {
- // The first 0-255 values should match the H264 specification (see Table E-4
- // Transfer Characteristics in https://www.itu.int/rec/T-REC-H.264/en).
- RESERVED0 = 0,
- BT709 = 1,
- UNSPECIFIED = 2,
- RESERVED = 3,
- 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,
- ARIB_STD_B67 = 18, // AKA hybrid-log gamma, HLG.
-
- LAST_STANDARD_VALUE = SMPTEST428_1,
-
- // Chrome-specific values start at 1000.
- UNKNOWN = 1000,
+ INVALID,
+ BT709,
+ GAMMA22,
GAMMA24,
-
+ GAMMA28,
+ SMPTE170M,
+ SMPTE240M,
+ LINEAR,
+ LOG,
+ LOG_SQRT,
+ IEC61966_2_4,
+ BT1361_ECG,
+ IEC61966_2_1,
+ BT2020_10,
+ BT2020_12,
+ SMPTEST2084,
+ SMPTEST428_1,
+ ARIB_STD_B67, // // AKA hybrid-log gamma, HLG.
// This is an ad-hoc transfer function that decodes SMPTE 2084 content
// into a 0-1 range more or less suitable for viewing on a non-hdr
// display.
SMPTEST2084_NON_HDR,
-
// Like LINEAR, but intended for HDR. (can go outside of 0-1)
LINEAR_HDR,
- // TODO(hubbe): Need to store an approximation of the gamma function(s).
CUSTOM,
LAST = CUSTOM,
};
enum class MatrixID : int16_t {
- // The first 0-255 values should match the H264 specification (see Table E-5
- // Matrix Coefficients in https://www.itu.int/rec/T-REC-H.264/en).
- RGB = 0,
- BT709 = 1,
- UNSPECIFIED = 2,
- RESERVED = 3,
- FCC = 4,
- BT470BG = 5,
- SMPTE170M = 6,
- SMPTE240M = 7,
- YCOCG = 8,
- BT2020_NCL = 9,
- BT2020_CL = 10,
- YDZDX = 11,
-
- LAST_STANDARD_VALUE = YDZDX,
-
- // Chrome-specific values start at 1000
- UNKNOWN = 1000,
- LAST = UNKNOWN,
+ INVALID,
+ RGB,
+ BT709,
+ FCC,
+ BT470BG,
+ SMPTE170M,
+ SMPTE240M,
+ YCOCG,
+ BT2020_NCL,
+ BT2020_CL,
+ YDZDX,
+ LAST = YDZDX,
};
- // This corresponds to the WebM Range enum which is part of WebM color data
- // (see http://www.webmproject.org/docs/container/#Range).
- // H.264 only uses a bool, which corresponds to the LIMITED/FULL values.
- // Chrome-specific values start at 1000.
enum class RangeID : int8_t {
- // Range is not explicitly specified / unknown.
- UNSPECIFIED = 0,
-
+ INVALID,
// Limited Rec. 709 color range with RGB values ranging from 16 to 235.
- LIMITED = 1,
-
+ LIMITED,
// Full RGB color range with RGB valees from 0 to 255.
- FULL = 2,
-
+ FULL,
// Range is defined by TransferID/MatrixID.
- DERIVED = 3,
-
- LAST = DERIVED
+ DERIVED,
+ LAST = DERIVED,
};
ColorSpace();
@@ -145,12 +107,16 @@ class GFX_EXPORT ColorSpace {
MatrixID matrix,
RangeID full_range);
ColorSpace(const ColorSpace& other);
- ColorSpace(int primaries, int transfer, int matrix, RangeID full_range);
~ColorSpace();
- static PrimaryID PrimaryIDFromInt(int primary_id);
- static TransferID TransferIDFromInt(int transfer_id);
- static MatrixID MatrixIDFromInt(int matrix_id);
+ // Create a color space with primary, transfer and matrix values from the
+ // H264 specification (Table E-3 Colour Primaries, E-4 Transfer
+ // Characteristics, and E-5 Matrix Coefficients in
+ // https://www.itu.int/rec/T-REC-H.264/en).
+ static ColorSpace CreateVideo(int h264_primary,
+ int h264_transfer,
+ int h264_matrix,
+ RangeID range_id);
// Returns true if this is not the default-constructor object.
bool IsValid() const;
@@ -187,10 +153,10 @@ class GFX_EXPORT ColorSpace {
void GetRangeAdjustMatrix(SkMatrix44* matrix) const;
private:
- PrimaryID primaries_ = PrimaryID::UNSPECIFIED;
- TransferID transfer_ = TransferID::UNSPECIFIED;
- MatrixID matrix_ = MatrixID::UNSPECIFIED;
- RangeID range_ = RangeID::LIMITED;
+ PrimaryID primaries_ = PrimaryID::INVALID;
+ TransferID transfer_ = TransferID::INVALID;
+ MatrixID matrix_ = MatrixID::INVALID;
+ RangeID range_ = RangeID::INVALID;
// Only used if primaries_ is PrimaryID::CUSTOM.
float custom_primary_matrix_[9] = {0, 0, 0, 0, 0, 0, 0, 0};
« no previous file with comments | « media/formats/webm/webm_colour_parser.cc ('k') | ui/gfx/color_space.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698