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

Function RealDFT

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

Source from the content-addressed store, hash-verified

962 re(0), re(1), im(1), ... , re(n/2-1), im((n+1)/2-1) [, re((n+1)/2)] OR ...
963 re(0), 0, re(1), im(1), ..., re(n/2-1), im((n+1)/2-1) [, re((n+1)/2), 0] */
964template<typename T> static void
965RealDFT( const T* src, T* dst, int n, int nf, int* factors, const int* itab,
966 const Complex<T>* wave, int tab_size, const void*
967#ifdef USE_IPP_DFT
968 spec
969#endif
970 ,
971 Complex<T>* buf, int flags, double _scale )
972{
973 int complex_output = (flags & DFT_COMPLEX_INPUT_OR_OUTPUT) != 0;
974 T scale = (T)_scale;
975 int j, n2 = n >> 1;
976 dst += complex_output;
977
978#ifdef USE_IPP_DFT
979 if( spec )
980 {
981 ippsDFTFwd_RToPack( src, dst, spec, (uchar*)buf );
982 if( complex_output )
983 {
984 dst[-1] = dst[0];
985 dst[0] = 0;
986 if( (n & 1) == 0 )
987 dst[n] = 0;
988 }
989 return;
990 }
991#endif
992 assert( tab_size == n );
993
994 if( n == 1 )
995 {
996 dst[0] = src[0]*scale;
997 }
998 else if( n == 2 )
999 {
1000 T t = (src[0] + src[1])*scale;
1001 dst[1] = (src[0] - src[1])*scale;
1002 dst[0] = t;
1003 }
1004 else if( n & 1 )
1005 {
1006 dst -= complex_output;
1007 Complex<T>* _dst = (Complex<T>*)dst;
1008 _dst[0].re = src[0]*scale;
1009 _dst[0].im = 0;
1010 for( j = 1; j < n; j += 2 )
1011 {
1012 T t0 = src[itab[j]]*scale;
1013 T t1 = src[itab[j+1]]*scale;
1014 _dst[j].re = t0;
1015 _dst[j].im = 0;
1016 _dst[j+1].re = t1;
1017 _dst[j+1].im = 0;
1018 }
1019 DFT( _dst, _dst, n, nf, factors, itab, wave,
1020 tab_size, 0, buf, DFT_NO_PERMUTE, 1 );
1021 if( !complex_output )

Callers 3

RealDFT_32fFunction · 0.85
RealDFT_64fFunction · 0.85
DCTFunction · 0.85

Calls 2

ippsDFTFwd_RToPackFunction · 0.85
DFTFunction · 0.85

Tested by

no test coverage detected