Commit ce5e2697 authored by Vadim Pisarevsky's avatar Vadim Pisarevsky

Merge pull request #3597 from wangyan42164:cascade_cl_opt

parents bcc9dac0 07ab0c1c
...@@ -1072,10 +1072,10 @@ bool CascadeClassifierImpl::ocl_detectMultiScaleNoGrouping( const std::vector<fl ...@@ -1072,10 +1072,10 @@ bool CascadeClassifierImpl::ocl_detectMultiScaleNoGrouping( const std::vector<fl
{ {
String opts; String opts;
if (lbufSize.area()) if (lbufSize.area())
opts = format("-D LOCAL_SIZE_X=%d -D LOCAL_SIZE_Y=%d -D SUM_BUF_SIZE=%d -D SUM_BUF_STEP=%d -D NODE_COUNT=%d -D SPLIT_STAGE=%d -D N_STAGES=%d -D MAX_FACES=%d", opts = format("-D LOCAL_SIZE_X=%d -D LOCAL_SIZE_Y=%d -D SUM_BUF_SIZE=%d -D SUM_BUF_STEP=%d -D NODE_COUNT=%d -D SPLIT_STAGE=%d -D N_STAGES=%d -D MAX_FACES=%d -D HAAR",
localsz.width, localsz.height, lbufSize.area(), lbufSize.width, data.maxNodesPerTree, splitstage_ocl, nstages, MAX_FACES); localsz.width, localsz.height, lbufSize.area(), lbufSize.width, data.maxNodesPerTree, splitstage_ocl, nstages, MAX_FACES);
else else
opts = format("-D LOCAL_SIZE_X=%d -D LOCAL_SIZE_Y=%d -D NODE_COUNT=%d -D SPLIT_STAGE=%d -D N_STAGES=%d -D MAX_FACES=%d", opts = format("-D LOCAL_SIZE_X=%d -D LOCAL_SIZE_Y=%d -D NODE_COUNT=%d -D SPLIT_STAGE=%d -D N_STAGES=%d -D MAX_FACES=%d -D HAAR",
localsz.width, localsz.height, data.maxNodesPerTree, splitstage_ocl, nstages, MAX_FACES); localsz.width, localsz.height, data.maxNodesPerTree, splitstage_ocl, nstages, MAX_FACES);
haarKernel.create("runHaarClassifier", ocl::objdetect::cascadedetect_oclsrc, opts); haarKernel.create("runHaarClassifier", ocl::objdetect::cascadedetect_oclsrc, opts);
if( haarKernel.empty() ) if( haarKernel.empty() )
...@@ -1112,10 +1112,10 @@ bool CascadeClassifierImpl::ocl_detectMultiScaleNoGrouping( const std::vector<fl ...@@ -1112,10 +1112,10 @@ bool CascadeClassifierImpl::ocl_detectMultiScaleNoGrouping( const std::vector<fl
{ {
String opts; String opts;
if (lbufSize.area()) if (lbufSize.area())
opts = format("-D LOCAL_SIZE_X=%d -D LOCAL_SIZE_Y=%d -D SUM_BUF_SIZE=%d -D SUM_BUF_STEP=%d -D SPLIT_STAGE=%d -D N_STAGES=%d -D MAX_FACES=%d", opts = format("-D LOCAL_SIZE_X=%d -D LOCAL_SIZE_Y=%d -D SUM_BUF_SIZE=%d -D SUM_BUF_STEP=%d -D SPLIT_STAGE=%d -D N_STAGES=%d -D MAX_FACES=%d -D LBP",
localsz.width, localsz.height, lbufSize.area(), lbufSize.width, splitstage_ocl, nstages, MAX_FACES); localsz.width, localsz.height, lbufSize.area(), lbufSize.width, splitstage_ocl, nstages, MAX_FACES);
else else
opts = format("-D LOCAL_SIZE_X=%d -D LOCAL_SIZE_Y=%d -D SPLIT_STAGE=%d -D N_STAGES=%d -D MAX_FACES=%d", opts = format("-D LOCAL_SIZE_X=%d -D LOCAL_SIZE_Y=%d -D SPLIT_STAGE=%d -D N_STAGES=%d -D MAX_FACES=%d -D LBP",
localsz.width, localsz.height, splitstage_ocl, nstages, MAX_FACES); localsz.width, localsz.height, splitstage_ocl, nstages, MAX_FACES);
lbpKernel.create("runLBPClassifierStumpSimple", ocl::objdetect::cascadedetect_oclsrc, opts); lbpKernel.create("runLBPClassifierStumpSimple", ocl::objdetect::cascadedetect_oclsrc, opts);
if( lbpKernel.empty() ) if( lbpKernel.empty() )
......
...@@ -12,19 +12,22 @@ ...@@ -12,19 +12,22 @@
// Erping Pang, erping@multicorewareinc.com // Erping Pang, erping@multicorewareinc.com
// //
#ifdef HAAR
typedef struct __attribute__((aligned(4))) OptHaarFeature typedef struct __attribute__((aligned(4))) OptHaarFeature
{ {
int4 ofs[3] __attribute__((aligned (4))); int4 ofs[3] __attribute__((aligned (4)));
float4 weight __attribute__((aligned (4))); float4 weight __attribute__((aligned (4)));
} }
OptHaarFeature; OptHaarFeature;
#endif
#ifdef LBP
typedef struct __attribute__((aligned(4))) OptLBPFeature typedef struct __attribute__((aligned(4))) OptLBPFeature
{ {
int16 ofs __attribute__((aligned (4))); int16 ofs __attribute__((aligned (4)));
} }
OptLBPFeature; OptLBPFeature;
#endif
typedef struct __attribute__((aligned(4))) Stump typedef struct __attribute__((aligned(4))) Stump
{ {
...@@ -64,6 +67,7 @@ ScaleData; ...@@ -64,6 +67,7 @@ ScaleData;
#define NODE_COUNT 1 #define NODE_COUNT 1
#endif #endif
#ifdef HAAR
__kernel __attribute__((reqd_work_group_size(LOCAL_SIZE_X,LOCAL_SIZE_Y,1))) __kernel __attribute__((reqd_work_group_size(LOCAL_SIZE_X,LOCAL_SIZE_Y,1)))
void runHaarClassifier( void runHaarClassifier(
int nscales, __global const ScaleData* scaleData, int nscales, __global const ScaleData* scaleData,
...@@ -352,7 +356,9 @@ void runHaarClassifier( ...@@ -352,7 +356,9 @@ void runHaarClassifier(
} }
} }
} }
#endif
#ifdef LBP
#undef CALC_SUM_OFS_ #undef CALC_SUM_OFS_
#define CALC_SUM_OFS_(p0, p1, p2, p3, ptr) \ #define CALC_SUM_OFS_(p0, p1, p2, p3, ptr) \
((ptr)[p0] - (ptr)[p1] - (ptr)[p2] + (ptr)[p3]) ((ptr)[p0] - (ptr)[p1] - (ptr)[p2] + (ptr)[p3])
...@@ -651,3 +657,4 @@ void runLBPClassifierStump( ...@@ -651,3 +657,4 @@ void runLBPClassifierStump(
} }
} }
} }
#endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment