Example #1
0
int main() {
  double x[16];
  int i;

  // Makes a fancy cubic signal
  for (i=0;i<16;i++) x[i]=5+i+0.4*i*i-0.02*i*i*i;
  
  // Prints original sigal x
  printf("Original signal:\n");
  for (i=0;i<16;i++) printf("x[%d]=%f\n",i,x[i]);
  printf("\n");

  // Do the forward 9/7 transform
  fwt97(x,16);
  
  // Prints the wavelet coefficients
  printf("Wavelets coefficients:\n");
  for (i=0;i<16;i++) printf("wc[%d]=%f\n",i,x[i]);
  printf("\n");

  // Do the inverse 9/7 transform
  iwt97(x,16); 

  // Prints the reconstructed signal 
  printf("Reconstructed signal:\n");
  for (i=0;i<16;i++) printf("xx[%d]=%f\n",i,x[i]);
  return 0;
}
Example #2
0
void b_analysis_1d(double *_out,int _out_stride,const double *_in,int _in_stride,
                   const int *_f, double _klt[BLOCKSIZE][BLOCKSIZE]){
  int    j;
  double t[SUPPORT];
  double w[BLOCKSIZE];

  for(j=0;j<SUPPORT;j++)
    t[j]=_in[j*_in_stride];

#if USE_WAVELET

  fwt97(w,BLOCKSIZE,t,SUPPORT);
  for(j=0;j<BLOCKSIZE;j++){
    _out[j*_out_stride]=w[j];
  }

#else
#  if USE_LAPPING
#    if BLOCKSIZE_LOG>=OD_LOG_BSIZE0&&BLOCKSIZE_LOG<OD_LOG_BSIZE0+OD_NBSIZES
  (*NE_PRE_FILTER_DOUBLE[BLOCKSIZE_LOG-OD_LOG_BSIZE0])
    (&t[SUPPORT/2-BLOCKSIZE],&t[SUPPORT/2-BLOCKSIZE],_f);
  (*NE_PRE_FILTER_DOUBLE[BLOCKSIZE_LOG-OD_LOG_BSIZE0])
    (&t[SUPPORT/2],&t[SUPPORT/2],_f);
#    else
#      error "Need a prefilter implementation for this block size."
#    endif
#  endif
#  if USE_KLT
  fklt(&w[0],&t[SUPPORT/2-BLOCKSIZE/2],&_klt[0][0],BLOCKSIZE);
#  elif USE_DCT
#    if BLOCKSIZE_LOG>=OD_LOG_BSIZE0&&BLOCKSIZE_LOG<OD_LOG_BSIZE0+OD_NBSIZES
  (*OD_FDCT_1D_DOUBLE[BLOCKSIZE_LOG-OD_LOG_BSIZE0])
    (w,&t[SUPPORT/2-BLOCKSIZE/2],1);
#    else
#      error "Need an fDCT implementation for this block size."
#    endif
#  else
    for(j=0;j<BLOCKSIZE;j++)
      w[j]=t[j+SUPPORT/2-BLOCKSIZE/2];
#  endif

  for(j=0;j<BLOCKSIZE;j++)
    _out[j*_out_stride]=w[j];

#endif
}