private void checkDeclarationInMethodBody(ClassDescriptor cd, MethodDescriptor md) {
BlockNode bn = state.getMethodBody(md);
+ System.out.println("\n#checkDeclarationInMethodBody=" + md);
+
// first, check annotations on method parameters
List<CompositeLocation> paramList = new ArrayList<CompositeLocation>();
for (int i = 0; i < md.numParameters(); i++) {
// process annotations on method parameters
VarDescriptor vd = (VarDescriptor) md.getParameter(i);
- assignLocationOfVarDescriptor(vd, md, md.getParameterTable(), bn);
+ assignLocationOfVarDescriptor(vd, md, md.getParameterTable(), null);
paramList.add(d2loc.get(vd));
}
Vector<AnnotationDescriptor> methodAnnotations = md.getModifiers().getAnnotations();
// if developer does not define method lattice
// search return location in the method default lattice
String rtrStr = ssjava.getMethodLattice(md).getReturnLoc();
- returnLocComp = new CompositeLocation(new Location(md, rtrStr));
+ if(rtrStr!=null){
+ returnLocComp = new CompositeLocation(new Location(md, rtrStr));
+ }
}
if (returnLocComp == null) {
System.out.println("### ReturnLocGenerator=" + md);
System.out.println("### md2ReturnLoc.get(md)=" + md2ReturnLoc.get(md));
+
md2ReturnLocGen.put(md, new ReturnLocGenerator(md2ReturnLoc.get(md), md, paramList, md
+ " of " + cd.getSourceFileName()));
}
// currently enforce every variable to have corresponding location
if (annotationVec.size() == 0) {
- throw new Error("Location is not assigned to variable " + vd.getSymbol() + " in the method "
- + md.getSymbol() + " of the class " + cd.getSymbol());
+ throw new Error("Location is not assigned to variable '" + vd.getSymbol() + "' in the method '"
+ + md + "' of the class " + cd.getSymbol() + " at " + generateErrorMessage(cd, n));
}
if (annotationVec.size() > 1) { // variable can have at most one location
+@LATTICE("VALUE")
public class Character {
public static int digit(char ch, int radix) {
return false;
}
- char value;
+ @LOC("VALUE") char value;
public Character(char c) {
value = c;
value = c.value;
}
+ @LATTICE("OUT<THIS,RETURNLOC=OUT,THISLOC=THIS")
public String toString() {
return ""+value;
}
}
@RETURNLOC("V")
- public static String toString(int i) {
- Integer I = new Integer(i);
+ public static String toString(@LOC("IN") int i) {
+ @LOC("C") Integer I = new Integer(i);
return I.toString();
}
* @since 1.0
* @status updated to 1.5
*/
+@LATTICE("V<C, V<O")
+@METHODDEFAULT("O<V,V<C,C<IN,C*,THISLOC=IN,RETURNLOC=O")
public final class Long //extends Number implements Comparable<Long>
{
/**
*
* @serial the wrapped long
*/
- private final long value;
+ @LOC("V") private final long value;
/**
* Create a <code>Long</code> object representing the value of the
import Vector;
+@LATTICE("V<C, V<O")
+@METHODDEFAULT("O<V,V<C,C<IN,C*,THISLOC=O,RETURNLOC=O")
public class String {
+
+ @LOC("V")
char value[];
+
+ @LOC("C")
int count;
+
+ @LOC("O")
int offset;
+
+ @LOC("V")
private int cachedHashcode;
private String() {
}
public String(char str[]) {
- char charstr[]=new char[str.length];
- for(int i=0; i<str.length; i++)
- charstr[i]=str[i];
- this.value=charstr;
- this.count=str.length;
- this.offset=0;
+ char charstr[] = new char[str.length];
+ for (int i = 0; i < str.length; i++)
+ charstr[i] = str[i];
+ this.value = charstr;
+ this.count = str.length;
+ this.offset = 0;
}
public String(byte str[]) {
- char charstr[]=new char[str.length];
- for(int i=0; i<str.length; i++)
- charstr[i]=(char)str[i];
- this.value=charstr;
- this.count=str.length;
- this.offset=0;
+ char charstr[] = new char[str.length];
+ for (int i = 0; i < str.length; i++)
+ charstr[i] = (char) str[i];
+ this.value = charstr;
+ this.count = str.length;
+ this.offset = 0;
}
public String(byte str[], int offset, int length) {
- if (length>(str.length-offset))
- length=str.length-offset;
- char charstr[]=new char[length];
- for(int i=0; i<length; i++)
- charstr[i]=(char)str[i+offset];
- this.value=charstr;
- this.count=length;
- this.offset=0;
+ if (length > (str.length - offset))
+ length = str.length - offset;
+ char charstr[] = new char[length];
+ for (int i = 0; i < length; i++)
+ charstr[i] = (char) str[i + offset];
+ this.value = charstr;
+ this.count = length;
+ this.offset = 0;
}
public String(byte str[], String encoding) {
int length = this.count;
- if (length>(str.length))
- length=str.length;
- char charstr[]=new char[length];
- for(int i=0; i<length; i++)
- charstr[i]=(char)str[i];
- this.value=charstr;
- this.count=length;
- this.offset=0;
+ if (length > (str.length))
+ length = str.length;
+ char charstr[] = new char[length];
+ for (int i = 0; i < length; i++)
+ charstr[i] = (char) str[i];
+ this.value = charstr;
+ this.count = length;
+ this.offset = 0;
}
public String(char str[], int offset, int length) {
- if (length>(str.length-offset))
- length=str.length-offset;
- char charstr[]=new char[length];
- for(int i=0; i<length; i++)
- charstr[i]=str[i+offset];
- this.value=charstr;
- this.count=length;
- this.offset=0;
+ if (length > (str.length - offset))
+ length = str.length - offset;
+ char charstr[] = new char[length];
+ for (int i = 0; i < length; i++)
+ charstr[i] = str[i + offset];
+ this.value = charstr;
+ this.count = length;
+ this.offset = 0;
}
public String(String str) {
- this.value=str.value;
- this.count=str.count;
- this.offset=str.offset;
+ this.value = str.value;
+ this.count = str.count;
+ this.offset = str.offset;
}
public String(StringBuffer strbuf) {
- value=new char[strbuf.length()];
- count=strbuf.length();
- offset=0;
- for(int i=0; i<count; i++)
- value[i]=strbuf.value[i];
+ value = new char[strbuf.length()];
+ count = strbuf.length();
+ offset = 0;
+ for (int i = 0; i < count; i++)
+ value[i] = strbuf.value[i];
}
public boolean endsWith(String suffix) {
return regionMatches(count - suffix.count, suffix, 0, suffix.count);
}
-
public String substring(int beginIndex) {
return substring(beginIndex, this.count);
}
}
public String substring(int beginIndex, int endIndex) {
- String str=new String();
- if (beginIndex>this.count||endIndex>this.count||beginIndex>endIndex) {
+ String str = new String();
+ if (beginIndex > this.count || endIndex > this.count || beginIndex > endIndex) {
// FIXME
- System.printString("Index error: "+beginIndex+" "+endIndex+" "+count+"\n"+this);
+ System.printString("Index error: " + beginIndex + " " + endIndex + " " + count + "\n" + this);
}
- str.value=this.value;
- str.count=endIndex-beginIndex;
- str.offset=this.offset+beginIndex;
+ str.value = this.value;
+ str.count = endIndex - beginIndex;
+ str.offset = this.offset + beginIndex;
return str;
}
}
public int lastIndexOf(char ch) {
- return this.lastindexOf((int)ch, count - 1);
+ return this.lastindexOf((int) ch, count - 1);
}
public static String concat2(String s1, String s2) {
- if (s1==null)
+ if (s1 == null)
return "null".concat(s2);
else
return s1.concat(s2);
}
public String concat(String str) {
- String newstr=new String();
- newstr.count=this.count+str.count;
- char charstr[]=new char[newstr.count];
- newstr.offset=0;
- for(int i=0; i<count; i++) {
- charstr[i]=value[i+offset];
+ String newstr = new String();
+ newstr.count = this.count + str.count;
+ char charstr[] = new char[newstr.count];
+ newstr.offset = 0;
+ for (int i = 0; i < count; i++) {
+ charstr[i] = value[i + offset];
}
- for(int i=0; i<str.count; i++) {
- charstr[i+count]=str.value[i+str.offset];
+ for (int i = 0; i < str.count; i++) {
+ charstr[i + count] = str.value[i + str.offset];
}
- newstr.value=charstr;
+ newstr.value = charstr;
return newstr;
}
public int lastindexOf(int ch, int fromIndex) {
- for(int i=fromIndex; i>0; i--)
- if (this.charAt(i)==ch)
+ for (int i = fromIndex; i > 0; i--)
+ if (this.charAt(i) == ch)
return i;
return -1;
}
public String replace(char oldch, char newch) {
- char[] buffer=new char[count];
- for(int i=0; i<count; i++) {
- char x=charAt(i);
- if (x==oldch)
- x=newch;
- buffer[i]=x;
+ char[] buffer = new char[count];
+ for (int i = 0; i < count; i++) {
+ char x = charAt(i);
+ if (x == oldch)
+ x = newch;
+ buffer[i] = x;
}
return new String(buffer);
}
public String toUpperCase() {
- char[] buffer=new char[count];
- for(int i=0; i<count; i++) {
- char x=charAt(i);
- if (x>='a'&&x<='z') {
- x=(char) ((x-'a')+'A');
+ char[] buffer = new char[count];
+ for (int i = 0; i < count; i++) {
+ char x = charAt(i);
+ if (x >= 'a' && x <= 'z') {
+ x = (char) ((x - 'a') + 'A');
}
- buffer[i]=x;
+ buffer[i] = x;
}
return new String(buffer);
}
public String toLowerCase() {
- char[] buffer=new char[count];
- for(int i=0; i<count; i++) {
- char x=charAt(i);
- if (x>='A'&&x<='Z') {
- x=(char) ((x-'A')+'a');
+ char[] buffer = new char[count];
+ for (int i = 0; i < count; i++) {
+ char x = charAt(i);
+ if (x >= 'A' && x <= 'Z') {
+ x = (char) ((x - 'A') + 'a');
}
- buffer[i]=x;
+ buffer[i] = x;
}
return new String(buffer);
}
}
public int indexOf(int ch, int fromIndex) {
- for(int i=fromIndex; i<count; i++)
- if (this.charAt(i)==ch)
+ for (int i = fromIndex; i < count; i++)
+ if (this.charAt(i) == ch)
return i;
return -1;
}
}
public int indexOf(String str, int fromIndex) {
- if (fromIndex<0)
- fromIndex=0;
- for(int i=fromIndex; i<=(count-str.count); i++)
+ if (fromIndex < 0)
+ fromIndex = 0;
+ for (int i = fromIndex; i <= (count - str.count); i++)
if (regionMatches(i, str, 0, str.count))
return i;
return -1;
}
public int lastIndexOf(String str, int fromIndex) {
- int k=count-str.count;
- if (k>fromIndex)
- k=fromIndex;
- for(; k>=0; k--) {
+ int k = count - str.count;
+ if (k > fromIndex)
+ k = fromIndex;
+ for (; k >= 0; k--) {
if (regionMatches(k, str, 0, str.count))
return k;
}
}
public int lastIndexOf(String str) {
- return lastIndexOf(str, count-str.count);
+ return lastIndexOf(str, count - str.count);
}
public boolean startsWith(String str) {
}
public boolean regionMatches(int toffset, String other, int ooffset, int len) {
- if (toffset<0 || ooffset <0 || (toffset+len)>count || (ooffset+len)>other.count)
+ if (toffset < 0 || ooffset < 0 || (toffset + len) > count || (ooffset + len) > other.count)
return false;
- for(int i=0; i<len; i++)
- if (other.value[i+other.offset+ooffset]!=
- this.value[i+this.offset+toffset])
+ for (int i = 0; i < len; i++)
+ if (other.value[i + other.offset + ooffset] != this.value[i + this.offset + toffset])
return false;
return true;
}
public char[] toCharArray() {
- char str[]=new char[count];
- for(int i=0; i<count; i++)
- str[i]=value[i+offset];
+ char str[] = new char[count];
+ for (int i = 0; i < count; i++)
+ str[i] = value[i + offset];
return str;
}
public byte[] getBytes() {
- byte str[]=new byte[count];
- for(int i=0; i<count; i++)
- str[i]=(byte)value[i+offset];
+ byte str[] = new byte[count];
+ for (int i = 0; i < count; i++)
+ str[i] = (byte) value[i + offset];
return str;
}
}
public void getChars(int srcBegin, int srcEnd, char dst[], int dstBegin) {
- if((srcBegin < 0) || (srcEnd > count) || (srcBegin > srcEnd)) {
+ if ((srcBegin < 0) || (srcEnd > count) || (srcBegin > srcEnd)) {
// FIXME
- System.printString("Index error: "+srcBegin+" "+srcEnd+" "+count+"\n"+this);
+ System.printString("Index error: " + srcBegin + " " + srcEnd + " " + count + "\n" + this);
System.exit(-1);
}
int len = srcEnd - srcBegin;
int j = dstBegin;
- for(int i=srcBegin; i<srcEnd; i++)
- dst[j++]=value[i+offset];
+ for (int i = srcBegin; i < srcEnd; i++)
+ dst[j++] = value[i + offset];
return;
}
}
public char charAt(int i) {
- return value[i+offset];
+ return value[i + offset];
}
public String toString() {
return this;
}
- public static String valueOf(Object o) {
- if (o==null)
+ public static String valueOf(@LOC("IN") Object o) {
+ if (o == null)
return "null";
else
return o.toString();
return new String("false");
}
- public static String valueOf(char c) {
- char ar[]=new char[1];
- ar[0]=c;
+ public static String valueOf(@LOC("IN") char c) {
+ @LOC("C") char ar[] = new char[1];
+ ar[0] = c;
return new String(ar);
}
- public static String valueOf(int x) {
- int length=0;
- int tmp;
- if (x<0)
- tmp=-x;
+ public static String valueOf(@LOC("IN") int x) {
+ @LOC("C") int length = 0;
+ @LOC("C") int tmp;
+ if (x < 0)
+ tmp = -x;
else
- tmp=x;
+ tmp = x;
do {
- tmp=tmp/10;
- length=length+1;
- } while(tmp!=0);
+ tmp = tmp / 10;
+ length = length + 1;
+ } while (tmp != 0);
- char chararray[];
- if (x<0)
- chararray=new char[length+1];
+ @LOC("C") char chararray[];
+ if (x < 0)
+ chararray = new char[length + 1];
else
- chararray=new char[length];
- int voffset;
- if (x<0) {
- chararray[0]='-';
- voffset=1;
- x=-x;
+ chararray = new char[length];
+ @LOC("C") int voffset;
+ if (x < 0) {
+ chararray[0] = '-';
+ voffset = 1;
+ x = -x;
} else
- voffset=0;
+ voffset = 0;
do {
- chararray[--length+voffset]=(char)(x%10+'0');
- x=x/10;
- } while (length!=0);
+ chararray[--length + voffset] = (char) (x % 10 + '0');
+ x = x / 10;
+ } while (length != 0);
return new String(chararray);
}
public static String valueOf(double val) {
- char[] chararray=new char[20];
- String s=new String();
- s.offset=0;
- s.count=convertdoubletochar(val, chararray);
- s.value=chararray;
+ char[] chararray = new char[20];
+ String s = new String();
+ s.offset = 0;
+ s.count = convertdoubletochar(val, chararray);
+ s.value = chararray;
return s;
}
- public static native int convertdoubletochar(double val, char [] chararray);
+ public static native int convertdoubletochar(double val, char[] chararray);
- public static String valueOf(long x) {
- int length=0;
- long tmp;
- if (x<0)
- tmp=-x;
+ public static String valueOf(@LOC("IN") long x) {
+ @LOC("C") int length = 0;
+ @LOC("C") long tmp;
+ if (x < 0)
+ tmp = -x;
else
- tmp=x;
+ tmp = x;
do {
- tmp=tmp/10;
- length=length+1;
- } while(tmp!=0);
+ tmp = tmp / 10;
+ length = length + 1;
+ } while (tmp != 0);
- char chararray[];
- if (x<0)
- chararray=new char[length+1];
+ @LOC("C") char chararray[];
+ if (x < 0)
+ chararray = new char[length + 1];
else
- chararray=new char[length];
- int voffset;
- if (x<0) {
- chararray[0]='-';
- voffset=1;
- x=-x;
+ chararray = new char[length];
+ @LOC("C") int voffset;
+ if (x < 0) {
+ chararray[0] = '-';
+ voffset = 1;
+ x = -x;
} else
- voffset=0;
+ voffset = 0;
do {
- chararray[--length+voffset]=(char)(x%10+'0');
- x=x/10;
- } while (length!=0);
+ chararray[--length + voffset] = (char) (x % 10 + '0');
+ x = x / 10;
+ } while (length != 0);
return new String(chararray);
}
public int compareTo(String s) {
- int smallerlength=count<s.count?count:s.count;
+ int smallerlength = count < s.count ? count : s.count;
- for( int i = 0; i < smallerlength; i++ ) {
+ for (int i = 0; i < smallerlength; i++) {
int valDiff = this.charAt(i) - s.charAt(i);
- if( valDiff != 0 ) {
+ if (valDiff != 0) {
return valDiff;
}
}
- return count-s.count;
+ return count - s.count;
}
public int hashCode() {
- if (cachedHashcode!=0)
+ if (cachedHashcode != 0)
return cachedHashcode;
- int hashcode=0;
- for(int i=0; i<count; i++)
- hashcode=hashcode*31+value[i+offset];
- cachedHashcode=hashcode;
+ @LOC("C") int hashcode = 0;
+ for (@LOC("C") int i = 0; i < count; i++)
+ hashcode = hashcode * 31 + value[i + offset];
+ cachedHashcode = hashcode;
return hashcode;
}
public boolean equals(Object o) {
- if (o.getType()!=getType())
+ if (o.getType() != getType())
return false;
- String s=(String)o;
- if (s.count!=count)
+ String s = (String) o;
+ if (s.count != count)
return false;
- for(int i=0; i<count; i++) {
- if (s.value[i+s.offset]!=value[i+offset])
+ for (int i = 0; i < count; i++) {
+ if (s.value[i + s.offset] != value[i + offset])
return false;
}
return true;
}
public boolean equalsIgnoreCase(String s) {
- if (s.count!=count)
+ if (s.count != count)
return false;
- for(int i=0; i<count; i++) {
- char l=s.value[i+s.offset];
- char r=value[i+offset];
- if (l>='a'&&l<='z')
- l=(char)((l-'a')+'A');
- if (r>='a'&&r<='z')
- r=(char)((r-'a')+'A');
- if (l!=r)
+ for (int i = 0; i < count; i++) {
+ char l = s.value[i + s.offset];
+ char r = value[i + offset];
+ if (l >= 'a' && l <= 'z')
+ l = (char) ((l - 'a') + 'A');
+ if (r >= 'a' && r <= 'z')
+ r = (char) ((r - 'a') + 'A');
+ if (l != r)
return false;
}
return true;
public Vector split() {
Vector splitted = new Vector();
int i;
- int cnt =0;
+ int cnt = 0;
// skip first spaces
- for(i = 0; i< count; i++) {
- if(value[i+offset] != '\n' && value[i+offset] != '\t' && value[i+offset] != ' ')
+ for (i = 0; i < count; i++) {
+ if (value[i + offset] != '\n' && value[i + offset] != '\t' && value[i + offset] != ' ')
break;
}
- int oldi=i;
+ int oldi = i;
- while(i<count) {
- if(value[i+offset] == '\n' || value[i+offset] == '\t' || value[i+offset] == ' ') {
- String t=new String();
- t.value=value;
- t.offset=oldi;
- t.count=i-oldi;
+ while (i < count) {
+ if (value[i + offset] == '\n' || value[i + offset] == '\t' || value[i + offset] == ' ') {
+ String t = new String();
+ t.value = value;
+ t.offset = oldi;
+ t.count = i - oldi;
splitted.addElement(t);
// skip extra spaces
- while( i < count && ( value[i+offset] == '\n' || value[i+offset] == '\t' || value[i+offset] == ' ')) {
+ while (i < count
+ && (value[i + offset] == '\n' || value[i + offset] == '\t' || value[i + offset] == ' ')) {
i++;
}
- oldi=i;
+ oldi = i;
} else {
i++;
}
}
- if(i!=oldi) {
- String t=new String();
- t.value=value;
- t.offset=oldi;
- t.count=i-oldi;
+ if (i != oldi) {
+ String t = new String();
+ t.value = value;
+ t.offset = oldi;
+ t.count = i - oldi;
splitted.addElement(t);
}
}
public boolean contains(String str) {
- int i,j;
+ int i, j;
char[] strChar = str.toCharArray();
int cnt;
- for(i = 0; i < count; i++) {
- if(value[i] == strChar[0]) {
- cnt=0;
- for(j=0; j < str.length() && i+j < count; j++) {
- if(value[i+j] == strChar[j])
+ for (i = 0; i < count; i++) {
+ if (value[i] == strChar[0]) {
+ cnt = 0;
+ for (j = 0; j < str.length() && i + j < count; j++) {
+ if (value[i + j] == strChar[j])
cnt++;
}
- if(cnt == str.length())
+ if (cnt == str.length())
return true;
}
}
public String trim() {
int len = count;
int st = 0;
- int off = offset; /* avoid getfield opcode */
- char[] val = value; /* avoid getfield opcode */
+ int off = offset; /* avoid getfield opcode */
+ char[] val = value; /* avoid getfield opcode */
while ((st < len) && (val[off + st] <= ' ')) {
st++;
while ((st < len) && (val[off + len - 1] <= ' ')) {
len--;
}
- return ((st > 0) || (len < count))?substring(st, len):this;
+ return ((st > 0) || (len < count)) ? substring(st, len) : this;
}
public boolean matches(String regex) {
+@LATTICE("V<C, V<O")
+@METHODDEFAULT("O<V,V<C,C<IN,C*,THISLOC=O,RETURNLOC=O")
public class StringBuffer {
+ @LOC("V")
char value[];
+ @LOC("C")
int count;
- // private static final int DEFAULTSIZE=16;
+
+ // private static final int DEFAULTSIZE=16;
public StringBuffer(String str) {
- value=new char[str.count+16]; //16 is DEFAULTSIZE
- count=str.count;
- for(int i=0; i<count; i++)
- value[i]=str.value[i+str.offset];
+ value = new char[str.count + 16]; // 16 is DEFAULTSIZE
+ count = str.count;
+ for (int i = 0; i < count; i++)
+ value[i] = str.value[i + str.offset];
}
public StringBuffer() {
- value=new char[16]; //16 is DEFAULTSIZE
- count=0;
+ value = new char[16]; // 16 is DEFAULTSIZE
+ count = 0;
}
public StringBuffer(int i) {
- value=new char[i];
- count=0;
+ value = new char[i];
+ count = 0;
}
public int length() {
return value[x];
}
- public StringBuffer append(char c) {
+ public StringBuffer append(@LOC("IN") char c) {
return append(String.valueOf(c));
}
- public StringBuffer append(String s) {
- if ((s.count+count)>value.length) {
+ public StringBuffer append(@LOC("IN") String s) {
+ if ((s.count + count) > value.length) {
// Need to allocate
- char newvalue[]=new char[s.count+count+16]; //16 is DEFAULTSIZE
- for(int i=0; i<count; i++)
- newvalue[i]=value[i];
- for(int i=0; i<s.count; i++)
- newvalue[i+count]=s.value[i+s.offset];
- value=newvalue;
- count+=s.count;
+ @LOC("C") char newvalue[] = new char[s.count + count + 16]; // 16 is
+ // DEFAULTSIZE
+ for (@LOC("C") int i = 0; i < count; i++)
+ newvalue[i] = value[i];
+ for (@LOC("C") int i = 0; i < s.count; i++)
+ newvalue[i + count] = s.value[i + s.offset];
+ value = newvalue;
+ count += s.count;
} else {
- for(int i=0; i<s.count; i++) {
- value[i+count]=s.value[i+s.offset];
+ for (@LOC("C") int i = 0; i < s.count; i++) {
+ value[i + count] = s.value[i + s.offset];
}
- count+=s.count;
+ count += s.count;
}
return this;
}
public void ensureCapacity(int i) {
- int size=2*count;
- if (i>size)
- size=i;
- if (i>value.length) {
- char newvalue[]=new char[i];
- for(int ii=0; ii<count; ii++)
- newvalue[ii]=value[ii];
- value=newvalue;
+ int size = 2 * count;
+ if (i > size)
+ size = i;
+ if (i > value.length) {
+ char newvalue[] = new char[i];
+ for (int ii = 0; ii < count; ii++)
+ newvalue[ii] = value[ii];
+ value = newvalue;
}
}
public StringBuffer append(StringBuffer s) {
- if ((s.count+count)>value.length) {
+ if ((s.count + count) > value.length) {
// Need to allocate
- char newvalue[]=new char[s.count+count+16]; //16 is DEFAULTSIZE
- for(int i=0; i<count; i++)
- newvalue[i]=value[i];
- for(int i=0; i<s.count; i++)
- newvalue[i+count]=s.value[i];
- value=newvalue;
- count+=s.count;
+ char newvalue[] = new char[s.count + count + 16]; // 16 is DEFAULTSIZE
+ for (int i = 0; i < count; i++)
+ newvalue[i] = value[i];
+ for (int i = 0; i < s.count; i++)
+ newvalue[i + count] = s.value[i];
+ value = newvalue;
+ count += s.count;
} else {
- for(int i=0; i<s.count; i++) {
- value[i+count]=s.value[i];
+ for (int i = 0; i < s.count; i++) {
+ value[i + count] = s.value[i];
}
- count+=s.count;
+ count += s.count;
}
return this;
}
public synchronized StringBuffer replace(int start, int end, String str) {
if (start < 0) {
// FIXME
- System.printString("StringIndexOutOfBoundsException: "+start+"\n");
+ System.printString("StringIndexOutOfBoundsException: " + start + "\n");
}
if (start > count) {
// FIXME
void expandCapacity(int minimumCapacity) {
int newCapacity = (value.length + 1) * 2;
if (newCapacity < 0) {
- newCapacity = 0x7fffffff /*Integer.MAX_VALUE*/;
+ newCapacity = 0x7fffffff /* Integer.MAX_VALUE */;
} else if (minimumCapacity > newCapacity) {
newCapacity = minimumCapacity;
}
* @version 0.0.7 12/12/99\r
* @since 0.0.5\r
*/\r
-@LATTICE("ST,DE<OUT,DE<FIL,DE<LA,O,EQ,PA,INIT,DE*")\r
+@LATTICE("OUT<DE,DE<FILTER,FILTER<FACTORS,FACTORS<EQ,EQ<PARAM,PARAM<INIT")\r
+@METHODDEFAULT("THIS,THISLOC=THIS,RETURNLOC=THIS")\r
public class Decoder implements DecoderErrors {\r
+\r
static private final Params DEFAULT_PARAMS = new Params();\r
\r
/**\r
// @LOC("DE")\r
// private LayerIDecoder l1decoder;\r
\r
- @LOC("O")\r
+ @LOC("OUT")\r
private int outputFrequency;\r
- @LOC("O")\r
+ @LOC("OUT")\r
private int outputChannels;\r
\r
@LOC("EQ")\r
private Equalizer equalizer = new Equalizer();\r
\r
- @LOC("PA")\r
+ @LOC("PARAM")\r
private Params params;\r
\r
@LOC("INIT")\r
* \r
* @return A SampleBuffer containing the decoded samples.\r
*/\r
- @LATTICE("O<DE,DE<TH,TH<IN,THISLOC=TH")\r
- @RETURNLOC("O")\r
- public Obuffer decodeFrame(@LOC("IN") Header header) throws DecoderException {\r
+ @LATTICE("THIS<VAR,THISLOC=THIS,VAR*")\r
+ public void decodeFrame(@LOC("VAR") Header header) throws DecoderException {\r
\r
if (!initialized) {\r
- float scalefactor = 32700.0f;\r
+ @LOC("VAR") float scalefactor = 32700.0f;\r
\r
- int mode = header.mode();\r
- int layer = header.layer();\r
- int channels = mode == Header.SINGLE_CHANNEL ? 1 : 2;\r
+ @LOC("VAR") int mode = header.mode();\r
+ @LOC("VAR") int layer = header.layer();\r
+ @LOC("VAR") int channels = mode == Header.SINGLE_CHANNEL ? 1 : 2;\r
\r
// set up output buffer if not set up by client.\r
// if (output == null)\r
// output = new SampleBuffer(header.frequency(), channels);\r
SampleBufferWrapper.init(header.frequency(), channels);\r
\r
- float[] factors = equalizer.getBandFactors();\r
- SynthesisFilter filter1 = new SynthesisFilter(0, scalefactor, factors);\r
+ @LOC("THIS,Decoder.FACTORS") float[] factors = equalizer.getBandFactors();\r
+ @LOC("THIS,Decoder.FILTER") SynthesisFilter filter1 =\r
+ new SynthesisFilter(0, scalefactor, factors);\r
\r
// REVIEW: allow mono output for stereo\r
- SynthesisFilter filter2 = null;\r
+ @LOC("THIS,Decoder.FILTER") SynthesisFilter filter2 = null;\r
if (channels == 2) {\r
filter2 = new SynthesisFilter(1, scalefactor, factors);\r
}\r
initialized = true;\r
}\r
\r
- @LOC("TH") int layer = header.layer();\r
-\r
SampleBufferWrapper.getOutput().clear_buffer();\r
- // output.clear_buffer();\r
-\r
- // @LOC("DE,Decoder.DE") FrameDecoder decoder = retrieveDecoder(header,\r
- // stream, layer);\r
- // decoder.decodeFrame();\r
-\r
l3decoder.decodeFrame(header);\r
-\r
SampleBufferWrapper.getOutput().write_buffer(1);\r
- // output.write_buffer(1);\r
\r
- // return output;\r
}\r
\r
/**\r
* Class for extracting information from a frame header.
*/
@LATTICE("HI<HNS,HNS<H,C<H,NS<FS,FS<H,FS<HV,H<SYNC,HV<SYNC,HV<T,SYNC*,HV*,FS*,HI*")
-@METHODDEFAULT("OUT<V,V<THIS,THIS<SH,SH<IN,SH*,THISLOC=THIS,GLOBALLOC=IN")
+// @METHODDEFAULT("OUT<V,V<THIS,THIS<SH,SH<IN,SH*,THISLOC=THIS,GLOBALLOC=IN")
+@METHODDEFAULT("THIS,THISLOC=THIS,RETURNLOC=THIS")
public final class Header {
public static final int[][] frequencies = { { 22050, 24000, 16000, 1 },
@LOC("T")
private int _headerstring = -1; // E.B
+ @LOC("T")
private SideInfoBuffer sib;
+ @LOC("T")
private BitReserve br;
Header() {
}
+ @LATTICE("OUT<BUF,BUF<THIS,THISLOC=THIS,RETURNLOC=OUT")
public String toString() {
- StringBuffer buffer = new StringBuffer(200);
+ @LOC("BUF") StringBuffer buffer = new StringBuffer(200);
buffer.append("Layer ");
buffer.append(layer_string());
buffer.append(" frame ");
buffer.append(' ');
buffer.append(bitrate_string());
- String s = buffer.toString();
+ @LOC("OUT") String s = buffer.toString();
return s;
}
boolean sync = false;
do {
headerstring = stream.syncHeader(syncmode);
- if(headerstring==-1){
+ if (headerstring == -1) {
return -1;
}
_headerstring = headerstring; // E.B
/**
* Returns version.
*/
- @RETURNLOC("OUT")
public int version() {
return h_version;
}
/**
* Returns Layer ID.
*/
- @RETURNLOC("OUT")
public int layer() {
return h_layer;
}
/**
* Returns bitrate index.
*/
- @RETURNLOC("OUT")
public int bitrate_index() {
return h_bitrate_index;
}
/**
* Returns Mode.
*/
- @RETURNLOC("OUT")
public int mode() {
return h_mode;
}
/**
* Returns Slots.
*/
- @RETURNLOC("OUT")
public int slots() {
return nSlots;
}
/**
* Returns Mode Extension.
*/
- @RETURNLOC("OUT")
public int mode_extension() {
return h_mode_extension;
}
// E.B -> private to public
- @LOC("T")
public static final int bitrates[][][] = {
{
{ 0 /* free format */, 32000, 48000, 56000, 64000, 80000, 96000, 112000, 128000, 144000,
*
* @return milliseconds per frame
*/
+ @LATTICE("OUT<THIS,THISLOC=THIS,RETURNLOC=OUT")
public float ms_per_frame() // E.B
{
if (h_vbr == true) {
- double tpf = h_vbr_time_per_frame[layer()] / frequency();
+ @LOC("OUT") double tpf = h_vbr_time_per_frame[layer()] / frequency();
if ((h_version == MPEG2_LSF) || (h_version == MPEG25_LSF))
tpf /= 2;
return ((float) (tpf * 1000));
} else {
- float ms_per_frame_array[][] =
+ @LOC("OUT") float ms_per_frame_array[][] =
{ { 8.707483f, 8.0f, 12.0f }, { 26.12245f, 24.0f, 36.0f }, { 26.12245f, 24.0f, 36.0f } };
return (ms_per_frame_array[h_layer - 1][h_sample_frequency]);
}
}
// E.B -> private to public
- @LOC("T")
public static final String bitrate_str[][][] = {
{
{ "free format", "32 kbit/s", "48 kbit/s", "56 kbit/s", "64 kbit/s", "80 kbit/s",
*
* @return number of subbands
*/
- @RETURNLOC("OUT")
public int number_of_subbands() {
return h_number_of_subbands;
}
*
* @return intensity
*/
- @RETURNLOC("OUT")
public int intensity_stereo_bound() {
return h_intensity_stereo_bound;
}
// llth added for decode
// @LATTICE("IS1D*,RO<IS1D,IS1D<SI2,SI2<SI1,SI<P2S,SF1<CH0,SF0*,SFB_SH<NS,NS<SI,SFB_SH*,SFB<SFB_SH,C,C*,SI1<SF2,SF2<SFB,SF1<BR,LR*,OUT<LR,LR<RO,NZ*,SI<SF1,SI1<NZ,NZ<SI,SI1<SBI,SBI<SI,BUF<FT,SF1<SF0,SF0<HD1,BR<ST,ST,FT<SP,SP<OUT,OUT<SI1,SI1<SI,P2S<CH0,CH0<MAX0,MAX0<BR1,FS<BR1,BR1<BR,BR<HD1,HD1<HD,OUT*,BR1*,SI1*,MAX0*,CH0*,RAW,TS,F,C,K,LY,VAR,IR,IP,CSH,GLSFD3,GLSFD4,GLSFD5,GLSFF4,GLSFF2,GLSFF3,GLSFF1,GSF4,GSF5,GSF1,GSF2,GSF3,HD2,HD3,BT,GR,RO6,RO5,RO9,RO8,RO7,RO4,RO1,RO3,RO2,SH,ME,TMP2,S,LSF,J")
@LATTICE("ISR*,ISP*,LR<ISR,ISR<ISP,SI1<SF2,NS*,HD<ST,IS1D*,RO1<RO,RO1*,RO<IS1D,IS1D<SI2,SI2<SI1,BR<NS,NS<SI,SFB_SH*,SFB<SFB_SH,C,C*,SF2<SFB,LR*,OUT<LR,ISP<RO1,NZ*,SI<SF1,BR1<NZ,NZ<BR,SI1<RT,RT<SBI,SBI<SI,BUF<FT,SF1<CH0,CH0<HD1,FT<SP,SP<OUT,OUT<SI1,SI1<SI,SFB_SH<BR1,BR1<BR,HD1<HD,OUT*,BR1*,SI1*,CH0*,RAW,TS,F,C,K,LY,VAR,IR,IP,CSH,GLSFD3,GLSFD4,GLSFD5,GLSFF4,GLSFF2,GLSFF3,GLSFF1,GSF4,GSF5,GSF1,GSF2,GSF3,HD2,HD3,BT,GR,RO6,RO5,RO9,RO8,RO7,RO4,RO1,RO3,RO2,SH,ME,TMP2,S,LSF,J")
-@METHODDEFAULT("OUT<V,V<THIS,THIS<SH,SH<IN,SH*,THISLOC=THIS,GLOBALLOC=IN")
+@METHODDEFAULT("OUT<V,V<THIS,THIS<SH,SH<IN,SH*,THISLOC=THIS,GLOBALLOC=IN,RETURNLOC=OUT")
final class LayerIIIDecoder implements FrameDecoder {
static final double d43 = (4.0 / 3.0);
@LOC("SFB")
@LOC("SBI")
private int sfreq;
+ @LOC("ST")
private int part2_start;
+ @LOC("ST")
private boolean initialized = false;
// constructor for the linear type system
}
- private void init(Header header) {
+ @LATTICE("THIS<C,THIS<IN,C*,THISLOC=THIS")
+ private void init(@LOC("IN") Header header) {
frame_start = 0;
channels = (header.mode() == Header.SINGLE_CHANNEL) ? 1 : 2;
first_channel = last_channel = 0;
}
- for (@LOC("CH") int ch = 0; ch < 2; ch++)
- for (@LOC("J") int j = 0; j < 576; j++)
+ for (@LOC("C") int ch = 0; ch < 2; ch++)
+ for (@LOC("C") int j = 0; j < 576; j++)
prevblck[ch][j] = 0.0f;
nonzero[0] = nonzero[1] = 576;
br = new BitReserve();
}
- public void decodeFrame(Header header) {
+ public void decodeFrame(@LOC("IN") Header header) {
decode(header);
}
*/
// @LATTICE("BYTE<THIS,THIS<MAIN,MAIN<VAR,THIS<GR,GR<VAR,BYTE*,GR*,THISLOC=THIS,GLOBALLOC=VAR")
@LATTICE("VAR<THIS,C<THIS,THIS<IN,THISLOC=THIS,C*,VAR*")
- public void decode(Header header) {
+ public void decode(@LOC("IN") Header header) {
if (!initialized) {
init(header);
* Reads the side info from the stream, assuming the entire. frame has been
* read already. Mono : 136 bits (= 17 bytes) Stereo : 256 bits (= 32 bytes)
*/
- private boolean get_side_info(Header header) {
+ @LATTICE("THIS<C,C<IN,C*,THISLOC=THIS,RETURNLOC=THIS")
+ private boolean get_side_info(@LOC("IN") Header header) {
- SideInfoBuffer sib = header.getSideInfoBuffer();
+ @LOC("IN") SideInfoBuffer sib = header.getSideInfoBuffer();
- int ch, gr;
+ @LOC("C") int ch;
+ @LOC("C") int gr;
// System.out.println("#get_side_info");
if (header.version() == Header.MPEG1) {
*
*/
@LATTICE("THIS<IN,THISLOC=THIS,GLOBALLOC=IN")
- private void get_scale_factors(Header header, @LOC("THIS,LayerIIIDecoder.CH0") int ch,
+ private void get_scale_factors(@LOC("IN") Header header, @LOC("THIS,LayerIIIDecoder.CH0") int ch,
@LOC("THIS,LayerIIIDecoder.CH0") int gr) {
// gr_info_s gr_info = (si.ch[ch].gr[gr]); remove alias
// ssjava
@LATTICE("M<THIS,THIS<IN,THIS<C,C*,M*,THISLOC=THIS,GLOBALLOC=THIS")
- private void get_LSF_scale_data(Header header, @LOC("THIS,LayerIIIDecoder.CH0") int ch,
- @LOC("THIS,LayerIIIDecoder.CH0") int gr) {
+ private void get_LSF_scale_data(@LOC("IN") Header header,
+ @LOC("THIS,LayerIIIDecoder.CH0") int ch, @LOC("THIS,LayerIIIDecoder.CH0") int gr) {
@LOC("THIS,LayerIIIDecoder.HD1") int mode_ext = header.mode_extension();
// @LOC("THIS,LayerIIIDecoder.GLSFD1") gr_info_s gr_info =
*
*/
@LATTICE("THIS<IN,THISLOC=THIS,GLOBALLOC=IN")
- private void get_LSF_scale_factors(Header header, @LOC("THIS,LayerIIIDecoder.CH0") int ch,
- @LOC("THIS,LayerIIIDecoder.CH0") int gr) {
+ private void get_LSF_scale_factors(@LOC("IN") Header header,
+ @LOC("THIS,LayerIIIDecoder.CH0") int ch, @LOC("THIS,LayerIIIDecoder.CH0") int gr) {
@LOC("THIS,LayerIIIDecoder.SFB_SH") int sfb;
@LOC("THIS,LayerIIIDecoder.SFB_SH") int m = 0;
@LOC("SI1")
int w[] = { 0 };
- private void huffman_decode(int ch, int gr) {
+ private void huffman_decode(@LOC("THIS,LayerIIIDecoder.CH0") int ch,
+ @LOC("THIS,LayerIIIDecoder.CH0") int gr) {
x[0] = 0;
y[0] = 0;
v[0] = 0;
w[0] = 0;
- int part2_3_end = part2_start + si.ch[ch].gr[gr].part2_3_length;
- int num_bits;
- int region1Start;
- int region2Start;
- int index;
-
- int buf, buf1;
+ @LOC("THIS,LayerIIIDecoder.BR,BitReserve.BIT") int part2_3_end =
+ part2_start + si.ch[ch].gr[gr].part2_3_length;
+ @LOC("THIS,LayerIIIDecoder.BR,BitReserve.BIT") int num_bits;
+ @LOC("THIS,LayerIIIDecoder.SI1") int region1Start;
+ @LOC("THIS,LayerIIIDecoder.SI1") int region2Start;
+ @LOC("THIS,LayerIIIDecoder.BR,BitReserve.BIT") int index;
- huffcodetab h;
+ @LOC("THIS,LayerIIIDecoder.SI1") int buf;
+ @LOC("THIS,LayerIIIDecoder.SI1") int buf1;
// Find region boundary for short block case
index = 0;
// Read bigvalues area
- for (int i = 0; i < (si.ch[ch].gr[gr].big_values << 1); i += 2) {
+ for (@LOC("THIS,LayerIIIDecoder.BR,BitReserve.BIT") int i = 0; i < (si.ch[ch].gr[gr].big_values << 1); i +=
+ 2) {
- int htIdx;
+ @LOC("THIS,LayerIIIDecoder.BR,BitReserve.BIT") int htIdx;
if (i < region1Start) {
htIdx = si.ch[ch].gr[gr].table_select[0];
// h = huffcodetab.ht[si.ch[ch].gr[gr].table_select[0]];
// Read count1 area
- int htIdx = si.ch[ch].gr[gr].count1table_select + 32;
+ @LOC("THIS,LayerIIIDecoder.BR,BitReserve.BIT") int htIdx = si.ch[ch].gr[gr].count1table_select + 32;
// h = huffcodetab.ht[si.ch[ch].gr[gr].count1table_select + 32];
num_bits = br.hsstell();
// ssjava
@LATTICE("IO<THIS,THIS<IN,THISLOC=THIS,GLOBALLOC=IN")
- private void stereo(Header header, @LOC("THIS,LayerIIIDecoder.CH0") int gr) {
+ private void stereo(@LOC("IN") Header header, @LOC("THIS,LayerIIIDecoder.CH0") int gr) {
@LOC("THIS,LayerIIIDecoder.RO1") int sb;
@LOC("THIS,LayerIIIDecoder.RO1") int ss;
@LOC("THIS,LayerIIIDecoder.SI1") int ss;
@LOC("THIS,LayerIIIDecoder.SI,LayerIIIDecoder$III_side_info_t.CH,LayerIIIDecoder$temporaire.GR2") int sb18lim;
-// @LOC("THIS,LayerIIIDecoder.SI,LayerIIIDecoder$III_side_info_t.CH,LayerIIIDecoder$temporaire.GR1") gr_info_s gr_info =
-// (si.ch[ch].gr[gr]);
+ // @LOC("THIS,LayerIIIDecoder.SI,LayerIIIDecoder$III_side_info_t.CH,LayerIIIDecoder$temporaire.GR1")
+ // gr_info_s gr_info =
+ // (si.ch[ch].gr[gr]);
// 31 alias-reduction operations between each pair of sub-bands
// with 8 butterflies between each pair
* @since 0.0.7\r
*/\r
@LATTICE("B<T")\r
-@METHODDEFAULT("OUT<IN")\r
+@METHODDEFAULT("OUT<THIS,THIS<IN,THISLOC=THIS,RETURNLOC=OUT")\r
public class OutputChannels {\r
/**\r
* Flag to indicate output should include both channels.\r
*/\r
public static final int DOWNMIX_CHANNELS = 3;\r
\r
- @LOC("B")\r
public static final OutputChannels LEFT = new OutputChannels(LEFT_CHANNEL);\r
- @LOC("B")\r
public static final OutputChannels RIGHT = new OutputChannels(RIGHT_CHANNEL);\r
- @LOC("B")\r
public static final OutputChannels BOTH = new OutputChannels(BOTH_CHANNELS);\r
- @LOC("B")\r
public static final OutputChannels DOWNMIX = new OutputChannels(DOWNMIX_CHANNELS);\r
\r
@LOC("T")\r
public boolean play(@LOC("IN") int frames) throws JavaLayerException {\r
@LOC("IN") boolean ret = true;\r
\r
- int count = 0;\r
SSJAVA: while (frames-- > 0 && ret) {\r
ret = decodeFrame();\r
}\r
* \r
* @return true if there are no more frames to decode, false otherwise.\r
*/\r
- @LATTICE("O<TH,THISLOC=TH")\r
- @RETURNLOC("O")\r
+ @LATTICE("C,O<THIS,THIS<IN,C*,THISLOC=THIS,RETURNLOC=O")\r
protected boolean decodeFrame() throws JavaLayerException {\r
try {\r
// AudioDevice out = audio;\r
// return false;\r
\r
// Header h = bitstream.readFrame();\r
- Header h = BitstreamWrapper.readFrame();\r
+ @LOC("IN") Header h = BitstreamWrapper.readFrame();\r
\r
if (h == null)\r
return false;\r
decoder.decodeFrame(h);\r
\r
// eom debug\r
- int sum = 0;\r
- short[] outbuf = SampleBufferWrapper.getOutput().getBuffer();\r
+ @LOC("C") int sum = 0;\r
+ @LOC("C") short[] outbuf = SampleBufferWrapper.getBuffer();\r
// short[] outbuf = output.getBuffer();\r
- for (int i = 0; i < SampleBufferWrapper.getOutput().getBufferLength(); i++) {\r
+ for (@LOC("C") int i = 0; i < SampleBufferWrapper.getBufferLength(); i++) {\r
// System.out.println(outbuf[i]);\r
sum += outbuf[i];\r
}\r
return output;
}
+ @TRUST
+ static short[] getBuffer() {
+ return output.getBuffer();
+ }
+
+ @TRUST
+ static int getBufferLength() {
+ return output.getBufferLength();
+ }
+
+ @TRUST
+ static void appendSamples(int channel, float[] f) {
+ output.appendSamples(channel, f);
+ }
+
}
+@LATTICE("BUF<IDX,V,IDX*")
+@METHODDEFAULT("THIS<IN,THISLOC=THIS,RETURNLOC=THIS")
public class SideInfoBuffer {
- /**
- * The frame buffer that holds the data for the current frame.
- */
- private final int[] framebuffer = new int[BUFFER_INT_SIZE];
+ /**
+ * The frame buffer that holds the data for the current frame.
+ */
+ @LOC("BUF")
+ private final int[] framebuffer = new int[BUFFER_INT_SIZE];
- /**
- * Maximum size of the frame buffer.
- */
- private static final int BUFFER_INT_SIZE = 433;
+ /**
+ * Maximum size of the frame buffer.
+ */
+ private static final int BUFFER_INT_SIZE = 433;
- /**
- * Index into <code>framebuffer</code> where the next bits are retrieved.
- */
- private int wordpointer;
+ /**
+ * Index into <code>framebuffer</code> where the next bits are retrieved.
+ */
+ @LOC("IDX")
+ private int wordpointer;
- /**
- * Number (0-31, from MSB to LSB) of next bit for get_bits()
- */
- private int bitindex;
+ /**
+ * Number (0-31, from MSB to LSB) of next bit for get_bits()
+ */
+ @LOC("IDX")
+ private int bitindex;
- private int main_data_begin;
+ @LOC("V")
+ private int main_data_begin;
- public int getMain_data_begin() {
- return main_data_begin;
- }
+ public int getMain_data_begin() {
+ return main_data_begin;
+ }
- public void setMain_data_begin(int main_data_begin) {
- this.main_data_begin = main_data_begin;
- }
+ public void setMain_data_begin(@LOC("IN") int main_data_begin) {
+ this.main_data_begin = main_data_begin;
+ }
- private final int bitmask[] = {
- 0, // dummy
- 0x00000001, 0x00000003, 0x00000007, 0x0000000F, 0x0000001F,
- 0x0000003F, 0x0000007F, 0x000000FF, 0x000001FF, 0x000003FF,
- 0x000007FF, 0x00000FFF, 0x00001FFF, 0x00003FFF, 0x00007FFF,
- 0x0000FFFF, 0x0001FFFF };
+ private static final int bitmask[] = {
+ 0, // dummy
+ 0x00000001, 0x00000003, 0x00000007, 0x0000000F, 0x0000001F, 0x0000003F, 0x0000007F,
+ 0x000000FF, 0x000001FF, 0x000003FF, 0x000007FF, 0x00000FFF, 0x00001FFF, 0x00003FFF,
+ 0x00007FFF, 0x0000FFFF, 0x0001FFFF };
- public int get_bits(int number_of_bits) {
- int returnvalue = 0;
- int sum = bitindex + number_of_bits;
- // System.out.println("bitindex=" + bitindex + " wordpointer="
- // + wordpointer);
- // E.B
- // There is a problem here, wordpointer could be -1 ?!
- if (wordpointer < 0)
- wordpointer = 0;
- // E.B : End.
+ @LATTICE("OUT<THIS,THIS<IN,THISLOC=THIS,RETURNLOC=OUT")
+ public int get_bits(@LOC("IN") int number_of_bits) {
+ @LOC("OUT") int returnvalue = 0;
+ @LOC("THIS,SideInfoBuffer.IDX") int sum = bitindex + number_of_bits;
+ // System.out.println("bitindex=" + bitindex + " wordpointer="
+ // + wordpointer);
+ // E.B
+ // There is a problem here, wordpointer could be -1 ?!
+ if (wordpointer < 0)
+ wordpointer = 0;
+ // E.B : End.
- if (sum <= 32) {
- // all bits contained in *wordpointer
- returnvalue = (framebuffer[wordpointer] >>> (32 - sum))
- & bitmask[number_of_bits];
- // returnvalue = (wordpointer[0] >> (32 - sum)) &
- // bitmask[number_of_bits];
- if ((bitindex += number_of_bits) == 32) {
- bitindex = 0;
- wordpointer++; // added by me!
- }
- return returnvalue;
- }
+ if (sum <= 32) {
+ // all bits contained in *wordpointer
+ returnvalue = (framebuffer[wordpointer] >>> (32 - sum)) & bitmask[number_of_bits];
+ // returnvalue = (wordpointer[0] >> (32 - sum)) &
+ // bitmask[number_of_bits];
+ if ((bitindex += number_of_bits) == 32) {
+ bitindex = 0;
+ wordpointer++; // added by me!
+ }
+ return returnvalue;
+ }
- // E.B : Check that ?
- // ((short[])&returnvalue)[0] = ((short[])wordpointer + 1)[0];
- // wordpointer++; // Added by me!
- // ((short[])&returnvalue + 1)[0] = ((short[])wordpointer)[0];
- int Right = (framebuffer[wordpointer] & 0x0000FFFF);
- wordpointer++;
- int Left = (framebuffer[wordpointer] & 0xFFFF0000);
- returnvalue = ((Right << 16) & 0xFFFF0000)
- | ((Left >>> 16) & 0x0000FFFF);
+ // E.B : Check that ?
+ // ((short[])&returnvalue)[0] = ((short[])wordpointer + 1)[0];
+ // wordpointer++; // Added by me!
+ // ((short[])&returnvalue + 1)[0] = ((short[])wordpointer)[0];
+ @LOC("THIS,SideInfoBuffer.IDX") int Right = (framebuffer[wordpointer] & 0x0000FFFF);
+ wordpointer++;
+ @LOC("THIS,SideInfoBuffer.IDX") int Left = (framebuffer[wordpointer] & 0xFFFF0000);
+ returnvalue = ((Right << 16) & 0xFFFF0000) | ((Left >>> 16) & 0x0000FFFF);
- returnvalue >>>= 48 - sum; // returnvalue >>= 16 - (number_of_bits - (32
- // - bitindex))
- returnvalue &= bitmask[number_of_bits];
- bitindex = sum - 32;
- return returnvalue;
- }
+ returnvalue >>>= 48 - sum; // returnvalue >>= 16 - (number_of_bits - (32
+ // - bitindex))
+ returnvalue &= bitmask[number_of_bits];
+ bitindex = sum - 32;
+ return returnvalue;
+ }
- public void setBuffer(int idx, int value) {
- framebuffer[idx] = value;
- }
+ public void setBuffer(int idx, int value) {
+ framebuffer[idx] = value;
+ }
}
* from 32, 44.1 or 48 kHz to 8 kHz, if ULAW is defined. Frequencies above 4 kHz\r
* are removed by ignoring higher subbands.\r
*/\r
+@LATTICE("OUT<V,V<SAMPLE,SAMPLE<EQ,EQ<IDX")\r
final class SynthesisFilter {\r
- private int vcount = 0;\r
+\r
+ @LOC("IDX")\r
private int vidx = 1;\r
+ @LOC("V")\r
private float[] v1;\r
+ @LOC("V")\r
private float[] v2;\r
// private float[] actual_v; // v1 or v2\r
+ @LOC("IDX")\r
private int actual_write_pos; // 0-15\r
+ @LOC("SAMPLE")\r
private float[] samples; // 32 new subband samples\r
+ @LOC("V")\r
private int channel;\r
+ @LOC("V")\r
private float scalefactor;\r
+ @LOC("EQ")\r
private float[] eq;\r
\r
/**\r
* Compute PCM Samples.\r
*/\r
\r
- private float[] _tmpOut = new float[32];\r
+ @LOC("OUT") private float[] _tmpOut = new float[32];\r
\r
private void compute_pcm_samples0() {\r
\r
// if (buffer != null) {\r
// buffer.appendSamples(channel, _tmpOut);\r
// }\r
- SampleBufferWrapper.getOutput().appendSamples(channel, _tmpOut);\r
+ SampleBufferWrapper.appendSamples(channel, _tmpOut);\r
\r
/*\r
* // MDM: I was considering putting in quality control for // low-spec\r
* d[] split into subarrays of length 16. This provides for more faster access\r
* by allowing a block of 16 to be addressed with constant offset.\r
**/\r
+ @LOC("V")\r
private static float d16[][] = null;\r
\r
/**\r