-
Notifications
You must be signed in to change notification settings - Fork 47
Support reading pixel values from color 16 bit images #699
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -413,6 +413,8 @@ TEST_F(ImageTest, ConvertPixelFormat) | |
| Image::ConvertPixelFormat("RGBA_INT8")); | ||
| EXPECT_EQ(Image::PixelFormatType::RGB_INT16, | ||
| Image::ConvertPixelFormat("RGB_INT16")); | ||
| EXPECT_EQ(Image::PixelFormatType::RGBA_INT16, | ||
| Image::ConvertPixelFormat("RGBA_INT16")); | ||
| EXPECT_EQ(Image::PixelFormatType::RGB_INT32, | ||
| Image::ConvertPixelFormat("RGB_INT32")); | ||
| EXPECT_EQ(Image::PixelFormatType::BGR_INT8, | ||
|
|
@@ -673,6 +675,53 @@ TEST_F(ImageTest, Grayscale) | |
| } | ||
| } | ||
|
|
||
|
|
||
| ///////////////////////////////////////////////// | ||
| TEST_F(ImageTest, Color16bit) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I noticed this test doesn't actually test the API that had the problematic behavior ( I have two alternative proposals:
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yep good idea, went with 1 and done in 0e307e7. I noticed that after refactoring |
||
| { | ||
| { | ||
| common::Image img; | ||
| std::string fileName = common::testing::TestFile("data", | ||
iche033 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| "rgb_16bit.png"); | ||
| EXPECT_EQ(0, img.Load(fileName)); | ||
| unsigned int width = 4u; | ||
| unsigned int height = 4u; | ||
| unsigned int channels = 3u; | ||
| unsigned int bpp = channels * 16u; | ||
iche033 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| EXPECT_TRUE(img.Valid()); | ||
| EXPECT_EQ(width, img.Width()); | ||
| EXPECT_EQ(height, img.Height()); | ||
| EXPECT_EQ(bpp, img.BPP()); | ||
| EXPECT_EQ(width * bpp / 8u, img.Pitch()); | ||
| EXPECT_EQ(common::Image::PixelFormatType::RGB_INT16, img.PixelFormat()); | ||
| math::Color maxColor(0.0f, 0.0f, 0.847f); | ||
| EXPECT_NEAR(maxColor.R(), img.MaxColor().R(), 1e-3); | ||
| EXPECT_NEAR(maxColor.G(), img.MaxColor().G(), 1e-3); | ||
| EXPECT_NEAR(maxColor.B(), img.MaxColor().B(), 1e-3); | ||
| } | ||
| { | ||
| common::Image img; | ||
| std::string fileName = common::testing::TestFile("data", | ||
| "rgba_16bit.png"); | ||
| EXPECT_EQ(0, img.Load(fileName)); | ||
| unsigned int width = 4u; | ||
| unsigned int height = 4u; | ||
| unsigned int channels = 4u; | ||
| unsigned int bpp = channels * 16u; | ||
| EXPECT_TRUE(img.Valid()); | ||
| EXPECT_EQ(width, img.Width()); | ||
| EXPECT_EQ(height, img.Height()); | ||
| EXPECT_EQ(bpp, img.BPP()); | ||
| EXPECT_EQ(width * bpp / 8u, img.Pitch()); | ||
| EXPECT_EQ(common::Image::PixelFormatType::RGBA_INT16, img.PixelFormat()); | ||
| math::Color maxColor(0.0f, 0.0f, 0.847f, 0.5f); | ||
| EXPECT_NEAR(maxColor.R(), img.MaxColor().R(), 1e-3); | ||
| EXPECT_NEAR(maxColor.G(), img.MaxColor().G(), 1e-3); | ||
| EXPECT_NEAR(maxColor.B(), img.MaxColor().B(), 1e-3); | ||
| EXPECT_NEAR(maxColor.A(), img.MaxColor().A(), 1e-3); | ||
| } | ||
| } | ||
|
|
||
| using string_int2 = std::tuple<const char *, unsigned int, unsigned int>; | ||
|
|
||
| class ImagePerformanceTest : public ImageTest, | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.