\r
Mat kernel(kSize, kSize, CV_32FC1);\r
randu(kernel, -3, 10);\r
- float s = (float)fabs( sum(kernel)[0] );\r
+ float s = fabs( sum(kernel)[0] );\r
if(s > 1e-3) kernel /= s;\r
\r
declare.in(src, WARMUP_RNG).out(dst).time(20);\r
void prefix##set_##type(CVPOS pos, type* data)\
{\
ELEMENT_##type* element = ((ELEMENT_##type*)(pos.m_pos));\
- memcpy(&(element->m_data), data, sizeof(*data));\
+ memcpy(&(element->m_data), data, sizeof(data));\
}\
type* prefix##get_##type(CVPOS pos)\
{\
if( !mask )
{
len *= cn;
+ #if CV_ENABLE_UNROLLED
for( ; i <= len - 4; i += 4 )
{
AT t0, t1;
t1 = src[i+3] + dst[i+3];
dst[i+2] = t0; dst[i+3] = t1;
}
-
+ #endif
for( ; i < len; i++ )
dst[i] += src[i];
}
if( !mask )
{
len *= cn;
+ #if CV_ENABLE_UNROLLED
for( ; i <= len - 4; i += 4 )
{
AT t0, t1;
t1 = (AT)src[i+3]*src[i+3] + dst[i+3];
dst[i+2] = t0; dst[i+3] = t1;
}
-
+ #endif
for( ; i < len; i++ )
dst[i] += (AT)src[i]*src[i];
}
if( !mask )
{
len *= cn;
+ #if CV_ENABLE_UNROLLED
for( ; i <= len - 4; i += 4 )
{
AT t0, t1;
t1 = (AT)src1[i+3]*src2[i+3] + dst[i+3];
dst[i+2] = t0; dst[i+3] = t1;
}
-
+ #endif
for( ; i < len; i++ )
dst[i] += (AT)src1[i]*src2[i];
}
if( !mask )
{
len *= cn;
+ #if CV_ENABLE_UNROLLED
for( ; i <= len - 4; i += 4 )
{
AT t0, t1;
t1 = src[i+3]*a + dst[i+3]*b;
dst[i+2] = t0; dst[i+3] = t1;
}
-
+ #endif
for( ; i < len; i++ )
dst[i] = src[i]*a + dst[i]*b;
}
i = vecOp(src, dst, width, cn);
width *= cn;
-
+ #if CV_ENABLE_UNROLLED
for( ; i <= width - 4; i += 4 )
{
S = (const ST*)src + i;
D[i] = s0; D[i+1] = s1;
D[i+2] = s2; D[i+3] = s3;
}
-
+ #endif
for( ; i < width; i++ )
{
S = (const ST*)src + i;
{
DT* D = (DT*)dst;
i = vecOp(src, dst, width);
+ #if CV_ENABLE_UNROLLED
for( ; i <= width - 4; i += 4 )
{
ST f = ky[0];
D[i] = castOp(s0); D[i+1] = castOp(s1);
D[i+2] = castOp(s2); D[i+3] = castOp(s3);
}
-
+ #endif
for( ; i < width; i++ )
{
ST s0 = ky[0]*((const ST*)src[0])[i] + _delta;
{
DT* D = (DT*)dst;
i = (this->vecOp)(src, dst, width);
-
+ #if CV_ENABLE_UNROLLED
for( ; i <= width - 4; i += 4 )
{
ST f = ky[0];
D[i] = castOp(s0); D[i+1] = castOp(s1);
D[i+2] = castOp(s2); D[i+3] = castOp(s3);
}
-
+ #endif
for( ; i < width; i++ )
{
ST s0 = ky[0]*((const ST*)src[0])[i] + _delta;
{
DT* D = (DT*)dst;
i = this->vecOp(src, dst, width);
-
+ #if CV_ENABLE_UNROLLED
for( ; i <= width - 4; i += 4 )
{
ST f = ky[0];
D[i] = castOp(s0); D[i+1] = castOp(s1);
D[i+2] = castOp(s2); D[i+3] = castOp(s3);
}
-
+ #endif
for( ; i < width; i++ )
{
ST s0 = _delta;
{
if( is_1_2_1 )
{
+ #if CV_ENABLE_UNROLLED
for( ; i <= width - 4; i += 4 )
{
ST s0 = S0[i] + S1[i]*2 + S2[i] + _delta;
D[i+2] = castOp(s0);
D[i+3] = castOp(s1);
}
+ #else
+ for( ; i < width; i ++ )
+ {
+ ST s0 = S0[i] + S1[i]*2 + S2[i] + _delta;
+ D[i] = castOp(s0);
+ }
+ #endif
}
else if( is_1_m2_1 )
{
+ #if CV_ENABLE_UNROLLED
for( ; i <= width - 4; i += 4 )
{
ST s0 = S0[i] - S1[i]*2 + S2[i] + _delta;
D[i+2] = castOp(s0);
D[i+3] = castOp(s1);
}
+ #else
+ for( ; i < width; i ++ )
+ {
+ ST s0 = S0[i] - S1[i]*2 + S2[i] + _delta;
+ D[i] = castOp(s0);
+ }
+ #endif
}
else
{
+ #if CV_ENABLE_UNROLLED
for( ; i <= width - 4; i += 4 )
{
ST s0 = (S0[i] + S2[i])*f1 + S1[i]*f0 + _delta;
D[i+2] = castOp(s0);
D[i+3] = castOp(s1);
}
+ #else
+ for( ; i < width; i ++ )
+ {
+ ST s0 = (S0[i] + S2[i])*f1 + S1[i]*f0 + _delta;
+ D[i] = castOp(s0);
+ }
+ #endif
}
-
for( ; i < width; i++ )
D[i] = castOp((S0[i] + S2[i])*f1 + S1[i]*f0 + _delta);
}
{
if( f1 < 0 )
std::swap(S0, S2);
-
+ #if CV_ENABLE_UNROLLED
for( ; i <= width - 4; i += 4 )
{
ST s0 = S2[i] - S0[i] + _delta;
D[i+2] = castOp(s0);
D[i+3] = castOp(s1);
}
-
+ #else
+ for( ; i < width; i ++ )
+ {
+ ST s0 = S2[i] - S0[i] + _delta;
+ D[i] = castOp(s0);
+ }
+ #endif
if( f1 < 0 )
std::swap(S0, S2);
}
else
{
+ #if CV_ENABLE_UNROLLED
for( ; i <= width - 4; i += 4 )
{
ST s0 = (S2[i] - S0[i])*f1 + _delta;
D[i+2] = castOp(s0);
D[i+3] = castOp(s1);
}
+ #endif
}
for( ; i < width; i++ )
kp[k] = (const ST*)src[pt[k].y] + pt[k].x*cn;
i = vecOp((const uchar**)kp, dst, width);
-
+ #if CV_ENABLE_UNROLLED
for( ; i <= width - 4; i += 4 )
{
KT s0 = _delta, s1 = _delta, s2 = _delta, s3 = _delta;
D[i] = castOp(s0); D[i+1] = castOp(s1);
D[i+2] = castOp(s2); D[i+3] = castOp(s3);
}
-
+ #endif
for( ; i < width; i++ )
{
KT s0 = _delta;
if( ksize.width > 0 )
xmax = ksize.width/2;
else
- xmax = (int)std::max(fabs(nstds*sigma_x*c), fabs(nstds*sigma_y*s));
+ xmax = std::max(fabs(nstds*sigma_x*c), fabs(nstds*sigma_y*s));
if( ksize.height > 0 )
ymax = ksize.height/2;
else
- ymax = (int)std::max(fabs(nstds*sigma_x*s), fabs(nstds*sigma_y*c));
+ ymax = std::max(fabs(nstds*sigma_x*s), fabs(nstds*sigma_y*c));
xmin = -xmax;
ymin = -ymax;
(0.0 > t) || (t > 1.0) )
code = '0';
- p.x = (float)(a.x + s * ( b.x - a.x ));
- p.y = (float)(a.y + s * ( b.y - a.y ));
+ p.x = a.x + s * ( b.x - a.x );
+ p.y = a.y + s * ( b.y - a.y );
return code;
}
_p12.release();
return 0.f;
}
- area = (float)contourArea(_InputArray(result, nr), false);
+ area = contourArea(_InputArray(result, nr), false);
}
if( _p12.needed() )
VecOp vecOp;
int x = vecOp((const uchar**)src, (uchar*)dst, (const uchar*)beta, width);
+ #if CV_ENABLE_UNROLLED
for( ; x <= width - 4; x += 4 )
{
WT t0, t1;
t1 = S0[x+3]*b0 + S1[x+3]*b1;
dst[x+2] = castOp(t0); dst[x+3] = castOp(t1);
}
-
+ #endif
for( ; x < width; x++ )
dst[x] = castOp(S0[x]*b0 + S1[x]*b1);
}
CastOp castOp;
VecOp vecOp;
int k, x = vecOp((const uchar**)src, (uchar*)dst, (const uchar*)beta, width);
-
+ #if CV_ENABLE_UNROLLED
for( ; x <= width - 4; x += 4 )
{
WT b = beta[0];
dst[x] = castOp(s0); dst[x+1] = castOp(s1);
dst[x+2] = castOp(s2); dst[x+3] = castOp(s3);
}
-
+ #endif
for( ; x < width; x++ )
{
dst[x] = castOp(src[0][x]*beta[0] + src[1][x]*beta[1] +
{
const T* S = (const T*)(src.data + src.step*sy0) + xofs[dx];
WT sum = 0;
- for( k = 0; k <= area - 4; k += 4 )
+ 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
for( ; k < area; k++ )
sum += S[ofs[k]];
for( ; _ksize > 1 && count > 1; count -= 2, D += dststep*2, src += 2 )
{
- for( i = i0; i <= width - 4; i += 4 )
+ i = i0;
+ #if CV_ENABLE_UNROLLED
+ for( ; i <= width - 4; i += 4 )
{
const T* sptr = src[1] + i;
T s0 = sptr[0], s1 = sptr[1], s2 = sptr[2], s3 = sptr[3];
D[i+dststep+2] = op(s2, sptr[2]);
D[i+dststep+3] = op(s3, sptr[3]);
}
-
+ #endif
for( ; i < width; i++ )
{
T s0 = src[1][i];
for( ; count > 0; count--, D += dststep, src++ )
{
- for( i = i0; i <= width - 4; i += 4 )
+ i = i0;
+ #if CV_ENABLE_UNROLLED
+ for( ; i <= width - 4; i += 4 )
{
const T* sptr = src[0] + i;
T s0 = sptr[0], s1 = sptr[1], s2 = sptr[2], s3 = sptr[3];
D[i] = s0; D[i+1] = s1;
D[i+2] = s2; D[i+3] = s3;
}
-
+ #endif
for( ; i < width; i++ )
{
T s0 = src[0][i];
kp[k] = (const T*)src[pt[k].y] + pt[k].x*cn;
i = vecOp(&ptrs[0], nz, dst, width);
-
+ #if CV_ENABLE_UNROLLED
for( ; i <= width - 4; i += 4 )
{
const T* sptr = kp[0] + i;
D[i] = s0; D[i+1] = s1;
D[i+2] = s2; D[i+3] = s3;
}
-
+ #endif
for( ; i < width; i++ )
{
T s0 = kp[0][i];
{
int row0 = min(cvRound(range.begin() * src.rows / nStripes), src.rows);
int row1 = min(cvRound(range.end() * src.rows / nStripes), src.rows);
-
- //printf("Size = (%d, %d), range[%d,%d), row0 = %d, row1 = %d\n", src.rows, src.cols, range.begin(), range.end(), row0, row1);
+
+ if(0)
+ printf("Size = (%d, %d), range[%d,%d), row0 = %d, row1 = %d\n",
+ src.rows, src.cols, range.begin(), range.end(), row0, row1);
Mat srcStripe = src.rowRange(row0, row1);
Mat dstStripe = dst.rowRange(row0, row1);
Point anchor;
int rowBorderType;
int columnBorderType;
- Scalar borderValue;
+ const Scalar& borderValue;
};
static void morphOp( int op, InputArray _src, OutputArray _dst,
{
int row_count = 0;
x = minx;
+ #if CV_ENABLE_UNROLLED
for( ; x + 3 <= maxx; x += 4, ptr += 12 )
{
int t0 = ptr[0], t1 = ptr[1], t2 = ptr[2];
sx += x+3; row_count++;
}
}
-
+ #endif
for( ; x <= maxx; x++, ptr += 3 )
{
int t0 = ptr[0], t1 = ptr[1], t2 = ptr[2];
{
const uchar* src = (const uchar*)(_src.data + _src.step*i);
uchar* dst = (uchar*)(_dst.data + _dst.step*i);
-
- for( j = j_scalar; j <= roi.width - 4; j += 4 )
+ j = j_scalar;
+ #if CV_ENABLE_UNROLLED
+ for( ; j <= roi.width - 4; j += 4 )
{
uchar t0 = tab[src[j]];
uchar t1 = tab[src[j+1]];
dst[j+2] = t0;
dst[j+3] = t1;
}
-
+ #endif
for( ; j < roi.width; j++ )
dst[j] = tab[src[j]];
}
for( i = 0; i < size.height; i++ )
{
const uchar* src = _src.data + _src.step*i;
- for( j = 0; j <= size.width - 4; j += 4 )
+ j = 0;
+ #if CV_ENABLE_UNROLLED
+ for( ; j <= size.width - 4; j += 4 )
{
int v0 = src[j], v1 = src[j+1];
h[v0]++; h[v1]++;
v0 = src[j+2]; v1 = src[j+3];
h[v0]++; h[v1]++;
}
+ #endif
for( ; j < size.width; j++ )
h[src[j]]++;
}
{
int row0 = std::min(cvRound(range.begin() * src.rows / nStripes), src.rows);
int row1 = std::min(cvRound(range.end() * src.rows / nStripes), src.rows);
-
- //printf("Size = (%d, %d), range[%d,%d), row0 = %d, row1 = %d\n", src.rows, src.cols, range.begin(), range.end(), row0, row1);
+
+ if(0)
+ printf("Size = (%d, %d), range[%d,%d), row0 = %d, row1 = %d\n",
+ src.rows, src.cols, range.begin(), range.end(), row0, row1);
Mat srcStripe = src.rowRange(row0, row1);
Mat dstStripe = dst.rowRange(row0, row1);