@ -17,11 +17,7 @@ void cvtYUVtoBGR(const uchar * src_data, size_t src_step,
uchar * dst_data , size_t dst_step ,
int width , int height ,
int depth , int dcn , bool swapBlue , bool isCbCr ) ;
void cvtTwoPlaneYUVtoBGR ( const uchar * src_data , size_t src_step ,
uchar * dst_data , size_t dst_step ,
int dst_width , int dst_height ,
int dcn , bool swapBlue , int uIdx ) ;
void cvtTwoPlaneYUVtoBGR ( const uchar * y_data , const uchar * uv_data , size_t src_step ,
void cvtTwoPlaneYUVtoBGR ( const uchar * y_data , size_t y_step , const uchar * uv_data , size_t uv_step ,
uchar * dst_data , size_t dst_step ,
int dst_width , int dst_height ,
int dcn , bool swapBlue , int uIdx ) ;
@ -1177,24 +1173,28 @@ struct YUV420sp2RGB8Invoker : ParallelLoopBody
uchar * dst_data ;
size_t dst_step ;
int width ;
const uchar * my1 , * muv ;
size_t stride ;
const uchar * my1 ;
size_t my1_step ;
const uchar * muv ;
size_t muv_step ;
YUV420sp2RGB8Invoker ( uchar * _dst_data , size_t _dst_step , int _dst_width , size_t _stride , const uchar * _y1 , const uchar * _uv )
: dst_data ( _dst_data ) , dst_step ( _dst_step ) , width ( _dst_width ) , my1 ( _y1 ) , muv ( _uv ) , stride ( _stride ) { }
YUV420sp2RGB8Invoker ( uchar * _dst_data , size_t _dst_step , int _dst_width ,
const uchar * _y1 , size_t _y1_step , const uchar * _uv , size_t _uv_step ) :
dst_data ( _dst_data ) , dst_step ( _dst_step ) , width ( _dst_width ) ,
my1 ( _y1 ) , my1_step ( _y1_step ) , muv ( _uv ) , muv_step ( _uv_step ) { }
void operator ( ) ( const Range & range ) const CV_OVERRIDE
{
const int rangeBegin = range . start * 2 ;
const int rangeEnd = range . end * 2 ;
const uchar * y1 = my1 + rangeBegin * strid e , * uv = muv + rangeBegin * strid e / 2 ;
const uchar * y1 = my1 + rangeBegin * my1_ step , * uv = muv + rangeBegin * muv_ step / 2 ;
for ( int j = rangeBegin ; j < rangeEnd ; j + = 2 , y1 + = strid e * 2 , uv + = strid e )
for ( int j = rangeBegin ; j < rangeEnd ; j + = 2 , y1 + = my1_ step * 2 , uv + = muv_ step )
{
uchar * row1 = dst_data + dst_step * j ;
uchar * row2 = dst_data + dst_step * ( j + 1 ) ;
const uchar * y2 = y1 + strid e ;
const uchar * y2 = y1 + my1_ step ;
int i = 0 ;
# if CV_SIMD
@ -1395,9 +1395,10 @@ struct YUV420p2RGB8Invoker : ParallelLoopBody
# define MIN_SIZE_FOR_PARALLEL_YUV420_CONVERSION (320*240)
template < int bIdx , int uIdx , int dcn >
inline void cvtYUV420sp2RGB ( uchar * dst_data , size_t dst_step , int dst_width , int dst_height , size_t _stride , const uchar * _y1 , const uchar * _uv )
inline void cvtYUV420sp2RGB ( uchar * dst_data , size_t dst_step , int dst_width , int dst_height ,
const uchar * _y1 , size_t _y1_step , const uchar * _uv , size_t _uv_step )
{
YUV420sp2RGB8Invoker < bIdx , uIdx , dcn > converter ( dst_data , dst_step , dst_width , _stride , _y1 , _uv ) ;
YUV420sp2RGB8Invoker < bIdx , uIdx , dcn > converter ( dst_data , dst_step , dst_width , _y1 , _y1_step , _uv , _uv_step ) ;
if ( dst_width * dst_height > = MIN_SIZE_FOR_PARALLEL_YUV420_CONVERSION )
parallel_for_ ( Range ( 0 , dst_height / 2 ) , converter ) ;
else
@ -1817,26 +1818,16 @@ void cvtYUVtoBGR(const uchar * src_data, size_t src_step,
CvtColorLoop ( src_data , src_step , dst_data , dst_step , width , height , YCrCb2RGB_f < float > ( dcn , blueIdx , isCbCr ) ) ;
}
void cvtTwoPlaneYUVtoBGR ( const uchar * src_data , size_t src_step ,
uchar * dst_data , size_t dst_step ,
int dst_width , int dst_height ,
int dcn , bool swapBlue , int uIdx )
{
CV_INSTRUMENT_REGION ( ) ;
const uchar * uv = src_data + src_step * static_cast < size_t > ( dst_height ) ;
cvtTwoPlaneYUVtoBGR ( src_data , uv , src_step , dst_data , dst_step , dst_width , dst_height , dcn , swapBlue , uIdx ) ;
}
typedef void ( * cvt_2plane_yuv_ptr_t ) ( uchar * /* dst_data*/ ,
size_t /* dst_step */ ,
int /* dst_width */ ,
int /* dst_height */ ,
size_t /* _stride */ ,
const uchar * /* _y1 */ ,
const uchar * /* _uv */ ) ;
size_t /* _y1_step */ ,
const uchar * /* _uv */ ,
size_t /* _uv_step */ ) ;
void cvtTwoPlaneYUVtoBGR ( const uchar * y_data , const uchar * uv_data , size_t src_step ,
void cvtTwoPlaneYUVtoBGR ( const uchar * y_data , size_t y_step , const uchar * uv_data , size_t uv_step ,
uchar * dst_data , size_t dst_step ,
int dst_width , int dst_height ,
int dcn , bool swapBlue , int uIdx )
@ -1859,7 +1850,7 @@ void cvtTwoPlaneYUVtoBGR(const uchar * y_data, const uchar * uv_data, size_t src
default : CV_Error ( CV_StsBadFlag , " Unknown/unsupported color conversion code " ) ; break ;
} ;
cvtPtr ( dst_data , dst_step , dst_width , dst_height , src_step , y_data , uv_data ) ;
cvtPtr ( dst_data , dst_step , dst_width , dst_height , y_data , y_step , uv_data , uv_step ) ;
}
typedef void ( * cvt_3plane_yuv_ptr_t ) ( uchar * /* dst_data */ ,