Enable parallel CvtColorLoop for all platforms
This commit is contained in:
parent
df94591336
commit
be98693aaf
@ -157,8 +157,7 @@ template<> struct ColorChannel<float>
|
||||
///////////////////////////// Top-level template function ////////////////////////////////
|
||||
|
||||
template <typename Cvt>
|
||||
class CvtColorLoop_Invoker :
|
||||
public ParallelLoopBody
|
||||
class CvtColorLoop_Invoker : public ParallelLoopBody
|
||||
{
|
||||
typedef typename Cvt::channel_type _Tp;
|
||||
public:
|
||||
@ -170,18 +169,17 @@ public:
|
||||
|
||||
virtual void operator()(const Range& range) const
|
||||
{
|
||||
int i = range.start;
|
||||
const uchar* yS = src.data + src.step * i;
|
||||
uchar* yD = dst.data + dst.step * i;
|
||||
const uchar* yS = src.ptr<uchar>(range.start);
|
||||
uchar* yD = dst.ptr<uchar>(range.start);
|
||||
|
||||
for ( ; i < range.end; ++i, yS += src.step, yD += dst.step )
|
||||
for( int i = range.start; i < range.end; ++i, yS += src.step, yD += dst.step )
|
||||
cvt((const _Tp*)yS, (_Tp*)yD, src.cols);
|
||||
}
|
||||
|
||||
private:
|
||||
const Mat src;
|
||||
Mat dst;
|
||||
const Cvt cvt;
|
||||
const Mat& src;
|
||||
Mat& dst;
|
||||
const Cvt& cvt;
|
||||
|
||||
CvtColorLoop_Invoker(const CvtColorLoop_Invoker&);
|
||||
const CvtColorLoop_Invoker& operator= (const CvtColorLoop_Invoker&);
|
||||
@ -190,13 +188,7 @@ private:
|
||||
template <typename Cvt>
|
||||
void CvtColorLoop(const Mat& src, Mat& dst, const Cvt& cvt)
|
||||
{
|
||||
Range range(0, src.rows);
|
||||
CvtColorLoop_Invoker<Cvt> invoker(src, dst, cvt);
|
||||
#if defined(_MSC_VER) || defined(__APPLE__)
|
||||
parallel_for_(range, invoker);
|
||||
#else
|
||||
invoker(range);
|
||||
#endif
|
||||
parallel_for_(Range(0, src.rows), CvtColorLoop_Invoker<Cvt>(src, dst, cvt));
|
||||
}
|
||||
|
||||
////////////////// Various 3/4-channel to 3/4-channel RGB transformations /////////////////
|
||||
|
Loading…
x
Reference in New Issue
Block a user