Tool/software: Linux
#include <unistd.h>
#include <time.h>
#include <stdio.h>
#include <opencv2/opencv.hpp>
#include <opencv2/core/ocl.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/highgui/highgui.hpp>
#ifndef _OCL_HPP_
#include "opencv2/core/ocl.hpp"
#endif
using namespace cv;
using namespace std;
int main(){
VideoCapture cap;
cap.open("1.avi");
if(!cap.isOpened())
{
cout << "colud not load vodeo...."<<endl;
return -1;
}
ocl::setUseOpenCL(true);
Mat matSrc;
while(cap.read(matSrc))
{
cvtColor( matSrc , matSrc , CV_RGB2GRAY );
Mat padded;
int m = getOptimalDFTSize(matSrc.rows); // Return size of 2^x that suite for FFT
int n = getOptimalDFTSize(matSrc.cols);
// Padding 0, result is @padded
copyMakeBorder(matSrc, padded, 0, m-matSrc.rows, 0, n-matSrc.cols, BORDER_CONSTANT, Scalar::all(0));
// Create planes to storage REAL part and IMAGE part, IMAGE part init are 0
Mat planes[] = {Mat_<float>(padded), Mat::zeros(padded.size(), CV_32F) };
UMat complexI;
merge(planes, 2, complexI);
cv::dft(complexI, complexI);
}
ocl::setUseOpenCL(false);
return 0;
}
We tried to use DSP accelerated cv::dft()
It would compiled the opencl kernel for about 5 mins and return a compile error :
>>> Optimizer terminated abnormally
>>>> in function ifft_multi_radix_rows()
>> Compilation failure
OpenCL program build log: -D LOCAL_SIZE=50 -D kercn=10 -D FT=float -D CT=float2 -D RADIX_PROCESS='fft_radix2_B5(smem,twiddles+0,ind,1,25);fft_radix5_B2(smem,twiddles+1,ind,2,1T
>> Compilation failure
It will succeed in ARM .My SDK is 4.2.
Please help us ,we need dsp to accelerate dft();