src/java.desktop/share/classes/com/sun/imageio/plugins/common/LZWStringTable.java
Print this page
*** 35,54 ****
* The strLen table to give quick access to the lenght of an expanded
* code for use by the <code>expandCode</code> method added by Robin.
**/
public class LZWStringTable {
/** codesize + Reserved Codes */
! private final static int RES_CODES = 2;
! private final static short HASH_FREE = (short)0xFFFF;
! private final static short NEXT_FIRST = (short)0xFFFF;
! private final static int MAXBITS = 12;
! private final static int MAXSTR = (1 << MAXBITS);
! private final static short HASHSIZE = 9973;
! private final static short HASHSTEP = 2039;
byte[] strChr; // after predecessor character
short[] strNxt; // predecessor string
short[] strHsh; // hash table to find predecessor + char pairs
short numStrings; // next code if adding new prestring + char
--- 35,54 ----
* The strLen table to give quick access to the lenght of an expanded
* code for use by the <code>expandCode</code> method added by Robin.
**/
public class LZWStringTable {
/** codesize + Reserved Codes */
! private static final int RES_CODES = 2;
! private static final short HASH_FREE = (short)0xFFFF;
! private static final short NEXT_FIRST = (short)0xFFFF;
! private static final int MAXBITS = 12;
! private static final int MAXSTR = (1 << MAXBITS);
! private static final short HASHSIZE = 9973;
! private static final short HASHSTEP = 2039;
byte[] strChr; // after predecessor character
short[] strNxt; // predecessor string
short[] strHsh; // hash table to find predecessor + char pairs
short numStrings; // next code if adding new prestring + char
*** 140,150 ****
for (int q = 0; q < w; q++) {
addCharString((short)0xFFFF, (byte)q); // init with no prefix
}
}
! static public int hash(short index, byte lastbyte) {
return (((short)(lastbyte << 8) ^ index) & 0xFFFF) % HASHSIZE;
}
/*
* If expanded data doesn't fit into array only what will fit is written
--- 140,150 ----
for (int q = 0; q < w; q++) {
addCharString((short)0xFFFF, (byte)q); // init with no prefix
}
}
! public static int hash(short index, byte lastbyte) {
return (((short)(lastbyte << 8) ^ index) & 0xFFFF) % HASHSIZE;
}
/*
* If expanded data doesn't fit into array only what will fit is written