have linear-type-safe source codes of mp3decoder
[IRC.git] / Robust / src / Tests / ssJava / mp3decoder / huffcodetab.java
index 7aec4ccc4042be457c8e686d7680605a112d01d3..054bc4d00b4f705150ed23eecd52b1bedcb92131 100644 (file)
@@ -482,8 +482,8 @@ final class huffcodetab {
    * Big Constructor : Computes all Huffman Tables.\r
    */\r
   private huffcodetab(@LOC("V") String S, @LOC("V") int XLEN, @LOC("V") int YLEN,\r
-      @LOC("V") int LINBITS, @LOC("V") int LINMAX, @LOC("V") int REF, @LOC("V") int[] TABLE,\r
-      @LOC("V") int[] HLEN, @LOC("V") int[][] VAL, @LOC("V") int TREELEN) {\r
+      @LOC("V") int LINBITS, @LOC("V") int LINMAX, @LOC("V") int REF, @DELEGATE @LOC("V") int[] TABLE,\r
+      @DELEGATE @LOC("V") int[] HLEN,@DELEGATE @LOC("V") int[][] VAL, @LOC("V") int TREELEN) {\r
     tablename0 = S.charAt(0);\r
     tablename1 = S.charAt(1);\r
     tablename2 = S.charAt(2);\r
@@ -506,11 +506,12 @@ final class huffcodetab {
    * 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
+  public static int huffman_decoder(int htIdx, int[] x, int[] y, int[] v, int[] w, BitReserve br)\r
   {\r
      // array of all huffcodtable headers\r
      // 0..31 Huffman code table 0..31\r
      // 32,33 count1-tables\r
+    \r
 \r
      int dmask = 1 << ((4 * 8) - 1);\r
      int hs    = 4 * 8;\r
@@ -519,10 +520,10 @@ final class huffcodetab {
      int error = 1;\r
      level = dmask;\r
 \r
-     if (h.val == null) return 2;\r
+     if (ht[htIdx].val == null) return 2;\r
 \r
      /* table 0 needs no bits */\r
-     if ( h.treelen == 0)\r
+     if ( ht[htIdx].treelen == 0)\r
       { \r
         x[0] = y[0] = 0;\r
         return 0;\r
@@ -536,10 +537,10 @@ final class huffcodetab {
       int bits[] = bitbuf;*/\r
       do \r
       {\r
-         if (h.val[point][0]==0)\r
+         if (ht[htIdx].val[point][0]==0)\r
           {   /*end of tree*/\r
-             x[0] = h.val[point][1] >>> 4;\r
-             y[0] = h.val[point][1] & 0xf;\r
+             x[0] = ht[htIdx].val[point][1] >>> 4;\r
+             y[0] = ht[htIdx].val[point][1] & 0xf;\r
              error = 0;\r
              break;\r
          }\r
@@ -556,13 +557,13 @@ final class huffcodetab {
           //if (bits[bitIndex++]!=0)\r
           if (br.hget1bit()!=0)\r
           {\r
-             while (h.val[point][1] >= MXOFF) point += h.val[point][1];\r
-             point += h.val[point][1];\r
+             while (ht[htIdx].val[point][1] >= MXOFF) point += ht[htIdx].val[point][1];\r
+             point += ht[htIdx].val[point][1];\r
          }\r
          else\r
           {\r
-             while (h.val[point][0] >= MXOFF) point += h.val[point][0];\r
-             point += h.val[point][0];\r
+             while (ht[htIdx].val[point][0] >= MXOFF) point += ht[htIdx].val[point][0];\r
+             point += ht[htIdx].val[point][0];\r
          }\r
          level >>>= 1;\r
           // MDM: ht[0] is always 0;\r
@@ -575,8 +576,8 @@ final class huffcodetab {
                br.rewindNbits(unread);\r
       */\r
        /* Process sign encodings for quadruples tables. */\r
-      // System.out.println(h.tablename);\r
-       if (h.tablename0 == '3' && (h.tablename1 == '2' || h.tablename1 == '3'))\r
+      // System.out.println(ht[htIdx].tablename);\r
+       if (ht[htIdx].tablename0 == '3' && (ht[htIdx].tablename1 == '2' || ht[htIdx].tablename1 == '3'))\r
        {\r
           v[0] = (y[0]>>3) & 1;\r
           w[0] = (y[0]>>2) & 1;\r
@@ -601,14 +602,14 @@ final class huffcodetab {
             // x and y are reversed in the test bitstream.\r
             // Reverse x and y here to make test bitstream work.\r
 \r
-           if (h.linbits != 0)\r
-             if ((h.xlen-1) == x[0])\r
-               x[0] += br.hgetbits(h.linbits);\r
+           if (ht[htIdx].linbits != 0)\r
+             if ((ht[htIdx].xlen-1) == x[0])\r
+               x[0] += br.hgetbits(ht[htIdx].linbits);\r
             if (x[0] != 0)\r
                  if (br.hget1bit() != 0) x[0] = -x[0];\r
-            if (h.linbits != 0)\r
-                if ((h.ylen-1) == y[0])\r
-                    y[0] += br.hgetbits(h.linbits);\r
+            if (ht[htIdx].linbits != 0)\r
+                if ((ht[htIdx].ylen-1) == y[0])\r
+                    y[0] += br.hgetbits(ht[htIdx].linbits);\r
             if (y[0] != 0)\r
                  if (br.hget1bit() != 0) y[0] = -y[0];\r
         }\r