uchar tab[256];
Size roi = _src.size();
roi.width *= _src.channels();
+ size_t src_step = _src.step;
+ size_t dst_step = _dst.step;
if( _src.isContinuous() && _dst.isContinuous() )
{
roi.width *= roi.height;
roi.height = 1;
+ src_step = dst_step = roi.width;
}
#ifdef HAVE_TEGRA_OPTIMIZATION
return;
#endif
+#ifdef HAVE_IPP
+ IppiSize sz = { roi.width, roi.height };
+ switch( type )
+ {
+ case THRESH_TRUNC:
+ if (0 <= ippiThreshold_GT_8u_C1R(_src.data, (int)src_step, _dst.data, (int)dst_step, sz, thresh))
+ return;
+ break;
+ case THRESH_TOZERO:
+ if (0 <= ippiThreshold_LTVal_8u_C1R(_src.data, (int)src_step, _dst.data, (int)dst_step, sz, thresh+1, 0))
+ return;
+ break;
+ case THRESH_TOZERO_INV:
+ if (0 <= ippiThreshold_GTVal_8u_C1R(_src.data, (int)src_step, _dst.data, (int)dst_step, sz, thresh, 0))
+ return;
+ break;
+ }
+#endif
+
switch( type )
{
case THRESH_BINARY:
for( i = 0; i < roi.height; i++ )
{
- const uchar* src = (const uchar*)(_src.data + _src.step*i);
- uchar* dst = (uchar*)(_dst.data + _dst.step*i);
+ const uchar* src = (const uchar*)(_src.data + src_step*i);
+ uchar* dst = (uchar*)(_dst.data + dst_step*i);
switch( type )
{
{
for( i = 0; i < roi.height; i++ )
{
- const uchar* src = (const uchar*)(_src.data + _src.step*i);
- uchar* dst = (uchar*)(_dst.data + _dst.step*i);
+ const uchar* src = (const uchar*)(_src.data + src_step*i);
+ uchar* dst = (uchar*)(_dst.data + dst_step*i);
j = j_scalar;
#if CV_ENABLE_UNROLLED
for( ; j <= roi.width - 4; j += 4 )
{
roi.width *= roi.height;
roi.height = 1;
+ src_step = dst_step = roi.width;
}
#ifdef HAVE_TEGRA_OPTIMIZATION
return;
#endif
+#ifdef HAVE_IPP
+ IppiSize sz = { roi.width, roi.height };
+ switch( type )
+ {
+ case THRESH_TRUNC:
+ if (0 <= ippiThreshold_GT_16s_C1R(src, (int)src_step*sizeof(src[0]), dst, (int)dst_step*sizeof(dst[0]), sz, thresh))
+ return;
+ break;
+ case THRESH_TOZERO:
+ if (0 <= ippiThreshold_LTVal_16s_C1R(src, (int)src_step*sizeof(src[0]), dst, (int)dst_step*sizeof(dst[0]), sz, thresh+1, 0))
+ return;
+ break;
+ case THRESH_TOZERO_INV:
+ if (0 <= ippiThreshold_GTVal_16s_C1R(src, (int)src_step*sizeof(src[0]), dst, (int)dst_step*sizeof(dst[0]), sz, thresh, 0))
+ return;
+ break;
+ }
+#endif
+
switch( type )
{
case THRESH_BINARY:
return;
#endif
+#ifdef HAVE_IPP
+ IppiSize sz = { roi.width, roi.height };
+ switch( type )
+ {
+ case THRESH_TRUNC:
+ if (0 <= ippiThreshold_GT_32f_C1R(src, (int)src_step*sizeof(src[0]), dst, (int)dst_step*sizeof(dst[0]), sz, thresh))
+ return;
+ break;
+ case THRESH_TOZERO:
+ if (0 <= ippiThreshold_LTVal_32f_C1R(src, (int)src_step*sizeof(src[0]), dst, (int)dst_step*sizeof(dst[0]), sz, thresh+FLT_EPSILON, 0))
+ return;
+ break;
+ case THRESH_TOZERO_INV:
+ if (0 <= ippiThreshold_GTVal_32f_C1R(src, (int)src_step*sizeof(src[0]), dst, (int)dst_step*sizeof(dst[0]), sz, thresh, 0))
+ return;
+ break;
+ }
+#endif
+
switch( type )
{
case THRESH_BINARY: