|
|
@ -157,8 +157,7 @@ template<> struct ColorChannel<float> |
|
|
|
///////////////////////////// Top-level template function ////////////////////////////////
|
|
|
|
///////////////////////////// Top-level template function ////////////////////////////////
|
|
|
|
|
|
|
|
|
|
|
|
template <typename Cvt> |
|
|
|
template <typename Cvt> |
|
|
|
class CvtColorLoop_Invoker :
|
|
|
|
class CvtColorLoop_Invoker : public ParallelLoopBody |
|
|
|
public ParallelLoopBody |
|
|
|
|
|
|
|
{ |
|
|
|
{ |
|
|
|
typedef typename Cvt::channel_type _Tp; |
|
|
|
typedef typename Cvt::channel_type _Tp; |
|
|
|
public: |
|
|
|
public: |
|
|
@ -170,18 +169,17 @@ public: |
|
|
|
|
|
|
|
|
|
|
|
virtual void operator()(const Range& range) const |
|
|
|
virtual void operator()(const Range& range) const |
|
|
|
{ |
|
|
|
{ |
|
|
|
int i = range.start; |
|
|
|
const uchar* yS = src.ptr<uchar>(range.start); |
|
|
|
const uchar* yS = src.data + src.step * i; |
|
|
|
uchar* yD = dst.ptr<uchar>(range.start); |
|
|
|
uchar* yD = dst.data + dst.step * i; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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); |
|
|
|
cvt((const _Tp*)yS, (_Tp*)yD, src.cols); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private: |
|
|
|
private: |
|
|
|
const Mat src; |
|
|
|
const Mat& src; |
|
|
|
Mat dst; |
|
|
|
Mat& dst; |
|
|
|
const Cvt cvt; |
|
|
|
const Cvt& cvt; |
|
|
|
|
|
|
|
|
|
|
|
CvtColorLoop_Invoker(const CvtColorLoop_Invoker&); |
|
|
|
CvtColorLoop_Invoker(const CvtColorLoop_Invoker&); |
|
|
|
const CvtColorLoop_Invoker& operator= (const CvtColorLoop_Invoker&); |
|
|
|
const CvtColorLoop_Invoker& operator= (const CvtColorLoop_Invoker&); |
|
|
@ -190,13 +188,7 @@ private: |
|
|
|
template <typename Cvt> |
|
|
|
template <typename Cvt> |
|
|
|
void CvtColorLoop(const Mat& src, Mat& dst, const Cvt& cvt) |
|
|
|
void CvtColorLoop(const Mat& src, Mat& dst, const Cvt& cvt) |
|
|
|
{ |
|
|
|
{ |
|
|
|
Range range(0, src.rows); |
|
|
|
parallel_for_(Range(0, src.rows), CvtColorLoop_Invoker<Cvt>(src, dst, cvt)); |
|
|
|
CvtColorLoop_Invoker<Cvt> invoker(src, dst, cvt); |
|
|
|
|
|
|
|
#if defined(_MSC_VER) || defined(__APPLE__) |
|
|
|
|
|
|
|
parallel_for_(range, invoker); |
|
|
|
|
|
|
|
#else |
|
|
|
|
|
|
|
invoker(range); |
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
////////////////// Various 3/4-channel to 3/4-channel RGB transformations /////////////////
|
|
|
|
////////////////// Various 3/4-channel to 3/4-channel RGB transformations /////////////////
|
|
|
|