remove redundant commented code
authorjzhou <jzhou>
Fri, 13 Feb 2009 21:35:36 +0000 (21:35 +0000)
committerjzhou <jzhou>
Fri, 13 Feb 2009 21:35:36 +0000 (21:35 +0000)
Robust/src/Benchmarks/Scheduling/FilterBank/FilterBank.java
Robust/src/Benchmarks/Scheduling/FilterBank/c/filterbank.c

index 05564e4f5652a7f6341de4ad4adda6aea6b97e27..5c08c45f80bb26a1fe6aef3a2969d289449d19be 100644 (file)
@@ -6,19 +6,13 @@ task t1(StartupObject s{initialstate}) {
        int N_ch=16;
        int N_col=128;
        int i,j;
-
-       /*float r[] = new float[N_sim];
-       for (i=0;i<N_sim;i++) {
-               r[i]=i+1;
-       }*/
        
        for(j = 0; j < N_ch; j++) {
                FilterBankAtom fba = new FilterBankAtom(j, 
                                                        N_ch, 
                                                        N_col, 
                                                        N_sim, 
-                                                       N_samp/*, 
-                                                       r*/){tosamp};
+                                                       N_samp){tosamp};
        }
        FilterBank fb = new FilterBank(N_sim, N_ch){!finish, !print};
 
@@ -28,7 +22,6 @@ task t1(StartupObject s{initialstate}) {
 task t2(FilterBankAtom fba{tosamp}) {
        //System.printString("task t2\n");
        
-       //fba.init();
        fba.FBCore();
 
        taskexit(fba{!tosamp, tomerge});
@@ -99,49 +92,20 @@ public class FilterBankAtom {
        int N_col;
        int N_sim;
        int N_samp;
-       //float[] r;
-       /*float[] H;
-       float[] F;
-       float[] vH;
-       float[] vDn;
-       float[] vUp;*/
        public float[] vF;
 
        public FilterBankAtom(int cindex, 
                              int N_ch, 
                              int N_col, 
                              int N_sim, 
-                             int N_samp/*, 
-                             float[] r*/) {
+                             int N_samp) {
            this.ch_index = cindex;
            this.N_ch = N_ch;
            this.N_col = N_col;
            this.N_sim = N_sim;
            this.N_samp = N_samp;
-           /*this.r = r;
-           //this.H = null;
-           //this.F = null;
-           this.vH = new float[this.N_sim];
-           this.vDn = new float[(int) this.N_sim/this.N_samp];
-           this.vUp = new float[this.N_sim];*/
            this.vF = new float[this.N_sim];
-           /*this.H[] = new float[N_col];
-           this.F[] = new float[N_col];
-           for(int i = 0; i < N_col; i++) {
-               H[i]=i*N_col+j*N_ch+j+i+j+1;
-               F[i]=i*j+j*j+j+i;
-           }*/
        }
-       
-       /*public void init() {
-           int j = this.ch_index;
-           this.H = new float[this.N_col];
-           this.F = new float[this.N_col];
-           for(int i = 0; i < this.N_col; i++) {
-               this.H[i]=i*this.N_col+j*this.N_ch+j+i+j+1;
-               this.F[i]=i*j+j*j+j+i;
-           }
-       }*/
 
        public void FBCore() {
                int i,j,k;
@@ -169,9 +133,6 @@ public class FilterBankAtom {
 
                //convolving H
                for (j=0; j< Nsim; j++) {
-                       /*for (k=0; ((k<Ncol) & ((j-k)>=0)); k++) {
-                               vH[j]+=H[k]*r[j-k];
-                       }*/
                    k = 0;
                    boolean stat = false;
                    int diff = j;
@@ -196,9 +157,6 @@ public class FilterBankAtom {
 
                //convolving F
                for (j=0; j< Nsim; j++) {
-                       /*for (k=0; ((k<Ncol) & ((j-k)>=0)); k++) {
-                               tvF[j]+=F[k]*vUp[j-k];
-                       }*/
                    k = 0;
                    boolean stat = false;
                    int diff = j;
index ba0596faaea2826701fed73e59939d35aae02dd7..288dca4511a10975d04a5271ac72be2ef8b76f74 100644 (file)
@@ -15,7 +15,13 @@ const int N_ch=16;//8;
 const int N_col=128;//32;
 
 void begin(void);
-void FBCore(int N_samp,int N_ch, int N_col,float r[N_sim],float y[N_sim], float H[N_ch][N_col],float F[N_ch][N_col]);
+void FBCore(int N_samp,
+            int N_ch, 
+            int N_col,
+            float* r,
+            float* y, 
+            float** H,
+            float** F);
 
 static int numiters = 1;
 
@@ -40,13 +46,17 @@ int main(int argc, char **argv)
 
 void begin(void){
 
-  float r[N_sim];
-  float y[N_sim];
-  float H[N_ch][N_col];
-  float F[N_ch][N_col];
-
+  float* r = (float*)malloc(sizeof(float) * N_sim);
+  float* y = (float*)malloc(sizeof(float) * N_sim);
+  float** H = (float**)malloc(sizeof(float) * N_ch);
+  float** F = (float**)malloc(sizeof(float) * N_ch);
                
   int i,j;
+  
+  for(i = 0; i < N_ch; i++) {
+         H[i] = (float*)malloc(sizeof(float) * N_col);
+         F[i] = (float*)malloc(sizeof(float) * N_col);
+  }
 
   for (i=0;i<N_sim;i++)
       r[i]=i+1;
@@ -72,6 +82,15 @@ void begin(void){
 #endif
     }
   }
+  
+  free(r);
+  free(y);
+  for(i = 0; i < N_ch; i++) {
+         free(H[i]);
+         free(F[i]);
+  }
+  free(H);
+  free(F);
 
 #ifdef RAW
     raw_test_pass(raw_get_cycle());
@@ -81,18 +100,23 @@ void begin(void){
 
 
 // the FB core gets the input vector (r) , the filter responses H and F and generates the output vector(y)
-void FBCore(int N_samp,int N_ch, int N_col,float r[N_sim],float y[N_sim], float H[N_ch][N_col],float F[N_ch][N_col])
-{
+void FBCore(int N_samp,
+            int N_ch, 
+            int N_col,
+            float* r,
+            float* y, 
+            float** H,
+            float** F) {
   int i,j,k;
   for (i=0; i < N_sim;i++)
     y[i]=0;
 
-  for (i=0; i< N_ch; i++)
-    {
-      float Vect_H[N_sim]; //(output of the H)
-      float Vect_Dn[(int) N_sim/N_samp]; //output of the down sampler;
-      float Vect_Up[N_sim]; // output of the up sampler;
-      float Vect_F[N_sim];// this is the output of the
+  for (i=0; i< N_ch; i++) {
+      float* Vect_H = (float *)malloc(sizeof(float) * N_sim); //(output of the H)
+      float* Vect_Dn = (float *)malloc(sizeof(float) * (int)(N_sim/N_samp)); //output of the down sampler;
+      float* Vect_Up = (float *)malloc(sizeof(float) * N_sim); // output of the up sampler;
+      float* Vect_F = (float *)malloc(sizeof(float) * N_sim);// this is the output of the
+
 #ifdef RAW
                //raw_test_pass(raw_get_cycle());
 #endif 
@@ -146,6 +170,11 @@ void FBCore(int N_samp,int N_ch, int N_col,float r[N_sim],float y[N_sim], float
 
       for (j=0; j < N_sim; j++)
        y[j]+=Vect_F[j];
+       
+         free(Vect_H);
+         free(Vect_Dn);
+         free(Vect_Up);
+         free(Vect_F);
 #ifdef RAW
                //raw_test_pass(raw_get_cycle());
 #endif