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

Function DFTInit

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

Source from the content-addressed store, hash-verified

170}
171
172static void
173DFTInit( int n0, int nf, int* factors, int* itab, int elem_size, void* _wave, int inv_itab )
174{
175 int digits[34], radix[34];
176 int n = factors[0], m = 0;
177 int* itab0 = itab;
178 int i, j, k;
179 Complex<double> w, w1;
180 double t;
181
182 if( n0 <= 5 )
183 {
184 itab[0] = 0;
185 itab[n0-1] = n0-1;
186
187 if( n0 != 4 )
188 {
189 for( i = 1; i < n0-1; i++ )
190 itab[i] = i;
191 }
192 else
193 {
194 itab[1] = 2;
195 itab[2] = 1;
196 }
197 if( n0 == 5 )
198 {
199 if( elem_size == sizeof(Complex<double>) )
200 ((Complex<double>*)_wave)[0] = Complex<double>(1.,0.);
201 else
202 ((Complex<float>*)_wave)[0] = Complex<float>(1.f,0.f);
203 }
204 if( n0 != 4 )
205 return;
206 m = 2;
207 }
208 else
209 {
210 // radix[] is initialized from index 'nf' down to zero
211 assert (nf < 34);
212 radix[nf] = 1;
213 digits[nf] = 0;
214 for( i = 0; i < nf; i++ )
215 {
216 digits[i] = 0;
217 radix[nf-i-1] = radix[nf-i]*factors[nf-i-1];
218 }
219
220 if( inv_itab && factors[0] != factors[nf-1] )
221 itab = (int*)_wave;
222
223 if( (n & 1) == 0 )
224 {
225 int a = radix[1], na2 = n*a>>1, na4 = na2 >> 1;
226 for( m = 0; (unsigned)(1 << m) < (unsigned)n; m++ )
227 ;
228 if( n <= 2 )
229 {

Callers 2

dftMethod · 0.85
dctMethod · 0.85

Calls 1

sqrtFunction · 0.85

Tested by

no test coverage detected