|
|
|
@ -2635,9 +2635,9 @@ struct SymmColumnSmallFilter : public SymmColumnFilter<CastOp, VecOp> |
|
|
|
|
const ST* ky = (const ST*)this->kernel.data + ksize2; |
|
|
|
|
int i; |
|
|
|
|
bool symmetrical = (this->symmetryType & KERNEL_SYMMETRICAL) != 0; |
|
|
|
|
bool is_1_2_1 = ky[0] == 1 && ky[1] == 2; |
|
|
|
|
bool is_1_m2_1 = ky[0] == 1 && ky[1] == -2; |
|
|
|
|
bool is_m1_0_1 = ky[1] == 1 || ky[1] == -1; |
|
|
|
|
bool is_1_2_1 = ky[0] == 2 && ky[1] == 1; |
|
|
|
|
bool is_1_m2_1 = ky[0] == -2 && ky[1] == 1; |
|
|
|
|
bool is_m1_0_1 = (ky[1] == 1 || ky[1] == -1) && ky[1] == -ky[-1] && ky[0] == 0; |
|
|
|
|
ST f0 = ky[0], f1 = ky[1]; |
|
|
|
|
ST _delta = this->delta; |
|
|
|
|
CastOp castOp = this->castOp0; |
|
|
|
@ -2668,13 +2668,12 @@ struct SymmColumnSmallFilter : public SymmColumnFilter<CastOp, VecOp> |
|
|
|
|
D[i+2] = castOp(s0); |
|
|
|
|
D[i+3] = castOp(s1); |
|
|
|
|
} |
|
|
|
|
#else |
|
|
|
|
#endif |
|
|
|
|
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 ) |
|
|
|
|
{ |
|
|
|
@ -2691,13 +2690,12 @@ struct SymmColumnSmallFilter : public SymmColumnFilter<CastOp, VecOp> |
|
|
|
|
D[i+2] = castOp(s0); |
|
|
|
|
D[i+3] = castOp(s1); |
|
|
|
|
} |
|
|
|
|
#else |
|
|
|
|
#endif |
|
|
|
|
for( ; i < width; i ++ ) |
|
|
|
|
{ |
|
|
|
|
ST s0 = S0[i] - S1[i]*2 + S2[i] + _delta; |
|
|
|
|
D[i] = castOp(s0); |
|
|
|
|
} |
|
|
|
|
#endif |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
@ -2714,13 +2712,12 @@ struct SymmColumnSmallFilter : public SymmColumnFilter<CastOp, VecOp> |
|
|
|
|
D[i+2] = castOp(s0); |
|
|
|
|
D[i+3] = castOp(s1); |
|
|
|
|
} |
|
|
|
|
#else |
|
|
|
|
#endif |
|
|
|
|
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); |
|
|
|
@ -2744,17 +2741,14 @@ struct SymmColumnSmallFilter : public SymmColumnFilter<CastOp, VecOp> |
|
|
|
|
D[i+2] = castOp(s0); |
|
|
|
|
D[i+3] = castOp(s1); |
|
|
|
|
} |
|
|
|
|
#else |
|
|
|
|
#endif |
|
|
|
|
for( ; i < width; i ++ ) |
|
|
|
|
{ |
|
|
|
|
ST s0 = S2[i] - S0[i] + _delta; |
|
|
|
|
D[i] = castOp(s0); |
|
|
|
|
} |
|
|
|
|
#endif |
|
|
|
|
if( f1 < 0 ) |
|
|
|
|
std::swap(S0, S2); |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
else if( ky[0] == 0 ) |
|
|
|
|
{ |
|
|
|
|
#if CV_ENABLE_UNROLLED |
|
|
|
|
for( ; i <= width - 4; i += 4 ) |
|
|
|
@ -2770,10 +2764,29 @@ struct SymmColumnSmallFilter : public SymmColumnFilter<CastOp, VecOp> |
|
|
|
|
D[i+3] = castOp(s1); |
|
|
|
|
} |
|
|
|
|
#endif |
|
|
|
|
for( ; i < width; i++ ) |
|
|
|
|
D[i] = castOp((S2[i] - S0[i])*f1 + _delta); |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
#if CV_ENABLE_UNROLLED |
|
|
|
|
for( ; i <= width - 4; i += 4 ) |
|
|
|
|
{ |
|
|
|
|
ST s0 = (S2[i] - S0[i])*f1 + S1[i]*f0 + _delta; |
|
|
|
|
ST s1 = (S2[i+1] - S0[i+1])*f1 + S1[i+1]*f0 + _delta; |
|
|
|
|
D[i] = castOp(s0); |
|
|
|
|
D[i+1] = castOp(s1); |
|
|
|
|
|
|
|
|
|
s0 = (S2[i+2] - S0[i+2])*f1 + S1[i+2]*f0 + _delta; |
|
|
|
|
s1 = (S2[i+3] - S0[i+3])*f1 + S1[i+2]*f0 + _delta; |
|
|
|
|
D[i+2] = castOp(s0); |
|
|
|
|
D[i+3] = castOp(s1); |
|
|
|
|
} |
|
|
|
|
#endif |
|
|
|
|
for( ; i < width; i++ ) |
|
|
|
|
D[i] = castOp((S2[i] - S0[i])*f1 + S1[i]*f0 + _delta); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
for( ; i < width; i++ ) |
|
|
|
|
D[i] = castOp((S2[i] - S0[i])*f1 + _delta); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|