Reduced some tegra stubs

This commit is contained in:
Andrey Kamaev 2012-06-14 14:09:04 +00:00
parent a98d6b6217
commit 913d4541a5
2 changed files with 56 additions and 160 deletions

View File

@ -2839,6 +2839,11 @@ void cv::warpAffine( InputArray _src, OutputArray _dst,
CV_Assert( (M0.type() == CV_32F || M0.type() == CV_64F) && M0.rows == 2 && M0.cols == 3 );
M0.convertTo(matM, matM.type());
#ifdef HAVE_TEGRA_OPTIMIZATION
if( tegra::warpAffine(src, dst, M, flags, borderType, borderValue) )
return;
#endif
if( !(flags & WARP_INVERSE_MAP) )
{
double D = M[0]*M[4] - M[1]*M[3];
@ -2851,22 +2856,6 @@ void cv::warpAffine( InputArray _src, OutputArray _dst,
M[2] = b1; M[5] = b2;
}
#ifdef HAVE_TEGRA_OPTIMIZATION
if (borderType == BORDER_REPLICATE)
{
if( tegra::warpAffine(src, dst, M, interpolation, borderType, borderValue) )
return;
}
else
{
double warp_mat[6];
Mat warp_m(2, 3, CV_64F, warp_mat);
M0.convertTo(warp_m, warp_m.type());
if( tegra::warpAffine(src, dst, warp_mat, interpolation, borderType, borderValue) )
return;
}
#endif
int x, y, x1, y1, width = dst.cols, height = dst.rows;
AutoBuffer<int> _abdelta(width*2);
int* adelta = &_abdelta[0], *bdelta = adelta + width;
@ -2995,14 +2984,14 @@ void cv::warpPerspective( InputArray _src, OutputArray _dst, InputArray _M0,
CV_Assert( (M0.type() == CV_32F || M0.type() == CV_64F) && M0.rows == 3 && M0.cols == 3 );
M0.convertTo(matM, matM.type());
if( !(flags & WARP_INVERSE_MAP) )
invert(matM, matM);
#ifdef HAVE_TEGRA_OPTIMIZATION
if( tegra::warpPerspective(src, dst, M, interpolation, borderType, borderValue) )
if( tegra::warpPerspective(src, dst, M, flags, borderType, borderValue) )
return;
#endif
if( !(flags & WARP_INVERSE_MAP) )
invert(matM, matM);
int x, y, x1, y1, width = dst.cols, height = dst.rows;
int bh0 = std::min(BLOCK_SZ/2, height);

View File

@ -60,39 +60,8 @@ thresh_8u( const Mat& _src, Mat& _dst, uchar thresh, uchar maxval, int type )
}
#ifdef HAVE_TEGRA_OPTIMIZATION
switch( type )
{
case THRESH_BINARY:
if(tegra::thresh_8u_binary(_src, _dst, roi.width, roi.height, thresh, maxval))
{
if (tegra::thresh_8u(_src, _dst, roi.width, roi.height, thresh, maxval, type))
return;
}
break;
case THRESH_BINARY_INV:
if(tegra::thresh_8u_binary_inv(_src, _dst, roi.width, roi.height, thresh, maxval))
{
return;
}
break;
case THRESH_TRUNC:
if(tegra::thresh_8u_trunc(_src, _dst, roi.width, roi.height, thresh))
{
return;
}
break;
case THRESH_TOZERO:
if(tegra::thresh_8u_tozero(_src, _dst, roi.width, roi.height, thresh))
{
return;
}
break;
case THRESH_TOZERO_INV:
if(tegra::thresh_8u_tozero_inv(_src, _dst, roi.width, roi.height, thresh))
{
return;
}
break;
}
#endif
switch( type )
@ -264,7 +233,7 @@ thresh_8u( const Mat& _src, Mat& _dst, uchar thresh, uchar maxval, int type )
const uchar* src = (const uchar*)(_src.data + _src.step*i);
uchar* dst = (uchar*)(_dst.data + _dst.step*i);
j = j_scalar;
#if CV_ENABLE_UNROLLED
#if CV_ENABLE_UNROLLED
for( ; j <= roi.width - 4; j += 4 )
{
uchar t0 = tab[src[j]];
@ -279,7 +248,7 @@ thresh_8u( const Mat& _src, Mat& _dst, uchar thresh, uchar maxval, int type )
dst[j+2] = t0;
dst[j+3] = t1;
}
#endif
#endif
for( ; j < roi.width; j++ )
dst[j] = tab[src[j]];
}
@ -307,41 +276,12 @@ thresh_16s( const Mat& _src, Mat& _dst, short thresh, short maxval, int type )
roi.width *= roi.height;
roi.height = 1;
}
#ifdef HAVE_TEGRA_OPTIMIZATION
switch( type )
{
case THRESH_BINARY:
if(tegra::thresh_16s_binary(_src, _dst, roi.width, roi.height, thresh, maxval))
{
if (tegra::thresh_16s(_src, _dst, roi.width, roi.height, thresh, maxval, type))
return;
}
break;
case THRESH_BINARY_INV:
if(tegra::thresh_16s_binary_inv(_src, _dst, roi.width, roi.height, thresh, maxval))
{
return;
}
break;
case THRESH_TRUNC:
if(tegra::thresh_16s_trunc(_src, _dst, roi.width, roi.height, thresh))
{
return;
}
break;
case THRESH_TOZERO:
if(tegra::thresh_16s_tozero(_src, _dst, roi.width, roi.height, thresh))
{
return;
}
break;
case THRESH_TOZERO_INV:
if(tegra::thresh_16s_tozero_inv(_src, _dst, roi.width, roi.height, thresh))
{
return;
}
break;
}
#endif
switch( type )
{
case THRESH_BINARY:
@ -510,40 +450,10 @@ thresh_32f( const Mat& _src, Mat& _dst, float thresh, float maxval, int type )
}
#ifdef HAVE_TEGRA_OPTIMIZATION
switch( type )
{
case THRESH_BINARY:
if(tegra::thresh_32f_binary(_src, _dst, roi.width, roi.height, thresh, maxval))
{
if (tegra::thresh_32f(_src, _dst, roi.width, roi.height, thresh, maxval, type))
return;
}
break;
case THRESH_BINARY_INV:
if(tegra::thresh_32f_binary_inv(_src, _dst, roi.width, roi.height, thresh, maxval))
{
return;
}
break;
case THRESH_TRUNC:
if(tegra::thresh_32f_trunc(_src, _dst, roi.width, roi.height, thresh))
{
return;
}
break;
case THRESH_TOZERO:
if(tegra::thresh_32f_tozero(_src, _dst, roi.width, roi.height, thresh))
{
return;
}
break;
case THRESH_TOZERO_INV:
if(tegra::thresh_32f_tozero_inv(_src, _dst, roi.width, roi.height, thresh))
{
return;
}
break;
}
#endif
switch( type )
{
case THRESH_BINARY:
@ -820,7 +730,7 @@ double cv::threshold( InputArray _src, OutputArray _dst, double thresh, double m
Mat dst = _dst.getMat();
int nStripes = 1;
#if defined HAVE_TBB && defined HAVE_TEGRA_OPTIMIZATION
#if defined HAVE_TBB && defined ANDROID
nStripes = 4;
#endif
@ -849,7 +759,6 @@ double cv::threshold( InputArray _src, OutputArray _dst, double thresh, double m
}
else
{
//thresh_8u( src, dst, (uchar)ithresh, (uchar)imaxval, type );
parallel_for(BlockedRange(0, nStripes),
ThresholdRunner(src, dst, nStripes, (uchar)ithresh, (uchar)imaxval, type));
}
@ -879,14 +788,12 @@ double cv::threshold( InputArray _src, OutputArray _dst, double thresh, double m
}
else
{
//thresh_16s( src, dst, (short)ithresh, (short)imaxval, type );
parallel_for(BlockedRange(0, nStripes),
ThresholdRunner(src, dst, nStripes, (short)ithresh, (short)imaxval, type));
}
}
else if( src.depth() == CV_32F )
{
//thresh_32f( src, dst, (float)thresh, (float)maxval, type );
parallel_for(BlockedRange(0, nStripes),
ThresholdRunner(src, dst, nStripes, (float)thresh, (float)maxval, type));
}