1 @LATTICE("BUF<IDX,V,IDX*")
2 @METHODDEFAULT("THIS<IN,THISLOC=THIS,RETURNLOC=THIS")
3 public class SideInfoBuffer {
6 * The frame buffer that holds the data for the current frame.
9 private final int[] framebuffer = new int[BUFFER_INT_SIZE];
12 * Maximum size of the frame buffer.
14 private static final int BUFFER_INT_SIZE = 433;
17 * Index into <code>framebuffer</code> where the next bits are retrieved.
20 private int wordpointer;
23 * Number (0-31, from MSB to LSB) of next bit for get_bits()
29 private int main_data_begin;
31 public int getMain_data_begin() {
32 return main_data_begin;
35 public void setMain_data_begin(@LOC("IN") int main_data_begin) {
36 this.main_data_begin = main_data_begin;
39 private static final int bitmask[] = {
41 0x00000001, 0x00000003, 0x00000007, 0x0000000F, 0x0000001F, 0x0000003F, 0x0000007F,
42 0x000000FF, 0x000001FF, 0x000003FF, 0x000007FF, 0x00000FFF, 0x00001FFF, 0x00003FFF,
43 0x00007FFF, 0x0000FFFF, 0x0001FFFF };
45 @LATTICE("OUT<THIS,THIS<IN,OUT*,THISLOC=THIS,RETURNLOC=OUT")
46 public int get_bits(@LOC("IN") int number_of_bits) {
47 @LOC("OUT") int returnvalue = 0;
48 @LOC("THIS,SideInfoBuffer.IDX") int sum = bitindex + number_of_bits;
49 // System.out.println("bitindex=" + bitindex + " wordpointer="
52 // There is a problem here, wordpointer could be -1 ?!
58 // all bits contained in *wordpointer
59 returnvalue = (framebuffer[wordpointer] >>> (32 - sum)) & bitmask[number_of_bits];
60 // returnvalue = (wordpointer[0] >> (32 - sum)) &
61 // bitmask[number_of_bits];
62 if ((bitindex += number_of_bits) == 32) {
64 wordpointer++; // added by me!
70 // ((short[])&returnvalue)[0] = ((short[])wordpointer + 1)[0];
71 // wordpointer++; // Added by me!
72 // ((short[])&returnvalue + 1)[0] = ((short[])wordpointer)[0];
73 @LOC("OUT") int Right = (framebuffer[wordpointer] & 0x0000FFFF);
75 @LOC("OUT") int Left = (framebuffer[wordpointer] & 0xFFFF0000);
76 returnvalue = ((Right << 16) & 0xFFFF0000) | ((Left >>> 16) & 0x0000FFFF);
78 returnvalue >>>= 48 - sum; // returnvalue >>= 16 - (number_of_bits - (32
80 returnvalue &= bitmask[number_of_bits];
85 public void setBuffer(int idx, int value) {
86 framebuffer[idx] = value;