[~] NCVPyramid uses tr1 and thus can be compiled with CL, commented out on linux
[+] Moved reduction functors to NCVAlg
[*] Warnings in NCV
This commit is contained in:
Anton Obukhov 2011-11-06 09:43:17 +00:00
parent 325e0b1ab8
commit 2cb9192604
5 changed files with 66 additions and 33 deletions

View File

@ -565,14 +565,7 @@ __global__ void applyHaarClassifierClassifierParallel(Ncv32u *d_IImg, Ncv32u IIm
curRootNodeOffset += NUM_THREADS_CLASSIFIERPARALLEL;
}
struct functorAddValues
{
__device__ void reduce(Ncv32f &in1out, Ncv32f &in2)
{
in1out += in2;
}
};
Ncv32f finalStageSum = subReduce<Ncv32f, functorAddValues, NUM_THREADS_CLASSIFIERPARALLEL>(curStageSum);
Ncv32f finalStageSum = subReduce<Ncv32f, functorAddValues<Ncv32f>, NUM_THREADS_CLASSIFIERPARALLEL>(curStageSum);
if (finalStageSum < stageThreshold)
{

View File

@ -278,6 +278,7 @@ NCVMemStackAllocator::NCVMemStackAllocator(NCVMemoryType memT, size_t capacity,
{
NcvBool bProperAlignment = (alignment & (alignment-1)) == 0;
ncvAssertPrintCheck(bProperAlignment, "NCVMemStackAllocator ctor:: _alignment not power of 2");
ncvAssertPrintCheck(memT != NCVMemoryTypeNone, "NCVMemStackAllocator ctor:: Incorrect allocator type");
allocBegin = NULL;
@ -295,6 +296,7 @@ NCVMemStackAllocator::NCVMemStackAllocator(NCVMemoryType memT, size_t capacity,
case NCVMemoryTypeHostPageable:
allocBegin = (Ncv8u *)malloc(capacity);
break;
default:;
}
}
else
@ -335,6 +337,7 @@ NCVMemStackAllocator::~NCVMemStackAllocator()
case NCVMemoryTypeHostPageable:
free(allocBegin);
break;
default:;
}
}
@ -455,6 +458,7 @@ NCVStatus NCVMemNativeAllocator::alloc(NCVMemSegment &seg, size_t size)
case NCVMemoryTypeHostPageable:
seg.begin.ptr = (Ncv8u *)malloc(size);
break;
default:;
}
this->currentSize += alignUp(size, this->_alignment);
@ -487,6 +491,7 @@ NCVStatus NCVMemNativeAllocator::dealloc(NCVMemSegment &seg)
case NCVMemoryTypeHostPageable:
free(seg.begin.ptr);
break;
default:;
}
seg.clear();

View File

@ -52,6 +52,36 @@ static T divUp(T a, T b)
}
template<typename T>
struct functorAddValues
{
static __device__ __inline__ void reduce(T &in1out, T &in2)
{
in1out += in2;
}
};
template<typename T>
struct functorMinValues
{
static __device__ __inline__ void reduce(T &in1out, T &in2)
{
in1out = in1out > in2 ? in2 : in1out;
}
};
template<typename T>
struct functorMaxValues
{
static __device__ __inline__ void reduce(T &in1out, T &in2)
{
in1out = in1out > in2 ? in1out : in2;
}
};
template<typename Tdata, class Tfunc, Ncv32u nThreads>
static __device__ Tdata subReduce(Tdata threadElem)
{

View File

@ -46,6 +46,7 @@
#include "NCVPyramid.hpp"
#include "NCVPixelOperations.hpp"
#ifdef _WIN32
template<typename T, Ncv32u CN> struct __average4_CN {static T _average4_CN(const T &p00, const T &p01, const T &p10, const T &p11);};
@ -395,3 +396,5 @@ template class NCVImagePyramid<uint4>;
template class NCVImagePyramid<float1>;
template class NCVImagePyramid<float3>;
template class NCVImagePyramid<float4>;
#endif //_WIN32

View File

@ -47,6 +47,7 @@
#include <vector>
#include "NCV.hpp"
#ifdef _WIN32
template <class T>
class NCV_EXPORTS NCVMatrixStack
@ -93,5 +94,6 @@ private:
Ncv32u nLayers;
};
#endif //_WIN32
#endif //_ncvpyramid_hpp_