diff --git a/modules/imgproc/src/imgwarp.cpp b/modules/imgproc/src/imgwarp.cpp index 2fbd285af..d68ac0619 100644 --- a/modules/imgproc/src/imgwarp.cpp +++ b/modules/imgproc/src/imgwarp.cpp @@ -786,6 +786,7 @@ typedef HResizeNoVec HResizeLinearVec_8u32s; typedef HResizeNoVec HResizeLinearVec_16u32f; typedef HResizeNoVec HResizeLinearVec_16s32f; typedef HResizeNoVec HResizeLinearVec_32f; +typedef HResizeNoVec HResizeLinearVec_64f; #else @@ -793,17 +794,17 @@ typedef HResizeNoVec HResizeLinearVec_8u32s; typedef HResizeNoVec HResizeLinearVec_16u32f; typedef HResizeNoVec HResizeLinearVec_16s32f; typedef HResizeNoVec HResizeLinearVec_32f; - + typedef VResizeNoVec VResizeLinearVec_32s8u; typedef VResizeNoVec VResizeLinearVec_32f16u; typedef VResizeNoVec VResizeLinearVec_32f16s; typedef VResizeNoVec VResizeLinearVec_32f; - + typedef VResizeNoVec VResizeCubicVec_32s8u; typedef VResizeNoVec VResizeCubicVec_32f16u; typedef VResizeNoVec VResizeCubicVec_32f16s; typedef VResizeNoVec VResizeCubicVec_32f; - + #endif @@ -1168,16 +1169,16 @@ struct DecimateAlpha float alpha; }; -template +template static void resizeArea_( const Mat& src, Mat& dst, const DecimateAlpha* xofs, int xofs_count ) { Size ssize = src.size(), dsize = dst.size(); int cn = src.channels(); dsize.width *= cn; - AutoBuffer _buffer(dsize.width*2); - float *buf = _buffer, *sum = buf + dsize.width; + AutoBuffer _buffer(dsize.width*2); + WT *buf = _buffer, *sum = buf + dsize.width; int k, sy, dx, cur_dy = 0; - float scale_y = (float)ssize.height/dsize.height; + WT scale_y = (WT)ssize.height/dsize.height; CV_Assert( cn <= 4 ); for( dx = 0; dx < dsize.width; dx++ ) @@ -1190,7 +1191,7 @@ static void resizeArea_( const Mat& src, Mat& dst, const DecimateAlpha* xofs, in for( k = 0; k < xofs_count; k++ ) { int dxn = xofs[k].di; - float alpha = xofs[k].alpha; + WT alpha = xofs[k].alpha; buf[dxn] += S[xofs[k].si]*alpha; } else if( cn == 2 ) @@ -1198,9 +1199,9 @@ static void resizeArea_( const Mat& src, Mat& dst, const DecimateAlpha* xofs, in { int sxn = xofs[k].si; int dxn = xofs[k].di; - float alpha = xofs[k].alpha; - float t0 = buf[dxn] + S[sxn]*alpha; - float t1 = buf[dxn+1] + S[sxn+1]*alpha; + WT alpha = xofs[k].alpha; + WT t0 = buf[dxn] + S[sxn]*alpha; + WT t1 = buf[dxn+1] + S[sxn+1]*alpha; buf[dxn] = t0; buf[dxn+1] = t1; } else if( cn == 3 ) @@ -1208,10 +1209,10 @@ static void resizeArea_( const Mat& src, Mat& dst, const DecimateAlpha* xofs, in { int sxn = xofs[k].si; int dxn = xofs[k].di; - float alpha = xofs[k].alpha; - float t0 = buf[dxn] + S[sxn]*alpha; - float t1 = buf[dxn+1] + S[sxn+1]*alpha; - float t2 = buf[dxn+2] + S[sxn+2]*alpha; + WT alpha = xofs[k].alpha; + WT t0 = buf[dxn] + S[sxn]*alpha; + WT t1 = buf[dxn+1] + S[sxn+1]*alpha; + WT t2 = buf[dxn+2] + S[sxn+2]*alpha; buf[dxn] = t0; buf[dxn+1] = t1; buf[dxn+2] = t2; } else @@ -1219,9 +1220,9 @@ static void resizeArea_( const Mat& src, Mat& dst, const DecimateAlpha* xofs, in { int sxn = xofs[k].si; int dxn = xofs[k].di; - float alpha = xofs[k].alpha; - float t0 = buf[dxn] + S[sxn]*alpha; - float t1 = buf[dxn+1] + S[sxn+1]*alpha; + WT alpha = xofs[k].alpha; + WT t0 = buf[dxn] + S[sxn]*alpha; + WT t1 = buf[dxn+1] + S[sxn+1]*alpha; buf[dxn] = t0; buf[dxn+1] = t1; t0 = buf[dxn+2] + S[sxn+2]*alpha; t1 = buf[dxn+3] + S[sxn+3]*alpha; @@ -1230,8 +1231,8 @@ static void resizeArea_( const Mat& src, Mat& dst, const DecimateAlpha* xofs, in if( (cur_dy + 1)*scale_y <= sy + 1 || sy == ssize.height - 1 ) { - float beta = std::max(sy + 1 - (cur_dy+1)*scale_y, 0.f); - float beta1 = 1 - beta; + WT beta = std::max(sy + 1 - (cur_dy+1)*scale_y, (WT)0); + WT beta1 = 1 - beta; T* D = (T*)(dst.data + dst.step*cur_dy); if( fabs(beta) < 1e-3 ) for( dx = 0; dx < dsize.width; dx++ ) @@ -1252,8 +1253,8 @@ static void resizeArea_( const Mat& src, Mat& dst, const DecimateAlpha* xofs, in { for( dx = 0; dx <= dsize.width - 2; dx += 2 ) { - float t0 = sum[dx] + buf[dx]; - float t1 = sum[dx+1] + buf[dx+1]; + WT t0 = sum[dx] + buf[dx]; + WT t1 = sum[dx+1] + buf[dx+1]; sum[dx] = t0; sum[dx+1] = t1; buf[dx] = buf[dx+1] = 0; } @@ -1309,7 +1310,12 @@ void resize( const Mat& src, Mat& dst, Size dsize, HResizeLinearVec_32f>, VResizeLinear, VResizeLinearVec_32f> >, - 0, 0 + resizeGeneric_< + HResizeLinear, + VResizeLinear, + VResizeNoVec> >, + 0 }; static ResizeFunc cubic_tab[] = @@ -1333,7 +1339,11 @@ void resize( const Mat& src, Mat& dst, Size dsize, HResizeCubic, VResizeCubic, VResizeCubicVec_32f> >, - 0, 0 + resizeGeneric_< + HResizeCubic, + VResizeCubic, + VResizeNoVec> >, + 0 }; static ResizeFunc lanczos4_tab[] = @@ -1353,7 +1363,10 @@ void resize( const Mat& src, Mat& dst, Size dsize, resizeGeneric_, VResizeLanczos4, VResizeNoVec> >, - 0, 0 + resizeGeneric_, + VResizeLanczos4, + VResizeNoVec> >, + 0 }; static ResizeAreaFastFunc areafast_tab[] = @@ -1361,12 +1374,16 @@ void resize( const Mat& src, Mat& dst, Size dsize, resizeAreaFast_, 0, resizeAreaFast_, resizeAreaFast_, - 0, resizeAreaFast_, 0, 0 + 0, + resizeAreaFast_, + resizeAreaFast_, + 0 }; static ResizeAreaFunc area_tab[] = { - resizeArea_, 0, resizeArea_, resizeArea_, 0, resizeArea_, 0, 0 + resizeArea_, 0, resizeArea_, resizeArea_, + 0, resizeArea_, resizeArea_, 0 }; Size ssize = src.size();