Merge branch 2.4

This commit is contained in:
Andrey Kamaev 2013-02-24 20:16:41 +04:00
commit dddd285d3b
29 changed files with 237 additions and 2429 deletions

View File

@ -53,8 +53,8 @@ As usual, after the not-so-lengthy explanation, let's go to the code:
std::cout<<"* Enter alpha [0-1]: "; std::cout<<"* Enter alpha [0-1]: ";
std::cin>>input; std::cin>>input;
/// We use the alpha provided by the user iff it is between 0 and 1 /// We use the alpha provided by the user if it is between 0 and 1
if( alpha >= 0 && alpha <= 1 ) if( input >= 0.0 && input <= 1.0 )
{ alpha = input; } { alpha = input; }
/// Read image ( same size, same type ) /// Read image ( same size, same type )

View File

@ -57,180 +57,6 @@ using namespace cv;
using namespace cv::ocl; using namespace cv::ocl;
using namespace std; using namespace std;
#if !defined (HAVE_OPENCL)
/* arithmetics */
void cv::ocl::add(const oclMat &, const oclMat &, oclMat &)
{
throw_nogpu();
}
void cv::ocl::add(const oclMat &, const oclMat &, oclMat &, const oclMat &)
{
throw_nogpu();
}
void cv::ocl::add(const oclMat &, const Scalar &, oclMat &, const oclMat &)
{
throw_nogpu();
}
void cv::ocl::subtract(const oclMat &, const oclMat &, oclMat &)
{
throw_nogpu();
}
void cv::ocl::subtract(const oclMat &, const oclMat &, oclMat &, const oclMat &)
{
throw_nogpu();
}
void cv::ocl::subtract(const oclMat &, const Scalar &, oclMat &, const oclMat & )
{
throw_nogpu();
}
void cv::ocl::subtract(const Scalar &, const oclMat &, oclMat &, const oclMat & )
{
throw_nogpu();
}
void cv::ocl::multiply(const oclMat &, const oclMat &, oclMat &, double)
{
throw_nogpu();
}
void cv::ocl::divide(const oclMat &, const oclMat &, oclMat &, double)
{
throw_nogpu();
}
void cv::ocl::divide(double, const oclMat &, oclMat &)
{
throw_nogpu();
}
void cv::ocl::absdiff(const oclMat &, const oclMat &, oclMat &)
{
throw_nogpu();
}
void cv::ocl::absdiff(const oclMat &, const Scalar &, oclMat &)
{
throw_nogpu();
}
void cv::ocl::compare(const oclMat &, const oclMat &, oclMat & , int)
{
throw_nogpu();
}
void cv::ocl::meanStdDev(const oclMat &, Scalar &, Scalar &)
{
throw_nogpu();
}
double cv::ocl::norm(const oclMat &, int)
{
throw_nogpu();
return 0.0;
}
double cv::ocl::norm(const oclMat &, const oclMat &, int)
{
throw_nogpu();
return 0.0;
}
void cv::ocl::flip(const oclMat &, oclMat &, int)
{
throw_nogpu();
}
Scalar cv::ocl::sum(const oclMat &)
{
throw_nogpu();
return Scalar();
}
void cv::ocl::minMax(const oclMat &, double *, double *, const oclMat &)
{
throw_nogpu();
}
void cv::ocl::minMaxLoc(const oclMat &, double *, double *, Point *, Point *, const oclMat &)
{
throw_nogpu();
}
void cv::ocl::LUT(const oclMat &, const Mat &, oclMat &)
{
throw_nogpu();
}
void cv::ocl::exp(const oclMat &, oclMat &)
{
throw_nogpu();
}
void cv::ocl::log(const oclMat &, oclMat &)
{
throw_nogpu();
}
void cv::ocl::magnitude(const oclMat &, oclMat &)
{
throw_nogpu();
}
void cv::ocl::phase(const oclMat &, const oclMat &, oclMat &, bool)
{
throw_nogpu();
}
void cv::ocl::cartToPolar(const oclMat &, const oclMat &, oclMat &, oclMat &, bool)
{
throw_nogpu();
}
void cv::ocl::polarToCart(const oclMat &, const oclMat &, oclMat &, oclMat &, bool)
{
throw_nogpu();
}
void cv::ocl::transpose(const oclMat &, oclMat &)
{
throw_nogpu();
}
void cv::ocl::pow(const oclMat &, double, oclMat &)
{
throw_nogpu();
}
void cv::ocl::addWeighted(const oclMat &src1, double alpha, const oclMat &src2, double beta, double gama, oclMat &dst)
{
throw_nogpu();
}
void cv::ocl::magnitudeSqr(const oclMat &src1, const oclMat &src2, oclMat &dst)
{
throw_nogpu();
}
/* bit wise operations */
void cv::ocl::bitwise_not(const oclMat &, oclMat &)
{
throw_nogpu();
}
void cv::ocl::bitwise_or(const oclMat &, const oclMat &, oclMat &, const oclMat &)
{
throw_nogpu();
}
void cv::ocl::bitwise_and(const oclMat &, const oclMat &, oclMat &, const oclMat &)
{
throw_nogpu();
}
void cv::ocl::bitwise_and(const oclMat &, const Scalar &, oclMat &, const oclMat &)
{
throw_nogpu();
}
void cv::ocl::bitwise_xor(const oclMat &, const oclMat &, oclMat &, const oclMat &)
{
throw_nogpu();
}
cv::ocl::oclMat cv::ocl::operator ~ (const oclMat &)
{
throw_nogpu();
return oclMat();
}
cv::ocl::oclMat cv::ocl::operator | (const oclMat &, const oclMat &)
{
throw_nogpu();
return oclMat();
}
cv::ocl::oclMat cv::ocl::operator & (const oclMat &, const oclMat &)
{
throw_nogpu();
return oclMat();
}
cv::ocl::oclMat cv::ocl::operator ^ (const oclMat &, const oclMat &)
{
throw_nogpu();
return oclMat();
}
#else /* !defined (HAVE_OPENCL) */
namespace cv namespace cv
{ {
namespace ocl namespace ocl
@ -2477,5 +2303,3 @@ void cv::ocl::pow(const oclMat &x, double p, oclMat &y)
arithmetic_pow_run(x, p, y, kernelName, &arithm_pow); arithmetic_pow_run(x, p, y, kernelName, &arithm_pow);
} }
#endif /* !defined (HAVE_OPENCL) */

View File

@ -50,17 +50,6 @@ using namespace std;
using std::cout; using std::cout;
using std::endl; using std::endl;
#if !defined (HAVE_OPENCL)
namespace cv
{
namespace ocl
{
//nothing
}//namespace ocl
}//namespace cv
#else /* !defined (HAVE_OPENCL) */
namespace cv namespace cv
{ {
namespace ocl namespace ocl
@ -99,4 +88,3 @@ namespace cv
}//namespace ocl }//namespace ocl
}//namespace cv }//namespace cv
#endif

View File

@ -50,13 +50,6 @@ using namespace cv;
using namespace cv::ocl; using namespace cv::ocl;
using namespace std; using namespace std;
#if !defined (HAVE_OPENCL)
void cv::ocl::blendLinear(const oclMat &img1, const oclMat &img2, const oclMat &weights1, const oclMat &weights2,
oclMat &result)
{
throw_nogpu();
}
#else
namespace cv namespace cv
{ {
namespace ocl namespace ocl
@ -97,5 +90,4 @@ void cv::ocl::blendLinear(const oclMat &img1, const oclMat &img2, const oclMat &
openCLExecuteKernel(ctx, &blend_linear, kernelName, globalSize, localSize, args, channels, depth); openCLExecuteKernel(ctx, &blend_linear, kernelName, globalSize, localSize, args, channels, depth);
} }
} }
#endif

View File

@ -51,136 +51,6 @@ using namespace cv;
using namespace cv::ocl; using namespace cv::ocl;
using namespace std; using namespace std;
#if !defined (HAVE_OPENCL)
cv::ocl::BruteForceMatcher_OCL_base::BruteForceMatcher_OCL_base(DistType)
{
throw_nogpu();
}
void cv::ocl::BruteForceMatcher_OCL_base::add(const vector<oclMat> &)
{
throw_nogpu();
}
const vector<oclMat> &cv::ocl::BruteForceMatcher_OCL_base::getTrainDescriptors() const
{
throw_nogpu();
return trainDescCollection;
}
void cv::ocl::BruteForceMatcher_OCL_base::clear()
{
throw_nogpu();
}
bool cv::ocl::BruteForceMatcher_OCL_base::empty() const
{
throw_nogpu();
return true;
}
bool cv::ocl::BruteForceMatcher_OCL_base::isMaskSupported() const
{
throw_nogpu();
return true;
}
void cv::ocl::BruteForceMatcher_OCL_base::matchSingle(const oclMat &, const oclMat &, oclMat &, oclMat &, const oclMat &)
{
throw_nogpu();
}
void cv::ocl::BruteForceMatcher_OCL_base::matchDownload(const oclMat &, const oclMat &, vector<DMatch> &)
{
throw_nogpu();
}
void cv::ocl::BruteForceMatcher_OCL_base::matchConvert(const Mat &, const Mat &, vector<DMatch> &)
{
throw_nogpu();
}
void cv::ocl::BruteForceMatcher_OCL_base::match(const oclMat &, const oclMat &, vector<DMatch> &, const oclMat &)
{
throw_nogpu();
}
void cv::ocl::BruteForceMatcher_OCL_base::makeGpuCollection(oclMat &, oclMat &, const vector<oclMat> &)
{
throw_nogpu();
}
void cv::ocl::BruteForceMatcher_OCL_base::matchCollection(const oclMat &, const oclMat &, oclMat &, oclMat &, oclMat &, const oclMat &)
{
throw_nogpu();
}
void cv::ocl::BruteForceMatcher_OCL_base::matchDownload(const oclMat &, const oclMat &, const oclMat &, vector<DMatch> &)
{
throw_nogpu();
}
void cv::ocl::BruteForceMatcher_OCL_base::matchConvert(const Mat &, const Mat &, const Mat &, vector<DMatch> &)
{
throw_nogpu();
}
void cv::ocl::BruteForceMatcher_OCL_base::match(const oclMat &, vector<DMatch> &, const vector<oclMat> &)
{
throw_nogpu();
}
void cv::ocl::BruteForceMatcher_OCL_base::knnMatchSingle(const oclMat &, const oclMat &, oclMat &, oclMat &, oclMat &, int, const oclMat &)
{
throw_nogpu();
}
void cv::ocl::BruteForceMatcher_OCL_base::knnMatchDownload(const oclMat &, const oclMat &, vector< vector<DMatch> > &, bool)
{
throw_nogpu();
}
void cv::ocl::BruteForceMatcher_OCL_base::knnMatchConvert(const Mat &, const Mat &, vector< vector<DMatch> > &, bool)
{
throw_nogpu();
}
void cv::ocl::BruteForceMatcher_OCL_base::knnMatch(const oclMat &, const oclMat &, vector< vector<DMatch> > &, int, const oclMat &, bool)
{
throw_nogpu();
}
void cv::ocl::BruteForceMatcher_OCL_base::knnMatch2Collection(const oclMat &, const oclMat &, oclMat &, oclMat &, oclMat &, const oclMat &)
{
throw_nogpu();
}
void cv::ocl::BruteForceMatcher_OCL_base::knnMatch2Download(const oclMat &, const oclMat &, const oclMat &, vector< vector<DMatch> > &, bool)
{
throw_nogpu();
}
void cv::ocl::BruteForceMatcher_OCL_base::knnMatch2Convert(const Mat &, const Mat &, const Mat &, vector< vector<DMatch> > &, bool)
{
throw_nogpu();
}
void cv::ocl::BruteForceMatcher_OCL_base::knnMatch(const oclMat &, vector< vector<DMatch> > &, int, const vector<oclMat> &, bool)
{
throw_nogpu();
}
void cv::ocl::BruteForceMatcher_OCL_base::radiusMatchSingle(const oclMat &, const oclMat &, oclMat &, oclMat &, oclMat &, float, const oclMat &)
{
throw_nogpu();
}
void cv::ocl::BruteForceMatcher_OCL_base::radiusMatchDownload(const oclMat &, const oclMat &, const oclMat &, vector< vector<DMatch> > &, bool)
{
throw_nogpu();
}
void cv::ocl::BruteForceMatcher_OCL_base::radiusMatchConvert(const Mat &, const Mat &, const Mat &, vector< vector<DMatch> > &, bool)
{
throw_nogpu();
}
void cv::ocl::BruteForceMatcher_OCL_base::radiusMatch(const oclMat &, const oclMat &, vector< vector<DMatch> > &, float, const oclMat &, bool)
{
throw_nogpu();
}
void cv::ocl::BruteForceMatcher_OCL_base::radiusMatchCollection(const oclMat &, oclMat &, oclMat &, oclMat &, oclMat &, float, const vector<oclMat> &)
{
throw_nogpu();
}
void cv::ocl::BruteForceMatcher_OCL_base::radiusMatchDownload(const oclMat &, const oclMat &, const oclMat &, const oclMat &, vector< vector<DMatch> > &, bool)
{
throw_nogpu();
}
void cv::ocl::BruteForceMatcher_OCL_base::radiusMatchConvert(const Mat &, const Mat &, const Mat &, const Mat &, vector< vector<DMatch> > &, bool)
{
throw_nogpu();
}
void cv::ocl::BruteForceMatcher_OCL_base::radiusMatch(const oclMat &, vector< vector<DMatch> > &, float, const vector<oclMat> &, bool)
{
throw_nogpu();
}
#else /* !defined (HAVE_OPENCL) */
using namespace std; using namespace std;
namespace cv namespace cv
{ {
@ -1826,8 +1696,4 @@ void cv::ocl::BruteForceMatcher_OCL_base::radiusMatch(const oclMat &query, vecto
oclMat trainIdx, imgIdx, distance, nMatches; oclMat trainIdx, imgIdx, distance, nMatches;
radiusMatchCollection(query, trainIdx, imgIdx, distance, nMatches, maxDistance, masks); radiusMatchCollection(query, trainIdx, imgIdx, distance, nMatches, maxDistance, masks);
radiusMatchDownload(trainIdx, imgIdx, distance, nMatches, matches, compactResult); radiusMatchDownload(trainIdx, imgIdx, distance, nMatches, matches, compactResult);
} }
#endif

View File

@ -49,21 +49,6 @@ using namespace cv;
using namespace cv::ocl; using namespace cv::ocl;
using namespace std; using namespace std;
#if !defined (HAVE_OPENCL)
void cv::ocl::buildWarpPlaneMaps(Size, Rect, const Mat &, const Mat &, const Mat &, float, oclMat &, oclMat &, Stream &)
{
throw_nogpu();
}
void cv::ocl::buildWarpCylindricalMaps(Size, Rect, const Mat &, const Mat &, float, oclMat &, oclMat &, Stream &)
{
throw_nogpu();
}
void cv::ocl::buildWarpSphericalMaps(Size, Rect, const Mat &, const Mat &, float, oclMat &, oclMat &, Stream &)
{
throw_nogpu();
}
#else
namespace cv namespace cv
{ {
namespace ocl namespace ocl
@ -275,6 +260,3 @@ void cv::ocl::buildWarpPerspectiveMaps(const Mat &M, bool inverse, Size dsize, o
size_t localThreads[3] = {32, 8, 1}; size_t localThreads[3] = {32, 8, 1};
openCLExecuteKernel(clCxt, &build_warps, kernelName, globalThreads, localThreads, args, -1, -1); openCLExecuteKernel(clCxt, &build_warps, kernelName, globalThreads, localThreads, args, -1, -1);
} }
#endif // HAVE_OPENCL

View File

@ -51,25 +51,6 @@ using namespace cv;
using namespace cv::ocl; using namespace cv::ocl;
using namespace std; using namespace std;
#if !defined (HAVE_OPENCL)
void cv::ocl::Canny(const oclMat &image, oclMat &edges, double low_thresh, double high_thresh, int apperture_size = 3, bool L2gradient = false)
{
throw_nogpu();
}
void cv::ocl::Canny(const oclMat &image, CannyBuf &buf, oclMat &edges, double low_thresh, double high_thresh, int apperture_size = 3, bool L2gradient = false)
{
throw_nogpu();
}
void cv::ocl::Canny(const oclMat &dx, const oclMat &dy, oclMat &edges, double low_thresh, double high_thresh, bool L2gradient = false)
{
throw_nogpu();
}
void cv::ocl::Canny(const oclMat &dx, const oclMat &dy, CannyBuf &buf, oclMat &edges, double low_thresh, double high_thresh, bool L2gradient = false)
{
throw_nogpu();
}
#else
namespace cv namespace cv
{ {
namespace ocl namespace ocl
@ -426,5 +407,3 @@ void canny::getEdges_gpu(oclMat &map, oclMat &dst, int rows, int cols)
openCLExecuteKernel2(clCxt, &imgproc_canny, kernelName, globalThreads, localThreads, args, -1, -1); openCLExecuteKernel2(clCxt, &imgproc_canny, kernelName, globalThreads, localThreads, args, -1, -1);
} }
#endif // HAVE_OPENCL

View File

@ -49,18 +49,6 @@
using namespace cv; using namespace cv;
using namespace cv::ocl; using namespace cv::ocl;
#if !defined (HAVE_OPENCL)
void cv::ocl::cvtColor(const oclMat &, oclMat &, int, int)
{
throw_nogpu();
}
void cv::ocl::cvtColor(const oclMat &, oclMat &, int, int, const Stream &)
{
throw_nogpu();
}
#else /* !defined (HAVE_OPENCL) */
#ifndef CV_DESCALE #ifndef CV_DESCALE
#define CV_DESCALE(x, n) (((x) + (1 << ((n)-1))) >> (n)) #define CV_DESCALE(x, n) (((x) + (1 << ((n)-1))) >> (n))
#endif #endif
@ -289,5 +277,3 @@ void cv::ocl::cvtColor(const oclMat &src, oclMat &dst, int code, int dcn)
{ {
cvtColor_caller(src, dst, code, dcn); cvtColor_caller(src, dst, code, dcn);
} }
#endif /* !defined (HAVE_OPENCL) */

View File

@ -50,16 +50,6 @@ using namespace cv;
using namespace cv::ocl; using namespace cv::ocl;
using namespace std; using namespace std;
#if !defined(HAVE_OPENCL)
void cv::ocl::columnSum(const oclMat &src, oclMat &dst)
{
throw_nogpu();
}
#else /*!HAVE_OPENCL */
namespace cv namespace cv
{ {
namespace ocl namespace ocl
@ -92,5 +82,4 @@ void cv::ocl::columnSum(const oclMat &src, oclMat &dst)
openCLExecuteKernel(clCxt, &imgproc_columnsum, kernelName, globalThreads, localThreads, args, src.channels(), src.depth()); openCLExecuteKernel(clCxt, &imgproc_columnsum, kernelName, globalThreads, localThreads, args, src.channels(), src.depth());
} }
#endif

View File

@ -46,12 +46,6 @@
using namespace cv; using namespace cv;
using namespace cv::ocl; using namespace cv::ocl;
#if !defined (HAVE_OPENCL)
// do nothing
#else /* !defined (HAVE_OPENCL) */
namespace cv namespace cv
{ {
namespace ocl namespace ocl
@ -194,5 +188,3 @@ namespace cv
} }
} }
} }
#endif

View File

@ -49,12 +49,7 @@ using namespace cv;
using namespace cv::ocl; using namespace cv::ocl;
using namespace std; using namespace std;
#if !defined HAVE_OPENCL #if !defined HAVE_CLAMDFFT
void cv::ocl::dft(const oclMat &, oclMat &, Size , int )
{
throw_nogpu();
}
#elif !defined HAVE_CLAMDFFT
void cv::ocl::dft(const oclMat&, oclMat&, Size, int) void cv::ocl::dft(const oclMat&, oclMat&, Size, int)
{ {
CV_Error(CV_StsNotImplemented, "OpenCL DFT is not implemented"); CV_Error(CV_StsNotImplemented, "OpenCL DFT is not implemented");

View File

@ -54,121 +54,6 @@ using namespace std;
using namespace cv; using namespace cv;
using namespace cv::ocl; using namespace cv::ocl;
#if !defined (HAVE_OPENCL)
Ptr<BaseFilter_GPU> cv::ocl::getBoxFilter_GPU(int, int, const Size &, Point, int)
{
throw_nogpu();
return Ptr<BaseFilter_GPU>(0);
}
Ptr<FilterEngine_GPU> cv::ocl::createBoxFilter_GPU(int, int, const Size &, const Point &, int)
{
throw_nogpu();
return Ptr<FilterEngine_GPU>(0);
}
Ptr<FilterEngine_GPU> cv::ocl::createFilter2D_GPU(const Ptr<BaseFilter_GPU>)
{
throw_nogpu();
return Ptr<FilterEngine_GPU>(0);
}
Ptr<FilterEngine_GPU> cv::ocl::createSeparableLinearFilter_GPU(int, int, const Mat &, const Mat &, const Point &)
{
throw_nogpu();
return Ptr<FilterEngine_GPU>(0);
}
Ptr<BaseRowFilter_GPU> cv::ocl::getLinearRowFilter_GPU(int, int, const Mat &, int)
{
throw_nogpu();
return Ptr<BaseRowFilter_GPU>(0);
}
Ptr<BaseColumnFilter_GPU> cv::ocl::getLinearColumnFilter_GPU(int, int, const Mat &, int)
{
throw_nogpu();
return Ptr<BaseColumnFilter_GPU>(0);
}
Ptr<FilterEngine_GPU> cv::ocl::createGaussianFilter_GPU(int, Size, double, double)
{
throw_nogpu();
return Ptr<FilterEngine_GPU>(0);
}
Ptr<BaseFilter_GPU> cv::ocl::getLinearFilter_GPU(int, int, const Mat &, const Size &, Point)
{
throw_nogpu();
return Ptr<BaseFilter_GPU>(0);
}
Ptr<FilterEngine_GPU> cv::ocl::createLinearFilter_GPU(int, int, const Mat &, const Point &)
{
throw_nogpu();
return Ptr<FilterEngine_GPU>(0);
}
Ptr<FilterEngine_GPU> cv::ocl::createDerivFilter_GPU(int srcType, int dstType, int dx, int dy, int ksize, int borderType)
{
throw_nogpu();
return Ptr<FilterEngine_GPU>(0);
}
void cv::ocl::boxFilter(const oclMat &, oclMat &, int, Size, Point, int)
{
throw_nogpu();
}
void cv::ocl::sepFilter2D(const oclMat &, oclMat &, int, const Mat &, const Mat &, Point)
{
throw_nogpu();
}
void cv::ocl::Sobel(const oclMat &, oclMat &, int, int, int, int, double)
{
throw_nogpu();
}
void cv::ocl::Scharr(const oclMat &, oclMat &, int, int, int, double)
{
throw_nogpu();
}
void cv::ocl::GaussianBlur(const oclMat &, oclMat &, Size, double, double)
{
throw_nogpu();
}
void cv::ocl::filter2D(const oclMat &, oclMat &, int, const Mat &, Point)
{
throw_nogpu();
}
void cv::ocl::Laplacian(const oclMat &, oclMat &, int, int, double)
{
throw_nogpu();
}
void cv::ocl::erode(const oclMat &, oclMat &, const Mat &, Point, int)
{
throw_nogpu();
}
void cv::ocl::dilate(const oclMat &, oclMat &, const Mat &, Point, int)
{
throw_nogpu();
}
void cv::ocl::morphologyEx(const oclMat &, oclMat &, int, const Mat &, Point, int)
{
throw_nogpu();
}
#else /* !defined (HAVE_OPENCL) */
//helper routines //helper routines
namespace cv namespace cv
{ {
@ -1705,5 +1590,3 @@ void cv::ocl::GaussianBlur(const oclMat &src, oclMat &dst, Size ksize, double si
Ptr<FilterEngine_GPU> f = createGaussianFilter_GPU(src.type(), ksize, sigma1, sigma2, bordertype); Ptr<FilterEngine_GPU> f = createGaussianFilter_GPU(src.type(), ksize, sigma1, sigma2, bordertype);
f->apply(src, dst); f->apply(src, dst);
} }
#endif /* !defined (HAVE_OPENCL) */

View File

@ -46,24 +46,14 @@
#include <iomanip> #include <iomanip>
#include "precomp.hpp" #include "precomp.hpp"
#ifdef HAVE_CLAMDBLAS #if !defined HAVE_CLAMDBLAS
void cv::ocl::gemm(const oclMat&, const oclMat&, double,
#include "clAmdBlas.h" const oclMat&, double, oclMat&, int)
#if !defined HAVE_OPENCL
void cv::ocl::gemm(const oclMat &src1, const oclMat &src2, double alpha,
const oclMat &src3, double beta, oclMat &dst, int flags)
{
throw_nogpu();
}
#elif !defined HAVE_CLAMDBLAS
void cv::ocl::gemm(const oclMat &src1, const oclMat &src2, double alpha,
const oclMat &src3, double beta, oclMat &dst, int flags)
{ {
CV_Error(CV_StsNotImplemented, "OpenCL BLAS is not implemented"); CV_Error(CV_StsNotImplemented, "OpenCL BLAS is not implemented");
} }
#else #else
#include "clAmdBlas.h"
using namespace cv; using namespace cv;
void cv::ocl::gemm(const oclMat &src1, const oclMat &src2, double alpha, void cv::ocl::gemm(const oclMat &src1, const oclMat &src2, double alpha,
@ -168,4 +158,3 @@ void cv::ocl::gemm(const oclMat &src1, const oclMat &src2, double alpha,
clAmdBlasTeardown(); clAmdBlasTeardown();
} }
#endif #endif
#endif

File diff suppressed because it is too large Load Diff

View File

@ -49,69 +49,6 @@ using namespace cv;
using namespace cv::ocl; using namespace cv::ocl;
using namespace std; using namespace std;
#if !defined (HAVE_OPENCL)
cv::ocl::HOGDescriptor::HOGDescriptor(Size, Size, Size, Size, int, double, double, bool, int)
{
throw_nogpu();
}
size_t cv::ocl::HOGDescriptor::getDescriptorSize() const
{
throw_nogpu();
return 0;
}
size_t cv::ocl::HOGDescriptor::getBlockHistogramSize() const
{
throw_nogpu();
return 0;
}
double cv::ocl::HOGDescriptor::getWinSigma() const
{
throw_nogpu();
return 0;
}
bool cv::ocl::HOGDescriptor::checkDetectorSize() const
{
throw_nogpu();
return false;
}
void cv::ocl::HOGDescriptor::setSVMDetector(const vector<float> &)
{
throw_nogpu();
}
void cv::ocl::HOGDescriptor::detect(const oclMat &, vector<Point> &, double, Size, Size)
{
throw_nogpu();
}
void cv::ocl::HOGDescriptor::detectMultiScale(const oclMat &, vector<Rect> &, double, Size, Size, double, int)
{
throw_nogpu();
}
void cv::ocl::HOGDescriptor::computeBlockHistograms(const oclMat &)
{
throw_nogpu();
}
void cv::ocl::HOGDescriptor::getDescriptors(const oclMat &, Size, oclMat &, int)
{
throw_nogpu();
}
std::vector<float> cv::ocl::HOGDescriptor::getDefaultPeopleDetector()
{
throw_nogpu();
return std::vector<float>();
}
std::vector<float> cv::ocl::HOGDescriptor::getPeopleDetector48x96()
{
throw_nogpu();
return std::vector<float>();
}
std::vector<float> cv::ocl::HOGDescriptor::getPeopleDetector64x128()
{
throw_nogpu();
return std::vector<float>();
}
#else
#define CELL_WIDTH 8 #define CELL_WIDTH 8
#define CELL_HEIGHT 8 #define CELL_HEIGHT 8
@ -1895,5 +1832,3 @@ void cv::ocl::device::hog::resize( const oclMat &src, oclMat &dst, const Size sz
openCLExecuteKernel2(clCxt, &objdetect_hog, kernelName, globalThreads, localThreads, args, -1, -1); openCLExecuteKernel2(clCxt, &objdetect_hog, kernelName, globalThreads, localThreads, args, -1, -1);
} }
#endif

View File

@ -59,62 +59,6 @@ using namespace cv;
using namespace cv::ocl; using namespace cv::ocl;
using namespace std; using namespace std;
#if !defined (HAVE_OPENCL)
void cv::ocl::meanShiftFiltering(const oclMat &, oclMat &, int, int, TermCriteria)
{
throw_nogpu();
}
void cv::ocl::meanShiftProc(const oclMat &, oclMat &, oclMat &, int, int, TermCriteria)
{
throw_nogpu();
}
double cv::ocl::threshold(const oclMat &, oclMat &, double, int)
{
throw_nogpu();
return 0.0;
}
void cv::ocl::resize(const oclMat &, oclMat &, Size, double, double, int)
{
throw_nogpu();
}
void cv::ocl::remap(const oclMat &, oclMat &, oclMat &, oclMat &, int, int , const Scalar &)
{
throw_nogpu();
}
void cv::ocl::copyMakeBorder(const oclMat &, oclMat &, int, int, int, int, const Scalar &)
{
throw_nogpu();
}
void cv::ocl::warpAffine(const oclMat &, oclMat &, const Mat &, Size, int)
{
throw_nogpu();
}
void cv::ocl::warpPerspective(const oclMat &, oclMat &, const Mat &, Size, int)
{
throw_nogpu();
}
void cv::ocl::integral(const oclMat &, oclMat &, oclMat &)
{
throw_nogpu();
}
void cv::ocl::calcHist(const oclMat &, oclMat &hist)
{
throw_nogpu();
}
void cv::ocl::bilateralFilter(const oclMat &, oclMat &, int, double, double, int)
{
throw_nogpu();
}
void cv::ocl::convolve(const oclMat &, const oclMat &, oclMat &)
{
throw_nogpu();
}
#else /* !defined (HAVE_OPENCL) */
namespace cv namespace cv
{ {
namespace ocl namespace ocl
@ -1696,4 +1640,3 @@ void cv::ocl::convolve(const oclMat &x, const oclMat &t, oclMat &y)
convolve_run(x, t, y, kernelName, &imgproc_convolve); convolve_run(x, t, y, kernelName, &imgproc_convolve);
} }
#endif /* !defined (HAVE_OPENCL) */

View File

@ -61,82 +61,6 @@ using std::endl;
//#define AMD_DOUBLE_DIFFER //#define AMD_DOUBLE_DIFFER
#if !defined (HAVE_OPENCL)
namespace cv
{
namespace ocl
{
cl_device_id getDevice()
{
throw_nogpu();
return 0;
}
void getComputeCapability(cl_device_id, int &major, int &minor)
{
throw_nogpu();
}
void openCLMallocPitch(Context * /*clCxt*/, void ** /*dev_ptr*/, size_t * /*pitch*/,
size_t /*widthInBytes*/, size_t /*height*/)
{
throw_nogpu();
}
void openCLMemcpy2D(Context * /*clCxt*/, void * /*dst*/, size_t /*dpitch*/,
const void * /*src*/, size_t /*spitch*/,
size_t /*width*/, size_t /*height*/, enum openCLMemcpyKind /*kind*/)
{
throw_nogpu();
}
void openCLCopyBuffer2D(Context * /*clCxt*/, void * /*dst*/, size_t /*dpitch*/,
const void * /*src*/, size_t /*spitch*/,
size_t /*width*/, size_t /*height*/, enum openCLMemcpyKind /*kind*/)
{
throw_nogpu();
}
cl_mem openCLCreateBuffer(Context *, size_t, size_t)
{
throw_nogpu();
}
void openCLReadBuffer(Context *, cl_mem, void *, size_t)
{
throw_nogpu();
}
void openCLFree(void * /*devPtr*/)
{
throw_nogpu();
}
cl_kernel openCLGetKernelFromSource(const Context * /*clCxt*/,
const char ** /*fileName*/, string /*kernelName*/)
{
throw_nogpu();
}
void openCLVerifyKernel(const Context * /*clCxt*/, cl_kernel /*kernel*/, size_t * /*blockSize*/,
size_t * /*globalThreads*/, size_t * /*localThreads*/)
{
throw_nogpu();
}
cl_mem load_constant(cl_context context, cl_command_queue command_queue, const void *value,
const size_t size)
{
throw_nogpu();
}
}//namespace ocl
}//namespace cv
#else /* !defined (HAVE_OPENCL) */
namespace cv namespace cv
{ {
namespace ocl namespace ocl
@ -1013,4 +937,3 @@ namespace cv
}//namespace ocl }//namespace ocl
}//namespace cv }//namespace cv
#endif

View File

@ -50,17 +50,6 @@ using namespace std;
using namespace cv; using namespace cv;
using namespace cv::ocl; using namespace cv::ocl;
#if !defined (HAVE_OPENCL)
void cv::ocl::interpolateFrames(const oclMat &frame0, const oclMat &frame1,
const oclMat &fu, const oclMat &fv,
const oclMat &bu, const oclMat &bv,
float pos, oclMat &newFrame, oclMat &buf)
{
throw_nogpu();
}
#else
namespace cv namespace cv
{ {
namespace ocl namespace ocl
@ -311,5 +300,4 @@ void interpolate::bindImgTex(const oclMat &img, cl_mem &texture)
clEnqueueCopyBufferToImage(img.clCxt->impl->clCmdQueue, (cl_mem)img.data, texture, 0, origin, region, 0, NULL, 0); clEnqueueCopyBufferToImage(img.clCxt->impl->clCmdQueue, (cl_mem)img.data, texture, 0, origin, region, 0, NULL, 0);
openCLSafeCall(err); openCLSafeCall(err);
} }
#endif//(HAVE_OPENCL)

View File

@ -9,6 +9,7 @@
// Niko Li, newlife20080214@gmail.com // Niko Li, newlife20080214@gmail.com
// Wang Weiyan, wangweiyanster@gmail.com // Wang Weiyan, wangweiyanster@gmail.com
// Jia Haipeng, jiahaipeng95@gmail.com // Jia Haipeng, jiahaipeng95@gmail.com
// Nathan, liujun@multicorewareinc.com
// Redistribution and use in source and binary forms, with or without modification, // Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met: // are permitted provided that the following conditions are met:
// //
@ -47,14 +48,14 @@ typedef float sqsumtype;
typedef struct __attribute__((aligned (128))) GpuHidHaarFeature typedef struct __attribute__((aligned (128))) GpuHidHaarFeature
{ {
struct __attribute__((aligned (32))) struct __attribute__((aligned (32)))
{ {
int p0 __attribute__((aligned (4))); int p0 __attribute__((aligned (4)));
int p1 __attribute__((aligned (4))); int p1 __attribute__((aligned (4)));
int p2 __attribute__((aligned (4))); int p2 __attribute__((aligned (4)));
int p3 __attribute__((aligned (4))); int p3 __attribute__((aligned (4)));
float weight __attribute__((aligned (4))); float weight __attribute__((aligned (4)));
} }
rect[CV_HAAR_FEATURE_MAX] __attribute__((aligned (32))); rect[CV_HAAR_FEATURE_MAX] __attribute__((aligned (32)));
} }
GpuHidHaarFeature; GpuHidHaarFeature;
@ -108,31 +109,31 @@ typedef struct __attribute__((aligned (64))) GpuHidHaarClassifierCascade
int p2 __attribute__((aligned (4))); int p2 __attribute__((aligned (4)));
int p3 __attribute__((aligned (4))); int p3 __attribute__((aligned (4)));
float inv_window_area __attribute__((aligned (4))); float inv_window_area __attribute__((aligned (4)));
}GpuHidHaarClassifierCascade; } GpuHidHaarClassifierCascade;
__kernel void __attribute__((reqd_work_group_size(8,8,1)))gpuRunHaarClassifierCascade(//constant GpuHidHaarClassifierCascade * cascade, __kernel void __attribute__((reqd_work_group_size(8,8,1)))gpuRunHaarClassifierCascade(//constant GpuHidHaarClassifierCascade * cascade,
global GpuHidHaarStageClassifier * stagecascadeptr, global GpuHidHaarStageClassifier * stagecascadeptr,
global int4 * info, global int4 * info,
global GpuHidHaarTreeNode * nodeptr, global GpuHidHaarTreeNode * nodeptr,
global const int * restrict sum1, global const int * restrict sum1,
global const float * restrict sqsum1, global const float * restrict sqsum1,
global int4 * candidate, global int4 * candidate,
const int pixelstep, const int pixelstep,
const int loopcount, const int loopcount,
const int start_stage, const int start_stage,
const int split_stage, const int split_stage,
const int end_stage, const int end_stage,
const int startnode, const int startnode,
const int splitnode, const int splitnode,
const int4 p, const int4 p,
const int4 pq, const int4 pq,
const float correction const float correction
//const int width, //const int width,
//const int height, //const int height,
//const int grpnumperline, //const int grpnumperline,
//const int totalgrp //const int totalgrp
) )
{ {
int grpszx = get_local_size(0); int grpszx = get_local_size(0);
int grpszy = get_local_size(1); int grpszy = get_local_size(1);
@ -184,7 +185,7 @@ __kernel void __attribute__((reqd_work_group_size(8,8,1)))gpuRunHaarClassifierCa
__global const int * sum = sum1 + imgoff; __global const int * sum = sum1 + imgoff;
__global const float * sqsum = sqsum1 + imgoff; __global const float * sqsum = sqsum1 + imgoff;
for(int grploop=grpidx;grploop<totalgrp;grploop+=grpnumx) for(int grploop=grpidx; grploop<totalgrp; grploop+=grpnumx)
{ {
int grpidy = grploop / grpnumperline; int grpidy = grploop / grpnumperline;
int grpidx = grploop - mul24(grpidy, grpnumperline); int grpidx = grploop - mul24(grpidy, grpnumperline);
@ -195,7 +196,7 @@ __kernel void __attribute__((reqd_work_group_size(8,8,1)))gpuRunHaarClassifierCa
int grpoffx = x-lclidx; int grpoffx = x-lclidx;
int grpoffy = y-lclidy; int grpoffy = y-lclidy;
for(int i=0;i<read_loop;i++) for(int i=0; i<read_loop; i++)
{ {
int pos_id = mad24(i,lcl_sz,lcl_id); int pos_id = mad24(i,lcl_sz,lcl_id);
pos_id = pos_id < total_read ? pos_id : 0; pos_id = pos_id < total_read ? pos_id : 0;
@ -234,15 +235,15 @@ __kernel void __attribute__((reqd_work_group_size(8,8,1)))gpuRunHaarClassifierCa
cascadeinfo1.x +=lcl_off; cascadeinfo1.x +=lcl_off;
cascadeinfo1.z +=lcl_off; cascadeinfo1.z +=lcl_off;
mean = (lcldata[mad24(cascadeinfo1.y,readwidth,cascadeinfo1.x)] - lcldata[mad24(cascadeinfo1.y,readwidth,cascadeinfo1.z)] - mean = (lcldata[mad24(cascadeinfo1.y,readwidth,cascadeinfo1.x)] - lcldata[mad24(cascadeinfo1.y,readwidth,cascadeinfo1.z)] -
lcldata[mad24(cascadeinfo1.w,readwidth,cascadeinfo1.x)] + lcldata[mad24(cascadeinfo1.w,readwidth,cascadeinfo1.z)]) lcldata[mad24(cascadeinfo1.w,readwidth,cascadeinfo1.x)] + lcldata[mad24(cascadeinfo1.w,readwidth,cascadeinfo1.z)])
*correction; *correction;
int p_offset = mad24(y, pixelstep, x); int p_offset = mad24(y, pixelstep, x);
cascadeinfo2.x +=p_offset; cascadeinfo2.x +=p_offset;
cascadeinfo2.z +=p_offset; cascadeinfo2.z +=p_offset;
variance_norm_factor =sqsum[mad24(cascadeinfo2.y, pixelstep, cascadeinfo2.x)] - sqsum[mad24(cascadeinfo2.y, pixelstep, cascadeinfo2.z)] - variance_norm_factor =sqsum[mad24(cascadeinfo2.y, pixelstep, cascadeinfo2.x)] - sqsum[mad24(cascadeinfo2.y, pixelstep, cascadeinfo2.z)] -
sqsum[mad24(cascadeinfo2.w, pixelstep, cascadeinfo2.x)] + sqsum[mad24(cascadeinfo2.w, pixelstep, cascadeinfo2.z)]; sqsum[mad24(cascadeinfo2.w, pixelstep, cascadeinfo2.x)] + sqsum[mad24(cascadeinfo2.w, pixelstep, cascadeinfo2.z)];
variance_norm_factor = variance_norm_factor * correction - mean * mean; variance_norm_factor = variance_norm_factor * correction - mean * mean;
variance_norm_factor = variance_norm_factor >=0.f ? sqrt(variance_norm_factor) : 1.f; variance_norm_factor = variance_norm_factor >=0.f ? sqrt(variance_norm_factor) : 1.f;
@ -270,19 +271,19 @@ __kernel void __attribute__((reqd_work_group_size(8,8,1)))gpuRunHaarClassifierCa
info2.z +=lcl_off; info2.z +=lcl_off;
float classsum = (lcldata[mad24(info1.y,readwidth,info1.x)] - lcldata[mad24(info1.y,readwidth,info1.z)] - float classsum = (lcldata[mad24(info1.y,readwidth,info1.x)] - lcldata[mad24(info1.y,readwidth,info1.z)] -
lcldata[mad24(info1.w,readwidth,info1.x)] + lcldata[mad24(info1.w,readwidth,info1.z)]) * w.x; lcldata[mad24(info1.w,readwidth,info1.x)] + lcldata[mad24(info1.w,readwidth,info1.z)]) * w.x;
classsum += (lcldata[mad24(info2.y,readwidth,info2.x)] - lcldata[mad24(info2.y,readwidth,info2.z)] - classsum += (lcldata[mad24(info2.y,readwidth,info2.x)] - lcldata[mad24(info2.y,readwidth,info2.z)] -
lcldata[mad24(info2.w,readwidth,info2.x)] + lcldata[mad24(info2.w,readwidth,info2.z)]) * w.y; lcldata[mad24(info2.w,readwidth,info2.x)] + lcldata[mad24(info2.w,readwidth,info2.z)]) * w.y;
//if((info3.z - info3.x) && (!stageinfo.z)) //if((info3.z - info3.x) && (!stageinfo.z))
//{ //{
info3.x +=lcl_off; info3.x +=lcl_off;
info3.z +=lcl_off; info3.z +=lcl_off;
classsum += (lcldata[mad24(info3.y,readwidth,info3.x)] - lcldata[mad24(info3.y,readwidth,info3.z)] - classsum += (lcldata[mad24(info3.y,readwidth,info3.x)] - lcldata[mad24(info3.y,readwidth,info3.z)] -
lcldata[mad24(info3.w,readwidth,info3.x)] + lcldata[mad24(info3.w,readwidth,info3.z)]) * w.z; lcldata[mad24(info3.w,readwidth,info3.x)] + lcldata[mad24(info3.w,readwidth,info3.z)]) * w.z;
//} //}
stage_sum += classsum >= nodethreshold ? alpha2.y : alpha2.x; stage_sum += classsum >= nodethreshold ? alpha2.y : alpha2.x;
nodecounter++; nodecounter++;
@ -299,12 +300,13 @@ __kernel void __attribute__((reqd_work_group_size(8,8,1)))gpuRunHaarClassifierCa
} }
barrier(CLK_LOCAL_MEM_FENCE); barrier(CLK_LOCAL_MEM_FENCE);
int queuecount = lclcount[0]; int queuecount = lclcount[0];
barrier(CLK_LOCAL_MEM_FENCE);
nodecounter = splitnode; nodecounter = splitnode;
for(int stageloop = split_stage; stageloop< end_stage && queuecount>0;stageloop++) for(int stageloop = split_stage; stageloop< end_stage && queuecount>0; stageloop++)
{ {
//barrier(CLK_LOCAL_MEM_FENCE); //barrier(CLK_LOCAL_MEM_FENCE);
//if(lcl_id == 0) //if(lcl_id == 0)
lclcount[0]=0; lclcount[0]=0;
barrier(CLK_LOCAL_MEM_FENCE); barrier(CLK_LOCAL_MEM_FENCE);
int2 stageinfo = *(global int2*)(stagecascadeptr+stageloop); int2 stageinfo = *(global int2*)(stagecascadeptr+stageloop);
@ -316,70 +318,73 @@ __kernel void __attribute__((reqd_work_group_size(8,8,1)))gpuRunHaarClassifierCa
int lcl_compute_win_id = (lcl_id >>(6-perfscale)); int lcl_compute_win_id = (lcl_id >>(6-perfscale));
int lcl_loops = (stageinfo.x + lcl_compute_win -1) >> (6-perfscale); int lcl_loops = (stageinfo.x + lcl_compute_win -1) >> (6-perfscale);
int lcl_compute_id = lcl_id - (lcl_compute_win_id << (6-perfscale)); int lcl_compute_id = lcl_id - (lcl_compute_win_id << (6-perfscale));
for(int queueloop=0;queueloop<queuecount_loop/* && lcl_compute_win_id < queuecount*/;queueloop++) for(int queueloop=0; queueloop<queuecount_loop/* && lcl_compute_win_id < queuecount*/; queueloop++)
{ {
float stage_sum = 0.f; float stage_sum = 0.f;
int temp_coord = lcloutindex[lcl_compute_win_id<<1]; int temp_coord = lcloutindex[lcl_compute_win_id<<1];
float variance_norm_factor = as_float(lcloutindex[(lcl_compute_win_id<<1)+1]); float variance_norm_factor = as_float(lcloutindex[(lcl_compute_win_id<<1)+1]);
int queue_pixel = mad24(((temp_coord & (int)0xffff0000)>>16),readwidth,temp_coord & 0xffff); int queue_pixel = mad24(((temp_coord & (int)0xffff0000)>>16),readwidth,temp_coord & 0xffff);
//barrier(CLK_LOCAL_MEM_FENCE); //barrier(CLK_LOCAL_MEM_FENCE);
if(lcl_compute_win_id < queuecount) { if(lcl_compute_win_id < queuecount)
int tempnodecounter = lcl_compute_id;
float part_sum = 0.f;
for(int lcl_loop=0;lcl_loop<lcl_loops && tempnodecounter<stageinfo.x;lcl_loop++)
{ {
__global GpuHidHaarTreeNode* currentnodeptr = (nodeptr + nodecounter + tempnodecounter);
int4 info1 = *(__global int4*)(&(currentnodeptr->p[0][0])); int tempnodecounter = lcl_compute_id;
int4 info2 = *(__global int4*)(&(currentnodeptr->p[1][0])); float part_sum = 0.f;
int4 info3 = *(__global int4*)(&(currentnodeptr->p[2][0])); for(int lcl_loop=0; lcl_loop<lcl_loops && tempnodecounter<stageinfo.x; lcl_loop++)
float4 w = *(__global float4*)(&(currentnodeptr->weight[0])); {
float2 alpha2 = *(__global float2*)(&(currentnodeptr->alpha[0])); __global GpuHidHaarTreeNode* currentnodeptr = (nodeptr + nodecounter + tempnodecounter);
float nodethreshold = w.w * variance_norm_factor;
info1.x +=queue_pixel; int4 info1 = *(__global int4*)(&(currentnodeptr->p[0][0]));
info1.z +=queue_pixel; int4 info2 = *(__global int4*)(&(currentnodeptr->p[1][0]));
info2.x +=queue_pixel; int4 info3 = *(__global int4*)(&(currentnodeptr->p[2][0]));
info2.z +=queue_pixel; float4 w = *(__global float4*)(&(currentnodeptr->weight[0]));
float2 alpha2 = *(__global float2*)(&(currentnodeptr->alpha[0]));
float nodethreshold = w.w * variance_norm_factor;
float classsum = (lcldata[mad24(info1.y,readwidth,info1.x)] - lcldata[mad24(info1.y,readwidth,info1.z)] - info1.x +=queue_pixel;
lcldata[mad24(info1.w,readwidth,info1.x)] + lcldata[mad24(info1.w,readwidth,info1.z)]) * w.x; info1.z +=queue_pixel;
info2.x +=queue_pixel;
info2.z +=queue_pixel;
float classsum = (lcldata[mad24(info1.y,readwidth,info1.x)] - lcldata[mad24(info1.y,readwidth,info1.z)] -
lcldata[mad24(info1.w,readwidth,info1.x)] + lcldata[mad24(info1.w,readwidth,info1.z)]) * w.x;
classsum += (lcldata[mad24(info2.y,readwidth,info2.x)] - lcldata[mad24(info2.y,readwidth,info2.z)] - classsum += (lcldata[mad24(info2.y,readwidth,info2.x)] - lcldata[mad24(info2.y,readwidth,info2.z)] -
lcldata[mad24(info2.w,readwidth,info2.x)] + lcldata[mad24(info2.w,readwidth,info2.z)]) * w.y; lcldata[mad24(info2.w,readwidth,info2.x)] + lcldata[mad24(info2.w,readwidth,info2.z)]) * w.y;
//if((info3.z - info3.x) && (!stageinfo.z)) //if((info3.z - info3.x) && (!stageinfo.z))
//{ //{
info3.x +=queue_pixel; info3.x +=queue_pixel;
info3.z +=queue_pixel; info3.z +=queue_pixel;
classsum += (lcldata[mad24(info3.y,readwidth,info3.x)] - lcldata[mad24(info3.y,readwidth,info3.z)] - classsum += (lcldata[mad24(info3.y,readwidth,info3.x)] - lcldata[mad24(info3.y,readwidth,info3.z)] -
lcldata[mad24(info3.w,readwidth,info3.x)] + lcldata[mad24(info3.w,readwidth,info3.z)]) * w.z; lcldata[mad24(info3.w,readwidth,info3.x)] + lcldata[mad24(info3.w,readwidth,info3.z)]) * w.z;
//} //}
part_sum += classsum >= nodethreshold ? alpha2.y : alpha2.x; part_sum += classsum >= nodethreshold ? alpha2.y : alpha2.x;
tempnodecounter +=lcl_compute_win; tempnodecounter +=lcl_compute_win;
}//end for(int lcl_loop=0;lcl_loop<lcl_loops;lcl_loop++) }//end for(int lcl_loop=0;lcl_loop<lcl_loops;lcl_loop++)
partialsum[lcl_id]=part_sum; partialsum[lcl_id]=part_sum;
} }
barrier(CLK_LOCAL_MEM_FENCE); barrier(CLK_LOCAL_MEM_FENCE);
if(lcl_compute_win_id < queuecount) { if(lcl_compute_win_id < queuecount)
for(int i=0;i<lcl_compute_win && (lcl_compute_id==0);i++)
{ {
stage_sum += partialsum[lcl_id+i]; for(int i=0; i<lcl_compute_win && (lcl_compute_id==0); i++)
{
stage_sum += partialsum[lcl_id+i];
}
if(stage_sum >= stagethreshold && (lcl_compute_id==0))
{
int queueindex = atomic_inc(lclcount);
lcloutindex[queueindex<<1] = temp_coord;
lcloutindex[(queueindex<<1)+1] = as_int(variance_norm_factor);
}
lcl_compute_win_id +=(1<<perfscale);
} }
if(stage_sum >= stagethreshold && (lcl_compute_id==0))
{
int queueindex = atomic_inc(lclcount);
lcloutindex[queueindex<<1] = temp_coord;
lcloutindex[(queueindex<<1)+1] = as_int(variance_norm_factor);
}
lcl_compute_win_id +=(1<<perfscale);
}
barrier(CLK_LOCAL_MEM_FENCE); barrier(CLK_LOCAL_MEM_FENCE);
}//end for(int queueloop=0;queueloop<queuecount_loop;queueloop++) }//end for(int queueloop=0;queueloop<queuecount_loop;queueloop++)
barrier(CLK_LOCAL_MEM_FENCE); //barrier(CLK_LOCAL_MEM_FENCE);
queuecount = lclcount[0]; queuecount = lclcount[0];
barrier(CLK_LOCAL_MEM_FENCE);
nodecounter += stageinfo.x; nodecounter += stageinfo.x;
}//end for(int stageloop = splitstage; stageloop< endstage && queuecount>0;stageloop++) }//end for(int stageloop = splitstage; stageloop< endstage && queuecount>0;stageloop++)
//barrier(CLK_LOCAL_MEM_FENCE); //barrier(CLK_LOCAL_MEM_FENCE);
@ -420,139 +425,139 @@ __kernel void __attribute__((reqd_work_group_size(8,8,1)))gpuRunHaarClassifierCa
/* /*
if(stagecascade->two_rects) if(stagecascade->two_rects)
{
#pragma unroll
for( n = 0; n < stagecascade->count; n++ )
{
t1 = *(node + counter);
t = t1.threshold * variance_norm_factor;
classsum = calc_sum1(t1,p_offset,0) * t1.weight[0];
classsum += calc_sum1(t1, p_offset,1) * t1.weight[1];
stage_sum += classsum >= t ? t1.alpha[1]:t1.alpha[0];
counter++;
}
}
else
{
#pragma unroll
for( n = 0; n < stagecascade->count; n++ )
{
t = node[counter].threshold*variance_norm_factor;
classsum = calc_sum1(node[counter],p_offset,0) * node[counter].weight[0];
classsum += calc_sum1(node[counter],p_offset,1) * node[counter].weight[1];
if( node[counter].p0[2] )
classsum += calc_sum1(node[counter],p_offset,2) * node[counter].weight[2];
stage_sum += classsum >= t ? node[counter].alpha[1]:node[counter].alpha[0];// modify
counter++;
}
}
*/
/*
__kernel void gpuRunHaarClassifierCascade_ScaleWindow(
constant GpuHidHaarClassifierCascade * _cascade,
global GpuHidHaarStageClassifier * stagecascadeptr,
//global GpuHidHaarClassifier * classifierptr,
global GpuHidHaarTreeNode * nodeptr,
global int * sum,
global float * sqsum,
global int * _candidate,
int pixel_step,
int cols,
int rows,
int start_stage,
int end_stage,
//int counts,
int nodenum,
int ystep,
int detect_width,
//int detect_height,
int loopcount,
int outputstep)
//float scalefactor)
{ {
unsigned int x1 = get_global_id(0); #pragma unroll
unsigned int y1 = get_global_id(1); for( n = 0; n < stagecascade->count; n++ )
int p_offset;
int m, n;
int result;
int counter;
float mean, variance_norm_factor;
for(int i=0;i<loopcount;i++)
{ {
constant GpuHidHaarClassifierCascade * cascade = _cascade + i; t1 = *(node + counter);
global int * candidate = _candidate + i*outputstep; t = t1.threshold * variance_norm_factor;
int window_width = cascade->p1 - cascade->p0; classsum = calc_sum1(t1,p_offset,0) * t1.weight[0];
int window_height = window_width;
result = 1;
counter = 0;
unsigned int x = mul24(x1,ystep);
unsigned int y = mul24(y1,ystep);
if((x < cols - window_width - 1) && (y < rows - window_height -1))
{
global GpuHidHaarStageClassifier *stagecascade = stagecascadeptr +cascade->count*i+ start_stage;
//global GpuHidHaarClassifier *classifier = classifierptr;
global GpuHidHaarTreeNode *node = nodeptr + nodenum*i;
p_offset = mad24(y, pixel_step, x);// modify classsum += calc_sum1(t1, p_offset,1) * t1.weight[1];
stage_sum += classsum >= t ? t1.alpha[1]:t1.alpha[0];
mean = (*(sum + p_offset + (int)cascade->p0) - *(sum + p_offset + (int)cascade->p1) - counter++;
*(sum + p_offset + (int)cascade->p2) + *(sum + p_offset + (int)cascade->p3))
*cascade->inv_window_area;
variance_norm_factor = *(sqsum + p_offset + cascade->p0) - *(sqsum + cascade->p1 + p_offset) -
*(sqsum + p_offset + cascade->p2) + *(sqsum + cascade->p3 + p_offset);
variance_norm_factor = variance_norm_factor * cascade->inv_window_area - mean * mean;
variance_norm_factor = variance_norm_factor >=0.f ? sqrt(variance_norm_factor) : 1;//modify
// if( cascade->is_stump_based )
//{
for( m = start_stage; m < end_stage; m++ )
{
float stage_sum = 0.f;
float t, classsum;
GpuHidHaarTreeNode t1;
//#pragma unroll
for( n = 0; n < stagecascade->count; n++ )
{
t1 = *(node + counter);
t = t1.threshold * variance_norm_factor;
classsum = calc_sum1(t1, p_offset ,0) * t1.weight[0] + calc_sum1(t1, p_offset ,1) * t1.weight[1];
if((t1.p0[2]) && (!stagecascade->two_rects))
classsum += calc_sum1(t1, p_offset, 2) * t1.weight[2];
stage_sum += classsum >= t ? t1.alpha[1] : t1.alpha[0];// modify
counter++;
}
if (stage_sum < stagecascade->threshold)
{
result = 0;
break;
}
stagecascade++;
}
if(result)
{
candidate[4 * (y1 * detect_width + x1)] = x;
candidate[4 * (y1 * detect_width + x1) + 1] = y;
candidate[4 * (y1 * detect_width + x1)+2] = window_width;
candidate[4 * (y1 * detect_width + x1) + 3] = window_height;
}
//}
}
} }
} }
else
{
#pragma unroll
for( n = 0; n < stagecascade->count; n++ )
{
t = node[counter].threshold*variance_norm_factor;
classsum = calc_sum1(node[counter],p_offset,0) * node[counter].weight[0];
classsum += calc_sum1(node[counter],p_offset,1) * node[counter].weight[1];
if( node[counter].p0[2] )
classsum += calc_sum1(node[counter],p_offset,2) * node[counter].weight[2];
stage_sum += classsum >= t ? node[counter].alpha[1]:node[counter].alpha[0];// modify
counter++;
}
}
*/
/*
__kernel void gpuRunHaarClassifierCascade_ScaleWindow(
constant GpuHidHaarClassifierCascade * _cascade,
global GpuHidHaarStageClassifier * stagecascadeptr,
//global GpuHidHaarClassifier * classifierptr,
global GpuHidHaarTreeNode * nodeptr,
global int * sum,
global float * sqsum,
global int * _candidate,
int pixel_step,
int cols,
int rows,
int start_stage,
int end_stage,
//int counts,
int nodenum,
int ystep,
int detect_width,
//int detect_height,
int loopcount,
int outputstep)
//float scalefactor)
{
unsigned int x1 = get_global_id(0);
unsigned int y1 = get_global_id(1);
int p_offset;
int m, n;
int result;
int counter;
float mean, variance_norm_factor;
for(int i=0;i<loopcount;i++)
{
constant GpuHidHaarClassifierCascade * cascade = _cascade + i;
global int * candidate = _candidate + i*outputstep;
int window_width = cascade->p1 - cascade->p0;
int window_height = window_width;
result = 1;
counter = 0;
unsigned int x = mul24(x1,ystep);
unsigned int y = mul24(y1,ystep);
if((x < cols - window_width - 1) && (y < rows - window_height -1))
{
global GpuHidHaarStageClassifier *stagecascade = stagecascadeptr +cascade->count*i+ start_stage;
//global GpuHidHaarClassifier *classifier = classifierptr;
global GpuHidHaarTreeNode *node = nodeptr + nodenum*i;
p_offset = mad24(y, pixel_step, x);// modify
mean = (*(sum + p_offset + (int)cascade->p0) - *(sum + p_offset + (int)cascade->p1) -
*(sum + p_offset + (int)cascade->p2) + *(sum + p_offset + (int)cascade->p3))
*cascade->inv_window_area;
variance_norm_factor = *(sqsum + p_offset + cascade->p0) - *(sqsum + cascade->p1 + p_offset) -
*(sqsum + p_offset + cascade->p2) + *(sqsum + cascade->p3 + p_offset);
variance_norm_factor = variance_norm_factor * cascade->inv_window_area - mean * mean;
variance_norm_factor = variance_norm_factor >=0.f ? sqrt(variance_norm_factor) : 1;//modify
// if( cascade->is_stump_based )
//{
for( m = start_stage; m < end_stage; m++ )
{
float stage_sum = 0.f;
float t, classsum;
GpuHidHaarTreeNode t1;
//#pragma unroll
for( n = 0; n < stagecascade->count; n++ )
{
t1 = *(node + counter);
t = t1.threshold * variance_norm_factor;
classsum = calc_sum1(t1, p_offset ,0) * t1.weight[0] + calc_sum1(t1, p_offset ,1) * t1.weight[1];
if((t1.p0[2]) && (!stagecascade->two_rects))
classsum += calc_sum1(t1, p_offset, 2) * t1.weight[2];
stage_sum += classsum >= t ? t1.alpha[1] : t1.alpha[0];// modify
counter++;
}
if (stage_sum < stagecascade->threshold)
{
result = 0;
break;
}
stagecascade++;
}
if(result)
{
candidate[4 * (y1 * detect_width + x1)] = x;
candidate[4 * (y1 * detect_width + x1) + 1] = y;
candidate[4 * (y1 * detect_width + x1)+2] = window_width;
candidate[4 * (y1 * detect_width + x1) + 3] = window_height;
}
//}
}
}
}
*/ */

View File

@ -51,12 +51,6 @@ using namespace cv;
using namespace cv::ocl; using namespace cv::ocl;
using namespace std; using namespace std;
#if !defined (HAVE_OPENCL)
void cv::ocl::matchTemplate(const oclMat &, const oclMat &, oclMat &)
{
throw_nogpu();
}
#else
//helper routines //helper routines
namespace cv namespace cv
{ {
@ -498,4 +492,3 @@ void cv::ocl::matchTemplate(const oclMat &image, const oclMat &templ, oclMat &re
CV_Assert(caller); CV_Assert(caller);
caller(image, templ, result, buf); caller(image, templ, result, buf);
} }
#endif //

View File

@ -58,60 +58,6 @@ using namespace std;
//////////////////////////////// oclMat //////////////////////////////// //////////////////////////////// oclMat ////////////////////////////////
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
#if !defined (HAVE_OPENCL)
namespace cv
{
namespace ocl
{
void oclMat::upload(const Mat & /*m*/)
{
throw_nogpu();
}
void oclMat::download(cv::Mat & /*m*/) const
{
throw_nogpu();
}
void oclMat::copyTo( oclMat & /*m*/ ) const
{
throw_nogpu();
}
void oclMat::copyTo( oclMat & /*m*/, const oclMat &/* mask */) const
{
throw_nogpu();
}
void oclMat::convertTo( oclMat & /*m*/, int /*rtype*/, double /*alpha*/, double /*beta*/ ) const
{
throw_nogpu();
}
oclMat &oclMat::operator = (const Scalar & /*s*/)
{
throw_nogpu();
return *this;
}
oclMat &oclMat::setTo(const Scalar & /*s*/, const oclMat & /*mask*/)
{
throw_nogpu();
return *this;
}
oclMat oclMat::reshape(int /*new_cn*/, int /*new_rows*/) const
{
throw_nogpu();
return oclMat();
}
void oclMat::create(int /*_rows*/, int /*_cols*/, int /*_type*/)
{
throw_nogpu();
}
void oclMat::release()
{
throw_nogpu();
}
}
}
#else /* !defined (HAVE_OPENCL) */
//helper routines //helper routines
namespace cv namespace cv
{ {
@ -1045,4 +991,3 @@ oclMat& cv::ocl::oclMat::operator/=( const oclMat& m )
divide(*this, m, *this); divide(*this, m, *this);
return *this; return *this;
} }
#endif /* !defined (HAVE_OPENCL) */

View File

@ -47,9 +47,6 @@
#define _OPENCV_MCWUTIL_ #define _OPENCV_MCWUTIL_
#include "precomp.hpp" #include "precomp.hpp"
#if defined (HAVE_OPENCL)
using namespace std; using namespace std;
namespace cv namespace cv
@ -76,5 +73,5 @@ namespace cv
}//namespace ocl }//namespace ocl
}//namespace cv }//namespace cv
#endif // HAVE_OPENCL
#endif //_OPENCV_MCWUTIL_ #endif //_OPENCV_MCWUTIL_

View File

@ -44,23 +44,6 @@
#include "precomp.hpp" #include "precomp.hpp"
#if !defined(HAVE_OPENCL)
namespace cv
{
namespace ocl
{
void meanShiftSegmentation(const oclMat &, Mat &, int, int, int, TermCriteria)
{
throw_nogpu();
}
}
}
#else
using namespace std; using namespace std;
// Auxiliray stuff // Auxiliray stuff
@ -411,4 +394,3 @@ namespace cv
} }
} }
#endif // #if !defined (HAVE_OPENCL)

View File

@ -52,13 +52,6 @@ using namespace std;
using namespace cv; using namespace cv;
using namespace cv::ocl; using namespace cv::ocl;
#if !defined (HAVE_OPENCL)
void cv::ocl::PyrLKOpticalFlow::sparse(const oclMat &, const oclMat &, const oclMat &, oclMat &, oclMat &, oclMat &) { }
void cv::ocl::PyrLKOpticalFlow::dense(const oclMat &, const oclMat &, oclMat &, oclMat &, oclMat *) { }
#else /* !defined (HAVE_OPENCL) */
namespace cv namespace cv
{ {
namespace ocl namespace ocl
@ -862,5 +855,3 @@ void cv::ocl::PyrLKOpticalFlow::dense(const oclMat &prevImg, const oclMat &nextI
clFinish(prevImg.clCxt->impl->clCmdQueue); clFinish(prevImg.clCxt->impl->clCmdQueue);
} }
#endif /* !defined (HAVE_CUDA) */

View File

@ -54,13 +54,6 @@ using namespace cv;
using namespace cv::ocl; using namespace cv::ocl;
using namespace std; using namespace std;
#ifndef HAVE_OPENCL
void cv::ocl::pyrUp(const oclMat &, GpuMat &, oclMat &)
{
throw_nogpu();
}
#else
namespace cv namespace cv
{ {
namespace ocl namespace ocl
@ -93,5 +86,4 @@ namespace cv
openCLExecuteKernel(clCxt, &pyr_up, kernelName, globalThreads, localThreads, args, src.oclchannels(), src.depth()); openCLExecuteKernel(clCxt, &pyr_up, kernelName, globalThreads, localThreads, args, src.oclchannels(), src.depth());
} }
} }
}; }
#endif // HAVE_OPENCL

View File

@ -58,34 +58,6 @@ using std::endl;
///////////////// oclMat merge and split /////////////////////////////// ///////////////// oclMat merge and split ///////////////////////////////
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
#if !defined (HAVE_OPENCL)
namespace cv
{
namespace ocl
{
void cv::ocl::merge(const oclMat *src_mat, size_t count, oclMat &dst_mat)
{
throw_nogpu();
}
void cv::ocl::merge(const vector<oclMat> &src_mat, oclMat &dst_mat)
{
throw_nogpu();
}
void cv::ocl::split(const oclMat &src, oclMat *dst)
{
throw_nogpu();
}
void cv::ocl::split(const oclMat &src, vector<oclMat> &dst)
{
throw_nogpu();
}
}
}
#else /* !defined (HAVE_OPENCL) */
namespace cv namespace cv
{ {
namespace ocl namespace ocl
@ -417,4 +389,3 @@ void cv::ocl::split(const oclMat &src, vector<oclMat> &dst)
if(src.oclchannels() > 0) if(src.oclchannels() > 0)
split_merge::split(src, &dst[0]); split_merge::split(src, &dst[0]);
} }
#endif /* !defined (HAVE_OPENCL) */

View File

@ -50,59 +50,6 @@ using namespace cv;
using namespace cv::ocl; using namespace cv::ocl;
using namespace std; using namespace std;
#if !defined (HAVE_OPENCL)
cv::ocl::SURF_OCL::SURF_OCL()
{
throw_nogpu();
}
cv::ocl::SURF_OCL::SURF_OCL(double, int, int, bool, float, bool)
{
throw_nogpu();
}
int cv::ocl::SURF_OCL::descriptorSize() const
{
throw_nogpu();
return 0;
}
void cv::ocl::SURF_OCL::uploadKeypoints(const vector<KeyPoint> &, oclMat &)
{
throw_nogpu();
}
void cv::ocl::SURF_OCL::downloadKeypoints(const oclMat &, vector<KeyPoint> &)
{
throw_nogpu();
}
void cv::ocl::SURF_OCL::downloadDescriptors(const oclMat &, vector<float> &)
{
throw_nogpu();
}
void cv::ocl::SURF_OCL::operator()(const oclMat &, const oclMat &, oclMat &)
{
throw_nogpu();
}
void cv::ocl::SURF_OCL::operator()(const oclMat &, const oclMat &, oclMat &, oclMat &, bool)
{
throw_nogpu();
}
void cv::ocl::SURF_OCL::operator()(const oclMat &, const oclMat &, vector<KeyPoint> &)
{
throw_nogpu();
}
void cv::ocl::SURF_OCL::operator()(const oclMat &, const oclMat &, vector<KeyPoint> &, oclMat &, bool)
{
throw_nogpu();
}
void cv::ocl::SURF_OCL::operator()(const oclMat &, const oclMat &, vector<KeyPoint> &, vector<float> &, bool)
{
throw_nogpu();
}
void cv::ocl::SURF_OCL::releaseMemory()
{
throw_nogpu();
}
#else /* !defined (HAVE_OPENCL) */
namespace cv namespace cv
{ {
namespace ocl namespace ocl
@ -755,5 +702,3 @@ void SURF_OCL_Invoker::compute_descriptors_gpu(const oclMat &descriptors, const
} }
} }
#endif // /* !defined (HAVE_OPENCL) */

View File

@ -791,8 +791,8 @@ TEST_P(WarpAffine, Mat)
{ {
static const double coeffs[2][3] = static const double coeffs[2][3] =
{ {
{cos(3.14 / 6), -sin(3.14 / 6), 100.0}, {cos(CV_PI / 6), -sin(CV_PI / 6), 100.0},
{sin(3.14 / 6), cos(3.14 / 6), -100.0} {sin(CV_PI / 6), cos(CV_PI / 6), -100.0}
}; };
Mat M(2, 3, CV_64F, (void *)coeffs); Mat M(2, 3, CV_64F, (void *)coeffs);

View File

@ -44,7 +44,7 @@
#include "precomp.hpp" #include "precomp.hpp"
//#define PERF_TEST 0
#ifdef HAVE_OPENCL #ifdef HAVE_OPENCL
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// MatchTemplate // MatchTemplate
@ -97,15 +97,7 @@ TEST_P(MatchTemplate8U, Accuracy)
cv::Mat mat_dst; cv::Mat mat_dst;
dst.download(mat_dst); dst.download(mat_dst);
EXPECT_MAT_NEAR(dst_gold, mat_dst, templ_size.area() * 1e-1, sss); EXPECT_MAT_NEAR(dst_gold, mat_dst, templ_size.area() * 1e-1, sss);
#ifdef PERF_TEST
{
P_TEST_FULL( {}, {cv::ocl::matchTemplate(ocl_image, ocl_templ, dst, method);}, {});
P_TEST_FULL( {}, {cv::matchTemplate(image, templ, dst_gold, method);}, {});
}
#endif // PERF_TEST
} }
PARAM_TEST_CASE(MatchTemplate32F, cv::Size, TemplateSize, Channels, TemplateMethod) PARAM_TEST_CASE(MatchTemplate32F, cv::Size, TemplateSize, Channels, TemplateMethod)
@ -144,17 +136,6 @@ TEST_P(MatchTemplate32F, Accuracy)
dst.download(mat_dst); dst.download(mat_dst);
EXPECT_MAT_NEAR(dst_gold, mat_dst, templ_size.area() * 1e-1, sss); EXPECT_MAT_NEAR(dst_gold, mat_dst, templ_size.area() * 1e-1, sss);
#ifdef PERF_TEST
{
std::cout << "Method: " << TEMPLATE_METHOD_NAMES[method] << std::endl;
std::cout << "Image Size: (" << size.width << ", " << size.height << ")" << std::endl;
std::cout << "Template Size: (" << templ_size.width << ", " << templ_size.height << ")" << std::endl;
std::cout << "Channels: " << cn << std::endl;
P_TEST_FULL( {}, {cv::ocl::matchTemplate(ocl_image, ocl_templ, dst, method);}, {});
P_TEST_FULL( {}, {cv::matchTemplate(image, templ, dst_gold, method);}, {});
}
#endif // PERF_TEST
} }
INSTANTIATE_TEST_CASE_P(GPU_ImgProc, MatchTemplate8U, INSTANTIATE_TEST_CASE_P(GPU_ImgProc, MatchTemplate8U,