19 #if defined(__msvc__) && (defined(ALGO_EXPORTS) || defined(Algo_EXPORTS)) 20 # define mAlgoClass class dll_export 22 # define mAlgoClass class 38 inline void setX(
const Array2D<T>&,
bool hasudfs);
40 inline void setY(
const Array2D<T>&,
bool hasudfs);
55 bool shouldFFT()
const;
81 if ( xhasudfs_ || yhasudfs_ || x_->info()!=y_->info() ||
82 x_->info()!=z_->info() )
94 : z_->info().getTotalSz();
98 template <
class T>
inline 103 template <
class T>
inline 108 , normalize_( false )
109 , correlate_( false )
129 template <
class T>
inline 138 template <
class T>
inline 149 #define mConvolver2DSetIndex( dim ) \ 150 const char y##dim##inc = correlate_ ? 1 : -1; \ 151 const int idy##dim = firsty##dim+idx##dim*y##dim##inc; \ 156 idx##dim += (-idy##dim)-1; \ 163 if ( idy##dim>=ysz##dim ) \ 168 const int diff = idy##dim-(ysz##dim-1); \ 169 idx##dim += diff-1; \ 174 template <
class T>
inline 179 :
z_->info().getTotalSz();
187 template <
class T>
inline 194 template <
class T>
inline 197 const int xsz0 =
x_->info().getSize( 0 );
198 const int xsz1 =
x_->info().getSize( 1 );
199 const int ysz0 =
y_->info().getSize( 0 );
200 const int ysz1 =
y_->info().getSize( 1 );
204 if ( !
z_->info().getArrayPos( start, startpos ) )
208 iterator.
setPos( startpos );
211 const T* xptr_ =
x_->getData();
214 const T* yptr_ =
y_->getData();
216 for (
od_int64 idx=start; idx<=stop; idx++ )
218 const int* zvar = iterator.getPos();
219 const int firsty0 =
correlate_ ? -zvar[0] : zvar[0];
220 const int firsty1 =
correlate_ ? -zvar[1] : zvar[1];
229 const od_int64 yoffset = ystor_ || yptr_ ?
230 y_->info().getOffset( idy0, 0 ) : 0;
232 const od_int64 xoffset = xstor_ || xptr_ ?
233 x_->info().getOffset( idx0, 0 ) : 0;
235 for (
int idx1=0; idx1<xsz1; idx1++ )
240 ? yptr_[yoffset+idy1]
242 ? ystor_->
value( yoffset+idy1 )
243 :
y_->get( idy0, idy1 );
249 ? xptr_[xoffset+idx1]
251 ? xstor_->
value( xoffset+idx1 )
252 :
x_->get( idx0, idx1 );
263 if ( !nrsamples )
z_->setND( zvar, 0 );
265 z_->setND( zvar, sum/ysum );
266 else z_->setND( zvar, sum );
270 if ( !iterator.next() && idx!=stop )
Does Fourier Transforms of any size.
Definition: fourier.h:28
#define mIsUdf(val)
Use mIsUdf to check for undefinedness of simple types.
Definition: undefval.h:285
virtual T value(int64_t) const =0
bool xhasudfs_
Definition: convolve2d.h:62
#define mIsZero(x, eps)
Definition: commondefs.h:55
#define od_int64
Definition: plftypes.h:34
~Convolver2D()
Definition: convolve2d.h:126
virtual bool shouldContinue()
bool correlate_
Definition: convolve2d.h:61
float_complex * xf_
Definition: convolve2d.h:65
const Array2D< T > * getX() const
Definition: convolve2d.h:39
float_complex * zf_
Definition: convolve2d.h:67
Generalization of a task that can be run in parallel.
Definition: paralleltask.h:64
void setZ(Array2D< T > &z)
Definition: convolve2d.h:42
bool normalize_
Definition: convolve2d.h:60
Array2D< T > * z_
Definition: convolve2d.h:59
bool updatexf_
Definition: convolve2d.h:69
Fourier::CC * fft_
Definition: convolve2d.h:72
Array2D ( Subclass of ArrayND ) is a two dimensional array.
Definition: arraynd.h:127
void setPos(const T &idxabl)
Definition: arraynd.h:252
Interface to a series of values.
Definition: odmemory.h:15
bool doWork(od_int64, od_int64, int)
Definition: convolve2d.h:188
void setNormalize(bool n)
Definition: convolve2d.h:43
Convolves (or correlates) two 2D signals.
Definition: convolve2d.h:32
void setCorrelate(bool yn)
Definition: convolve2d.h:46
bool yhasudfs_
Definition: convolve2d.h:63
bool doNonFFTWork(od_int64, od_int64, int)
Definition: convolve2d.h:195
const Array2D< T > * y_
Definition: convolve2d.h:58
std::complex< float > float_complex
Definition: odcomplex.h:16
#define mConvolver2DSetIndex(dim)
Definition: convolve2d.h:149
#define mAlgoClass
Definition: convolve2d.h:22
bool shouldFFT() const
Definition: convolve2d.h:99
Definition: convolve2d.h:25
Iterates through all samples in an ArrayND.
Definition: arraynd.h:175
const Array2D< T > * x_
Definition: convolve2d.h:57
od_int64 nrIterations() const
Definition: convolve2d.h:175
bool updateyf_
Definition: convolve2d.h:70
void setX(const Array2D< T > &, bool hasudfs)
Definition: convolve2d.h:130
void setY(const Array2D< T > &, bool hasudfs)
Definition: convolve2d.h:139
const Array2D< T > * getY() const
Definition: convolve2d.h:41
float_complex * yf_
Definition: convolve2d.h:66
void addToNrDone(int64_t increment)
Convolver2D()
Definition: convolve2d.h:104