Skip to content

Commit

Permalink
Fixed #859, Test clean-up, removed unused class.
Browse files Browse the repository at this point in the history
  • Loading branch information
haraldk committed Nov 15, 2023
1 parent 3623a7c commit e2cc73f
Show file tree
Hide file tree
Showing 9 changed files with 224 additions and 354 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public interface JPEG {
// Start of Frame segment markers (SOFn).
/** SOF0: Baseline DCT, Huffman coding. */
int SOF0 = 0xFFC0;
/** SOF0: Extended DCT, Huffman coding. */
/** SOF1: Extended DCT, Huffman coding. */
int SOF1 = 0xFFC1;
/** SOF2: Progressive DCT, Huffman coding. */
int SOF2 = 0xFFC2;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ private DelegateTileDecoder(final IIOReadWarningListener warningListener, final
this.delegate = notNull(delegate, "delegate");
delegate.addIIOReadWarningListener(warningListener);

if (TIFFImageReader.DEBUG) {
System.out.println("tile reading delegate: " + delegate);
}

param = delegate.getDefaultReadParam();
param.setSourceSubsampling(originalParam.getSourceXSubsampling(), originalParam.getSourceYSubsampling(), 0, 0);

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,21 @@
* @version $Id: JPEGTileDecoder.java,v 1.0 09/11/2023 haraldk Exp$
*/
final class JPEGTileDecoder extends DelegateTileDecoder {
JPEGTileDecoder(final IIOReadWarningListener warningListener, final byte[] jpegTables, final int numTiles, final ImageReadParam originalParam, final Predicate<ImageReader> needsConversion, final RasterConverter converter) throws IOException {
JPEGTileDecoder(final IIOReadWarningListener warningListener, final int compression, final byte[] jpegTables, final int numTiles, final ImageReadParam originalParam, final Predicate<ImageReader> needsConversion, final RasterConverter converter) throws IOException {
super(warningListener, "JPEG", originalParam, needsConversion, converter);

if (jpegTables != null) {
// Whatever values I pass the reader as the read param, it never gets the same quality as if
// I just invoke jpegReader.getStreamMetadata(), so we'll do that...
delegate.setInput(new ByteArrayImageInputStream(jpegTables));

// This initializes the tables and other internal settings for the reader,
// and is actually a feature of JPEG, see abbreviated streams:
// and is actually a feature of JPEG, see "abbreviated streams":
// http://docs.oracle.com/javase/6/docs/api/javax/imageio/metadata/doc-files/jpeg_metadata.html#abbrev
delegate.setInput(new ByteArrayImageInputStream(jpegTables));
delegate.getStreamMetadata();
}
else if (numTiles > 1) {
warningListener.warningOccurred(delegate, "Missing JPEGTables for tiled/striped TIFF with compression: 7 (JPEG)");
// TODO: This is not really a problem as long as we read ALL tiles, but we can't have random access in this case...
if (compression == TIFFExtension.COMPRESSION_JPEG) {
warningListener.warningOccurred(delegate, "Missing JPEGTables for tiled/striped TIFF with compression: 7 (JPEG)");
}
// ...and the JPEG reader might choke on missing tables...
}
}
Expand Down
Loading

0 comments on commit e2cc73f

Please sign in to comment.