-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Add support for reading TIFFs with PlanarConfiguration=2 #5178
Conversation
wiredfool
commented
Jan 2, 2021
•
edited by hugovk
Loading
edited by hugovk
- Rebase of Add support for reading TIFFs with PlanarConfiguration=2 #4641
- Add support for reading TIFFs with PlanarConfiguration=2
I'm afraid I don't have the setup to debug the windows side of this at the moment. |
I am not familiar with Windows specifics here, but here is some observations: |
@nulano Do you have any insight into this? |
shuffler((UINT8*) im->image[tile_y + y] + x * im->pixelsize, | ||
state->buffer + current_line * row_byte_size, | ||
current_tile_width | ||
); |
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.
I'm not yet sure what is going on, but compiling with debug information shows that state->buffer
is NULL on this line even though it was valid on line 587 for the realloc call.
The error doesn't show up when compiling with in a debug build (setup.py build_ext --dubug
), I had to change setup.py
line 852 to Extension("PIL._imaging", files, extra_compile_args=["/Z7"], extra_link_args=["/DEBUG"]),
and copy the PDB to the PIL directory.
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.
Solved it, see wiredfool#6
src/libImaging/TiffDecode.c
Outdated
@@ -405,6 +402,11 @@ ImagingLibTiffDecode( | |||
TIFF *tiff; | |||
uint16 photometric = 0; // init to not PHOTOMETRIC_YCBCR | |||
int isYCbCr = 0; | |||
UINT8 planarconfig = 0; | |||
UINT8 planes = 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.
@kkopachev Is there any reason to use UINT8
for planes
? It looks to me like it would make more sense to use int
.
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.
Yeah, should be just int
🤦
src/libImaging/TiffDecode.c
Outdated
// if number of bands is 1, there is no difference with contig case | ||
if (planarconfig == PLANARCONFIG_SEPARATE && | ||
im->bands > 1 && | ||
photometric != PHOTOMETRIC_YCBCR) { |
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.
photometric != PHOTOMETRIC_YCBCR) { | |
!isYCbCr) { |
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.
Thanks @nulano and @kkopachev
Fix win32/s390x for PR4641
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.
Same as UINT8 planes
-> int planes
.
src/libImaging/TiffDecode.c
Outdated
state->errcode = IMAGING_CODEC_BROKEN; | ||
return -1; | ||
} | ||
UINT8 plane; |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
src/libImaging/TiffDecode.c
Outdated
* backwards | ||
*/ | ||
|
||
UINT8 plane; |
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.
UINT8 plane; | |
int plane; |
@wiredfool I have some changes I did on top of this PR to fix BigEndian skipped tests and a bit of refactoring. Do you want me to create PR into this branch or wait until this merged and open into Pillow:master afterwards for separate review? |
Might as well pr to this branch |