Diff of /mex/comp_filterbank_fft.c [7c7a96] .. [3deeb5]  Maximize  Restore

  Switch to unified view

a/mex/comp_filterbank_fft.c b/mex/comp_filterbank_fft.c
...
...
72
   mwSize M = mxGetNumberOfElements(mxG);
72
   mwSize M = mxGetNumberOfElements(mxG);
73
73
74
   // output lengths
74
   // output lengths
75
   mwSize outLen[M];
75
   mwSize outLen[M];
76
   // Filter pointer array
76
   // Filter pointer array
77
   LTFAT_REAL _Complex* GPtrs[M];
77
   LTFAT_COMPLEX* GPtrs[M];
78
   // POINTER TO THE INPUT
78
   // POINTER TO THE INPUT
79
   LTFAT_REAL _Complex* FPtr = (LTFAT_REAL _Complex*) mxGetData(prhs[0]);
79
   LTFAT_COMPLEX* FPtr = (LTFAT_COMPLEX*) mxGetData(prhs[0]);
80
   // POINTER TO OUTPUTS
80
   // POINTER TO OUTPUTS
81
   LTFAT_REAL _Complex* cPtrs[M]; // C99 feature
81
   LTFAT_COMPLEX* cPtrs[M]; // C99 feature
82
   plhs[0] = mxCreateCellMatrix(M, 1);
82
   plhs[0] = mxCreateCellMatrix(M, 1);
83
83
84
   if(M!=LTFAT_NAME(oldM))
84
   if(M!=LTFAT_NAME(oldM))
85
   {
85
   {
86
      LTFAT_NAME(fftMexAtExitFnc)();
86
      LTFAT_NAME(fftMexAtExitFnc)();
...
...
90
   }
90
   }
91
91
92
   for(mwIndex m=0;m<M;++m)
92
   for(mwIndex m=0;m<M;++m)
93
   {
93
   {
94
      outLen[m] = (mwSize) ceil( L/a[m] );
94
      outLen[m] = (mwSize) ceil( L/a[m] );
95
      GPtrs[m] = (LTFAT_REAL _Complex*) mxGetPr(mxGetCell(mxG, m));
95
      GPtrs[m] = (LTFAT_COMPLEX*) mxGetPr(mxGetCell(mxG, m));
96
      mxSetCell(plhs[0], m, ltfatCreateMatrix(outLen[m], W,LTFAT_MX_CLASSID,mxCOMPLEX));
96
      mxSetCell(plhs[0], m, ltfatCreateMatrix(outLen[m], W,LTFAT_MX_CLASSID,mxCOMPLEX));
97
      cPtrs[m] = (LTFAT_REAL _Complex*) mxGetData(mxGetCell(plhs[0],m));
97
      cPtrs[m] = (LTFAT_COMPLEX*) mxGetData(mxGetCell(plhs[0],m));
98
      memset(cPtrs[m],0,outLen[m]*W*sizeof(LTFAT_REAL _Complex)); // Unnecessary memset to 0
98
      memset(cPtrs[m],0,outLen[m]*W*sizeof(LTFAT_COMPLEX)); // Unnecessary memset to 0
99
       
99
       
100
      if(LTFAT_NAME(oldLc)[m]!=outLen[m])
100
      if(LTFAT_NAME(oldLc)[m]!=outLen[m])
101
      {
101
      {
102
         LTFAT_NAME(oldLc)[m] = outLen[m];
102
         LTFAT_NAME(oldLc)[m] = outLen[m];
103
     LTFAT_FFTW(plan) ptmp = LTFAT_FFTW(plan_dft_1d)(outLen[m],(LTFAT_REAL (*)[2]) cPtrs[m],(LTFAT_REAL (*)[2]) cPtrs[m], FFTW_BACKWARD, FFTW_OPTITYPE);
103
     LTFAT_FFTW(plan) ptmp = LTFAT_FFTW(plan_dft_1d)(outLen[m],cPtrs[m],cPtrs[m], FFTW_BACKWARD, FFTW_OPTITYPE);
104
           
104
           
105
     if(LTFAT_NAME(oldPlans)[m]!=0)
105
     if(LTFAT_NAME(oldPlans)[m]!=0)
106
     {
106
     {
107
        LTFAT_FFTW(destroy_plan)(*LTFAT_NAME(oldPlans)[m]);
107
        LTFAT_FFTW(destroy_plan)(*LTFAT_NAME(oldPlans)[m]);
108
        ltfat_free(LTFAT_NAME(oldPlans)[m]);
108
        ltfat_free(LTFAT_NAME(oldPlans)[m]);
...
...
119
   {
119
   {
120
   // First col of cPtrs[m] is used as a buffer to assure correct memory aligment 
120
   // First col of cPtrs[m] is used as a buffer to assure correct memory aligment 
121
      for(mwIndex w =1; w<W; w++)
121
      for(mwIndex w =1; w<W; w++)
122
      {
122
      {
123
         LTFAT_NAME(convsub_fft_plan)(FPtr+w*L,GPtrs[m],L,(size_t)a[m],cPtrs[m],LTFAT_NAME(oldPlans)[m]);
123
         LTFAT_NAME(convsub_fft_plan)(FPtr+w*L,GPtrs[m],L,(size_t)a[m],cPtrs[m],LTFAT_NAME(oldPlans)[m]);
124
         memcpy(cPtrs[m] + w*outLen[m], cPtrs[m], outLen[m]*sizeof(LTFAT_REAL _Complex));
124
         memcpy(cPtrs[m] + w*outLen[m], cPtrs[m], outLen[m]*sizeof(LTFAT_COMPLEX));
125
      }
125
      }
126
126
127
      LTFAT_NAME(convsub_fft_plan)(FPtr,GPtrs[m],L,(size_t)a[m],cPtrs[m],LTFAT_NAME(oldPlans)[m]);
127
      LTFAT_NAME(convsub_fft_plan)(FPtr,GPtrs[m],L,(size_t)a[m],cPtrs[m],LTFAT_NAME(oldPlans)[m]);
128
   }
128
   }
129
}
129
}

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks