| 2276 | } |
| 2277 | |
| 2278 | void cv::dct( InputArray _src0, OutputArray _dst, int flags ) |
| 2279 | { |
| 2280 | static DCTFunc dct_tbl[4] = |
| 2281 | { |
| 2282 | (DCTFunc)DCT_32f, |
| 2283 | (DCTFunc)IDCT_32f, |
| 2284 | (DCTFunc)DCT_64f, |
| 2285 | (DCTFunc)IDCT_64f |
| 2286 | }; |
| 2287 | |
| 2288 | bool inv = (flags & DCT_INVERSE) != 0; |
| 2289 | Mat src0 = _src0.getMat(), src = src0; |
| 2290 | int type = src.type(), depth = src.depth(); |
| 2291 | void /* *spec_dft = 0, */ *spec = 0; |
| 2292 | |
| 2293 | double scale = 1.; |
| 2294 | int prev_len = 0, nf = 0, stage, end_stage; |
| 2295 | uchar *src_dft_buf = 0, *dst_dft_buf = 0; |
| 2296 | uchar *dft_wave = 0, *dct_wave = 0; |
| 2297 | int* itab = 0; |
| 2298 | uchar* ptr = 0; |
| 2299 | int elem_size = (int)src.elemSize(), complex_elem_size = elem_size*2; |
| 2300 | int factors[34], inplace_transform; |
| 2301 | int i, len, count; |
| 2302 | AutoBuffer<uchar> buf; |
| 2303 | |
| 2304 | CV_Assert( type == CV_32FC1 || type == CV_64FC1 ); |
| 2305 | _dst.create( src.rows, src.cols, type ); |
| 2306 | Mat dst = _dst.getMat(); |
| 2307 | |
| 2308 | DCTFunc dct_func = dct_tbl[(int)inv + (depth == CV_64F)*2]; |
| 2309 | |
| 2310 | if( (flags & DCT_ROWS) || src.rows == 1 || |
| 2311 | (src.cols == 1 && (src.isContinuous() && dst.isContinuous()))) |
| 2312 | { |
| 2313 | stage = end_stage = 0; |
| 2314 | } |
| 2315 | else |
| 2316 | { |
| 2317 | stage = src.cols == 1; |
| 2318 | end_stage = 1; |
| 2319 | } |
| 2320 | |
| 2321 | for( ; stage <= end_stage; stage++ ) |
| 2322 | { |
| 2323 | uchar *sptr = src.data, *dptr = dst.data; |
| 2324 | size_t sstep0, sstep1, dstep0, dstep1; |
| 2325 | |
| 2326 | if( stage == 0 ) |
| 2327 | { |
| 2328 | len = src.cols; |
| 2329 | count = src.rows; |
| 2330 | if( len == 1 && !(flags & DCT_ROWS) ) |
| 2331 | { |
| 2332 | len = src.rows; |
| 2333 | count = 1; |
| 2334 | } |
| 2335 | sstep0 = src.step; |
nothing calls this directly
no test coverage detected