Added nonzero_rows support
This commit is contained in:
@@ -66,7 +66,7 @@ PARAM_TEST_CASE(Dft, cv::Size, OCL_FFT_TYPE, bool, bool, bool, bool)
|
||||
{
|
||||
cv::Size dft_size;
|
||||
int dft_flags, depth, cn, dft_type;
|
||||
bool inplace;
|
||||
bool hint;
|
||||
bool is1d;
|
||||
|
||||
TEST_DECLARE_INPUT_PARAMETER(src);
|
||||
@@ -93,9 +93,7 @@ PARAM_TEST_CASE(Dft, cv::Size, OCL_FFT_TYPE, bool, bool, bool, bool)
|
||||
dft_flags |= cv::DFT_ROWS;
|
||||
if (GET_PARAM(4))
|
||||
dft_flags |= cv::DFT_SCALE;
|
||||
inplace = GET_PARAM(5);
|
||||
|
||||
|
||||
hint = GET_PARAM(5);
|
||||
is1d = (dft_flags & DFT_ROWS) != 0 || dft_size.height == 1;
|
||||
}
|
||||
|
||||
@@ -103,9 +101,6 @@ PARAM_TEST_CASE(Dft, cv::Size, OCL_FFT_TYPE, bool, bool, bool, bool)
|
||||
{
|
||||
src = randomMat(dft_size, CV_MAKE_TYPE(depth, cn), 0.0, 100.0);
|
||||
usrc = src.getUMat(ACCESS_READ);
|
||||
|
||||
if (inplace)
|
||||
dst = src, udst = usrc;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -113,8 +108,9 @@ OCL_TEST_P(Dft, Mat)
|
||||
{
|
||||
generateTestData();
|
||||
|
||||
OCL_OFF(cv::dft(src, dst, dft_flags));
|
||||
OCL_ON(cv::dft(usrc, udst, dft_flags));
|
||||
int nonzero_rows = hint ? src.cols - randomInt(1, src.rows-1) : 0;
|
||||
OCL_OFF(cv::dft(src, dst, dft_flags, nonzero_rows));
|
||||
OCL_ON(cv::dft(usrc, udst, dft_flags, nonzero_rows));
|
||||
|
||||
if (dft_type == R2C && is1d && (dft_flags & cv::DFT_INVERSE) == 0)
|
||||
{
|
||||
@@ -122,15 +118,16 @@ OCL_TEST_P(Dft, Mat)
|
||||
udst = udst(cv::Range(0, udst.rows), cv::Range(0, udst.cols/2 + 1));
|
||||
}
|
||||
|
||||
Mat gpu = udst.getMat(ACCESS_READ);
|
||||
std::cout << src << std::endl;
|
||||
std::cout << dst << std::endl;
|
||||
std::cout << gpu << std::endl;
|
||||
//Mat gpu = udst.getMat(ACCESS_READ);
|
||||
//std::cout << dst << std::endl;
|
||||
//std::cout << gpu << std::endl;
|
||||
|
||||
//int cn = udst.channels();
|
||||
//
|
||||
//Mat dst1ch = dst.reshape(1);
|
||||
//Mat gpu1ch = gpu.reshape(1);
|
||||
//Mat df;
|
||||
//absdiff(dst, gpu, df);
|
||||
//absdiff(dst1ch, gpu1ch, df);
|
||||
//std::cout << Mat_<int>(df) << std::endl;
|
||||
|
||||
double eps = src.size().area() * 1e-4;
|
||||
@@ -188,13 +185,12 @@ OCL_TEST_P(MulSpectrums, Mat)
|
||||
|
||||
OCL_INSTANTIATE_TEST_CASE_P(OCL_ImgProc, MulSpectrums, testing::Combine(Bool(), Bool()));
|
||||
|
||||
OCL_INSTANTIATE_TEST_CASE_P(Core, Dft, Combine(Values(cv::Size(4, 1), cv::Size(5, 8), cv::Size(6, 6),
|
||||
cv::Size(512, 1), cv::Size(1280, 768)),
|
||||
Values((OCL_FFT_TYPE) R2C, (OCL_FFT_TYPE) C2C, (OCL_FFT_TYPE) R2R, (OCL_FFT_TYPE) C2R),
|
||||
OCL_INSTANTIATE_TEST_CASE_P(Core, Dft, Combine(Values(cv::Size(10, 10), cv::Size(36, 36), cv::Size(512, 1), cv::Size(1280, 768)),
|
||||
Values((OCL_FFT_TYPE) R2C, (OCL_FFT_TYPE) C2C, (OCL_FFT_TYPE) R2R, (OCL_FFT_TYPE) C2R),
|
||||
Bool(), // DFT_INVERSE
|
||||
Bool(), // DFT_ROWS
|
||||
Bool(), // DFT_SCALE
|
||||
Bool() // inplace
|
||||
Bool() // hint
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user