int getNextIdatBits(int length) throws IOException { int value = 0; for (int i = 0; i < length; i++) { value |= (getNextIdatBit() << i); } return value; }
void readNextBlockHeader() throws IOException { isLastBlock = stream.getNextIdatBit() != 0; compressionType = (byte) stream.getNextIdatBits(2); if (compressionType > 2) stream.error(); if (compressionType == UNCOMPRESSED) { byte b1 = stream.getNextIdatByte(); byte b2 = stream.getNextIdatByte(); byte b3 = stream.getNextIdatByte(); byte b4 = stream.getNextIdatByte(); if (b1 != ~b3 || b2 != ~b4) stream.error(); uncompressedBytesRemaining = (b1 & 0xFF) | ((b2 & 0xFF) << 8); } else if (compressionType == COMPRESSED_DYNAMIC) { huffmanTables = PngHuffmanTables.getDynamicTables(stream); } else { huffmanTables = PngHuffmanTables.getFixedTables(); } }
void readNextBlockHeader() throws IOException { isLastBlock = stream.getNextIdatBit() != 0; compressionType = (byte) stream.getNextIdatBits(2); if (compressionType > 2) stream.error(); if (compressionType == UNCOMPRESSED) { byte b1 = stream.getNextIdatByte(); byte b2 = stream.getNextIdatByte(); byte b3 = stream.getNextIdatByte(); byte b4 = stream.getNextIdatByte(); if (b1 != ~b3 || b2 != ~b4) stream.error(); uncompressedBytesRemaining = (b1 & 0xFF) | ((b2 & 0xFF) << 8); } else if (compressionType == COMPRESSED_DYNAMIC) { huffmanTables = PngHuffmanTables.getDynamicTables(stream); } else { huffmanTables = PngHuffmanTables.getFixedTables(); } }
int getNextIdatBits(int length) throws IOException { int value = 0; for (int i = 0; i < length; i++) { value |= (getNextIdatBit() << i); } return value; }
void readNextBlockHeader() throws IOException { isLastBlock = stream.getNextIdatBit() != 0; compressionType = (byte) stream.getNextIdatBits(2); if (compressionType > 2) stream.error(); if (compressionType == UNCOMPRESSED) { byte b1 = stream.getNextIdatByte(); byte b2 = stream.getNextIdatByte(); byte b3 = stream.getNextIdatByte(); byte b4 = stream.getNextIdatByte(); if (b1 != ~b3 || b2 != ~b4) stream.error(); uncompressedBytesRemaining = (b1 & 0xFF) | ((b2 & 0xFF) << 8); } else if (compressionType == COMPRESSED_DYNAMIC) { huffmanTables = PngHuffmanTables.getDynamicTables(stream); } else { huffmanTables = PngHuffmanTables.getFixedTables(); } }
int getNextIdatBits(int length) throws IOException { int value = 0; for (int i = 0; i < length; i++) { value |= (getNextIdatBit() << i); } return value; }
void readNextBlockHeader() throws IOException { isLastBlock = stream.getNextIdatBit() != 0; compressionType = (byte) stream.getNextIdatBits(2); if (compressionType > 2) stream.error(); if (compressionType == UNCOMPRESSED) { byte b1 = stream.getNextIdatByte(); byte b2 = stream.getNextIdatByte(); byte b3 = stream.getNextIdatByte(); byte b4 = stream.getNextIdatByte(); if (b1 != ~b3 || b2 != ~b4) stream.error(); uncompressedBytesRemaining = (b1 & 0xFF) | ((b2 & 0xFF) << 8); } else if (compressionType == COMPRESSED_DYNAMIC) { huffmanTables = PngHuffmanTables.getDynamicTables(stream); } else { huffmanTables = PngHuffmanTables.getFixedTables(); } }
int getNextIdatBits(int length) throws IOException { int value = 0; for (int i = 0; i < length; i++) { value |= (getNextIdatBit() << i); } return value; }
void readNextBlockHeader() throws IOException { isLastBlock = stream.getNextIdatBit() != 0; compressionType = (byte) stream.getNextIdatBits(2); if (compressionType > 2) stream.error(); if (compressionType == UNCOMPRESSED) { byte b1 = stream.getNextIdatByte(); byte b2 = stream.getNextIdatByte(); byte b3 = stream.getNextIdatByte(); byte b4 = stream.getNextIdatByte(); if (b1 != ~b3 || b2 != ~b4) stream.error(); uncompressedBytesRemaining = (b1 & 0xFF) | ((b2 & 0xFF) << 8); } else if (compressionType == COMPRESSED_DYNAMIC) { huffmanTables = PngHuffmanTables.getDynamicTables(stream); } else { huffmanTables = PngHuffmanTables.getFixedTables(); } }
int getNextIdatBits(int length) throws IOException { int value = 0; for (int i = 0; i < length; i++) { value |= (getNextIdatBit() << i); } return value; }
void readNextBlockHeader() throws IOException { isLastBlock = stream.getNextIdatBit() != 0; compressionType = (byte) stream.getNextIdatBits(2); if (compressionType > 2) stream.error(); if (compressionType == UNCOMPRESSED) { byte b1 = stream.getNextIdatByte(); byte b2 = stream.getNextIdatByte(); byte b3 = stream.getNextIdatByte(); byte b4 = stream.getNextIdatByte(); if (b1 != ~b3 || b2 != ~b4) stream.error(); uncompressedBytesRemaining = (b1 & 0xFF) | ((b2 & 0xFF) << 8); } else if (compressionType == COMPRESSED_DYNAMIC) { huffmanTables = PngHuffmanTables.getDynamicTables(stream); } else { huffmanTables = PngHuffmanTables.getFixedTables(); } }
int getNextIdatBits(int length) throws IOException { int value = 0; for (int i = 0; i < length; i++) { value |= (getNextIdatBit() << i); } return value; }
int getNextValue(PngDecodingDataStream stream) throws IOException { int code = stream.getNextIdatBit(); int codelength = 0; // Here we are taking advantage of the fact that 1 bits are used as // a prefix to the longer codeValues. while (codelength < MAX_CODE_LENGTH && code > codeLengthInfo[codelength].max) { code = ((code << 1) | stream.getNextIdatBit()); codelength++; } if (codelength >= MAX_CODE_LENGTH) stream.error(); // Now we have a Huffman code of length (codelength + 1) that // is somewhere in the range // minCodesByLength[codelength]..maxCodesByLength[codelength]. // This code is the (offset + 1)'th code of (codelength + 1); int offset = code - codeLengthInfo[codelength].min; // indexesByLength[codelength] is the first code of length (codelength + 1) // so now we can look up the value for the Huffman code in the table. int index = codeLengthInfo[codelength].baseIndex + offset; return codeValues[index]; }
int getNextValue(PngDecodingDataStream stream) throws IOException { int code = stream.getNextIdatBit(); int codelength = 0; // Here we are taking advantage of the fact that 1 bits are used as // a prefix to the longer codeValues. while (codelength < MAX_CODE_LENGTH && code > codeLengthInfo[codelength].max) { code = ((code << 1) | stream.getNextIdatBit()); codelength++; } if (codelength >= MAX_CODE_LENGTH) stream.error(); // Now we have a Huffman code of length (codelength + 1) that // is somewhere in the range // minCodesByLength[codelength]..maxCodesByLength[codelength]. // This code is the (offset + 1)'th code of (codelength + 1); int offset = code - codeLengthInfo[codelength].min; // indexesByLength[codelength] is the first code of length (codelength + 1) // so now we can look up the value for the Huffman code in the table. int index = codeLengthInfo[codelength].baseIndex + offset; return codeValues[index]; }
int getNextValue(PngDecodingDataStream stream) throws IOException { int code = stream.getNextIdatBit(); int codelength = 0; // Here we are taking advantage of the fact that 1 bits are used as // a prefix to the longer codeValues. while (codelength < MAX_CODE_LENGTH && code > codeLengthInfo[codelength].max) { code = ((code << 1) | stream.getNextIdatBit()); codelength++; } if (codelength >= MAX_CODE_LENGTH) stream.error(); // Now we have a Huffman code of length (codelength + 1) that // is somewhere in the range // minCodesByLength[codelength]..maxCodesByLength[codelength]. // This code is the (offset + 1)'th code of (codelength + 1); int offset = code - codeLengthInfo[codelength].min; // indexesByLength[codelength] is the first code of length (codelength + 1) // so now we can look up the value for the Huffman code in the table. int index = codeLengthInfo[codelength].baseIndex + offset; return codeValues[index]; }
int getNextValue(PngDecodingDataStream stream) throws IOException { int code = stream.getNextIdatBit(); int codelength = 0; // Here we are taking advantage of the fact that 1 bits are used as // a prefix to the longer codeValues. while (codelength < MAX_CODE_LENGTH && code > codeLengthInfo[codelength].max) { code = ((code << 1) | stream.getNextIdatBit()); codelength++; } if (codelength >= MAX_CODE_LENGTH) stream.error(); // Now we have a Huffman code of length (codelength + 1) that // is somewhere in the range // minCodesByLength[codelength]..maxCodesByLength[codelength]. // This code is the (offset + 1)'th code of (codelength + 1); int offset = code - codeLengthInfo[codelength].min; // indexesByLength[codelength] is the first code of length (codelength + 1) // so now we can look up the value for the Huffman code in the table. int index = codeLengthInfo[codelength].baseIndex + offset; return codeValues[index]; }
int getNextValue(PngDecodingDataStream stream) throws IOException { int code = stream.getNextIdatBit(); int codelength = 0; // Here we are taking advantage of the fact that 1 bits are used as // a prefix to the longer codeValues. while (codelength < MAX_CODE_LENGTH && code > codeLengthInfo[codelength].max) { code = ((code << 1) | stream.getNextIdatBit()); codelength++; } if (codelength >= MAX_CODE_LENGTH) stream.error(); // Now we have a Huffman code of length (codelength + 1) that // is somewhere in the range // minCodesByLength[codelength]..maxCodesByLength[codelength]. // This code is the (offset + 1)'th code of (codelength + 1); int offset = code - codeLengthInfo[codelength].min; // indexesByLength[codelength] is the first code of length (codelength + 1) // so now we can look up the value for the Huffman code in the table. int index = codeLengthInfo[codelength].baseIndex + offset; return codeValues[index]; }
int getNextValue(PngDecodingDataStream stream) throws IOException { int code = stream.getNextIdatBit(); int codelength = 0; // Here we are taking advantage of the fact that 1 bits are used as // a prefix to the longer codeValues. while (codelength < MAX_CODE_LENGTH && code > codeLengthInfo[codelength].max) { code = ((code << 1) | stream.getNextIdatBit()); codelength++; } if (codelength >= MAX_CODE_LENGTH) stream.error(); // Now we have a Huffman code of length (codelength + 1) that // is somewhere in the range // minCodesByLength[codelength]..maxCodesByLength[codelength]. // This code is the (offset + 1)'th code of (codelength + 1); int offset = code - codeLengthInfo[codelength].min; // indexesByLength[codelength] is the first code of length (codelength + 1) // so now we can look up the value for the Huffman code in the table. int index = codeLengthInfo[codelength].baseIndex + offset; return codeValues[index]; }