checkLocationFromExpressionNode(md, nametable, returnExp, new CompositeLocation(),
constraint, false);
+ // System.out.println("# RETURN VALUE LOC=" + returnValueLoc +
+ // " with constraint=" + constraint);
+
+ // TODO: do we need to check here?
// if this return statement is inside branch, return value has an implicit
// flow from conditional location
- if (constraint != null) {
- Set<CompositeLocation> inputGLB = new HashSet<CompositeLocation>();
- inputGLB.add(returnValueLoc);
- inputGLB.add(constraint);
- returnValueLoc =
- CompositeLattice.calculateGLB(inputGLB, generateErrorMessage(md.getClassDesc(), rn));
- }
+ // if (constraint != null) {
+ // Set<CompositeLocation> inputGLB = new HashSet<CompositeLocation>();
+ // inputGLB.add(returnValueLoc);
+ // inputGLB.add(constraint);
+ // returnValueLoc =
+ // CompositeLattice.calculateGLB(inputGLB,
+ // generateErrorMessage(md.getClassDesc(), rn));
+ // }
// check if return value is equal or higher than RETRUNLOC of method
// declaration annotation
// values
// in this case, we don't need to check flow down rule!
- System.out.println("\n#tertiary cond=" + tn.getCond().printNode(0) + " Loc=" + condLoc);
- System.out.println("# true=" + tn.getTrueExpr().printNode(0) + " Loc=" + trueLoc);
- System.out.println("# false=" + tn.getFalseExpr().printNode(0) + " Loc=" + falseLoc);
+ // System.out.println("\n#tertiary cond=" + tn.getCond().printNode(0) +
+ // " Loc=" + condLoc);
+ // System.out.println("# true=" + tn.getTrueExpr().printNode(0) + " Loc=" +
+ // trueLoc);
+ // System.out.println("# false=" + tn.getFalseExpr().printNode(0) + " Loc="
+ // + falseLoc);
// check if condLoc is higher than trueLoc & falseLoc
if (!trueLoc.get(0).isTop()
checkLocationFromExpressionNode(md, nametable, min.getExpression(),
new CompositeLocation(), constraint, false);
} else {
- System.out.println("min=" + min.getMethod());
if (min.getMethod().isStatic()) {
String globalLocId = ssjava.getMethodLattice(md).getGlobalLoc();
if (globalLocId == null) {
String thisLocId = ssjava.getMethodLattice(md).getThisLoc();
baseLocation = new CompositeLocation(new Location(md, thisLocId));
}
-
}
- System.out.println("\n#checkLocationFromMethodInvokeNode=" + min.printNode(0)
- + " baseLocation=" + baseLocation + " constraint=" + constraint);
+ // System.out.println("\n#checkLocationFromMethodInvokeNode=" +
+ // min.printNode(0)
+ // + " baseLocation=" + baseLocation + " constraint=" + constraint);
if (constraint != null) {
int compareResult =
int callerResult =
CompositeLattice.compare(callerLoc1, callerLoc2, true,
generateErrorMessage(md.getClassDesc(), min));
- System.out.println("callerResult=" + callerResult);
+ // System.out.println("callerResult=" + callerResult);
int calleeResult =
CompositeLattice.compare(calleeLoc1, calleeLoc2, true,
generateErrorMessage(md.getClassDesc(), min));
- System.out.println("calleeResult=" + calleeResult);
+ // System.out.println("calleeResult=" + calleeResult);
if (callerResult == ComparisonResult.EQUAL) {
if (ssjava.isSharedLocation(callerLoc1.get(callerLoc1.getSize() - 1))
}
}
- if (calleeResult == ComparisonResult.EQUAL) {
- if (ssjava.isSharedLocation(calleeLoc1.get(calleeLoc1.getSize() - 1))
- && ssjava.isSharedLocation(calleeLoc2.get(calleeLoc2.getSize() - 1))) {
- // if both of them are shared locations, promote them to
- // "GREATER relation"
- calleeResult = ComparisonResult.GREATER;
- }
- }
-
if (calleeResult == ComparisonResult.GREATER
&& callerResult != ComparisonResult.GREATER) {
// If calleeLoc1 is higher than calleeLoc2
public static int compare(CompositeLocation loc1, CompositeLocation loc2, boolean ignore,
String msg) {
- System.out.println("compare=" + loc1 + " " + loc2);
+ // System.out.println("compare=" + loc1 + " " + loc2);
int baseCompareResult = compareBaseLocationSet(loc1, loc2, false, ignore, msg);
if (baseCompareResult == ComparisonResult.EQUAL) {
*/
@LATTICE("OUT<V,V<C,C<THIS,THIS<IN,C*,V*,THISLOC=THIS,RETURNLOC=OUT")
public boolean classifyFace(@LOC("THIS,Classifier.C") IntegralImageData image,
- @LOC("IN") float scaleFactor, @LOC("IN") int translationX, @LOC("IN") int translationY,
- @LOC("IN") float borderline) {
+ @LOC("THIS,Classifier.C") float scaleFactor, @LOC("THIS,Classifier.C") int translationX,
+ @LOC("THIS,Classifier.C") int translationY, @LOC("THIS,Classifier.C") float borderline) {
@LOC("THIS,Classifier.V") long values[] = new long[scanAreas.length];
public String toString() {
@LOC("OUT") String str = "";
- for (@LOC("THIS,Classifier.C") int i = 0; i < scanAreas.length; i++) {
+ for (@LOC("C") int i = 0; i < scanAreas.length; i++) {
str += scanAreas[i].toString() + "\n";
}
*
* @author Florian
*/
-@LATTICE("C")
+@LATTICE("CS<C,C*")
@METHODDEFAULT("OUT<THIS,THIS<IN,THISLOC=THIS,RETURNLOC=OUT")
public class ClassifierTree {
- @LOC("C")
+ @LOC("CS")
private Classifier classifiers[];
public ClassifierTree(int size) {
* @return an rectangle representing the actual face position on success or
* null if no face could be detected
*/
- @LATTICE("OUT,THIS<CXY,CXY<V,V<IMG,IMG<C,C<IN,C*,FACTOR*,CXY*,THISLOC=THIS,RETURNLOC=OUT")
+ @LATTICE("OUT<CXY,CXY<THIS,THIS<V,V<IMG,IMG<C,C<IN,C*,V*,FACTOR*,CXY*,THISLOC=THIS,RETURNLOC=OUT,GLOBALLOC=IN")
public Rectangle2D locateFaceRadial(@LOC("IN") Image smallImage,
- @LOC("C") Rectangle2D lastCoordinates) {
+ @LOC("THIS,ClassifierTree.C") Rectangle2D lastCoordinates) {
@LOC("IMG") IntegralImageData imageData = new IntegralImageData(smallImage);
@LOC("IN") float originalImageFactor = 1;
if (lastCoordinates == null) {
// if we don't have a last coordinate we just begin in the center
- @LOC("C") int smallImageMaxDimension =
+ @LOC("THIS,ClassifierTree.C") int smallImageMaxDimension =
Math.min(smallImage.getWidth(), smallImage.getHeight());
lastCoordinates =
new Rectangle2D((smallImage.getWidth() - smallImageMaxDimension) / 2.0,
(lastCoordinates.getHeight() * (1 / originalImageFactor)));
}
- @LOC("V") float startFactor = (float) (lastCoordinates.getWidth() / 100.0f);
+ @LOC("THIS,ClassifierTree.C") float startFactor = (float) (lastCoordinates.getWidth() / 100.0f);
// first we calculate the maximum scale factor for our 200x200 image
- @LOC("V") float maxScaleFactor =
+ @LOC("THIS,ClassifierTree.C") float maxScaleFactor =
Math.min(imageData.getWidth() / 100f, imageData.getHeight() / 100f);
// maxScaleFactor = 1.0f;
// we simply won't recognize faces that are smaller than 40x40 px
- @LOC("V") float minScaleFactor = 0.5f;
+ @LOC("THIS,ClassifierTree.C") float minScaleFactor = 0.5f;
- @LOC("V") float maxScaleDifference =
+ @LOC("THIS,ClassifierTree.C") float maxScaleDifference =
Math.max(Math.abs(maxScaleFactor - startFactor), Math.abs(minScaleFactor - startFactor));
// border for faceYes-possibility must be greater that that
- @LOC("V") float maxBorder = 0.999f;
+ @LOC("THIS,ClassifierTree.C") float maxBorder = 0.999f;
- @LOC("V") int startPosX = (int) lastCoordinates.getX();
- @LOC("V") int startPosY = (int) lastCoordinates.getX();
+ @LOC("THIS,ClassifierTree.C") int startPosX = (int) lastCoordinates.getX();
+ @LOC("THIS,ClassifierTree.C") int startPosY = (int) lastCoordinates.getX();
- for (@LOC("C") float factorDiff = 0.0f; Math.abs(factorDiff) <= maxScaleDifference; factorDiff =
+ for (@LOC("THIS,ClassifierTree.C") float factorDiff = 0.0f; Math.abs(factorDiff) <= maxScaleDifference; factorDiff =
(factorDiff + sgn(factorDiff) * 0.1f) * -1 // we alternate between
// negative and positiv
// factors
) {
- @LOC("V") float factor = startFactor + factorDiff;
+ @LOC("THIS,ClassifierTree.C") float factor = startFactor + factorDiff;
// System.out.println("factor=" + factor);
if (factor > maxScaleFactor || factor < minScaleFactor)
continue;
// now we calculate the actualDimmension
- @LOC("V") int actualDimmension = (int) (100 * factor);
- @LOC("V") int maxX = imageData.getWidth() - actualDimmension;
- @LOC("V") int maxY = imageData.getHeight() - actualDimmension;
+ @LOC("THIS,ClassifierTree.C") int actualDimmension = (int) (100 * factor);
+ @LOC("THIS,ClassifierTree.C") int maxX = imageData.getWidth() - actualDimmension;
+ @LOC("THIS,ClassifierTree.C") int maxY = imageData.getHeight() - actualDimmension;
- @LOC("V") int maxDiffX = Math.max(Math.abs(startPosX - maxX), startPosX);
- @LOC("V") int maxDiffY = Math.max(Math.abs(startPosY - maxY), startPosY);
+ @LOC("THIS,ClassifierTree.C") int maxDiffX = Math.max(Math.abs(startPosX - maxX), startPosX);
+ @LOC("THIS,ClassifierTree.C") int maxDiffY = Math.max(Math.abs(startPosY - maxY), startPosY);
for (@LOC("CXY") float xDiff = 0.1f; Math.abs(xDiff) <= maxDiffX; xDiff =
(xDiff + sgn(xDiff) * 0.5f) * -1) {
}
+ @LATTICE("OUT<IN,OUT<THIS,THISLOC=THIS,RETURNLOC=OUT")
private static int sgn(@LOC("IN") float value) {
return (value < 0 ? -1 : (value > 0 ? +1 : 1));
}
* \r
* @author Florian Frankenberger\r
*/\r
-@LATTICE("SIZE<POS,SIZE*")\r
+@LATTICE("DEV<C,C<SIZE,SIZE*,C*,DEV*")\r
@METHODDEFAULT("OUT<THIS,THIS<IN,THISLOC=THIS,RETURNLOC=OUT")\r
public class DeviationScanner {\r
\r
- @LOC("POS")\r
+ @LOC("DEV")\r
private EyePosition eyePositions[];\r
\r
// LEFT_UP(+1, -1), UP(0, -1), RIGHT_UP(-1, -1), LEFT(+1, 0), NONE(0, 0),\r
public static final int DOWN = 7;\r
public static final int RIGHT_DOWN = 8;\r
\r
- @LOC("SIZE")\r
+ @LOC("DEV")\r
private int size;\r
\r
public DeviationScanner() {\r
@LATTICE("THIS<C,C<IN,THISLOC=THIS")\r
public void addEyePosition(@LOC("IN") EyePosition eyePosition) {\r
\r
- for (@LOC("C") int i = 1; i < eyePositions.length; i++) {\r
- eyePositions[i - 1] = eyePositions[i];\r
- eyePositions[i] = null;\r
- }\r
- eyePositions[eyePositions.length - 1] = eyePosition;\r
+ // for (@LOC("THIS,DeviationScanner.C") int i = 1; i < 3; i++) {\r
+ // eyePositions[i - 1] = eyePositions[i];\r
+ // eyePositions[i] = null;\r
+ // }\r
+ // eyePositions[eyePositions.length - 1] = eyePosition;\r
+\r
+ SSJAVA.append(eyePositions, eyePosition);\r
\r
if (size < eyePositions.length) {\r
size++;\r
}\r
+\r
}\r
\r
+ @RETURNLOC("THIS,DeviationScanner.DEV")\r
public int getEyePositionsSize() {\r
return size;\r
}\r
\r
- @LATTICE("OUT<DEV,DEV<THIS,THIS<C,C<IN,C*,DEV*,OUT*,THISLOC=THIS,RETURNLOC=OUT")\r
+ // @LATTICE("OUT<DEV,DEV<C,C<THIS,THIS<IN,C*,DEV*,OUT*,THISLOC=THIS,RETURNLOC=OUT")\r
+ @LATTICE("THIS<IN,THISLOC=THIS")\r
+ @RETURNLOC("THIS,DeviationScanner.DEV")\r
public int scanForDeviation(@LOC("IN") Rectangle2D faceRect) {\r
- @LOC("OUT") int deviation = NONE;\r
+ @LOC("THIS,DeviationScanner.DEV") int deviation = NONE;\r
if (getEyePositionsSize() >= 3) {\r
- @LOC("DEV") double deviationX = 0;\r
- @LOC("DEV") double deviationY = 0;\r
+ @LOC("THIS,DeviationScanner.DEV") double deviationX = 0;\r
+ @LOC("THIS,DeviationScanner.DEV") double deviationY = 0;\r
\r
- @LOC("DEV") int lastIdx = -1;\r
- for (@LOC("C") int i = 0; i < 3; ++i) {\r
+ @LOC("THIS,DeviationScanner.DEV") int lastIdx = -1;\r
+ for (@LOC("THIS,DeviationScanner.DEV") int i = 0; i < 3; ++i) {\r
if (lastIdx != -1) {\r
deviationX += (eyePositions[i].getX() - eyePositions[lastIdx].getX());\r
deviationY += (eyePositions[i].getY() - eyePositions[lastIdx].getY());\r
lastIdx = i;\r
}\r
\r
- @LOC("DEV") final double deviationPercentX = 0.04;\r
- @LOC("DEV") final double deviationPercentY = 0.04;\r
+ @LOC("THIS,DeviationScanner.DEV") final double deviationPercentX = 0.04;\r
+ @LOC("THIS,DeviationScanner.DEV") final double deviationPercentY = 0.04;\r
\r
deviationX /= faceRect.getWidth();\r
deviationY /= faceRect.getWidth();\r
\r
- @LOC("DEV") int deviationAbsoluteX = 0;\r
- @LOC("DEV") int deviationAbsoluteY = 0;\r
+ @LOC("THIS,DeviationScanner.DEV") int deviationAbsoluteX = 0;\r
+ @LOC("THIS,DeviationScanner.DEV") int deviationAbsoluteY = 0;\r
if (deviationX > deviationPercentX)\r
deviationAbsoluteX = 1;\r
if (deviationX < -deviationPercentX)\r
return deviation;\r
}\r
\r
+ @LATTICE("OUT<IN,OUT<THIS,THISLOC=THIS,RETURNLOC=OUT")\r
public int getDirectionFor(@LOC("IN") int directionX, @LOC("IN") int directionY) {\r
\r
if (directionX == +1 && directionY == -1) {\r
* @author Florian Frankenberger
*/
@LATTICE("IMG")
-@METHODDEFAULT("OUT<THIS,THIS<IN,OUT*,THISLOC=THIS,RETURNLOC=OUT")
+@METHODDEFAULT("OUT<THIS,THIS<IN,OUT*,THISLOC=THIS,RETURNLOC=OUT,GLOBALLOC=THIS")
class EyeDetector {
@LOC("IMG")
}
- @LATTICE("OUT,V<THIS,THIS<C,C*,THISLOC=THIS,RETURNLOC=OUT")
+ @LATTICE("OUT<V,V<C,C<THIS,C*,V*,THISLOC=THIS,RETURNLOC=OUT,GLOBALLOC=THIS")
public Point detectEye() {
@LOC("OUT") Point eyePosition = null;
@LOC("V") float brightness = 255f;
return eyePosition;
}
+ @LATTICE("OUT<V,V<G,G<IN,G<THIS,THISLOC=THIS,GLOBALLOC=G,RETURNLOC=OUT")
private static float getBrightness(@LOC("IN") int[] color) {
- @LOC("IN") int min = Math.min(Math.min(color[0], color[1]), color[2]);
- @LOC("IN") int max = Math.max(Math.max(color[0], color[1]), color[2]);
+ @LOC("V") int min = Math.min(Math.min(color[0], color[1]), color[2]);
+ @LOC("V") int max = Math.max(Math.max(color[0], color[1]), color[2]);
return 0.5f * (max + min);
}
@LOC("THIS,LEA.POS") FaceAndEyePosition positions = implementation.getEyePosition(image);
if (positions.getEyePosition() != null) {
deviationScanner.addEyePosition(positions.getEyePosition());
- @LOC("THIS,LEA.DEV") int deviation =
+ @LOC("THIS,LEA.DEV,DeviationScanner.DEV") int deviation =
deviationScanner.scanForDeviation(positions.getFacePosition());// positions.getEyePosition().getDeviation(lastPositions.getEyePosition());
if (deviation != DeviationScanner.NONE) {
System.out.println("deviation=" + deviationScanner.toStringDeviation(deviation));
*
* @author Florian Frankenberger
*/
-@LATTICE("R<CT")
+@LATTICE("R<CT,R*")
@METHODDEFAULT("OUT<THIS,THIS<IN,THISLOC=THIS,RETURNLOC=OUT")
public class LEAImplementation {
this.loadFaceData();
}
- @LATTICE("OUT<V,V<THIS,THIS<IN,THISLOC=THIS,RETURNLOC=OUT")
+ @LATTICE("OUT<V,V<THIS,THIS<IN,V*,THISLOC=THIS,RETURNLOC=OUT")
public FaceAndEyePosition getEyePosition(@LOC("IN") Image image) {
if (image == null)
return null;
- @LOC("V") Rectangle2D faceRect = classifierTree.locateFaceRadial(image, lastRectangle);
+ @LOC("THIS,LEAImplementation.R") Rectangle2D faceRect =
+ classifierTree.locateFaceRadial(image, lastRectangle);
@LOC("V") EyePosition eyePosition = null;
if (faceRect != null) {
lastRectangle = faceRect;
return new FaceAndEyePosition(lastRectangle, eyePosition);
}
+ @LATTICE("OUT<IN,OUT<THIS,THISLOC=THIS,RETURNLOC=OUT")
private Point readEyes(@LOC("IN") Image image, @LOC("IN") Rectangle2D rect) {
- @LOC("THIS") EyeDetector ed = new EyeDetector(image, rect);
+ @LOC("OUT") EyeDetector ed = new EyeDetector(image, rect);
return ed.detectEye();
}
@LATTICE("B<T")
-@METHODDEFAULT("OUT<IN,THISLOC=IN,RETURNLOC=OUT")
+@METHODDEFAULT("OUT<IN,OUT<THIS,,IN*,THISLOC=THIS,RETURNLOC=OUT")
public class Math {
@LOC("T")
static final double PI = 3.14159265358979323846;
return (a < b) ? a : b;
}
- @RETURNLOC("IN")
+ @RETURNLOC("OUT")
public static int min(@LOC("IN") int a, @LOC("IN") int b) {
return (a < b) ? a : b;
}
return false;
}
+ @TRUST
@RETURNLOC("TH")
public String toString() {
return "Object" + hashCode();
+import Benchmarks.SSJava.EyeTracking.LOC;
+
public class SSJAVA {
// Definitely written analysis assumes that the first parameter may have write
}
}
}
-
+
static void arrayinit(float array[][], int size_1, int size_2, float value) {
for (int idx1 = 0; idx1 < size_1; idx1++) {
}
}
}
-
static void arraycopy(float array[][], float src[][], int size_1, int size_2) {
}
}
+ static void append(Object array[], Object item) {
+ for (int i = 1; i < array.length; i++) {
+ array[i - 1] = array[i];
+ array[i]=null;
+ }
+ array[array.length - 1] = item;
+ }
+
}