MCPcopy Create free account
hub / github.com/creatale/node-dv / DFT

Function DFT

deps/opencv/modules/core/src/dxt.cpp:522–957  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

520
521// mixed-radix complex discrete Fourier transform: double-precision version
522template<typename T> static void
523DFT( const Complex<T>* src, Complex<T>* dst, int n,
524 int nf, const int* factors, const int* itab,
525 const Complex<T>* wave, int tab_size,
526 const void*
527#ifdef USE_IPP_DFT
528 spec
529#endif
530 , Complex<T>* buf,
531 int flags, double _scale )
532{
533 static const T sin_120 = (T)0.86602540378443864676372317075294;
534 static const T fft5_2 = (T)0.559016994374947424102293417182819;
535 static const T fft5_3 = (T)-0.951056516295153572116439333379382;
536 static const T fft5_4 = (T)-1.538841768587626701285145288018455;
537 static const T fft5_5 = (T)0.363271264002680442947733378740309;
538
539 int n0 = n, f_idx, nx;
540 int inv = flags & DFT_INVERSE;
541 int dw0 = tab_size, dw;
542 int i, j, k;
543 Complex<T> t;
544 T scale = (T)_scale;
545 int tab_step;
546
547#ifdef USE_IPP_DFT
548 if( spec )
549 {
550 if( !inv )
551 ippsDFTFwd_CToC( src, dst, spec, (uchar*)buf );
552 else
553 ippsDFTInv_CToC( src, dst, spec, (uchar*)buf );
554 return;
555 }
556#endif
557
558 tab_step = tab_size == n ? 1 : tab_size == n*2 ? 2 : tab_size/n;
559
560 // 0. shuffle data
561 if( dst != src )
562 {
563 assert( (flags & DFT_NO_PERMUTE) == 0 );
564 if( !inv )
565 {
566 for( i = 0; i <= n - 2; i += 2, itab += 2*tab_step )
567 {
568 int k0 = itab[0], k1 = itab[tab_step];
569 assert( (unsigned)k0 < (unsigned)n && (unsigned)k1 < (unsigned)n );
570 dst[i] = src[k0]; dst[i+1] = src[k1];
571 }
572
573 if( i < n )
574 dst[n-1] = src[n-1];
575 }
576 else
577 {
578 for( i = 0; i <= n - 2; i += 2, itab += 2*tab_step )
579 {

Callers 4

RealDFTFunction · 0.85
CCSIDFTFunction · 0.85
DFT_32fFunction · 0.85
DFT_64fFunction · 0.85

Calls 3

ippsDFTFwd_CToCFunction · 0.85
ippsDFTInv_CToCFunction · 0.85
checkHardwareSupportFunction · 0.85

Tested by

no test coverage detected