// decompress data
int k = decodeParms.getInt(COSName.K, 0);
boolean encodedByteAlign = decodeParms.getBoolean(COSName.ENCODED_BYTE_ALIGN, false);
int arraySize = (cols + 7) / 8 * rows;
TIFFFaxDecoder faxDecoder = new TIFFFaxDecoder(1, cols, rows);
// TODO possible options??
long tiffOptions = 0;
byte[] compressed = IOUtils.toByteArray(encoded);
byte[] decompressed = null;
if (k == 0)
{
InputStream in = new CCITTFaxG31DDecodeInputStream(
new ByteArrayInputStream(compressed), cols, encodedByteAlign);
in = new FillOrderChangeInputStream(in); //Decorate to change fill order
decompressed = IOUtils.toByteArray(in);
in.close();
}
else if (k > 0)
{
decompressed = new byte[arraySize];
faxDecoder.decode2D(decompressed, compressed, 0, rows, tiffOptions);
}
else if (k < 0)
{
decompressed = new byte[arraySize];
faxDecoder.decodeT6(decompressed, compressed, 0, rows, tiffOptions, encodedByteAlign);
}
// invert bitmap
boolean blackIsOne = decodeParms.getBoolean(COSName.BLACK_IS_1, false);
if (!blackIsOne)