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

Function DFTFactorize

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

Source from the content-addressed store, hash-verified

126 ((unsigned)bitrevTab[((i)>>24)])) >> (shift)))
127
128static int
129DFTFactorize( int n, int* factors )
130{
131 int nf = 0, f, i, j;
132
133 if( n <= 5 )
134 {
135 factors[0] = n;
136 return 1;
137 }
138
139 f = (((n - 1)^n)+1) >> 1;
140 if( f > 1 )
141 {
142 factors[nf++] = f;
143 n = f == n ? 1 : n/f;
144 }
145
146 for( f = 3; n > 1; )
147 {
148 int d = n/f;
149 if( d*f == n )
150 {
151 factors[nf++] = f;
152 n = d;
153 }
154 else
155 {
156 f += 2;
157 if( f*f > n )
158 break;
159 }
160 }
161
162 if( n > 1 )
163 factors[nf++] = n;
164
165 f = (factors[0] & 1) == 0;
166 for( i = f; i < (nf+f)/2; i++ )
167 CV_SWAP( factors[i], factors[nf-i-1+f], j );
168
169 return nf;
170}
171
172static void
173DFTInit( int n0, int nf, int* factors, int* itab, int elem_size, void* _wave, int inv_itab )

Callers 2

dftMethod · 0.85
dctMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected