mirror of
https://github.com/opencv/opencv.git
synced 2024-11-29 13:47:32 +08:00
cv::transpose inplace
This commit is contained in:
parent
8da0e2b707
commit
5ca3d855a2
@ -3019,24 +3019,50 @@ void cv::transpose( InputArray _src, OutputArray _dst )
|
||||
return;
|
||||
}
|
||||
|
||||
#if defined(HAVE_IPP) && !defined(HAVE_IPP_ICV_ONLY)
|
||||
#if defined HAVE_IPP && !defined HAVE_IPP_ICV_ONLY
|
||||
typedef IppStatus (CV_STDCALL * ippiTranspose)(const void * pSrc, int srcStep, void * pDst, int dstStep, IppiSize roiSize);
|
||||
ippiTranspose ippFunc =
|
||||
type == CV_8UC1 ? (ippiTranspose)ippiTranspose_8u_C1R :
|
||||
type == CV_8UC3 ? (ippiTranspose)ippiTranspose_8u_C3R :
|
||||
type == CV_8UC4 ? (ippiTranspose)ippiTranspose_8u_C4R :
|
||||
type == CV_16UC1 ? (ippiTranspose)ippiTranspose_16u_C1R :
|
||||
type == CV_16UC3 ? (ippiTranspose)ippiTranspose_16u_C3R :
|
||||
type == CV_16UC4 ? (ippiTranspose)ippiTranspose_16u_C4R :
|
||||
type == CV_16SC1 ? (ippiTranspose)ippiTranspose_16s_C1R :
|
||||
type == CV_16SC3 ? (ippiTranspose)ippiTranspose_16s_C3R :
|
||||
type == CV_16SC4 ? (ippiTranspose)ippiTranspose_16s_C4R :
|
||||
type == CV_32SC1 ? (ippiTranspose)ippiTranspose_32s_C1R :
|
||||
type == CV_32SC3 ? (ippiTranspose)ippiTranspose_32s_C3R :
|
||||
type == CV_32SC4 ? (ippiTranspose)ippiTranspose_32s_C4R :
|
||||
type == CV_32FC1 ? (ippiTranspose)ippiTranspose_32f_C1R :
|
||||
type == CV_32FC3 ? (ippiTranspose)ippiTranspose_32f_C3R :
|
||||
type == CV_32FC4 ? (ippiTranspose)ippiTranspose_32f_C4R : 0;
|
||||
typedef IppStatus (CV_STDCALL * ippiTransposeI)(const void * pSrcDst, int srcDstStep, IppiSize roiSize);
|
||||
ippiTranspose ippFunc = 0;
|
||||
ippiTransposeI ippFuncI = 0;
|
||||
|
||||
if (dst.data == src.data && dst.cols == dst.rows)
|
||||
{
|
||||
ippFuncI =
|
||||
type == CV_8UC1 ? (ippiTransposeI)ippiTranspose_8u_C1IR :
|
||||
type == CV_8UC3 ? (ippiTransposeI)ippiTranspose_8u_C3IR :
|
||||
type == CV_8UC4 ? (ippiTransposeI)ippiTranspose_8u_C4IR :
|
||||
type == CV_16UC1 ? (ippiTransposeI)ippiTranspose_16u_C1IR :
|
||||
type == CV_16UC3 ? (ippiTransposeI)ippiTranspose_16u_C3IR :
|
||||
type == CV_16UC4 ? (ippiTransposeI)ippiTranspose_16u_C4IR :
|
||||
type == CV_16SC1 ? (ippiTransposeI)ippiTranspose_16s_C1IR :
|
||||
type == CV_16SC3 ? (ippiTransposeI)ippiTranspose_16s_C3IR :
|
||||
type == CV_16SC4 ? (ippiTransposeI)ippiTranspose_16s_C4IR :
|
||||
type == CV_32SC1 ? (ippiTransposeI)ippiTranspose_32s_C1IR :
|
||||
type == CV_32SC3 ? (ippiTransposeI)ippiTranspose_32s_C3IR :
|
||||
type == CV_32SC4 ? (ippiTransposeI)ippiTranspose_32s_C4IR :
|
||||
type == CV_32FC1 ? (ippiTransposeI)ippiTranspose_32f_C1IR :
|
||||
type == CV_32FC3 ? (ippiTransposeI)ippiTranspose_32f_C3IR :
|
||||
type == CV_32FC4 ? (ippiTransposeI)ippiTranspose_32f_C4IR : 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
ippFunc =
|
||||
type == CV_8UC1 ? (ippiTranspose)ippiTranspose_8u_C1R :
|
||||
type == CV_8UC3 ? (ippiTranspose)ippiTranspose_8u_C3R :
|
||||
type == CV_8UC4 ? (ippiTranspose)ippiTranspose_8u_C4R :
|
||||
type == CV_16UC1 ? (ippiTranspose)ippiTranspose_16u_C1R :
|
||||
type == CV_16UC3 ? (ippiTranspose)ippiTranspose_16u_C3R :
|
||||
type == CV_16UC4 ? (ippiTranspose)ippiTranspose_16u_C4R :
|
||||
type == CV_16SC1 ? (ippiTranspose)ippiTranspose_16s_C1R :
|
||||
type == CV_16SC3 ? (ippiTranspose)ippiTranspose_16s_C3R :
|
||||
type == CV_16SC4 ? (ippiTranspose)ippiTranspose_16s_C4R :
|
||||
type == CV_32SC1 ? (ippiTranspose)ippiTranspose_32s_C1R :
|
||||
type == CV_32SC3 ? (ippiTranspose)ippiTranspose_32s_C3R :
|
||||
type == CV_32SC4 ? (ippiTranspose)ippiTranspose_32s_C4R :
|
||||
type == CV_32FC1 ? (ippiTranspose)ippiTranspose_32f_C1R :
|
||||
type == CV_32FC3 ? (ippiTranspose)ippiTranspose_32f_C3R :
|
||||
type == CV_32FC4 ? (ippiTranspose)ippiTranspose_32f_C4R : 0;
|
||||
}
|
||||
|
||||
IppiSize roiSize = { src.cols, src.rows };
|
||||
if (ippFunc != 0)
|
||||
@ -3045,7 +3071,12 @@ void cv::transpose( InputArray _src, OutputArray _dst )
|
||||
return;
|
||||
setIppErrorStatus();
|
||||
}
|
||||
#endif
|
||||
else if (ippFuncI != 0)
|
||||
{
|
||||
if (ippFuncI(dst.data, (int)dst.step, roiSize) >= 0)
|
||||
return;
|
||||
setIppErrorStatus();
|
||||
}
|
||||
|
||||
if( dst.data == src.data )
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user