21 #if defined(__msvc__) && (defined(ALGO_EXPORTS) || defined(Algo_EXPORTS)) 22 # define mAlgoClass class dll_export 24 # define mAlgoClass class 40 inline void setX(
const Array2D<T>&,
bool hasudfs);
42 inline void setY(
const Array2D<T>&,
bool hasudfs);
57 bool shouldFFT()
const;
83 if ( xhasudfs_ || yhasudfs_ || x_->info()!=y_->info() ||
84 x_->info()!=z_->info() )
96 : z_->info().getTotalSz();
100 template <
class T>
inline 105 template <
class T>
inline 110 , normalize_( false )
111 , correlate_( false )
131 template <
class T>
inline 140 template <
class T>
inline 151 #define mConvolver2DSetIndex( dim ) \ 152 const char y##dim##inc = correlate_ ? 1 : -1; \ 153 const int idy##dim = firsty##dim+idx##dim*y##dim##inc; \ 158 idx##dim += (-idy##dim)-1; \ 165 if ( idy##dim>=ysz##dim ) \ 170 const int diff = idy##dim-(ysz##dim-1); \ 171 idx##dim += diff-1; \ 176 template <
class T>
inline 181 :
z_->info().getTotalSz();
189 template <
class T>
inline 196 template <
class T>
inline 199 const int xsz0 =
x_->info().getSize( 0 );
200 const int xsz1 =
x_->info().getSize( 1 );
201 const int ysz0 =
y_->info().getSize( 0 );
202 const int ysz1 =
y_->info().getSize( 1 );
206 if ( !
z_->info().getArrayPos( start, startpos ) )
210 iterator.
setPos( startpos );
213 const T* xptr_ =
x_->getData();
216 const T* yptr_ =
y_->getData();
218 for (
od_int64 idx=start; idx<=stop; idx++ )
220 const int* zvar = iterator.getPos();
221 const int firsty0 =
correlate_ ? -zvar[0] : zvar[0];
222 const int firsty1 =
correlate_ ? -zvar[1] : zvar[1];
231 const od_int64 yoffset = ystor_ || yptr_ ?
232 y_->info().getOffset( idy0, 0 ) : 0;
234 const od_int64 xoffset = xstor_ || xptr_ ?
235 x_->info().getOffset( idx0, 0 ) : 0;
237 for (
int idx1=0; idx1<xsz1; idx1++ )
242 ? yptr_[yoffset+idy1]
244 ? ystor_->
value( yoffset+idy1 )
245 :
y_->get( idy0, idy1 );
251 ? xptr_[xoffset+idx1]
253 ? xstor_->
value( xoffset+idx1 )
254 :
x_->get( idx0, idx1 );
265 if ( !nrsamples )
z_->setND( zvar, 0 );
267 z_->setND( zvar, sum/ysum );
268 else z_->setND( zvar, sum );
272 if ( !iterator.next() && idx!=stop )
Does Fourier Transforms of any size.
Definition: fourier.h:30
#define mIsUdf(val)
Use mIsUdf to check for undefinedness of simple types.
Definition: undefval.h:287
virtual T value(int64_t) const =0
bool xhasudfs_
Definition: convolve2d.h:64
#define mIsZero(x, eps)
Definition: commondefs.h:53
#define od_int64
Definition: plftypes.h:36
~Convolver2D()
Definition: convolve2d.h:128
virtual bool shouldContinue()
bool correlate_
Definition: convolve2d.h:63
float_complex * xf_
Definition: convolve2d.h:67
const Array2D< T > * getX() const
Definition: convolve2d.h:41
float_complex * zf_
Definition: convolve2d.h:69
Generalization of a task that can be run in parallel.
Definition: paralleltask.h:66
void setZ(Array2D< T > &z)
Definition: convolve2d.h:44
bool normalize_
Definition: convolve2d.h:62
Array2D< T > * z_
Definition: convolve2d.h:61
bool updatexf_
Definition: convolve2d.h:71
Fourier::CC * fft_
Definition: convolve2d.h:74
Array2D ( Subclass of ArrayND ) is a two dimensional array.
Definition: arraynd.h:131
void setPos(const T &idxabl)
Definition: arraynd.h:256
Interface to a series of values.
Definition: odmemory.h:17
bool doWork(od_int64, od_int64, int)
Definition: convolve2d.h:190
void setNormalize(bool n)
Definition: convolve2d.h:45
Convolves (or correlates) two 2D signals.
Definition: convolve2d.h:34
void setCorrelate(bool yn)
Definition: convolve2d.h:48
bool yhasudfs_
Definition: convolve2d.h:65
bool doNonFFTWork(od_int64, od_int64, int)
Definition: convolve2d.h:197
const Array2D< T > * y_
Definition: convolve2d.h:60
std::complex< float > float_complex
Definition: odcomplex.h:18
#define mConvolver2DSetIndex(dim)
Definition: convolve2d.h:151
#define mAlgoClass
Definition: convolve2d.h:24
bool shouldFFT() const
Definition: convolve2d.h:101
Definition: convolve2d.h:27
Iterates through all samples in an ArrayND.
Definition: arraynd.h:179
const Array2D< T > * x_
Definition: convolve2d.h:59
od_int64 nrIterations() const
Definition: convolve2d.h:177
bool updateyf_
Definition: convolve2d.h:72
void setX(const Array2D< T > &, bool hasudfs)
Definition: convolve2d.h:132
void setY(const Array2D< T > &, bool hasudfs)
Definition: convolve2d.h:141
const Array2D< T > * getY() const
Definition: convolve2d.h:43
float_complex * yf_
Definition: convolve2d.h:68
void addToNrDone(int64_t increment)
Convolver2D()
Definition: convolve2d.h:106