| 1516 | } |
| 1517 | |
| 1518 | void cv::dft( InputArray _src0, OutputArray _dst, int flags, int nonzero_rows ) |
| 1519 | { |
| 1520 | static DFTFunc dft_tbl[6] = |
| 1521 | { |
| 1522 | (DFTFunc)DFT_32f, |
| 1523 | (DFTFunc)RealDFT_32f, |
| 1524 | (DFTFunc)CCSIDFT_32f, |
| 1525 | (DFTFunc)DFT_64f, |
| 1526 | (DFTFunc)RealDFT_64f, |
| 1527 | (DFTFunc)CCSIDFT_64f |
| 1528 | }; |
| 1529 | |
| 1530 | AutoBuffer<uchar> buf; |
| 1531 | void *spec = 0; |
| 1532 | |
| 1533 | Mat src0 = _src0.getMat(), src = src0; |
| 1534 | int prev_len = 0, stage = 0; |
| 1535 | bool inv = (flags & DFT_INVERSE) != 0; |
| 1536 | int nf = 0, real_transform = src.channels() == 1 || (inv && (flags & DFT_REAL_OUTPUT)!=0); |
| 1537 | int type = src.type(), depth = src.depth(); |
| 1538 | int elem_size = (int)src.elemSize1(), complex_elem_size = elem_size*2; |
| 1539 | int factors[34]; |
| 1540 | bool inplace_transform = false; |
| 1541 | #ifdef USE_IPP_DFT |
| 1542 | AutoBuffer<uchar> ippbuf; |
| 1543 | int ipp_norm_flag = !(flags & DFT_SCALE) ? 8 : inv ? 2 : 1; |
| 1544 | #endif |
| 1545 | |
| 1546 | CV_Assert( type == CV_32FC1 || type == CV_32FC2 || type == CV_64FC1 || type == CV_64FC2 ); |
| 1547 | |
| 1548 | if( !inv && src.channels() == 1 && (flags & DFT_COMPLEX_OUTPUT) ) |
| 1549 | _dst.create( src.size(), CV_MAKETYPE(depth, 2) ); |
| 1550 | else if( inv && src.channels() == 2 && (flags & DFT_REAL_OUTPUT) ) |
| 1551 | _dst.create( src.size(), depth ); |
| 1552 | else |
| 1553 | _dst.create( src.size(), type ); |
| 1554 | |
| 1555 | Mat dst = _dst.getMat(); |
| 1556 | |
| 1557 | if( !real_transform ) |
| 1558 | elem_size = complex_elem_size; |
| 1559 | |
| 1560 | if( src.cols == 1 && nonzero_rows > 0 ) |
| 1561 | CV_Error( CV_StsNotImplemented, |
| 1562 | "This mode (using nonzero_rows with a single-column matrix) breaks the function's logic, so it is prohibited.\n" |
| 1563 | "For fast convolution/correlation use 2-column matrix or single-row matrix instead" ); |
| 1564 | |
| 1565 | // determine, which transform to do first - row-wise |
| 1566 | // (stage 0) or column-wise (stage 1) transform |
| 1567 | if( !(flags & DFT_ROWS) && src.rows > 1 && |
| 1568 | ((src.cols == 1 && (!src.isContinuous() || !dst.isContinuous())) || |
| 1569 | (src.cols > 1 && inv && real_transform)) ) |
| 1570 | stage = 1; |
| 1571 | |
| 1572 | for(;;) |
| 1573 | { |
| 1574 | double scale = 1; |
| 1575 | uchar* wave = 0; |
nothing calls this directly
no test coverage detected