Skip to content
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

TIFF: add support for FillOrder == 2 #2936

Merged
merged 2 commits into from Sep 13, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 9 additions & 0 deletions components/formats-bsd/src/loci/formats/tiff/TiffParser.java
Expand Up @@ -725,6 +725,14 @@ else if (stripByteCounts[countIndex] < 0 && countIndex > 0) {
in.seek(stripOffset);
in.read(tile);

// reverse bits in each byte if FillOrder == 2

if (ifd.getIFDIntValue(IFD.FILL_ORDER) == 2) {
for (int i=0; i<tile.length; i++) {
tile[i] = (byte) (Integer.reverse(tile[i]) >> 24);
}
}

codecOptions.maxBytes = (int) Math.max(size, tile.length);
codecOptions.ycbcr =
ifd.getPhotometricInterpretation() == PhotoInterp.Y_CB_CR &&
Expand Down Expand Up @@ -874,6 +882,7 @@ public byte[] getSamples(IFD ifd, byte[] buf, int x, int y,
photoInterp != PhotoInterp.WHITE_IS_ZERO &&
photoInterp != PhotoInterp.CMYK && photoInterp != PhotoInterp.Y_CB_CR &&
compression == TiffCompression.UNCOMPRESSED &&
ifd.getIFDIntValue(IFD.FILL_ORDER) != 2 &&
numTileRows * numTileCols == 1 && stripOffsets != null && stripByteCounts != null &&
in.length() >= stripOffsets[0] + stripByteCounts[0])
{
Expand Down