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