if (cn == 1)
{
__m128i masklow = _mm_set1_epi16(0x00ff);
- for ( ; dx <= w - 8; dx += 8, S0 += 16, S1 += 16, D += 8)
+ for ( ; dx < w - 8; dx += 8, S0 += 16, S1 += 16, D += 8)
{
__m128i r0 = _mm_loadu_si128((const __m128i*)S0);
__m128i r1 = _mm_loadu_si128((const __m128i*)S1);
}
}
else if (cn == 3)
- for ( ; dx <= w - 6; dx += 6, S0 += 12, S1 += 12, D += 6)
+ for ( ; dx < w - 6; dx += 6, S0 += 12, S1 += 12, D += 6)
{
__m128i r0 = _mm_loadu_si128((const __m128i*)S0);
__m128i r1 = _mm_loadu_si128((const __m128i*)S1);
else
{
CV_Assert(cn == 4);
- for ( ; dx <= w - 8; dx += 8, S0 += 16, S1 += 16, D += 8)
+ for ( ; dx < w - 8; dx += 8, S0 += 16, S1 += 16, D += 8)
{
__m128i r0 = _mm_loadu_si128((const __m128i*)S0);
__m128i r1 = _mm_loadu_si128((const __m128i*)S1);
__m128i zero = _mm_setzero_si128();
__m128i delta2 = _mm_set1_epi32(2);
-#define _mm_packus_epi32(a, zero) _mm_packs_epi32(_mm_srai_epi32(_mm_slli_epi32(a, 16), 16), zero);
+#define _mm_packus_epi32(a, zero) _mm_packs_epi32(_mm_srai_epi32(_mm_slli_epi32(a, 16), 16), zero)
if (cn == 1)
{
- for ( ; dx <= w - 4; dx += 4, S0 += 8, S1 += 8, D += 4)
+ for ( ; dx < w - 4; dx += 4, S0 += 8, S1 += 8, D += 4)
{
__m128i r0 = _mm_loadu_si128((const __m128i*)S0);
__m128i r1 = _mm_loadu_si128((const __m128i*)S1);
}
}
else if (cn == 3)
- for ( ; dx <= w - 3; dx += 3, S0 += 6, S1 += 6, D += 3)
+ for ( ; dx < w - 3; dx += 3, S0 += 6, S1 += 6, D += 3)
{
__m128i r0 = _mm_loadu_si128((const __m128i*)S0);
__m128i r1 = _mm_loadu_si128((const __m128i*)S1);
else
{
CV_Assert(cn == 4);
- for ( ; dx <= w - 4; dx += 4, S0 += 8, S1 += 8, D += 4)
+ for ( ; dx < w - 4; dx += 4, S0 += 8, S1 += 8, D += 4)
{
__m128i r0 = _mm_loadu_si128((const __m128i*)S0);
__m128i r1 = _mm_loadu_si128((const __m128i*)S1);
}
}
+#undef _mm_packus_epi32
+
return dx;
}