< prev index next >

src/java.desktop/share/classes/com/sun/imageio/plugins/tiff/TIFFDeflateDecompressor.java

Print this page

        

*** 1,7 **** /* ! * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this --- 1,7 ---- /* ! * Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this
*** 99,115 **** // Reset the Inflater. inflater.reset(); if (predictor == BaselineTIFFTagSet.PREDICTOR_HORIZONTAL_DIFFERENCING) { for (int j = 0; j < srcHeight; j++) { ! int count = bufOffset + samplesPerPixel * (j * srcWidth + 1); ! for (int i=samplesPerPixel; i<srcWidth*samplesPerPixel; i++) { ! buf[count] += buf[count - samplesPerPixel]; count++; } } } if(bytesPerRow != scanlineStride) { int off = 0; --- 99,122 ---- // Reset the Inflater. inflater.reset(); if (predictor == BaselineTIFFTagSet.PREDICTOR_HORIZONTAL_DIFFERENCING) { + int step = planar || samplesPerPixel == 1 ? 1 : samplesPerPixel; + int bias = bufOffset + step; + int gain = step * srcWidth; + int bound = srcWidth * step; + + int off = bias; for (int j = 0; j < srcHeight; j++) { ! int count = off; ! for (int i = step; i < bound; i++) { ! buf[count] += buf[count - step]; count++; } + off += gain; } } if(bytesPerRow != scanlineStride) { int off = 0;
< prev index next >