|
|
|
@ -878,8 +878,8 @@ struct VResizeLinear |
|
|
|
|
VecOp vecOp; |
|
|
|
|
|
|
|
|
|
int x = vecOp((const uchar**)src, (uchar*)dst, (const uchar*)beta, width); |
|
|
|
|
#if CV_ENABLE_UNROLLED |
|
|
|
|
for( ; x <= width - 4; x += 4 ) |
|
|
|
|
#if CV_ENABLE_UNROLLED |
|
|
|
|
for( ; x <= width - 4; x += 4 ) |
|
|
|
|
{ |
|
|
|
|
WT t0, t1; |
|
|
|
|
t0 = S0[x]*b0 + S1[x]*b1; |
|
|
|
@ -1035,7 +1035,7 @@ struct VResizeLanczos4 |
|
|
|
|
CastOp castOp; |
|
|
|
|
VecOp vecOp; |
|
|
|
|
int k, x = vecOp((const uchar**)src, (uchar*)dst, (const uchar*)beta, width); |
|
|
|
|
#if CV_ENABLE_UNROLLED |
|
|
|
|
#if CV_ENABLE_UNROLLED |
|
|
|
|
for( ; x <= width - 4; x += 4 ) |
|
|
|
|
{ |
|
|
|
|
WT b = beta[0]; |
|
|
|
@ -1130,7 +1130,7 @@ static void resizeGeneric_( const Mat& src, Mat& dst, |
|
|
|
|
if( k0 < ksize ) |
|
|
|
|
hresize( srows + k0, rows + k0, ksize - k0, xofs, alpha, |
|
|
|
|
ssize.width, dsize.width, cn, xmin, xmax ); |
|
|
|
|
vresize( (const WT**)rows, (T*)(dst.data + dst.step*dy), beta, dsize.width ); |
|
|
|
|
vresize( (const WT**)rows, (T*)(dst.data + dst.step*dy), beta, dsize.width ); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -1163,8 +1163,8 @@ static void resizeAreaFast_( const Mat& src, Mat& dst, const int* ofs, const int |
|
|
|
|
{ |
|
|
|
|
const T* S = (const T*)(src.data + src.step*sy0) + xofs[dx]; |
|
|
|
|
WT sum = 0; |
|
|
|
|
k=0; |
|
|
|
|
#if CV_ENABLE_UNROLLED |
|
|
|
|
k=0; |
|
|
|
|
#if CV_ENABLE_UNROLLED |
|
|
|
|
for( ; k <= area - 4; k += 4 ) |
|
|
|
|
sum += S[ofs[k]] + S[ofs[k+1]] + S[ofs[k+2]] + S[ofs[k+3]]; |
|
|
|
|
#endif |
|
|
|
@ -1272,15 +1272,18 @@ static void resizeArea_( const Mat& src, Mat& dst, const DecimateAlpha* xofs, in |
|
|
|
|
WT beta1 = 1 - beta; |
|
|
|
|
T* D = (T*)(dst.data + dst.step*cur_dy); |
|
|
|
|
if( fabs(beta) < 1e-3 ) |
|
|
|
|
{ |
|
|
|
|
if(cur_dy >= dsize.height) return; |
|
|
|
|
for( dx = 0; dx < dsize.width; dx++ ) |
|
|
|
|
{ |
|
|
|
|
D[dx] = saturate_cast<T>(sum[dx] + buf[dx]); |
|
|
|
|
D[dx] = saturate_cast<T>((sum[dx] + buf[dx]) / min(scale_y, src.rows - cur_dy * scale_y)); |
|
|
|
|
sum[dx] = buf[dx] = 0; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
for( dx = 0; dx < dsize.width; dx++ ) |
|
|
|
|
{ |
|
|
|
|
D[dx] = saturate_cast<T>(sum[dx] + buf[dx]*beta1); |
|
|
|
|
D[dx] = saturate_cast<T>((sum[dx] + buf[dx]* beta1)/ min(scale_y, src.rows - cur_dy*scale_y)); |
|
|
|
|
sum[dx] = buf[dx]*beta; |
|
|
|
|
buf[dx] = 0; |
|
|
|
|
} |
|
|
|
@ -1329,11 +1332,11 @@ void cv::resize( InputArray _src, OutputArray _dst, Size dsize, |
|
|
|
|
resizeGeneric_< |
|
|
|
|
HResizeLinear<uchar, int, short, |
|
|
|
|
INTER_RESIZE_COEF_SCALE, |
|
|
|
|
HResizeLinearVec_8u32s>, |
|
|
|
|
HResizeLinearVec_8u32s>, |
|
|
|
|
VResizeLinear<uchar, int, short, |
|
|
|
|
FixedPtCast<int, uchar, INTER_RESIZE_COEF_BITS*2>, |
|
|
|
|
VResizeLinearVec_32s8u> >, |
|
|
|
|
0, |
|
|
|
|
VResizeLinearVec_32s8u> >, |
|
|
|
|
0, |
|
|
|
|
resizeGeneric_< |
|
|
|
|
HResizeLinear<ushort, float, float, 1, |
|
|
|
|
HResizeLinearVec_16u32f>, |
|
|
|
@ -1344,7 +1347,7 @@ void cv::resize( InputArray _src, OutputArray _dst, Size dsize, |
|
|
|
|
HResizeLinearVec_16s32f>, |
|
|
|
|
VResizeLinear<short, float, float, Cast<float, short>, |
|
|
|
|
VResizeLinearVec_32f16s> >, |
|
|
|
|
0, |
|
|
|
|
0, |
|
|
|
|
resizeGeneric_< |
|
|
|
|
HResizeLinear<float, float, float, 1, |
|
|
|
|
HResizeLinearVec_32f>, |
|
|
|
@ -1374,7 +1377,7 @@ void cv::resize( InputArray _src, OutputArray _dst, Size dsize, |
|
|
|
|
HResizeCubic<short, float, float>, |
|
|
|
|
VResizeCubic<short, float, float, Cast<float, short>, |
|
|
|
|
VResizeCubicVec_32f16s> >, |
|
|
|
|
0, |
|
|
|
|
0, |
|
|
|
|
resizeGeneric_< |
|
|
|
|
HResizeCubic<float, float, float>, |
|
|
|
|
VResizeCubic<float, float, float, Cast<float, float>, |
|
|
|
@ -1396,10 +1399,10 @@ void cv::resize( InputArray _src, OutputArray _dst, Size dsize, |
|
|
|
|
resizeGeneric_<HResizeLanczos4<ushort, float, float>, |
|
|
|
|
VResizeLanczos4<ushort, float, float, Cast<float, ushort>, |
|
|
|
|
VResizeNoVec> >, |
|
|
|
|
resizeGeneric_<HResizeLanczos4<short, float, float>, |
|
|
|
|
resizeGeneric_<HResizeLanczos4<short, float, float>, |
|
|
|
|
VResizeLanczos4<short, float, float, Cast<float, short>, |
|
|
|
|
VResizeNoVec> >, |
|
|
|
|
0, |
|
|
|
|
0, |
|
|
|
|
resizeGeneric_<HResizeLanczos4<float, float, float>, |
|
|
|
|
VResizeLanczos4<float, float, float, Cast<float, float>, |
|
|
|
|
VResizeNoVec> >, |
|
|
|
@ -1412,8 +1415,8 @@ void cv::resize( InputArray _src, OutputArray _dst, Size dsize, |
|
|
|
|
static ResizeAreaFastFunc areafast_tab[] = |
|
|
|
|
{ |
|
|
|
|
resizeAreaFast_<uchar, int>, 0, |
|
|
|
|
resizeAreaFast_<ushort, float>, |
|
|
|
|
resizeAreaFast_<short, float>, |
|
|
|
|
resizeAreaFast_<ushort, float>, |
|
|
|
|
resizeAreaFast_<short, float>, |
|
|
|
|
0, |
|
|
|
|
resizeAreaFast_<float, float>, |
|
|
|
|
resizeAreaFast_<double, double>, |
|
|
|
@ -1498,7 +1501,6 @@ void cv::resize( InputArray _src, OutputArray _dst, Size dsize, |
|
|
|
|
|
|
|
|
|
AutoBuffer<DecimateAlpha> _xofs(ssize.width*2); |
|
|
|
|
DecimateAlpha* xofs = _xofs; |
|
|
|
|
double scale = 1.f/(scale_x*scale_y); |
|
|
|
|
|
|
|
|
|
for( dx = 0, k = 0; dx < dsize.width; dx++ ) |
|
|
|
|
{ |
|
|
|
@ -1512,7 +1514,7 @@ void cv::resize( InputArray _src, OutputArray _dst, Size dsize, |
|
|
|
|
assert( k < ssize.width*2 ); |
|
|
|
|
xofs[k].di = dx*cn; |
|
|
|
|
xofs[k].si = (sx1-1)*cn; |
|
|
|
|
xofs[k++].alpha = (float)((sx1 - fsx1)*scale); |
|
|
|
|
xofs[k++].alpha = (float)((sx1 - fsx1) / min(scale_x, src.cols - fsx1)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
for( sx = sx1; sx < sx2; sx++ ) |
|
|
|
@ -1520,7 +1522,7 @@ void cv::resize( InputArray _src, OutputArray _dst, Size dsize, |
|
|
|
|
assert( k < ssize.width*2 ); |
|
|
|
|
xofs[k].di = dx*cn; |
|
|
|
|
xofs[k].si = sx*cn; |
|
|
|
|
xofs[k++].alpha = (float)scale; |
|
|
|
|
xofs[k++].alpha = 1.f / min(scale_x, src.cols - fsx1); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if( fsx2 - sx2 > 1e-3 ) |
|
|
|
@ -1528,10 +1530,9 @@ void cv::resize( InputArray _src, OutputArray _dst, Size dsize, |
|
|
|
|
assert( k < ssize.width*2 ); |
|
|
|
|
xofs[k].di = dx*cn; |
|
|
|
|
xofs[k].si = sx2*cn; |
|
|
|
|
xofs[k++].alpha = (float)((fsx2 - sx2)*scale); |
|
|
|
|
xofs[k++].alpha = (float)(min(fsx2 - sx2, 1.) / min(scale_x, src.cols - fsx1)); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
func( src, dst, xofs, k ,scale_y); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
@ -3480,7 +3481,7 @@ void cvLinearPolar( const CvArr* srcarr, CvArr* dstarr, |
|
|
|
|
if( !CV_ARE_TYPES_EQ( src, dst )) |
|
|
|
|
CV_Error( CV_StsUnmatchedFormats, "" ); |
|
|
|
|
|
|
|
|
|
ssize.width = src->cols; |
|
|
|
|
ssize.width = src->cols; |
|
|
|
|
ssize.height = src->rows; |
|
|
|
|
dsize.width = dst->cols; |
|
|
|
|
dsize.height = dst->rows; |
|
|
|
|