-
-
Notifications
You must be signed in to change notification settings - Fork 860
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
Jpeg color space deduction fix #2177
Jpeg color space deduction fix #2177
Conversation
There were 3 failing tiff tests, but I believe it was an issue with the Tiff JpegDecompressor. Hopefully this 1959bf6 fixes it now. |
I believe it's not not that simple :D TIFF with PhotometricInterpretation=RGB can have YCbCr signature at jpeg decoding level which would lead to invalid results. |
@@ -506,90 +506,48 @@ public void Dispose() | |||
/// Returns the correct colorspace based on the image component count and the jpeg frame component id's. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment is no longer valid, maybe change it like this:
/// Returns the correct colorspace based on the image component count and the jpeg frame component id's. | |
/// Returns the correct colorspace based on the image component count and adobe APP14 marker's color transform flag. |
{ | ||
if (componentCount == 1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adobe spec doesn't say anything about grayscale images but I think we can include it as decoding it doesn't violate the spec :)
I've implemented tests for the specific method which resolves encoded jpeg color space. Not only it's easier to maintain, it is also much faster and there's no need to find a ton of images with different setups. This is ready to be merged after the review. |
[InlineData(3, JpegConstants.Adobe.ColorTransformYCbCr, JpegColorSpace.YCbCr)] | ||
[InlineData(4, JpegConstants.Adobe.ColorTransformUnknown, JpegColorSpace.Cmyk)] | ||
[InlineData(4, JpegConstants.Adobe.ColorTransformYcck, JpegColorSpace.Ycck)] | ||
internal void DeduceJpegColorSpaceAdobeMarker_ShouldReturnValidColorSpace(byte componentCount, byte adobeFlag, JpegColorSpace expectedColorSpace) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is all very nice 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This all looks great! Thanks @br3aker
Prerequisites
Description
Fixes #2174