/* -*- mode: c++; c-basic-offset: 3 -*-
 *
 * PANTHEON Project
 *
 * GREYC IMAGE
 * 6 Boulevard Maréchal Juin
 * F-14050 Caen Cedex France
 *
 * This file is free software. You can use it, distribute it
 * and/or modify it. However, the entire risk to the quality
 * and performance of this program is with you.
 *
 * Please email any bugs, comments, and/or additions to this file to:
 * pandore@greyc.ensicaen.fr
 * http://www.greyc.ensicaen.fr/EquipeImage/Pandore/
 */

/**
 * @author Jalal Fadili
 * @date 2007-05-29
 *
 */

/*
 * @file fatom2sym.cpp
 * @brief Forward transform of wave atom orthonormal basis, symmetric version
 */

#include <math.h>
#include <complex>
#include <iostream>
using namespace std;
#include "complexe.h"
using namespace pandore;



#ifdef MAIN
#undef MAIN

namespace freq_pat{
#include "freq_pat.cpp"
}
#define MAIN
#else
namespace freq_pat{
#include "freq_pat.cpp"
}
#endif





#ifdef MAIN
#define USAGE   "usage: %s pat(p or q) n"
#define PARC    2
#define FINC    0
#define FOUTC   0
#define MASK    0

int main(int argc,char* argv[]) {
   Errc result;			// The result code of the execution.
   Pobject *mask;		// The mask.
   Pobject *objin[FINC+1];	// The input objects;
   Pobject *objs[FINC+1];	// The source objects masked by mask.
   Pobject *objout[FOUTC+1];	// The output object unmasked by mask.
   Pobject *objd[FOUTC+1];	// The result object.
   char *parv[PARC+1];		// The input parameters.
  
   ReadArgs(argc,argv,PARC,FINC,FOUTC,&mask,objin,objs,objout,objd,parv,USAGE,MASK);

   Img1duc* lst;
   int H = atoi(parv[1])/2;
   result=freq_pat::Freq_pat(lst, H, parv[0][0]);
   int len = (parv[0][0]=='p' ? (int) ceil(log2((double)H)/2.)+1:(int) floor(log2((double)H)/2.)+1);
  for(int i=0;i<len;i++){
  	printf("%d ",lst[i].Width());
	for(int j=0;j<lst[i].Width();j++)
	  printf("%d ",lst[i][j]);
	printf("\n");
  }
   Exit(result);
   return 0;
}

#endif
