1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-31 08:13:04 +04:00

Merge remote-tracking branch 'upstream/3.4' into merge-3.4

This commit is contained in:
Alexander Alekhin
2020-02-04 19:49:24 +03:00
14 changed files with 577 additions and 611 deletions
+18 -17
View File
@@ -1446,7 +1446,7 @@ equal to sigmaX, if both sigmas are zeros, they are computed from ksize.width an
respectively (see #getGaussianKernel for details); to fully control the result regardless of
possible future modifications of all this semantics, it is recommended to specify all of ksize,
sigmaX, and sigmaY.
@param borderType pixel extrapolation method, see #BorderTypes
@param borderType pixel extrapolation method, see #BorderTypes. #BORDER_WRAP is not supported.
@sa sepFilter2D, filter2D, blur, boxFilter, bilateralFilter, medianBlur
*/
@@ -1507,7 +1507,7 @@ algorithms, and so on). If you need to compute pixel sums over variable-size win
@param anchor anchor point; default value Point(-1,-1) means that the anchor is at the kernel
center.
@param normalize flag, specifying whether the kernel is normalized by its area or not.
@param borderType border mode used to extrapolate pixels outside of the image, see #BorderTypes
@param borderType border mode used to extrapolate pixels outside of the image, see #BorderTypes. #BORDER_WRAP is not supported.
@sa blur, bilateralFilter, GaussianBlur, medianBlur, integral
*/
CV_EXPORTS_W void boxFilter( InputArray src, OutputArray dst, int ddepth,
@@ -1530,7 +1530,7 @@ variance and standard deviation around the neighborhood of a pixel.
@param anchor kernel anchor point. The default value of Point(-1, -1) denotes that the anchor is at the kernel
center.
@param normalize flag, specifying whether the kernel is to be normalized by it's area or not.
@param borderType border mode used to extrapolate pixels outside of the image, see #BorderTypes
@param borderType border mode used to extrapolate pixels outside of the image, see #BorderTypes. #BORDER_WRAP is not supported.
@sa boxFilter
*/
CV_EXPORTS_W void sqrBoxFilter( InputArray src, OutputArray dst, int ddepth,
@@ -1553,7 +1553,7 @@ the depth should be CV_8U, CV_16U, CV_16S, CV_32F or CV_64F.
@param ksize blurring kernel size.
@param anchor anchor point; default value Point(-1,-1) means that the anchor is at the kernel
center.
@param borderType border mode used to extrapolate pixels outside of the image, see #BorderTypes
@param borderType border mode used to extrapolate pixels outside of the image, see #BorderTypes. #BORDER_WRAP is not supported.
@sa boxFilter, bilateralFilter, GaussianBlur, medianBlur
*/
CV_EXPORTS_W void blur( InputArray src, OutputArray dst,
@@ -1587,7 +1587,7 @@ separate color planes using split and process them individually.
the kernel; the anchor should lie within the kernel; default value (-1,-1) means that the anchor
is at the kernel center.
@param delta optional value added to the filtered pixels before storing them in dst.
@param borderType pixel extrapolation method, see #BorderTypes
@param borderType pixel extrapolation method, see #BorderTypes. #BORDER_WRAP is not supported.
@sa sepFilter2D, dft, matchTemplate
*/
CV_EXPORTS_W void filter2D( InputArray src, OutputArray dst, int ddepth,
@@ -1608,7 +1608,7 @@ kernel kernelY. The final result shifted by delta is stored in dst .
@param anchor Anchor position within the kernel. The default value \f$(-1,-1)\f$ means that the anchor
is at the kernel center.
@param delta Value added to the filtered results before storing them.
@param borderType Pixel extrapolation method, see #BorderTypes
@param borderType Pixel extrapolation method, see #BorderTypes. #BORDER_WRAP is not supported.
@sa filter2D, Sobel, GaussianBlur, boxFilter, blur
*/
CV_EXPORTS_W void sepFilter2D( InputArray src, OutputArray dst, int ddepth,
@@ -1661,7 +1661,7 @@ The second case corresponds to a kernel of:
@param scale optional scale factor for the computed derivative values; by default, no scaling is
applied (see #getDerivKernels for details).
@param delta optional delta value that is added to the results prior to storing them in dst.
@param borderType pixel extrapolation method, see #BorderTypes
@param borderType pixel extrapolation method, see #BorderTypes. #BORDER_WRAP is not supported.
@sa Scharr, Laplacian, sepFilter2D, filter2D, GaussianBlur, cartToPolar
*/
CV_EXPORTS_W void Sobel( InputArray src, OutputArray dst, int ddepth,
@@ -1682,7 +1682,8 @@ Sobel( src, dy, CV_16SC1, 0, 1, 3 );
@param dx output image with first-order derivative in x.
@param dy output image with first-order derivative in y.
@param ksize size of Sobel kernel. It must be 3.
@param borderType pixel extrapolation method, see #BorderTypes
@param borderType pixel extrapolation method, see #BorderTypes.
Only #BORDER_DEFAULT=#BORDER_REFLECT_101 and #BORDER_REPLICATE are supported.
@sa Sobel
*/
@@ -1710,7 +1711,7 @@ is equivalent to
@param scale optional scale factor for the computed derivative values; by default, no scaling is
applied (see #getDerivKernels for details).
@param delta optional delta value that is added to the results prior to storing them in dst.
@param borderType pixel extrapolation method, see #BorderTypes
@param borderType pixel extrapolation method, see #BorderTypes. #BORDER_WRAP is not supported.
@sa cartToPolar
*/
CV_EXPORTS_W void Scharr( InputArray src, OutputArray dst, int ddepth,
@@ -1741,7 +1742,7 @@ details. The size must be positive and odd.
@param scale Optional scale factor for the computed Laplacian values. By default, no scaling is
applied. See #getDerivKernels for details.
@param delta Optional delta value that is added to the results prior to storing them in dst .
@param borderType Pixel extrapolation method, see #BorderTypes
@param borderType Pixel extrapolation method, see #BorderTypes. #BORDER_WRAP is not supported.
@sa Sobel, Scharr
*/
CV_EXPORTS_W void Laplacian( InputArray src, OutputArray dst, int ddepth,
@@ -1810,7 +1811,7 @@ of the formulae in the cornerEigenValsAndVecs description.
src .
@param blockSize Neighborhood size (see the details on #cornerEigenValsAndVecs ).
@param ksize Aperture parameter for the Sobel operator.
@param borderType Pixel extrapolation method. See #BorderTypes.
@param borderType Pixel extrapolation method. See #BorderTypes. #BORDER_WRAP is not supported.
*/
CV_EXPORTS_W void cornerMinEigenVal( InputArray src, OutputArray dst,
int blockSize, int ksize = 3,
@@ -1833,7 +1834,7 @@ size as src .
@param blockSize Neighborhood size (see the details on #cornerEigenValsAndVecs ).
@param ksize Aperture parameter for the Sobel operator.
@param k Harris detector free parameter. See the formula above.
@param borderType Pixel extrapolation method. See #BorderTypes.
@param borderType Pixel extrapolation method. See #BorderTypes. #BORDER_WRAP is not supported.
*/
CV_EXPORTS_W void cornerHarris( InputArray src, OutputArray dst, int blockSize,
int ksize, double k,
@@ -1861,7 +1862,7 @@ The output of the function can be used for robust edge or corner detection.
@param dst Image to store the results. It has the same size as src and the type CV_32FC(6) .
@param blockSize Neighborhood size (see details below).
@param ksize Aperture parameter for the Sobel operator.
@param borderType Pixel extrapolation method. See #BorderTypes.
@param borderType Pixel extrapolation method. See #BorderTypes. #BORDER_WRAP is not supported.
@sa cornerMinEigenVal, cornerHarris, preCornerDetect
*/
@@ -1890,7 +1891,7 @@ The corners can be found as local maximums of the functions, as shown below:
@param src Source single-channel 8-bit of floating-point image.
@param dst Output image that has the type CV_32F and the same size as src .
@param ksize %Aperture size of the Sobel .
@param borderType Pixel extrapolation method. See #BorderTypes.
@param borderType Pixel extrapolation method. See #BorderTypes. #BORDER_WRAP is not supported.
*/
CV_EXPORTS_W void preCornerDetect( InputArray src, OutputArray dst, int ksize,
int borderType = BORDER_DEFAULT );
@@ -2154,7 +2155,7 @@ structuring element is used. Kernel can be created using #getStructuringElement.
@param anchor position of the anchor within the element; default value (-1, -1) means that the
anchor is at the element center.
@param iterations number of times erosion is applied.
@param borderType pixel extrapolation method, see #BorderTypes
@param borderType pixel extrapolation method, see #BorderTypes. #BORDER_WRAP is not supported.
@param borderValue border value in case of a constant border
@sa dilate, morphologyEx, getStructuringElement
*/
@@ -2186,7 +2187,7 @@ structuring element is used. Kernel can be created using #getStructuringElement
@param anchor position of the anchor within the element; default value (-1, -1) means that the
anchor is at the element center.
@param iterations number of times dilation is applied.
@param borderType pixel extrapolation method, see #BorderTypes
@param borderType pixel extrapolation method, see #BorderTypes. #BORDER_WRAP is not suported.
@param borderValue border value in case of a constant border
@sa erode, morphologyEx, getStructuringElement
*/
@@ -2211,7 +2212,7 @@ CV_8U, CV_16U, CV_16S, CV_32F or CV_64F.
@param anchor Anchor position with the kernel. Negative values mean that the anchor is at the
kernel center.
@param iterations Number of times erosion and dilation are applied.
@param borderType Pixel extrapolation method, see #BorderTypes
@param borderType Pixel extrapolation method, see #BorderTypes. #BORDER_WRAP is not supported.
@param borderValue Border value in case of a constant border. The default value has a special
meaning.
@sa dilate, erode, getStructuringElement
+83 -112
View File
@@ -308,7 +308,7 @@ LineAA( Mat& img, Point2l pt1, Point2l pt2, const void* color )
int nch = img.channels();
uchar* ptr = img.ptr();
size_t step = img.step;
Size2l size(img.size());
Size2l size0(img.size()), size = size0;
if( !((nch == 1 || nch == 3 || nch == 4) && img.depth() == CV_8U) )
{
@@ -316,15 +316,8 @@ LineAA( Mat& img, Point2l pt1, Point2l pt2, const void* color )
return;
}
pt1.x -= XY_ONE*2;
pt1.y -= XY_ONE*2;
pt2.x -= XY_ONE*2;
pt2.y -= XY_ONE*2;
ptr += img.step*2 + 2*nch;
size.width = ((size.width - 5) << XY_SHIFT) + 1;
size.height = ((size.height - 5) << XY_SHIFT) + 1;
size.width <<= XY_SHIFT;
size.height <<= XY_SHIFT;
if( !clipLine( size, pt1, pt2 ))
return;
@@ -403,171 +396,160 @@ LineAA( Mat& img, Point2l pt1, Point2l pt2, const void* color )
if( nch == 3 )
{
#define ICV_PUT_POINT() \
#define ICV_PUT_POINT(x, y) \
{ \
uchar* tptr = ptr + (x)*3 + (y)*step; \
_cb = tptr[0]; \
_cb += ((cb - _cb)*a + 127)>> 8;\
_cb += ((cb - _cb)*a + 127)>> 8;\
_cg = tptr[1]; \
_cg += ((cg - _cg)*a + 127)>> 8;\
_cg += ((cg - _cg)*a + 127)>> 8;\
_cr = tptr[2]; \
_cr += ((cr - _cr)*a + 127)>> 8;\
_cr += ((cr - _cr)*a + 127)>> 8;\
tptr[0] = (uchar)_cb; \
tptr[1] = (uchar)_cg; \
tptr[2] = (uchar)_cr; \
}
if( ax > ay )
{
ptr += (pt1.x >> XY_SHIFT) * 3;
int x = (int)(pt1.x >> XY_SHIFT);
while( ecount >= 0 )
for( ; ecount >= 0; x++, pt1.y += y_step, scount++, ecount-- )
{
uchar *tptr = ptr + ((pt1.y >> XY_SHIFT) - 1) * step;
if( (unsigned)x >= (unsigned)size0.width )
continue;
int y = (int)((pt1.y >> XY_SHIFT) - 1);
int ep_corr = ep_table[(((scount >= 2) + 1) & (scount | 2)) * 3 +
(((ecount >= 2) + 1) & (ecount | 2))];
int a, dist = (pt1.y >> (XY_SHIFT - 5)) & 31;
a = (ep_corr * FilterTable[dist + 32] >> 8) & 0xff;
ICV_PUT_POINT();
ICV_PUT_POINT();
if( (unsigned)y < (unsigned)size0.height )
ICV_PUT_POINT(x, y)
tptr += step;
a = (ep_corr * FilterTable[dist] >> 8) & 0xff;
ICV_PUT_POINT();
ICV_PUT_POINT();
if( (unsigned)(y+1) < (unsigned)size0.height )
ICV_PUT_POINT(x, y+1)
tptr += step;
a = (ep_corr * FilterTable[63 - dist] >> 8) & 0xff;
ICV_PUT_POINT();
ICV_PUT_POINT();
pt1.y += y_step;
ptr += 3;
scount++;
ecount--;
if( (unsigned)(y+2) < (unsigned)size0.height )
ICV_PUT_POINT(x, y+2)
}
}
else
{
ptr += (pt1.y >> XY_SHIFT) * step;
int y = (int)(pt1.y >> XY_SHIFT);
while( ecount >= 0 )
for( ; ecount >= 0; y++, pt1.x += x_step, scount++, ecount-- )
{
uchar *tptr = ptr + ((pt1.x >> XY_SHIFT) - 1) * 3;
if( (unsigned)y >= (unsigned)size0.height )
continue;
int x = (int)((pt1.x >> XY_SHIFT) - 1);
int ep_corr = ep_table[(((scount >= 2) + 1) & (scount | 2)) * 3 +
(((ecount >= 2) + 1) & (ecount | 2))];
int a, dist = (pt1.x >> (XY_SHIFT - 5)) & 31;
a = (ep_corr * FilterTable[dist + 32] >> 8) & 0xff;
ICV_PUT_POINT();
ICV_PUT_POINT();
if( (unsigned)x < (unsigned)size0.width )
ICV_PUT_POINT(x, y)
tptr += 3;
a = (ep_corr * FilterTable[dist] >> 8) & 0xff;
ICV_PUT_POINT();
ICV_PUT_POINT();
if( (unsigned)(x+1) < (unsigned)size0.width )
ICV_PUT_POINT(x+1, y)
tptr += 3;
a = (ep_corr * FilterTable[63 - dist] >> 8) & 0xff;
ICV_PUT_POINT();
ICV_PUT_POINT();
pt1.x += x_step;
ptr += step;
scount++;
ecount--;
if( (unsigned)(x+2) < (unsigned)size0.width )
ICV_PUT_POINT(x+2, y)
}
}
#undef ICV_PUT_POINT
}
else if(nch == 1)
{
#define ICV_PUT_POINT() \
#define ICV_PUT_POINT(x, y) \
{ \
uchar* tptr = ptr + (x) + (y) * step; \
_cb = tptr[0]; \
_cb += ((cb - _cb)*a + 127)>> 8;\
_cb += ((cb - _cb)*a + 127)>> 8;\
tptr[0] = (uchar)_cb; \
}
if( ax > ay )
{
ptr += (pt1.x >> XY_SHIFT);
int x = (int)(pt1.x >> XY_SHIFT);
while( ecount >= 0 )
for( ; ecount >= 0; x++, pt1.y += y_step, scount++, ecount-- )
{
uchar *tptr = ptr + ((pt1.y >> XY_SHIFT) - 1) * step;
if( (unsigned)x >= (unsigned)size0.width )
continue;
int y = (int)((pt1.y >> XY_SHIFT) - 1);
int ep_corr = ep_table[(((scount >= 2) + 1) & (scount | 2)) * 3 +
(((ecount >= 2) + 1) & (ecount | 2))];
int a, dist = (pt1.y >> (XY_SHIFT - 5)) & 31;
a = (ep_corr * FilterTable[dist + 32] >> 8) & 0xff;
ICV_PUT_POINT();
ICV_PUT_POINT();
if( (unsigned)y < (unsigned)size0.height )
ICV_PUT_POINT(x, y)
tptr += step;
a = (ep_corr * FilterTable[dist] >> 8) & 0xff;
ICV_PUT_POINT();
ICV_PUT_POINT();
if( (unsigned)(y+1) < (unsigned)size0.height )
ICV_PUT_POINT(x, y+1)
tptr += step;
a = (ep_corr * FilterTable[63 - dist] >> 8) & 0xff;
ICV_PUT_POINT();
ICV_PUT_POINT();
pt1.y += y_step;
ptr++;
scount++;
ecount--;
if( (unsigned)(y+2) < (unsigned)size0.height )
ICV_PUT_POINT(x, y+2)
}
}
else
{
ptr += (pt1.y >> XY_SHIFT) * step;
int y = (int)(pt1.y >> XY_SHIFT);
while( ecount >= 0 )
for( ; ecount >= 0; y++, pt1.x += x_step, scount++, ecount-- )
{
uchar *tptr = ptr + ((pt1.x >> XY_SHIFT) - 1);
if( (unsigned)y >= (unsigned)size0.height )
continue;
int x = (int)((pt1.x >> XY_SHIFT) - 1);
int ep_corr = ep_table[(((scount >= 2) + 1) & (scount | 2)) * 3 +
(((ecount >= 2) + 1) & (ecount | 2))];
int a, dist = (pt1.x >> (XY_SHIFT - 5)) & 31;
a = (ep_corr * FilterTable[dist + 32] >> 8) & 0xff;
ICV_PUT_POINT();
ICV_PUT_POINT();
if( (unsigned)x < (unsigned)size0.width )
ICV_PUT_POINT(x, y)
tptr++;
a = (ep_corr * FilterTable[dist] >> 8) & 0xff;
ICV_PUT_POINT();
ICV_PUT_POINT();
if( (unsigned)(x+1) < (unsigned)size0.width )
ICV_PUT_POINT(x+1, y)
tptr++;
a = (ep_corr * FilterTable[63 - dist] >> 8) & 0xff;
ICV_PUT_POINT();
ICV_PUT_POINT();
pt1.x += x_step;
ptr += step;
scount++;
ecount--;
if( (unsigned)(x+2) < (unsigned)size0.width )
ICV_PUT_POINT(x+2, y)
}
}
#undef ICV_PUT_POINT
}
else
{
#define ICV_PUT_POINT() \
#define ICV_PUT_POINT(x, y) \
{ \
uchar* tptr = ptr + (x)*4 + (y)*step; \
_cb = tptr[0]; \
_cb += ((cb - _cb)*a + 127)>> 8;\
_cb += ((cb - _cb)*a + 127)>> 8;\
_cg = tptr[1]; \
_cg += ((cg - _cg)*a + 127)>> 8;\
_cg += ((cg - _cg)*a + 127)>> 8;\
_cr = tptr[2]; \
_cr += ((cr - _cr)*a + 127)>> 8;\
_cr += ((cr - _cr)*a + 127)>> 8;\
_ca = tptr[3]; \
_ca += ((ca - _ca)*a + 127)>> 8;\
_ca += ((ca - _ca)*a + 127)>> 8;\
tptr[0] = (uchar)_cb; \
tptr[1] = (uchar)_cg; \
tptr[2] = (uchar)_cr; \
@@ -575,66 +557,55 @@ LineAA( Mat& img, Point2l pt1, Point2l pt2, const void* color )
}
if( ax > ay )
{
ptr += (pt1.x >> XY_SHIFT) * 4;
int x = (int)(pt1.x >> XY_SHIFT);
while( ecount >= 0 )
for( ; ecount >= 0; x++, pt1.y += y_step, scount++, ecount-- )
{
uchar *tptr = ptr + ((pt1.y >> XY_SHIFT) - 1) * step;
if( (unsigned)x >= (unsigned)size0.width )
continue;
int y = (int)((pt1.y >> XY_SHIFT) - 1);
int ep_corr = ep_table[(((scount >= 2) + 1) & (scount | 2)) * 3 +
(((ecount >= 2) + 1) & (ecount | 2))];
int a, dist = (pt1.y >> (XY_SHIFT - 5)) & 31;
a = (ep_corr * FilterTable[dist + 32] >> 8) & 0xff;
ICV_PUT_POINT();
ICV_PUT_POINT();
if( (unsigned)y < (unsigned)size0.height )
ICV_PUT_POINT(x, y)
tptr += step;
a = (ep_corr * FilterTable[dist] >> 8) & 0xff;
ICV_PUT_POINT();
ICV_PUT_POINT();
if( (unsigned)(y+1) < (unsigned)size0.height )
ICV_PUT_POINT(x, y+1)
tptr += step;
a = (ep_corr * FilterTable[63 - dist] >> 8) & 0xff;
ICV_PUT_POINT();
ICV_PUT_POINT();
pt1.y += y_step;
ptr += 4;
scount++;
ecount--;
if( (unsigned)(y+2) < (unsigned)size0.height )
ICV_PUT_POINT(x, y+2)
}
}
else
{
ptr += (pt1.y >> XY_SHIFT) * step;
int y = (int)(pt1.y >> XY_SHIFT);
while( ecount >= 0 )
for( ; ecount >= 0; y++, pt1.x += x_step, scount++, ecount-- )
{
uchar *tptr = ptr + ((pt1.x >> XY_SHIFT) - 1) * 4;
if( (unsigned)y >= (unsigned)size0.height )
continue;
int x = (int)((pt1.x >> XY_SHIFT) - 1);
int ep_corr = ep_table[(((scount >= 2) + 1) & (scount | 2)) * 3 +
(((ecount >= 2) + 1) & (ecount | 2))];
int a, dist = (pt1.x >> (XY_SHIFT - 5)) & 31;
a = (ep_corr * FilterTable[dist + 32] >> 8) & 0xff;
ICV_PUT_POINT();
ICV_PUT_POINT();
if( (unsigned)x < (unsigned)size0.width )
ICV_PUT_POINT(x, y)
tptr += 4;
a = (ep_corr * FilterTable[dist] >> 8) & 0xff;
ICV_PUT_POINT();
ICV_PUT_POINT();
if( (unsigned)(x+1) < (unsigned)size0.width )
ICV_PUT_POINT(x+1, y)
tptr += 4;
a = (ep_corr * FilterTable[63 - dist] >> 8) & 0xff;
ICV_PUT_POINT();
ICV_PUT_POINT();
pt1.x += x_step;
ptr += step;
scount++;
ecount--;
if( (unsigned)(x+2) < (unsigned)size0.width )
ICV_PUT_POINT(x+2, y)
}
}
#undef ICV_PUT_POINT
+1 -85
View File
@@ -1674,93 +1674,9 @@ struct HResizeLinearVecU8_X4
}
}
}
else if(cn < 9)
{
const int step = 8;
const int len0 = xmax & -step;
for( ; k <= (count - 2); k+=2 )
{
const uchar *S0 = src[k];
int *D0 = dst[k];
const uchar *S1 = src[k+1];
int *D1 = dst[k+1];
for( dx = 0; dx < len0; dx += cn )
{
v_int16x8 a0 = v_load(alpha+dx*2);
v_int16x8 a1 = v_load(alpha+dx*2 + 8);
v_uint16x8 s0, s1;
v_zip(v_load_expand(S0+xofs[dx]), v_load_expand(S0+xofs[dx]+cn), s0, s1);
v_store(&D0[dx], v_dotprod(v_reinterpret_as_s16(s0), a0));
v_store(&D0[dx+4], v_dotprod(v_reinterpret_as_s16(s1), a1));
v_zip(v_load_expand(S1+xofs[dx]), v_load_expand(S1+xofs[dx]+cn), s0, s1);
v_store(&D1[dx], v_dotprod(v_reinterpret_as_s16(s0), a0));
v_store(&D1[dx+4], v_dotprod(v_reinterpret_as_s16(s1), a1));
}
}
for( ; k < count; k++ )
{
const uchar *S = src[k];
int *D = dst[k];
for( dx = 0; dx < len0; dx += cn )
{
v_int16x8 a0 = v_load(alpha+dx*2);
v_int16x8 a1 = v_load(alpha+dx*2 + 8);
v_uint16x8 s0, s1;
v_zip(v_load_expand(S+xofs[dx]), v_load_expand(S+xofs[dx]+cn), s0, s1);
v_store(&D[dx], v_dotprod(v_reinterpret_as_s16(s0), a0));
v_store(&D[dx+4], v_dotprod(v_reinterpret_as_s16(s1), a1));
}
}
}
else
{
const int step = 16;
const int len0 = (xmax - cn) & -step;
for( ; k <= (count - 2); k+=2 )
{
const uchar *S0 = src[k];
int *D0 = dst[k];
const uchar *S1 = src[k+1];
int *D1 = dst[k+1];
for( dx = 0; dx < len0; dx += step )
{
v_int16x8 a0 = v_load(alpha+dx*2);
v_int16x8 a1 = v_load(alpha+dx*2 + 8);
v_int16x8 a2 = v_load(alpha+dx*2 + 16);
v_int16x8 a3 = v_load(alpha+dx*2 + 24);
v_uint8x16 s01, s23;
v_zip(v_lut(S0, xofs+dx), v_lut(S0+cn, xofs+dx), s01, s23);
v_store(&D0[dx], v_dotprod(v_reinterpret_as_s16(v_expand_low(s01)), a0));
v_store(&D0[dx+4], v_dotprod(v_reinterpret_as_s16(v_expand_high(s01)), a1));
v_store(&D0[dx+8], v_dotprod(v_reinterpret_as_s16(v_expand_low(s23)), a2));
v_store(&D0[dx+12], v_dotprod(v_reinterpret_as_s16(v_expand_high(s23)), a3));
v_zip(v_lut(S1, xofs+dx), v_lut(S1+cn, xofs+dx), s01, s23);
v_store(&D1[dx], v_dotprod(v_reinterpret_as_s16(v_expand_low(s01)), a0));
v_store(&D1[dx+4], v_dotprod(v_reinterpret_as_s16(v_expand_high(s01)), a1));
v_store(&D1[dx+8], v_dotprod(v_reinterpret_as_s16(v_expand_low(s23)), a2));
v_store(&D1[dx+12], v_dotprod(v_reinterpret_as_s16(v_expand_high(s23)), a3));
}
}
for( ; k < count; k++ )
{
const uchar *S = src[k];
int *D = dst[k];
for( dx = 0; dx < len0; dx += step )
{
v_int16x8 a0 = v_load(alpha+dx*2);
v_int16x8 a1 = v_load(alpha+dx*2 + 8);
v_int16x8 a2 = v_load(alpha+dx*2 + 16);
v_int16x8 a3 = v_load(alpha+dx*2 + 24);
v_uint8x16 s01, s23;
v_zip(v_lut(S, xofs+dx), v_lut(S+cn, xofs+dx), s01, s23);
v_store(&D[dx], v_dotprod(v_reinterpret_as_s16(v_expand_low(s01)), a0));
v_store(&D[dx+4], v_dotprod(v_reinterpret_as_s16(v_expand_high(s01)), a1));
v_store(&D[dx+8], v_dotprod(v_reinterpret_as_s16(v_expand_low(s23)), a2));
v_store(&D[dx+12], v_dotprod(v_reinterpret_as_s16(v_expand_high(s23)), a3));
}
}
return 0; // images with channels >4 are out of optimization scope
}
return dx;
}
+10
View File
@@ -583,4 +583,14 @@ TEST(Drawing, line)
ASSERT_THROW(line(mat, Point(1,1),Point(99,99),Scalar(255),0), cv::Exception);
}
TEST(Drawing, regression_16308)
{
Mat_<uchar> img(Size(100, 100), (uchar)0);
circle(img, Point(50, 50), 50, 255, 1, LINE_AA);
EXPECT_NE(0, (int)img.at<uchar>(0, 50));
EXPECT_NE(0, (int)img.at<uchar>(50, 0));
EXPECT_NE(0, (int)img.at<uchar>(50, 99));
EXPECT_NE(0, (int)img.at<uchar>(99, 50));
}
}} // namespace