commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [commons-imaging] gwlucastrig commented on a change in pull request #98: Fix for IMAGING-265
Date Mon, 21 Sep 2020 00:09:47 GMT

gwlucastrig commented on a change in pull request #98:
URL: https://github.com/apache/commons-imaging/pull/98#discussion_r491751970



##########
File path: src/main/java/org/apache/commons/imaging/formats/tiff/datareaders/DataReaderStrips.java
##########
@@ -237,27 +240,51 @@ private void interpretStrip(
 
     @Override
     public void readImageData(final ImageBuilder imageBuilder)
-            throws ImageReadException, IOException {
-        for (int strip = 0; strip < imageData.getImageDataLength(); strip++) {
-            final long rowsPerStripLong = 0xFFFFffffL & rowsPerStrip;
-            final long rowsRemaining = height - (strip * rowsPerStripLong);
-            final long rowsInThisStrip = Math.min(rowsRemaining, rowsPerStripLong);
-            final long bytesPerRow = (bitsPerPixel * width + 7) / 8;
-            final long bytesPerStrip = rowsInThisStrip * bytesPerRow;
-            final long pixelsPerStrip = rowsInThisStrip * width;
-
-            final byte[] compressed = imageData.getImageData(strip).getData();
-
-            final byte[] decompressed = decompress(compressed, compression,
-                    (int) bytesPerStrip, width, (int) rowsInThisStrip);
-
-            interpretStrip(
-                    imageBuilder,
-                    decompressed,
-                    (int) pixelsPerStrip,
-                    height);
-
+      throws ImageReadException, IOException {
+        if (planarConfiguration != 2) {

Review comment:
       You are absolutely right about using the TiffTagConstant values in the places you cited.
 Actually, I wanted to make line 244 test for planarConfiguration == "Chunky" rather than
!= "Planar", but I was afraid that there might be places in the code where the planarConfiguration
variable didn't get set correctly.  So I thought this would be safer.
   
   If we ever get our hands on some additional test files, I might revisit this.  But that
may be unlikely...  The Tiff Specification itself describes planar-configuration 2 as follows:
_PlanarConfiguration=2 is not currently in widespread use and it is not recommended for general
interchange. It is used an extension and Baseline TIFF readers are not required to support
it._




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



Mime
View raw message