fix some bug found by Yonghun
authorjzhou <jzhou>
Thu, 5 Aug 2010 18:33:41 +0000 (18:33 +0000)
committerjzhou <jzhou>
Thu, 5 Aug 2010 18:33:41 +0000 (18:33 +0000)
Robust/src/Benchmarks/Scheduling/Tracking/BlurPiece.java
Robust/src/Benchmarks/Scheduling/Tracking/BlurPieceL.java
Robust/src/Benchmarks/Scheduling/Tracking/IDX.java
Robust/src/Benchmarks/Scheduling/Tracking/IXL.java
Robust/src/Benchmarks/Scheduling/Tracking/IXLR.java
Robust/src/Benchmarks/Scheduling/Tracking/IYL.java
Robust/src/Benchmarks/Scheduling/Tracking/IYLR.java
Robust/src/Benchmarks/Scheduling/Tracking/ImageX.java
Robust/src/Benchmarks/Scheduling/Tracking/ImageY.java
Robust/src/Benchmarks/Scheduling/Tracking/TrackDemo.java

index 447dee926b6d627af858c08e911cfbf40f285462..fc9694314a52ff6cc71da7080444905a434950b7 100644 (file)
@@ -17,16 +17,19 @@ public class BlurPiece {
     /* id indicating the piece # */
     int m_id;  
     int m_range;
+    int m_pnum;
 
     /* constructor */
     public BlurPiece(int id,
                      int range,
-                     int[] data) {
+                     int[] data,
+                     int pnum) {
       this.m_id = id;
       this.m_range = range;
       this.m_image = data;
       this.m_rows = data[0];
       this.m_cols = data[1];
+      this.m_pnum = pnum;
     }
     
     public int getId() {
@@ -75,6 +78,9 @@ public class BlurPiece {
       if(rows < this.m_rows_re) {
         this.m_rows_re = rows;
       }
+      if(this.m_id == this.m_pnum - 1) {
+        this.m_rows_re = rows;
+      }
       this.m_cols_r = this.m_cols;
       image = this.m_result = new float[(this.m_rows_re-this.m_rows_rs)*cols];
 
@@ -104,10 +110,9 @@ public class BlurPiece {
       int ii = startRow - this.m_rows_rs;
       for(i=startRow; i<endRow; i++){
         for(j=startCol; j<endCol; j++) {
-          temp = 0;
+          temp = 0.0f;
           for(k=-halfKernel; k<=halfKernel; k++) {
-            temp += (float)((inputs[4 + i * cols + (j+k)] 
-                                    * (float)(kernel[k+halfKernel])));
+            temp += (float)(inputs[4 + i * cols + (j+k)]*(kernel[k+halfKernel]));
           }
 
           image[ii * cols + j] = (float)(temp/kernelSum);
index bca39fac041752d86845af2c350394e4a6c8674c..f4888b4ecd59c37ba556f65386f9afbf69bc0cca 100644 (file)
@@ -17,16 +17,19 @@ public class BlurPieceL {
     /* id indicating the piece # */
     int m_id;  
     int m_range;
+    int m_pnum;
 
     /* constructor */
     public BlurPieceL(int id,
                       int range,
-                      int[] data) {
+                      int[] data,
+                      int pnum) {
       this.m_id = id;
       this.m_range = range;
       this.m_image = data;
       this.m_rows = data[0];
       this.m_cols = data[1];
+      this.m_pnum = pnum;
     }
     
     public int getId() {
@@ -75,6 +78,9 @@ public class BlurPieceL {
       if(rows < this.m_rows_re) {
         this.m_rows_re = rows;
       }
+      if(this.m_id == this.m_pnum - 1) {
+        this.m_rows_re = rows;
+      }
       this.m_cols_r = this.m_cols;
       image = this.m_result = new float[(this.m_rows_re-this.m_rows_rs)*cols];
 
@@ -106,8 +112,7 @@ public class BlurPieceL {
         for(j=startCol; j<endCol; j++) {
           temp = 0;
           for(k=-halfKernel; k<=halfKernel; k++) {
-            temp += (float)((inputs[4 + i * cols + (j+k)] 
-                                    * (float)(kernel[k+halfKernel])));
+            temp += (float)(inputs[4 + i * cols + (j+k)]*(kernel[k+halfKernel]));
           }
 
           image[ii * cols + j] = (float)(temp/kernelSum);
index f508a21b8b3c68d65a8c532f083dd217d78027e5..07f51ebc2c662924cda7ceb793de04d42ccb7b30 100644 (file)
@@ -21,6 +21,7 @@ public class IDX {
     /* id indicating the piece # */
     int m_id;  
     int m_range;
+    int m_pnum;
 
     /* constructor */
     public IDX(int nfea,
@@ -29,7 +30,8 @@ public class IDX {
                float[] data,
                int rows,
                int cols,
-               int r) {
+               int r,
+               int pnum) {
       this.N_FEA = nfea;
       
       this.m_id = id;
@@ -39,9 +41,13 @@ public class IDX {
       this.m_rows = rows;
       this.m_cols = cols;
       this.m_r = r;
+      this.m_pnum = pnum;
 
       this.m_rows_rs = this.m_id * this.m_range;
       this.m_rows_re = (this.m_id + 1) * this.m_range;
+      if(this.m_id == this.m_pnum - 1) {
+        this.m_rows_re = rows;
+      }
       this.m_cols_r = cols;
       
       this.m_ind = new int[(this.m_rows_re - this.m_rows_rs) * this.m_cols_r];
index 7693fcd83e4a246b8fa6e51467ba213300fecbf5..29f94ef36b850e5744cd7569cdfb594c447eac6e 100644 (file)
@@ -17,18 +17,21 @@ public class IXL {
     /* id indicating the piece # */
     int m_id;  
     int m_range;
+    int m_pnum;
     
     /* constructor */
     public IXL(int id,
                int range,
                float[] data,
                int rows,
-               int cols) {
+               int cols,
+               int pnum) {
       this.m_id = id;
       this.m_range = range;
       this.m_image = data;
       this.m_rows = rows;
       this.m_cols = cols;
+      this.m_pnum = pnum;
     }
     
     public int getId() {
@@ -73,6 +76,9 @@ public class IXL {
       
       this.m_rows_rs = this.m_id * this.m_range;
       this.m_rows_re = (this.m_id + 1) * this.m_range;
+      if(this.m_id == this.m_pnum - 1) {
+        this.m_rows_re = rows;
+      }
       this.m_cols_r = cols;
       result=this.m_result=new float[(this.m_rows_re-this.m_rows_rs)*this.m_cols_r];
       
@@ -111,8 +117,7 @@ public class IXL {
           for(j=startCol; j<endCol; j++) {
               temp = 0;
               for(k=-halfKernel; k<=halfKernel; k++) {
-                  temp += (float)(image[i * cols + (j+k)] 
-                                        * (float)(kernel_2[k+halfKernel]));
+                  temp += (float)(image[i * cols + (j+k)]*kernel_2[k+halfKernel]);
               }
               result[ii * cols + j] = (float)(temp/kernelSum_2);
           }
index 36009cfc8556b5170439e595f1ff2285337c1651..7c2b0e55d889346094255bf808c99d526116e236 100644 (file)
@@ -17,18 +17,21 @@ public class IXLR {
     /* id indicating the piece # */
     int m_id;  
     int m_range;
+    int m_pnum;
     
     /* constructor */
     public IXLR(int id,
                 int range,
                 float[] data,
                 int rows,
-                int cols) {
+                int cols,
+                int pnum) {
       this.m_id = id;
       this.m_range = range;
       this.m_image = data;
       this.m_rows = rows;
       this.m_cols = cols;
+      this.m_pnum = pnum;
     }
     
     public int getId() {
@@ -73,6 +76,9 @@ public class IXLR {
       
       this.m_rows_rs = this.m_id * this.m_range;
       this.m_rows_re = (this.m_id + 1) * this.m_range;
+      if(this.m_id == this.m_pnum - 1) {
+        this.m_rows_re = rows;
+      }
       this.m_cols_r = cols;
       result=this.m_result=new float[(this.m_rows_re-this.m_rows_rs)*this.m_cols_r];
       
index c2be76a92d45dea97d87ecfe0a4a9d574d8b6987..8d272c02ec0c1cbfa4971788fcec26146b66bc63 100644 (file)
@@ -17,18 +17,21 @@ public class IYL {
     /* id indicating the piece # */
     int m_id;  
     int m_range;
+    int m_pnum;
     
     /* constructor */
     public IYL(int id,
                int range,
                float[] image,
                int rows,
-               int cols) {
+               int cols,
+               int pnum) {
       this.m_id = id;
       this.m_range = range;
       this.m_image = image;
       this.m_rows = rows;
       this.m_cols = cols;
+      this.m_pnum = pnum;
     }
     
     public int getId() {
@@ -79,6 +82,9 @@ public class IYL {
       
       this.m_rows_rs = this.m_id * this.m_range;
       this.m_rows_re = (this.m_id + 1) * this.m_range;
+      if(this.m_id == this.m_pnum - 1) {
+        this.m_rows_re = rows;
+      }
       this.m_cols_r = cols;
       result=this.m_result=new float[(this.m_rows_re-this.m_rows_rs)*this.m_cols_r];
       
index 1956c3bc96d614461ae4d68c6f1c6edcfdf565d9..c0834b265b6279c7a302c79de6db837e86f0dd81 100644 (file)
@@ -17,18 +17,21 @@ public class IYLR {
     /* id indicating the piece # */
     int m_id;  
     int m_range;
+    int m_pnum;
     
     /* constructor */
     public IYLR(int id,
                 int range,
                 float[] image,
                 int rows,
-                int cols) {
+                int cols,
+                int pnum) {
       this.m_id = id;
       this.m_range = range;
       this.m_image = image;
       this.m_rows = rows;
       this.m_cols = cols;
+      this.m_pnum = pnum;
     }
     
     public int getId() {
@@ -79,6 +82,9 @@ public class IYLR {
       
       this.m_rows_rs = this.m_id * this.m_range;
       this.m_rows_re = (this.m_id + 1) * this.m_range;
+      if(this.m_id == this.m_pnum - 1) {
+        this.m_rows_re = rows;
+      }
       this.m_cols_r = cols;
       result=this.m_result=new float[(this.m_rows_re-this.m_rows_rs)*this.m_cols_r];
       
index becfc3aa7f3f66c2652dcdcd20c73cd6e1f08842..cad77debe6410ac6e5a42b856a3237eb14666f85 100644 (file)
@@ -17,18 +17,21 @@ public class ImageX {
     /* id indicating the piece # */
     int m_id;  
     int m_range;
+    int m_pnum;
     
     /* constructor */
     public ImageX(int id,
                   int range,
                   float[] data,
                   int rows,
-                  int cols) {
+                  int cols,
+                  int pnum) {
       this.m_id = id;
       this.m_range = range;
       this.m_image = data;
       this.m_rows = rows;
       this.m_cols = cols;
+      this.m_pnum = pnum;
     }
     
     public int getId() {
@@ -73,6 +76,9 @@ public class ImageX {
       
       this.m_rows_rs = this.m_id * this.m_range;
       this.m_rows_re = (this.m_id + 1) * this.m_range;
+      if(this.m_id == this.m_pnum - 1) {
+        this.m_rows_re = rows;
+      }
       this.m_cols_r = cols;
       result=this.m_result=new float[(this.m_rows_re-this.m_rows_rs)*this.m_cols_r];
       
index 4f067c175d080aa7f0d5f10d304e430f2d91f50e..b9cff5932b3a2f2f44cf281fec5f4ce643302fea 100644 (file)
@@ -17,18 +17,21 @@ public class ImageY {
     /* id indicating the piece # */
     int m_id;  
     int m_range;
+    int m_pnum;
     
     /* constructor */
     public ImageY(int id,
                   int range,
                   float[] image,
                   int rows,
-                  int cols) {
+                  int cols,
+                  int pnum) {
       this.m_id = id;
       this.m_range = range;
       this.m_image = image;
       this.m_rows = rows;
       this.m_cols = cols;
+      this.m_pnum = pnum;
     }
     
     public int getId() {
@@ -79,6 +82,9 @@ public class ImageY {
       
       this.m_rows_rs = this.m_id * this.m_range;
       this.m_rows_re = (this.m_id + 1) * this.m_range;
+      if(this.m_id == this.m_pnum - 1) {
+        this.m_rows_re = rows;
+      }
       this.m_cols_r = cols;
       result=this.m_result=new float[(this.m_rows_re-this.m_rows_rs)*this.m_cols_r];
       
index 4a60902a6d00f986506c5beba9476cb3bf83a1ef..f92a4b9e136bd3001c515a2c121e9e022bdfe5a4 100644 (file)
@@ -60,7 +60,7 @@ public class TrackDemo {
       this.m_count = 0;
       
       this.m_num_bp = 0;
-                       this.m_num_bpl = 0;
+      this.m_num_bpl = 0;
       
       this.WINSZ = 8;
       this.N_FEA = 16; //00;
@@ -89,20 +89,20 @@ public class TrackDemo {
       */
       this.m_3f = new float[3][this.N_FEA];
       this.m_rows_3f = this.N_FEA;
-      this.m_cols_3f = this.N_FEA;
+      this.m_cols_3f = 1; //this.N_FEA;
       this.m_counter_3f = 3;
       this.m_num_p = nump;
 
-                       this.m_rows = 0;
-                       this.m_cols = 0;
-                       this.m_image = null;
-                       this.m_image_resized = null;
-                       this.m_rows_r = 0;
-                       this.m_cols_r = 0;
+      this.m_rows = 0;
+      this.m_cols = 0;
+      this.m_image = null;
+      this.m_image_resized = null;
+      this.m_rows_r = 0;
+      this.m_cols_r = 0;
 
-                       this.m_features = null;
-                       this.m_rows_f = 0;
-                       this.m_cols_f = 0;
+      this.m_features = null;
+      this.m_rows_f = 0;
+      this.m_cols_f = 0;
     }
     
     public int getNumP() {
@@ -265,7 +265,7 @@ public class TrackDemo {
       
       for(i=startRow; i<endRow; i++) {
         for(j=startCol; j<endCol; j++) {
-          temp = 0;
+          temp = 0.0f;
           for(k=-halfKernel; k<=halfKernel; k++)  {
             temp += (float)((image[(i+k) * cols + j] 
                                    * (float)(kernel[k+halfKernel])));
@@ -341,8 +341,7 @@ public class TrackDemo {
         for(j=0; j<outputCols; j++) {
           tempVal = 0;
           for(k=-halfKernel; k<=halfKernel; k++) {
-            tempVal += (float)(temp[(i+k) * outputCols + j] 
-                                    * (float)(kernel[k+halfKernel]));
+            tempVal += (float)(temp[(i+k) * outputCols + j]*kernel[k+halfKernel]);
           }
           resized[m * outputCols + j] = (float)(tempVal/kernelSum);
         }    
@@ -760,20 +759,20 @@ public class TrackDemo {
           t1 = (float)0;
 
           if ((C_ROBUST * interestPnts[rows1 * cols1 + 2]) 
-              >= srtdPnts[supId[i] * cols_sp + 2]) {
-            t = srtdPnts[supId[i] * cols_sp + 0] - interestPnts[rows1 * cols1 + 0];
-            t1 = srtdPnts[supId[i] * cols_sp + 1] - interestPnts[rows1 * cols1 + 1];
+              >= srtdPnts[i * cols_sp + 2]) {
+            t = srtdPnts[i * cols_sp + 0] - interestPnts[rows1 * cols1 + 0];
+            t1 = srtdPnts[i * cols_sp + 1] - interestPnts[rows1 * cols1 + 1];
             t = t * t + t1 * t1;
             t1 = (float)0;
           }
 
           if ((C_ROBUST * interestPnts[rows1 * cols1 + 2]) 
-              < srtdPnts[supId[i] * cols_sp + 2]) {
+              < srtdPnts[i * cols_sp + 2]) {
             t1 = (float)1 * (float)MAX_LIMIT;
           }
 
-          if (suppressR[supId[i]] > (t + t1)) {
-            suppressR[supId[i]] = t + t1;
+          if (suppressR[i] > (t + t1)) {
+            suppressR[i] = t + t1;
           }  
         }
 
@@ -911,6 +910,9 @@ public class TrackDemo {
       rows_v = 1;
       cols_v = nFeatures;
       valid = new int[rows_v * cols_v];
+      for(int valid_idx=0;valid_idx<valid.length;valid_idx++){
+        valid[valid_idx]=1;
+      }
 
       for(i=0; i<nFeatures; i++) {
         dX = (float)0;