OLD | NEW |
1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "base/logging.h" | 5 #include "base/logging.h" |
6 #include "testing/gtest/include/gtest/gtest.h" | 6 #include "testing/gtest/include/gtest/gtest.h" |
7 #include "ui/gfx/color_space.h" | 7 #include "ui/gfx/color_space.h" |
8 #include "ui/gfx/color_transform.h" | 8 #include "ui/gfx/color_transform.h" |
9 #include "ui/gfx/icc_profile.h" | 9 #include "ui/gfx/icc_profile.h" |
10 #include "ui/gfx/test/icc_profiles.h" | 10 #include "ui/gfx/test/icc_profiles.h" |
(...skipping 21 matching lines...) Expand all Loading... |
32 ColorSpace::TransferID::IEC61966_2_1, ColorSpace::TransferID::BT2020_10, | 32 ColorSpace::TransferID::IEC61966_2_1, ColorSpace::TransferID::BT2020_10, |
33 ColorSpace::TransferID::BT2020_12, ColorSpace::TransferID::SMPTEST2084, | 33 ColorSpace::TransferID::BT2020_12, ColorSpace::TransferID::SMPTEST2084, |
34 ColorSpace::TransferID::ARIB_STD_B67, | 34 ColorSpace::TransferID::ARIB_STD_B67, |
35 // This one is weird as the non-linear numbers are not between 0 and 1. | 35 // This one is weird as the non-linear numbers are not between 0 and 1. |
36 // TODO(hubbe): Test this separately. | 36 // TODO(hubbe): Test this separately. |
37 // ColorSpace::TransferID::SMPTEST428_1, | 37 // ColorSpace::TransferID::SMPTEST428_1, |
38 }; | 38 }; |
39 | 39 |
40 ColorSpace::MatrixID all_matrices[] = { | 40 ColorSpace::MatrixID all_matrices[] = { |
41 ColorSpace::MatrixID::RGB, ColorSpace::MatrixID::BT709, | 41 ColorSpace::MatrixID::RGB, ColorSpace::MatrixID::BT709, |
42 ColorSpace::MatrixID::UNSPECIFIED, ColorSpace::MatrixID::RESERVED, | |
43 ColorSpace::MatrixID::FCC, ColorSpace::MatrixID::BT470BG, | 42 ColorSpace::MatrixID::FCC, ColorSpace::MatrixID::BT470BG, |
44 ColorSpace::MatrixID::SMPTE170M, ColorSpace::MatrixID::SMPTE240M, | 43 ColorSpace::MatrixID::SMPTE170M, ColorSpace::MatrixID::SMPTE240M, |
45 | 44 |
46 // YCOCG produces lots of negative values which isn't compatible with many | 45 // YCOCG produces lots of negative values which isn't compatible with many |
47 // transfer functions. | 46 // transfer functions. |
48 // TODO(hubbe): Test this separately. | 47 // TODO(hubbe): Test this separately. |
49 // ColorSpace::MatrixID::YCOCG, | 48 // ColorSpace::MatrixID::YCOCG, |
50 ColorSpace::MatrixID::BT2020_NCL, ColorSpace::MatrixID::BT2020_CL, | 49 ColorSpace::MatrixID::BT2020_NCL, ColorSpace::MatrixID::BT2020_CL, |
51 ColorSpace::MatrixID::YDZDX, | 50 ColorSpace::MatrixID::YDZDX, |
52 }; | 51 }; |
53 | 52 |
54 ColorSpace::RangeID all_ranges[] = {ColorSpace::RangeID::UNSPECIFIED, | 53 ColorSpace::RangeID all_ranges[] = {ColorSpace::RangeID::FULL, |
55 ColorSpace::RangeID::FULL, | |
56 ColorSpace::RangeID::LIMITED, | 54 ColorSpace::RangeID::LIMITED, |
57 ColorSpace::RangeID::DERIVED}; | 55 ColorSpace::RangeID::DERIVED}; |
58 | 56 |
59 ColorTransform::Intent intents[] = {ColorTransform::Intent::INTENT_ABSOLUTE, | 57 ColorTransform::Intent intents[] = {ColorTransform::Intent::INTENT_ABSOLUTE, |
60 ColorTransform::Intent::TEST_NO_OPT}; | 58 ColorTransform::Intent::TEST_NO_OPT}; |
61 | 59 |
62 TEST(SimpleColorSpace, BT709toSRGB) { | 60 TEST(SimpleColorSpace, BT709toSRGB) { |
63 ColorSpace bt709 = ColorSpace::CreateREC709(); | 61 ColorSpace bt709 = ColorSpace::CreateREC709(); |
64 ColorSpace sRGB = ColorSpace::CreateSRGB(); | 62 ColorSpace sRGB = ColorSpace::CreateSRGB(); |
65 std::unique_ptr<ColorTransform> t(ColorTransform::NewColorTransform( | 63 std::unique_ptr<ColorTransform> t(ColorTransform::NewColorTransform( |
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
320 | 318 |
321 INSTANTIATE_TEST_CASE_P( | 319 INSTANTIATE_TEST_CASE_P( |
322 C, | 320 C, |
323 ColorSpaceTest, | 321 ColorSpaceTest, |
324 testing::Combine(testing::ValuesIn(all_primaries), | 322 testing::Combine(testing::ValuesIn(all_primaries), |
325 testing::Values(ColorSpace::TransferID::BT709), | 323 testing::Values(ColorSpace::TransferID::BT709), |
326 testing::ValuesIn(all_matrices), | 324 testing::ValuesIn(all_matrices), |
327 testing::ValuesIn(all_ranges), | 325 testing::ValuesIn(all_ranges), |
328 testing::ValuesIn(intents))); | 326 testing::ValuesIn(intents))); |
329 } // namespace | 327 } // namespace |
OLD | NEW |