mirror of
https://github.com/haraldk/TwelveMonkeys.git
synced 2025-08-05 04:25:29 -04:00
Convert transforms list and colorCache to local variables
This is needed because on recursion new (empty) ones are necessary.
This commit is contained in:
parent
b856ce07af
commit
7382151db8
@ -52,9 +52,6 @@ public final class VP8LDecoder {
|
|||||||
private final ImageInputStream imageInput;
|
private final ImageInputStream imageInput;
|
||||||
private final LSBBitReader lsbBitReader;
|
private final LSBBitReader lsbBitReader;
|
||||||
|
|
||||||
private final List<Transform> transforms = new ArrayList<>();
|
|
||||||
private ColorCache colorCache;
|
|
||||||
|
|
||||||
public VP8LDecoder(final ImageInputStream imageInput, final boolean debug) {
|
public VP8LDecoder(final ImageInputStream imageInput, final boolean debug) {
|
||||||
this.imageInput = imageInput;
|
this.imageInput = imageInput;
|
||||||
lsbBitReader = new LSBBitReader(imageInput);
|
lsbBitReader = new LSBBitReader(imageInput);
|
||||||
@ -67,8 +64,9 @@ public final class VP8LDecoder {
|
|||||||
int ySize = raster.getHeight();
|
int ySize = raster.getHeight();
|
||||||
|
|
||||||
// Read transforms
|
// Read transforms
|
||||||
|
ArrayList<Transform> transforms = new ArrayList<>();
|
||||||
while (topLevel && lsbBitReader.readBit() == 1) {
|
while (topLevel && lsbBitReader.readBit() == 1) {
|
||||||
xSize = readTransform(xSize, ySize);
|
xSize = readTransform(xSize, ySize, transforms);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Read color cache size
|
// Read color cache size
|
||||||
@ -83,6 +81,8 @@ public final class VP8LDecoder {
|
|||||||
// Read Huffman codes
|
// Read Huffman codes
|
||||||
readHuffmanCodes(colorCacheBits, topLevel);
|
readHuffmanCodes(colorCacheBits, topLevel);
|
||||||
|
|
||||||
|
ColorCache colorCache = null;
|
||||||
|
|
||||||
if (colorCacheBits > 0) {
|
if (colorCacheBits > 0) {
|
||||||
colorCache = new ColorCache(colorCacheBits);
|
colorCache = new ColorCache(colorCacheBits);
|
||||||
}
|
}
|
||||||
@ -91,7 +91,7 @@ public final class VP8LDecoder {
|
|||||||
// decodeImageData(raster, )
|
// decodeImageData(raster, )
|
||||||
}
|
}
|
||||||
|
|
||||||
private int readTransform(int xSize, int ySize) throws IOException {
|
private int readTransform(int xSize, int ySize, List<Transform> transforms) throws IOException {
|
||||||
int transformType = (int) lsbBitReader.readBits(2);
|
int transformType = (int) lsbBitReader.readBits(2);
|
||||||
|
|
||||||
// TODO: Each transform type can only be present once in the stream.
|
// TODO: Each transform type can only be present once in the stream.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user