From 2c4882eb5bb49314d697c83cfe3a5b5f68e9a29f Mon Sep 17 00:00:00 2001 From: yeom Date: Fri, 19 Aug 2011 00:00:48 +0000 Subject: [PATCH] mp3decoder finally passes the flow-down rule checking. --- .../Tests/ssJava/mp3decoder/BitReserve.java | 9 +- .../ssJava/mp3decoder/LayerIIIDecoder.java | 56 ++----- .../Tests/ssJava/mp3decoder/huffcodetab.java | 138 +----------------- 3 files changed, 28 insertions(+), 175 deletions(-) diff --git a/Robust/src/Tests/ssJava/mp3decoder/BitReserve.java b/Robust/src/Tests/ssJava/mp3decoder/BitReserve.java index aa47a961..e4167f00 100644 --- a/Robust/src/Tests/ssJava/mp3decoder/BitReserve.java +++ b/Robust/src/Tests/ssJava/mp3decoder/BitReserve.java @@ -52,7 +52,7 @@ final class BitReserve { */ private static final int BUFSIZE_MASK = BUFSIZE - 1; - @LOC("OFF") + @LOC("BIT") private int offset; @LOC("BIT") @@ -61,7 +61,7 @@ final class BitReserve { @LOC("BIT") private int buf_byte_idx; - @LOC("BUF") + @LOC("BIT") private final int[] buf; BitReserve() { @@ -76,7 +76,7 @@ final class BitReserve { */ @RETURNLOC("THIS,BitReserve.BIT") public int hsstell() { - return (totbit); + return (totbit); } /** @@ -116,9 +116,10 @@ final class BitReserve { * * @returns 0 if next bit is reset, or 1 if next bit is set. */ + @RETURNLOC("THIS,BitReserve.BIT") public int hget1bit() { totbit++; - @LOC("OUT") int val = buf[buf_byte_idx]; + @LOC("THIS,BitReserve.BIT") int val = buf[buf_byte_idx]; buf_byte_idx = (buf_byte_idx + 1) & BUFSIZE_MASK; return val; } diff --git a/Robust/src/Tests/ssJava/mp3decoder/LayerIIIDecoder.java b/Robust/src/Tests/ssJava/mp3decoder/LayerIIIDecoder.java index 5ebedb1b..cd0d38e6 100644 --- a/Robust/src/Tests/ssJava/mp3decoder/LayerIIIDecoder.java +++ b/Robust/src/Tests/ssJava/mp3decoder/LayerIIIDecoder.java @@ -47,7 +47,7 @@ // 10th added for get_scale_factors // llth added for decode // @LATTICE("IS1D*,RO>> 4; - data.y = ht[idx].val[point][1] & 0xf; - error = 0; - break; - } - - // hget1bit() is called thousands of times, and so needs to be - // ultra fast. - /* - * if (bitIndex==bitsAvailable) { bitsAvailable = br.readBits(bits, 32); - * bitIndex = 0; } - */ - // if (bits[bitIndex++]!=0) - if (data.br.hget1bit() != 0) { - while (ht[idx].val[point][1] >= MXOFF) - point += ht[idx].val[point][1]; - point += ht[idx].val[point][1]; - } else { - while (ht[idx].val[point][0] >= MXOFF) - point += ht[idx].val[point][0]; - point += ht[idx].val[point][0]; - } - level >>>= 1; - // MDM: ht[0] is always 0; - } while ((level != 0) || (point < 0 /* ht[0].treelen */)); - - // put back any bits not consumed - /* - * int unread = (bitsAvailable-bitIndex); if (unread>0) - * br.rewindNbits(unread); - */ - /* Process sign encodings for quadruples tables. */ - // System.out.println(h.tablename); - if (ht[idx].tablename0 == '3' && (ht[idx].tablename1 == '2' || ht[idx].tablename1 == '3')) { - data.v = (data.y >> 3) & 1; - data.w = (data.y >> 2) & 1; - data.x = (data.y >> 1) & 1; - data.y = data.y & 1; - - /* - * v, w, x and y are reversed in the bitstream. switch them around to make - * test bistream work. - */ - - if (data.v != 0) - if (data.br.hget1bit() != 0) - data.v = -data.v; - if (data.w != 0) - if (data.br.hget1bit() != 0) - data.w = -data.w; - if (data.x != 0) - if (data.br.hget1bit() != 0) - data.x = -data.x; - if (data.y != 0) - if (data.br.hget1bit() != 0) - data.y = -data.y; - } else { - // Process sign and escape encodings for dual tables. - // x and y are reversed in the test bitstream. - // Reverse x and y here to make test bitstream work. - - if (ht[idx].linbits != 0) - if ((ht[idx].xlen - 1) == data.x) - data.x += data.br.hgetbits(ht[idx].linbits); - if (data.x != 0) - if (data.br.hget1bit() != 0) - data.x = -data.x; - if (ht[idx].linbits != 0) - if ((ht[idx].ylen - 1) == data.y) - data.y += data.br.hgetbits(ht[idx].linbits); - if (data.y != 0) - if (data.br.hget1bit() != 0) - data.y = -data.y; - } - - return data; - // return error; - } - public static void inithuff() { if (ht != null) -- 2.34.1