/**\r
* Class to implements Huffman decoder.\r
*/\r
+@LATTICE("FIELD<FINAL")\r
+@METHODDEFAULT("OUT<V,V<SH,SH<IN,SH*,THISLOC=IN,GLOBALLOC=IN");\r
final class huffcodetab\r
{\r
- private static final int MXOFF=250;\r
- private static final int HTN=34;\r
+ @LOC("FINAL") private static final int MXOFF=250;\r
+ @LOC("FINAL") private static final int HTN=34;\r
\r
- private char tablename0 = ' '; /* string, containing table_description */\r
- private char tablename1 = ' '; /* string, containing table_description */\r
- private char tablename2 = ' '; /* string, containing table_description */\r
+ @LOC("FIELD") private char tablename0 = ' '; /* string, containing table_description */\r
+ @LOC("FIELD") private char tablename1 = ' '; /* string, containing table_description */\r
+ @LOC("FIELD") private char tablename2 = ' '; /* string, containing table_description */\r
\r
- private int xlen; /* max. x-index+ */\r
- private int ylen; /* max. y-index+ */\r
- private int linbits; /* number of linbits */\r
- private int linmax; /* max number to be stored in linbits */\r
- private int ref; /* a positive value indicates a reference */\r
- private int[] table=null; /* pointer to array[xlen][ylen] */\r
- private int[] hlen=null; /* pointer to array[xlen][ylen] */\r
- private int[][] val=null; /* decoder tree */\r
- private int treelen; /* length of decoder tree */\r
+ @LOC("FIELD") private int xlen; /* max. x-index+ */\r
+ @LOC("FIELD") private int ylen; /* max. y-index+ */\r
+ @LOC("FIELD") private int linbits; /* number of linbits */\r
+ @LOC("FIELD") private int linmax; /* max number to be stored in linbits */\r
+ @LOC("FIELD") private int ref; /* a positive value indicates a reference */\r
+ @LOC("FIELD") private int[] table=null; /* pointer to array[xlen][ylen] */\r
+ @LOC("FIELD") private int[] hlen=null; /* pointer to array[xlen][ylen] */\r
+ @LOC("FIELD") private int[][] val=null; /* decoder tree */\r
+ @LOC("FIELD") private int treelen; /* length of decoder tree */\r
\r
- private static int ValTab0[][] = {\r
+ @LOC("FINAL") private static int ValTab0[][] = {\r
{0,0} // dummy\r
};\r
\r
- private static int ValTab1[][] = {\r
+ @LOC("FINAL") private static int ValTab1[][] = {\r
{2,1},{0,0},{2,1},{0,16},{2,1},{0,1},{0,17},\r
};\r
\r
- private static int ValTab2[][] = {\r
+ @LOC("FINAL") private static int ValTab2[][] = {\r
{2,1},{0,0},{4,1},{2,1},{0,16},{0,1},{2,1},{0,17},{4,1},{2,1},\r
{0,32},{0,33},{2,1},{0,18},{2,1},{0,2},{0,34},\r
};\r
\r
- private static int ValTab3[][] = {\r
+ @LOC("FINAL") private static int ValTab3[][] = {\r
{4,1},{2,1},{0,0},{0,1},{2,1},{0,17},{2,1},{0,16},{4,1},{2,1},\r
{0,32},{0,33},{2,1},{0,18},{2,1},{0,2},{0,34},\r
};\r
\r
- private static int ValTab4[][] = {{0,0}}; // dummy\r
+ @LOC("FINAL") private static int ValTab4[][] = {{0,0}}; // dummy\r
\r
- private static int ValTab5[][] = {\r
+ @LOC("FINAL") private static int ValTab5[][] = {\r
{2,1},{0,0},{4,1},{2,1},{0,16},{0,1},{2,1},{0,17},{8,1},{4,1},\r
{2,1},{0,32},{0,2},{2,1},{0,33},{0,18},{8,1},{4,1},{2,1},{0,34},\r
{0,48},{2,1},{0,3},{0,19},{2,1},{0,49},{2,1},{0,50},{2,1},{0,35},\r
{0,51},\r
};\r
\r
- private static int ValTab6[][] = {\r
+ @LOC("FINAL") private static int ValTab6[][] = {\r
{6,1},{4,1},{2,1},{0,0},{0,16},{0,17},{6,1},{2,1},{0,1},{2,1},\r
{0,32},{0,33},{6,1},{2,1},{0,18},{2,1},{0,2},{0,34},{4,1},{2,1},\r
{0,49},{0,19},{4,1},{2,1},{0,48},{0,50},{2,1},{0,35},{2,1},{0,3},\r
{0,51},\r
};\r
\r
- private static int ValTab7[][] = {\r
+ @LOC("FINAL") private static int ValTab7[][] = {\r
{2,1},{0,0},{4,1},{2,1},{0,16},{0,1},{8,1},{2,1},{0,17},{4,1},\r
{2,1},{0,32},{0,2},{0,33},{18,1},{6,1},{2,1},{0,18},{2,1},{0,34},\r
{0,48},{4,1},{2,1},{0,49},{0,19},{4,1},{2,1},{0,3},{0,50},{2,1},\r
{0,85},\r
};\r
\r
- private static int ValTab8[][] = {\r
+ @LOC("FINAL") private static int ValTab8[][] = {\r
{6,1},{2,1},{0,0},{2,1},{0,16},{0,1},{2,1},{0,17},{4,1},{2,1},\r
{0,33},{0,18},{14,1},{4,1},{2,1},{0,32},{0,2},{2,1},{0,34},{4,1},\r
{2,1},{0,48},{0,3},{2,1},{0,49},{0,19},{14,1},{8,1},{4,1},{2,1},\r
{0,85},\r
};\r
\r
- private static int ValTab9[][] = {\r
+ @LOC("FINAL") private static int ValTab9[][] = {\r
{8,1},{4,1},{2,1},{0,0},{0,16},{2,1},{0,1},{0,17},{10,1},{4,1},\r
{2,1},{0,32},{0,33},{2,1},{0,18},{2,1},{0,2},{0,34},{12,1},{6,1},\r
{4,1},{2,1},{0,48},{0,3},{0,49},{2,1},{0,19},{2,1},{0,50},{0,35},\r
{0,85},\r
};\r
\r
- private static int ValTab10[][] = {\r
+ @LOC("FINAL") private static int ValTab10[][] = {\r
{2,1},{0,0},{4,1},{2,1},{0,16},{0,1},{10,1},{2,1},{0,17},{4,1},\r
{2,1},{0,32},{0,2},{2,1},{0,33},{0,18},{28,1},{8,1},{4,1},{2,1},\r
{0,34},{0,48},{2,1},{0,49},{0,19},{8,1},{4,1},{2,1},{0,3},{0,50},\r
{4,1},{2,1},{0,87},{0,118},{2,1},{0,103},{0,119},\r
};\r
\r
- private static int ValTab11[][] = {\r
+ @LOC("FINAL") private static int ValTab11[][] = {\r
{6,1},{2,1},{0,0},{2,1},{0,16},{0,1},{8,1},{2,1},{0,17},{4,1},\r
{2,1},{0,32},{0,2},{0,18},{24,1},{8,1},{2,1},{0,33},{2,1},{0,34},\r
{2,1},{0,48},{0,3},{4,1},{2,1},{0,49},{0,19},{4,1},{2,1},{0,50},\r
{4,1},{2,1},{0,117},{0,118},{2,1},{0,103},{0,119},\r
};\r
\r
- private static int ValTab12[][] = {\r
+ @LOC("FINAL") private static int ValTab12[][] = {\r
{12,1},{4,1},{2,1},{0,16},{0,1},{2,1},{0,17},{2,1},{0,0},{2,1},\r
{0,32},{0,2},{16,1},{4,1},{2,1},{0,33},{0,18},{4,1},{2,1},{0,34},\r
{0,49},{2,1},{0,19},{2,1},{0,48},{2,1},{0,3},{0,64},{26,1},{8,1},\r
{0,117},{0,87},{2,1},{0,118},{2,1},{0,103},{0,119},\r
};\r
\r
- private static int ValTab13[][] = {\r
+ @LOC("FINAL") private static int ValTab13[][] = {\r
{2,1},{0,0},{6,1},{2,1},{0,16},{2,1},{0,1},{0,17},{28,1},{8,1},\r
{4,1},{2,1},{0,32},{0,2},{2,1},{0,33},{0,18},{8,1},{4,1},{2,1},\r
{0,34},{0,48},{2,1},{0,3},{0,49},{6,1},{2,1},{0,19},{2,1},{0,50},\r
{0,254},\r
};\r
\r
- private static int ValTab14[][] = {\r
+ @LOC("FINAL") private static int ValTab14[][] = {\r
{0,0} // dummy\r
};\r
\r
- private static int ValTab15[][] = {\r
+ @LOC("FINAL") private static int ValTab15[][] = {\r
{16,1},{6,1},{2,1},{0,0},{2,1},{0,16},{0,1},{2,1},{0,17},{4,1},\r
{2,1},{0,32},{0,2},{2,1},{0,33},{0,18},{50,1},{16,1},{6,1},{2,1},\r
{0,34},{2,1},{0,48},{0,49},{6,1},{2,1},{0,19},{2,1},{0,3},{0,64},\r
{0,255},\r
};\r
\r
- private static int ValTab16[][] = {\r
+ @LOC("FINAL") private static int ValTab16[][] = {\r
{2,1},{0,0},{6,1},{2,1},{0,16},{2,1},{0,1},{0,17},{42,1},{8,1},\r
{4,1},{2,1},{0,32},{0,2},{2,1},{0,33},{0,18},{10,1},{6,1},{2,1},\r
{0,34},{2,1},{0,48},{0,3},{2,1},{0,49},{0,19},{10,1},{4,1},{2,1},\r
{0,239},\r
};\r
\r
- private static int ValTab24[][] = {\r
+ @LOC("FINAL") private static int ValTab24[][] = {\r
{60,1},{8,1},{4,1},{2,1},{0,0},{0,16},{2,1},{0,1},{0,17},{14,1},\r
{6,1},{4,1},{2,1},{0,32},{0,2},{0,33},{2,1},{0,18},{2,1},{0,34},\r
{2,1},{0,48},{0,3},{14,1},{4,1},{2,1},{0,49},{0,19},{4,1},{2,1},\r
{0,254},{0,239},\r
};\r
\r
- private static int ValTab32[][] = {\r
+ @LOC("FINAL") private static int ValTab32[][] = {\r
{2,1},{0,0},{8,1},{4,1},{2,1},{0,8},{0,4},{2,1},{0,1},{0,2},\r
{8,1},{4,1},{2,1},{0,12},{0,10},{2,1},{0,3},{0,6},{6,1},{2,1},\r
{0,9},{2,1},{0,5},{0,7},{4,1},{2,1},{0,14},{0,13},{2,1},{0,15},\r
{0,11},\r
};\r
\r
- private static int ValTab33[][] = {\r
+ @LOC("FINAL") private static int ValTab33[][] = {\r
{16,1},{8,1},{4,1},{2,1},{0,0},{0,1},{2,1},{0,2},{0,3},{4,1},\r
{2,1},{0,4},{0,5},{2,1},{0,6},{0,7},{8,1},{4,1},{2,1},{0,8},\r
{0,9},{2,1},{0,10},{0,11},{4,1},{2,1},{0,12},{0,13},{2,1},{0,14},\r
};\r
\r
\r
- public static huffcodetab[] ht = null; /* Simulate extern struct */\r
+ @LOC("FINAL") public static huffcodetab[] ht = null; /* Simulate extern struct */\r
\r
- private static int[] bitbuf = new int[32];\r
+ @LOC("FINAL") private static int[] bitbuf = new int[32];\r
\r
/**\r
* Big Constructor : Computes all Huffman Tables.\r
*/\r
- private huffcodetab(String S,int XLEN, int YLEN, int LINBITS, int LINMAX, int REF,\r
- int[] TABLE, int[] HLEN, int[][] VAL, int TREELEN) \r
+ private huffcodetab(@LOC("V") String S,@LOC("V") int XLEN, @LOC("V") int YLEN, @LOC("V") int LINBITS,\r
+ @LOC("V") int LINMAX, @LOC("V") int REF,@LOC("V") int[] TABLE, @LOC("V") int[] HLEN, \r
+ @LOC("V") int[][] VAL, @LOC("V") int TREELEN) \r
{\r
tablename0 = S.charAt(0);\r
tablename1 = S.charAt(1);\r
linmax = LINMAX;\r
ref = REF;\r
table = TABLE;\r
+ TABLE = null;\r
hlen = HLEN;\r
+ HLEN = null;\r
val = VAL;\r
+ VAL = null;\r
treelen = TREELEN;\r
}\r
\r
* note! for counta,countb -the 4 bit value is returned in y,\r
* discard x.\r
*/\r
- public static int huffman_decoder(huffcodetab h, int[] x, int[] y, int[] v, int[] w, BitReserve br)\r
+ @LATTICE("X<Y,V<Y,W<Y,Y<VAR,VAR<IN,OUT<IN,VAR*,Y*,X*,V*,W*,THISLOC=IN,GLOBALLOC=IN")\r
+ @RETURNLOC("OUT")\r
+ public static int huffman_decoder(@LOC("IN") huffcodetab h, @LOC("X") int[] x, @LOC("Y") int[] y, @LOC("V") int[] v, @LOC("W") int[] w, @LOC("IN") BitReserve br)\r
{\r
// array of all huffcodtable headers\r
// 0..31 Huffman code table 0..31\r
// 32,33 count1-tables\r
\r
- int dmask = 1 << ((4 * 8) - 1);\r
- int hs = 4 * 8;\r
- int level;\r
- int point = 0;\r
- int error = 1;\r
+ @LOC("IN") int dmask = 1 << ((4 * 8) - 1);\r
+ @LOC("IN") int hs = 4 * 8;\r
+ @LOC("VAR") int level;\r
+ @LOC("VAR") int point = 0;\r
+ @LOC("OUT") int error = 1;\r
level = dmask;\r
\r
if (h.val == null) return 2;\r
\r
/* table 0 needs no bits */\r
if ( h.treelen == 0)\r
- { \r
- x[0] = y[0] = 0;\r
+ { \r
+ y[0] = 0;\r
+ x[0] = 0;\r
return 0;\r
}\r
\r
do \r
{\r
if (h.val[point][0]==0)\r
- { /*end of tree*/\r
+ { /*end of tree*/\r
x[0] = h.val[point][1] >>> 4;\r
y[0] = h.val[point][1] & 0xf;\r
error = 0;\r
if (br.hget1bit() != 0) x[0] = -x[0];\r
if (y[0]!=0)\r
if (br.hget1bit() != 0) y[0] = -y[0];\r
- }\r
+ }\r
else\r
{\r
// Process sign and escape encodings for dual tables.\r
if (ht!=null)\r
return;\r
\r
- ht = new huffcodetab[HTN];\r
+ ht = new huffcodetab[HTN];\r
ht[0] = new huffcodetab("0 ",0,0,0,0,-1,null,null,ValTab0,0);\r
ht[1] = new huffcodetab("1 ",2,2,0,0,-1,null,null,ValTab1,7);\r
ht[2] = new huffcodetab("2 ",3,3,0,0,-1,null,null,ValTab2,17);\r
ht[25] = new huffcodetab("25 ",16,16,5,31,24,null,null,ValTab24,512);\r
ht[26] = new huffcodetab("26 ",16,16,6,63,24,null,null,ValTab24,512);\r
ht[27] = new huffcodetab("27 ",16,16,7,127,24,null,null,ValTab24,512);\r
- ht[28] = new huffcodetab("28 ",16,16,8,255,24,null,null,ValTab24,512); \r
+ ht[28] = new huffcodetab("28 ",16,16,8,255,24,null,null,ValTab24,512); \r
ht[29] = new huffcodetab("29 ",16,16,9,511,24,null,null,ValTab24,512);\r
ht[30] = new huffcodetab("30 ",16,16,11,2047,24,null,null,ValTab24,512);\r
ht[31] = new huffcodetab("31 ",16,16,13,8191,24,null,null,ValTab24,512);\r