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



##########
File path: 
src/test/java/org/apache/commons/imaging/formats/tiff/datareaders/DataReaderStripsTest.java
##########
@@ -24,7 +24,7 @@
     @Test
     public void testApplyPredictor() throws Exception {
         final int[] bitsPerPixel = {1,2,3};
-        final DataReaderStrips strips = new DataReaderStrips(null, null, 3, 
bitsPerPixel, 2, 4, 0, 3, 1, 1, null, 2, null);
+        final DataReaderStrips strips = new DataReaderStrips(null, null, 3, 
bitsPerPixel, 2, 4, 0, 3, 1, 1, 1, null, 2, null);

Review comment:
       Agreed. Good catch.

##########
File path: 
src/main/java/org/apache/commons/imaging/formats/tiff/datareaders/DataReaderStrips.java
##########
@@ -291,25 +318,50 @@ public BufferedImage readImageData(final Rectangle 
subImage)
         //        or working
         final ImageBuilder workingBuilder =
                 new ImageBuilder(width, workingHeight, false);
-
-        for (int strip = strip0; strip <= strip1; 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(
-                    workingBuilder,
-                    decompressed,
-                    (int) pixelsPerStrip,
-                    yLimit);
+        if (planarConfiguration != 2) {

Review comment:
       Agreed. Good catch.

##########
File path: 
src/main/java/org/apache/commons/imaging/formats/tiff/TiffImageParser.java
##########
@@ -898,7 +921,7 @@ TiffRasterData getFloatingPointRasterData(
 
         final ImageDataReader dataReader = imageData.getDataReader(directory,
             photometricInterpreter, bitsPerPixel, bitsPerSample, predictor,
-            samplesPerPixel, width, height, compression, byteOrder);
+          samplesPerPixel, width, height, compression, 1, byteOrder);

Review comment:
        Agreed. Good catch.




----------------------------------------------------------------
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:
us...@infra.apache.org


Reply via email to