hopefully, now opencv_test_imgproc should pass

This commit is contained in:
Vadim Pisarevsky 2013-12-02 18:27:08 +04:00
parent 5fea17ff0d
commit 161c3b71e6
5 changed files with 6 additions and 21 deletions

View File

@ -283,7 +283,6 @@ public:
void* data, size_t* step, int flags) const = 0;
virtual bool allocate(UMatData* data, int accessflags) const = 0;
virtual void deallocate(UMatData* data) const = 0;
virtual void sync(UMatData* u) const;
virtual void map(UMatData* data, int accessflags) const;
virtual void unmap(UMatData* data) const;
virtual void download(UMatData* data, void* dst, int dims, const size_t sz[],

View File

@ -48,10 +48,6 @@
namespace cv {
void MatAllocator::sync(UMatData*) const
{
}
void MatAllocator::map(UMatData*, int) const
{
}

View File

@ -2268,8 +2268,8 @@ bool Kernel::run(int dims, size_t _globalsize[], size_t _localsize[],
CV_Assert(_globalsize != 0);
for (int i = 0; i < dims; i++)
{
size_t val = _localsize ? _localsize[i] : 1;
//dims == 1 ? 64 : dims == 2 ? (16>>i) : dims == 3 ? (8>>(int)(i>0)) : 1;
size_t val = _localsize ? _localsize[i] :
dims == 1 ? 64 : dims == 2 ? (16>>i) : dims == 3 ? (8>>(int)(i>0)) : 1;
CV_Assert( val > 0 );
total *= _globalsize[i];
globalsize[i] = ((_globalsize[i] + val - 1)/val)*val;
@ -2721,7 +2721,7 @@ public:
return true;
}
void sync(UMatData* u) const
/*void sync(UMatData* u) const
{
cl_command_queue q = (cl_command_queue)Queue::getDefault().ptr();
UMatDataAutoLock lock(u);
@ -2749,19 +2749,19 @@ public:
clEnqueueWriteBuffer(q, (cl_mem)u->handle, CL_TRUE, 0,
u->size, u->data, 0, 0, 0);
}
}
}*/
void deallocate(UMatData* u) const
{
if(!u)
return;
UMatDataAutoLock lock(u);
// TODO: !!! when we add Shared Virtual Memory Support,
// this function (as well as the others) should be corrected
CV_Assert(u->handle != 0 && u->urefcount == 0);
if(u->tempUMat())
{
UMatDataAutoLock lock(u);
if( u->hostCopyObsolete() && u->refcount > 0 )
{
cl_command_queue q = (cl_command_queue)Queue::getDefault().ptr();
@ -2792,6 +2792,7 @@ public:
}
else
{
CV_Assert(u->refcount == 0);
if(u->data && u->copyOnMap() && !(u->flags & UMatData::USER_ALLOCATED))
{
fastFree(u->data);

View File

@ -286,8 +286,6 @@ void UMat::copySize(const UMat& m)
UMat::~UMat()
{
//if( u && u->refcount > 0 )
// u->currAllocator->sync(u);
release();
if( step.p != step.buf )
fastFree(step.p);

View File

@ -83,12 +83,8 @@ TEST(TestAPI, openCLExecuteKernelInterop)
TEST(OCL_TestTAPI, performance)
{
cv::RNG rng;
#if 1
cv::Mat src(1280,768,CV_8UC4), dst;
rng.fill(src, RNG::UNIFORM, 0, 255);
#else
cv::Mat src = cv::imread("/Users/vp/work/opencv/samples/c/lena.jpg", 1), dst;
#endif
cv::UMat usrc, udst;
src.copyTo(usrc);
@ -130,9 +126,4 @@ TEST(OCL_TestTAPI, performance)
}
t = (double)cv::getTickCount() - t;
printf("cpu exec time = %gms per iter\n", t*1000./niters/cv::getTickFrequency());
/*cv::imshow("result0", dst);
cv::imshow("result1", udst);
cv::waitKey();
cv::destroyWindow("result0");
cv::destroyWindow("result1");*/
}