Exemple #1
0
int main()
    {
     short i,j;
     int character;

     timeb starttime,endtime;
  
    printf("start after carriage return\n");
      character = getchar(); 
    
     for(i=0;i<NROWS;i++)
	  for(j=0;j<NCOLS;j++)
	     { test11[i*NCOLS +j] =  (i+j)%4;
	    //   test2[i][j] = 0.0;
	    //   if(i==4) test1[i][j] = 1.0;
	     }
    dreverse(NROWS,NCOLS,test11,test33);
//    printf("dreverse test \n");
//    printarray(NROWS,NCOLS,test33);
    ftime(&starttime);
    topdowndadd(log2(NROWS),NCOLS,&(test1[0][0]));
    ftime(&endtime);
    timediff(&starttime,&endtime);
    unscramble(NROWS,NCOLS,test11);
//  printarray(NROWS,NCOLS,test11);
//    printf("start inverse dadd \n");

//  initdaddarr(log2(NROWS),NCOLS,test11);
     
    invdadd(log2(NROWS),NCOLS,test11,test22);
//    printf("end inverse dadd \n");

//    printarray(NROWS,NCOLS,test11);

    topdowndadd(log2(NROWS),NCOLS,test33);
    unscramble(NROWS,NCOLS,test33);
    invdadd(log2(NROWS),NCOLS,test33,test22);
//    printf("end backward inverse dadd\n");
//    printarray(NROWS,NCOLS,test33);
    dreverse(NROWS,NCOLS,test33,test33);
//    printf("reversed version of same array\n");
//    printarray(NROWS,NCOLS,test33);
    mergehalves(NROWS,NCOLS,test11,test33);
//    printf("merged array\n");
//    printarray(NROWS,NCOLS,test33);
     for(i=0;i<NROWS;i++)
	  for(j=0;j<NCOLS;j++)
	     { test11[i*NCOLS+j] =  (i+j)%4;
	     }
   comparrays(NROWS,NCOLS,test11,test33); 
   }
// get__contour_breadth_first: apply after boundary is clean to get the ordered boundary
// the parameter "once" specifies whether to look for only outer contour or for all the
// connected boundary segments (in the case of a multiply connected region
void Image::get__contour_breadth_first(bool once)
{
    int i;
    int front, back;
    point pt, aux, last = start-1;

    while ( (pt = get_next_boundary_point(last)) ) {
        vector<point> V;
        last = pt;
        *pt = bound;
        front = back = 0;
        V.push_back(pt);
        ++back;
        while ( front != back ) {
            pt = V[front];
            for (i=0; i<4; ++i) {
                aux= pt + offset_4neighbor[i];
                if (in_range(aux) &&
                    is_8boundary_point(aux)) {
                    *aux=bound;
                    V.push_back(aux);
                    ++back;
                }
            }
            ++front;
        }
        unscramble(V, boundary_queue);
        if (once) break;
    }
}
Exemple #3
0
static void ifct_noscale(double *f)
{
  f[0] *= INVROOT2;
  inv_sums(f);
  bitrev(f,N);
  inv_butterflies(f);
  unscramble(f,N);
}
Exemple #4
0
int main(int argc, char **argv)
{
	unsigned char *buf = (unsigned char *)argv[1];
	int l = strlen((char *)buf);
	printf("original   :"); hexdump(buf, l);
	scramble(buf, l);
	printf("scrambled  :"); hexdump(buf, l);
	unscramble(buf, l);
	printf("unscrambled:"); hexdump(buf, l);
}