< prev index next >
src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFLZWDecompressor.java
Print this page
@@ -160,20 +160,22 @@
}
}
if (predictor ==
BaselineTIFFTagSet.PREDICTOR_HORIZONTAL_DIFFERENCING) {
+ int step = planar || samplesPerPixel == 1 ? 1 : samplesPerPixel;
- for (int j = 0; j < srcHeight; j++) {
-
- int count = dstOffset + samplesPerPixel * (j * srcWidth + 1);
+ int samplesPerRow = step * srcWidth;
- for (int i = samplesPerPixel; i < srcWidth * samplesPerPixel; i++) {
-
- dstData[count] += dstData[count - samplesPerPixel];
+ int off = dstOffset + step;
+ for (int j = 0; j < srcHeight; j++) {
+ int count = off;
+ for (int i = step; i < samplesPerRow; i++) {
+ dstData[count] += dstData[count - step];
count++;
}
+ off += samplesPerRow;
}
}
return dstIndex - dstOffset;
}
< prev index next >