add tracking benchmark
[IRC.git] / Robust / src / Benchmarks / oooJava / tracking / IDX.java
1 public class IDX {
2     /* current processing image related */
3     float[] m_image;
4     int m_rows;
5     int m_cols;
6     int m_r;
7     
8     /* results related */
9     int m_rows_rs;
10     int m_rows_re;
11     int m_cols_r;
12     int[] m_ind;
13     
14     /* benchmark constants */
15     public int N_FEA;
16     
17     /* id indicating the piece # */
18     int m_id;  
19     int m_range;
20
21     /* constructor */
22     public IDX(int nfea,
23                int id,
24                int range,
25                float[] data,
26                int rows,
27                int cols,
28                int r) {
29       this.N_FEA = nfea;
30       
31       this.m_id = id;
32       this.m_range = range;
33       
34       this.m_image = data;
35       this.m_rows = rows;
36       this.m_cols = cols;
37       this.m_r = r;
38
39       this.m_rows_rs = this.m_id * this.m_range;
40       this.m_rows_re = (this.m_id + 1) * this.m_range;
41       this.m_cols_r = cols;
42       
43       this.m_ind = new int[(this.m_rows_re - this.m_rows_rs) * this.m_cols_r];
44     }
45     
46     public int getR() {
47       return this.m_r;
48     }
49     
50     public int getRows() {
51       return this.m_rows;
52     }
53     
54     public int getCols() {
55       return this.m_cols;
56     }
57     
58     public float[] getImage() {
59       return this.m_image;
60     }
61     
62     public int[] getInd() {
63       return this.m_ind;
64     }
65     
66     public int getRowsRS() {
67       return this.m_rows_rs;
68     }
69     
70     public int getRowsRE() {
71       return this.m_rows_re;
72     }
73     
74     public int getColsR() {
75       return this.m_cols_r;
76     }
77     
78     public void fSortIndices() {
79       int i, j, k, startRow, endRow;
80       int[] ind;
81       int rows_i, cols_i;
82       float[] image;
83
84       image = this.m_image;
85       
86       rows_i = this.m_rows;
87       cols_i = this.m_cols;
88       ind = this.m_ind;
89
90       startRow = this.m_rows_rs;  
91       endRow = this.m_rows_re;
92       int ii = 0;
93       for(k=0; k<cols_i; k++) {
94         for(i=0; i<rows_i; i++) {
95           float local = image[i * cols_i + k];
96           ii = 0;
97           for(j=startRow; j<endRow; j++) {
98             if(local <= image[j*cols_i+k]) {
99               ind[ii * cols_i + k]++;
100             }
101             ii++;
102           }
103         }
104       }
105     }
106     
107     public void printImage() {
108       //    result validation
109       for(int i=0; i<this.m_rows; i++) {
110           for(int j=0; j<this.m_cols; j++) {
111               System.printI((int)(this.m_image[i * this.m_cols + j]*10));
112           }
113       }
114     }
115     
116     public void printInd() {
117       //    result validation
118       System.printI(44444444);
119       for(int i=0; i<this.m_rows_re-this.m_rows_rs; i++) {
120           for(int j=0; j<this.m_cols_r; j++) {
121               System.printI((int)(this.m_ind[i * this.m_cols_r + j]*10));
122           }
123       }
124     }
125 }