use mutex provided by opencv itself

add getoclcontext and getoclcommandqueue so that other opencl program can interactive with opencv ocl module
correct haar test cases
add face detection sample
This commit is contained in:
niko
2012-08-31 14:08:52 +08:00
parent 11e16a7204
commit 6f6e990988
8 changed files with 416 additions and 428 deletions

View File

@@ -44,7 +44,6 @@
//M*/
#include "precomp.hpp"
#include "threadsafe.h"
#include <iomanip>
#include "binarycaching.hpp"
@@ -348,7 +347,14 @@ namespace cv
}
Context::setContext(oclinfo);
}
void* getoclContext()
{
return &(Context::getContext()->impl->clContext);
}
void* getoclCommandQueue()
{
return &(Context::getContext()->impl->clCmdQueue);
}
void openCLReadBuffer(Context *clCxt, cl_mem dst_buffer, void *host_buffer, size_t size)
{
cl_int status;
@@ -772,12 +778,12 @@ namespace cv
/////////////////////////////OpenCL initialization/////////////////
auto_ptr<Context> Context::clCxt;
int Context::val = 0;
CriticalSection cs;
Mutex cs;
Context *Context::getContext()
{
if(val == 0)
{
myAutoLock al(&cs);
AutoLock al(cs);
if( NULL == clCxt.get())
clCxt.reset(new Context);