mirror of
https://github.com/haraldk/TwelveMonkeys.git
synced 2025-08-04 20:15:28 -04:00
#274 Fixed bug in 16 -> 8 bit downsampling of DQT, causing "Bogus marker length" IIOException
This commit is contained in:
parent
654e111605
commit
f0316f7ec5
@ -361,7 +361,6 @@ final class JPEGSegmentImageInputStream extends ImageInputStreamImpl {
|
|||||||
return stream.read(b, off, len);
|
return stream.read(b, off, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return String.format("0x%04x[%d-%d]", marker, realStart, realEnd());
|
return String.format("0x%04x[%d-%d]", marker, realStart, realEnd());
|
||||||
@ -409,7 +408,7 @@ final class JPEGSegmentImageInputStream extends ImageInputStreamImpl {
|
|||||||
byte[] replacementData = new byte[length];
|
byte[] replacementData = new byte[length];
|
||||||
|
|
||||||
int numQTs = length / 128;
|
int numQTs = length / 128;
|
||||||
int newSegmentLength = 2 + 1 + 64 * numQTs;
|
int newSegmentLength = 2 + (1 + 64) * numQTs; // Len + (qtInfo + qtSize) * numQTs
|
||||||
|
|
||||||
replacementData[0] = (byte) ((JPEG.DQT >> 8) & 0xff);
|
replacementData[0] = (byte) ((JPEG.DQT >> 8) & 0xff);
|
||||||
replacementData[1] = (byte) (JPEG.DQT & 0xff);
|
replacementData[1] = (byte) (JPEG.DQT & 0xff);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user