Do more. Code less. Free software for GPU computing.
<scroll to top>

signal.h

Go to the documentation of this file.
00001 //-----------------------------------------------------------------------//
00002 //   Copyright (c) AccelerEyes LLC. All rights reserved.                 //
00003 //   See http://www.accelereyes.com/eula for details.                    //
00004 //   This software is distributed WITHOUT ANY WARRANTY; without even     //
00005 //   the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR //
00006 //   PURPOSE.  See the above copyright notices for more information.     //
00007 //-----------------------------------------------------------------------//
00008 
00009 #pragma once
00010 
00011 #include <cuComplex.h>
00012 #include "defines.h"
00013 
00016 
00028    typedef enum {
00029    afConvSame = 0,    
00030    afConvValid = -1,  
00031    afConvFull = 1,    
00032    } afConv;
00033 
00034 // convolution_mat
00036 
00037 
00038 namespace af {
00039 class array;
00040 class dim4;
00041 
00044 
00051 AFAPI array fft(const array&, unsigned pad=0);
00052 
00060 AFAPI array ifft(const array&, unsigned pad=0);
00061 
00062 
00071 AFAPI array fft2(const array&, unsigned nx=0, unsigned ny=0);
00072 
00073 
00083 AFAPI array ifft2(const array&, unsigned nx=0, unsigned ny=0);
00084 
00085 
00091 AFAPI array fft3(const array&);
00092 
00100 AFAPI array fft3(const array&, const dim4& dims);
00101 
00102 
00109 AFAPI array ifft3(const array&);
00110 
00119 AFAPI array ifft3(const array&, const dim4& dims);
00120 
00121 // fft_mat
00123 
00126 
00141 AFAPI array fir(int nb, const float* h_b, const array& x);
00142 
00143 
00144 
00158 AFAPI array fir(const array& b, const array& x);
00159 
00160 
00182 AFAPI array iir(int nb, const float* h_b, int na, const float* h_a, const array& x);
00183 
00203 AFAPI array iir(const array& b, const array& a, const array& x);
00204 
00205 
00206 // filter_mat
00208 
00209 
00210 
00213 
00222 AFAPI array convolve(const array& f1, const array& f2, const array& signal, afConv shape=afConvFull);
00223 
00234 template<typename ty> array convolve(unsigned n1, const ty *f1,  unsigned n2, const ty *f2,  const array& signal, afConv shape=afConvFull);
00235 
00236 
00243 AFAPI array convolve(const array& signal, const array& filter, afConv shape=afConvFull);
00244 
00254 template<typename ty> array convolve(const array& signal, unsigned ndims, unsigned *dims, const ty *h_kernel, afConv shape=afConvFull);
00255 
00256 
00257 // convolution_mat
00259 
00260 
00261 
00264 
00274 AFAPI array interp(array& X, array& Y, array& Xi, unsigned method=0);
00275 
00286 AFAPI array interp(array& X, array& Y, array& Xi, float  init, unsigned method=0);
00287 
00299 AFAPI array interp(array& X, array& Y, array& Z, array& Xi, array& Yi, unsigned method=0);
00300 
00313 AFAPI array interp(array& X, array& Y, array& Z, array& Xi, array& Yi, float  init, unsigned method=0);
00314 
00315 // interpolation
00317 
00318 }
00319 
00320 #ifdef __cplusplus
00321 extern "C" {
00322 #endif
00323 
00334 
00335 AFAPI afError af_fft_S(unsigned nout, cuComplex *d_O,
00336                             unsigned nin, const float  *d_I,
00337                             unsigned batch, int direction);
00338 
00340 AFAPI afError af_fft_C(unsigned nout, cuComplex *d_O,
00341                             unsigned nin, const cuComplex *d_I,
00342                             unsigned batch, int direction);
00343 
00345 AFAPI afError af_fft_D(unsigned nout, cuDoubleComplex *d_O,
00346                             unsigned nin, const double  *d_I,
00347                             unsigned batch, int direction);
00348 
00350 AFAPI afError af_fft_Z(unsigned nout, cuDoubleComplex *d_O,
00351                             unsigned nin, const cuDoubleComplex  *d_I,
00352                             unsigned batch, int direction);
00355 
00369 
00370 AFAPI afError af_fft2_S(unsigned xo, unsigned yo, cuComplex *d_O,
00371                              unsigned xi, unsigned yi, const float  *d_I,
00372                              unsigned batch, int direction);
00374 AFAPI afError af_fft2_C(unsigned xo, unsigned yo, cuComplex *d_O,
00375                              unsigned xi, unsigned yi,
00376                              const cuComplex *d_I,
00377                              unsigned batch, int direction);
00379 AFAPI afError af_fft2_D(unsigned xo, unsigned yo, cuDoubleComplex *d_O,
00380                              unsigned xi, unsigned yi, const double  *d_I,
00381                              unsigned batch, int direction);
00383 AFAPI afError af_fft2_Z(unsigned xo, unsigned yo, cuDoubleComplex *d_O,
00384                              unsigned xi, unsigned yi,
00385                              const cuDoubleComplex  *d_I,
00386                              unsigned batch, int direction);
00389 
00390 
00401 
00402 AFAPI afError af_fft3_S(dim3 dims_O, cuComplex *d_O,
00403                              dim3 dims_I, const float  *d_I,
00404                              unsigned batch, int direction);
00406 AFAPI afError af_fft3_C(dim3 dims_O, cuComplex *d_O,
00407                              dim3 dims_I, const cuComplex *d_I,
00408                              unsigned batch, int direction);
00410 AFAPI afError af_fft3_D(dim3 dims_O, cuDoubleComplex *d_O,
00411                              dim3 dims_I, const double  *d_I,
00412                              unsigned batch, int direction);
00414 AFAPI afError af_fft3_Z(dim3 dims_O, cuDoubleComplex *d_O,
00415                              dim3 dims_I, const cuDoubleComplex  *d_I,
00416                              unsigned batch, int direction);
00419 
00425 
00426 
00427 AFAPI afError af_fft_setplans(int max_plans);
00428 
00430 AFAPI afError af_fft_clear(void);
00431 
00433 AFAPI void af_fft_info(void);
00434 
00436 
00437 
00438 
00456 
00457 AFAPI afError af_filter1D_SS(float *d_out,
00458                                 unsigned len_in, const float *d_in,
00459                                 unsigned len_a , const float *h_a,
00460                                 unsigned len_b , const float *h_b,
00461                                 const float *d_init, float *d_final,
00462                                 unsigned Nin, unsigned Ninit);
00463 
00466 
00482 
00483 AFAPI afError af_conv_SS(float *d_out,
00484                               unsigned ni, const float *d_in, unsigned batchi,
00485                               unsigned nf, const float *d_filt, unsigned batchf,
00486                               afConv shape);
00488 AFAPI afError af_conv_CS(cuComplex *d_out,
00489                               unsigned ni, const cuComplex *d_in, unsigned batchi,
00490                               unsigned nf, const float *d_filt, unsigned batchf,
00491                               afConv shape);
00493 AFAPI afError af_conv_CC(cuComplex *d_out,
00494                               unsigned ni, const cuComplex *d_in, unsigned batchi,
00495                               unsigned nf, const cuComplex *d_filt, unsigned batchf,
00496                               afConv shape);
00498 AFAPI afError af_conv_DD(double *d_out,
00499                               unsigned ni, const double *d_in, unsigned batchi,
00500                               unsigned nf, const double *d_filt, unsigned batchf,
00501                               afConv shape);
00503 AFAPI afError af_conv_ZD(cuDoubleComplex *d_out,
00504                               unsigned ni, const cuDoubleComplex *d_in, unsigned batchi,
00505                               unsigned nf, const double *d_filt, unsigned batchf,
00506                               afConv shape);
00508 AFAPI afError af_conv_ZZ(cuDoubleComplex *d_out,
00509                               unsigned ni, const cuDoubleComplex *d_in, unsigned batchi,
00510                               unsigned nf, const cuDoubleComplex *d_filt, unsigned batchf,
00511                               afConv shape);
00514 
00515 
00531 
00532 AFAPI afError af_conv2_SS(float *d_out,
00533                                unsigned mi, unsigned ni, const float *d_in,   unsigned batch_in,
00534                                unsigned mf, unsigned nf, const float *d_filt, unsigned batch_filt,
00535                                afConv shape);
00537 AFAPI afError af_conv2_CS(cuComplex *d_out,
00538                                unsigned mi, unsigned ni, const cuComplex *d_in, unsigned batch_in,
00539                                unsigned mf, unsigned nf, const float *d_filt,   unsigned batch_filt,
00540                                afConv shape);
00542 AFAPI afError af_conv2_CC(cuComplex *d_out,
00543                                unsigned mi, unsigned ni, const cuComplex *d_in, unsigned batch_in,
00544                                unsigned mf, unsigned nf, const cuComplex *d_filt, unsigned batch_filt,
00545                                afConv shape);
00547 AFAPI afError af_conv2_DD(double *d_out,
00548                                unsigned mi, unsigned ni, const double *d_in, unsigned batch_in,
00549                                unsigned mf, unsigned nf, const double *d_filt, unsigned batch_filt,
00550                                afConv shape);
00552 AFAPI afError af_conv2_ZD(cuDoubleComplex *d_out,
00553                                unsigned mi, unsigned ni, const cuDoubleComplex *d_in, unsigned batch_in,
00554                                unsigned mf, unsigned nf, const double *d_filt, unsigned batch_filt,
00555                                afConv shape);
00557 AFAPI afError af_conv2_ZZ(cuDoubleComplex *d_out,
00558                                unsigned mi, unsigned ni, const cuDoubleComplex *d_in, unsigned batch_in,
00559                                unsigned mf, unsigned nf, const cuDoubleComplex *d_filt, unsigned batch_filt,
00560                                afConv shape);
00563 
00579 
00580 AFAPI afError af_convn_SS(float *d_out,
00581                                unsigned ndimsi, unsigned *dimsi,
00582                                const float *d_in, unsigned batchi,
00583                                unsigned ndimsf, unsigned *dimsf,
00584                                const float *d_filt, unsigned batchf,
00585                                afConv shape);
00587 AFAPI afError af_convn_CS(cuComplex *d_out,
00588                                unsigned ndimsi, unsigned *dimsi,
00589                                const cuComplex *d_in, unsigned batchi,
00590                                unsigned ndimsf, unsigned *dimsf,
00591                                const float *d_filt, unsigned batchf,
00592                                afConv shape);
00594 AFAPI afError af_convn_CC(cuComplex *d_out,
00595                                unsigned ndimsi, unsigned *dimsi,
00596                                const cuComplex *d_in, unsigned batchi,
00597                                unsigned ndimsf, unsigned *dimsf,
00598                                const cuComplex *d_filt, unsigned batchf,
00599                                afConv shape);
00601 AFAPI afError af_convn_DD(double *d_out,
00602                                unsigned ndimsi, unsigned *dimsi,
00603                                const double *d_in, unsigned batchi,
00604                                unsigned ndimsf, unsigned *dimsf,
00605                                const double *d_filt, unsigned batchf,
00606                                afConv shape);
00608 AFAPI afError af_convn_ZD(cuDoubleComplex *d_out,
00609                                unsigned ndimsi, unsigned *dimsi,
00610                                const cuDoubleComplex *d_in, unsigned batchi,
00611                                unsigned ndimsf, unsigned *dimsf,
00612                                const double *d_filt, unsigned batchf,
00613                                afConv shape);
00615 AFAPI afError af_convn_ZZ(cuDoubleComplex *d_out,
00616                                unsigned ndimsi, unsigned *dimsi,
00617                                const cuDoubleComplex *d_in, unsigned batchi,
00618                                unsigned ndimsf, unsigned *dimsf,
00619                                const cuDoubleComplex *d_filt, unsigned batchf,
00620                                afConv shape);
00622 
00637 
00638 AFAPI afError af_convh_SS(float *d_out,
00639                                unsigned ndimsi, unsigned *dimsi,
00640                                const float *d_in, unsigned batchi,
00641                                unsigned ndimsf, unsigned *dimsf,
00642                                const float *h_filt, unsigned batchf,
00643                                afConv shape);
00645 AFAPI afError af_convh_CS(cuComplex *d_out,
00646                                unsigned ndimsi, unsigned *dimsi,
00647                                const cuComplex *d_in, unsigned batchi,
00648                                unsigned ndimsf, unsigned *dimsf,
00649                                const float *h_filt, unsigned batchf,
00650                                afConv shape);
00652 AFAPI afError af_convh_DD(double *d_out,
00653                                unsigned ndimsi, unsigned *dimsi,
00654                                const double *d_in, unsigned batchi,
00655                                unsigned ndimsf, unsigned *dimsf,
00656                                const double *h_filt, unsigned batchf,
00657                                afConv shape);
00659 AFAPI afError af_convh_ZD(cuDoubleComplex *d_out,
00660                                unsigned ndimsi, unsigned *dimsi,
00661                                const cuDoubleComplex *d_in, unsigned batchi,
00662                                unsigned ndimsf, unsigned *dimsf,
00663                                const double *h_filt, unsigned batchf,
00664                                afConv shape);
00667 
00682 
00683 AFAPI afError af_scale2D_S(float *d_ZI, unsigned md, unsigned nd,
00684                            const float *d_Z, int factor, unsigned method);
00685 AFAPI afError af_scale2D_D(double *d_ZI, unsigned md, unsigned nd,
00686                            const double *d_Z, int factor, unsigned method);
00687 AFAPI afError af_scale2D_C(cuComplex *d_ZI, unsigned md, unsigned nd,
00688                            const cuComplex *d_Z, int factor, unsigned method);
00689 AFAPI afError af_scale2D_Z(cuDoubleComplex *d_ZI, unsigned md, unsigned nd,
00690                            const cuDoubleComplex *d_Z, int factor,
00691                            unsigned method);
00693 AFAPI afError af_scale2D_c(char *d_ZI,
00694                                 unsigned md, unsigned nd, const char *d_Z,
00695                                 int factor, unsigned method);
00698 
00714 
00715 AFAPI afError af_interp1D_S(float *d_YI,
00716                                  unsigned n,
00717                                  const float *d_Y , unsigned batch_Y,
00718                                  const float *d_X , unsigned batch_X,
00719                                  unsigned ni, const float *d_XI,
00720                                  float Y0, unsigned method);
00722 AFAPI afError af_interp1D_C(cuComplex *d_YI,
00723                                  unsigned n ,
00724                                  const cuComplex *d_Y , unsigned batch_Y,
00725                                  const float *d_X , unsigned batch_X,
00726                                  unsigned ni, const float *d_XI,
00727                                  float Y0, unsigned method);
00729 AFAPI afError af_interp1D_D(double *d_YI,
00730                                  unsigned n ,
00731                                  const double *d_Y , unsigned batch_Y,
00732                                  const double *d_X , unsigned batch_X,
00733                                  unsigned ni, const double *XI,
00734                                  double Y0, unsigned method);
00736 AFAPI afError af_interp1D_Z(cuDoubleComplex *d_YI,
00737                                  unsigned n ,
00738                                  const cuDoubleComplex *d_Y, unsigned batch_Y,
00739                                  const double *d_X , unsigned batch_X,
00740                                  unsigned ni, const double *d_XI,
00741                                  double Y0, unsigned method);
00744 
00766 
00767 #define INTERP(ty, tyi, T)                                          \
00768     AFAPI afError af_interp2D_##T(ty *d_ZI,                        \
00769                                        unsigned m, unsigned n,          \
00770                                        const ty *d_Z, unsigned batch_Z, \
00771                                        unsigned mi, unsigned ni,        \
00772                                        const tyi *d_XI, unsigned batch_XI, \
00773                                        const tyi *d_YI, unsigned batch_YI, \
00774                                        tyi Z0, unsigned method)
00775     INTERP(float, float,  S);
00776     INTERP(double,double, D);
00777     INTERP(cuComplex, float, C);
00778     INTERP(cuDoubleComplex, double, Z);
00779 
00780 #undef INTERP
00781 
00784 
00785 #ifdef __cplusplus
00786 }
00787 #endif
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines