optimized cv::norm with NORM_RELATIVE

This commit is contained in:
Ilya Lavrenov
2014-06-07 20:53:20 +04:00
parent 2040995801
commit 5403bdd228
4 changed files with 47 additions and 18 deletions

View File

@@ -76,7 +76,7 @@
#ifdef OP_CALC2
#define CALC_MAX2(p) \
if (maxval2 < temp.p) \
maxval2 = temp.p
maxval2 = temp.p;
#else
#define CALC_MAX2(p)
#endif
@@ -171,6 +171,9 @@ __kernel void minmaxloc(__global const uchar * srcptr, int src_step, int src_off
#endif
temp2 = convertToDT(*(__global const srcT *)(src2ptr + src2_index));
temp = temp > temp2 ? temp - temp2 : (temp2 - temp);
#ifdef OP_CALC2
temp2 = temp2 >= (dstT)(0) ? temp2 : -temp2;
#endif
#endif
#if kercn == 1
@@ -192,7 +195,6 @@ __kernel void minmaxloc(__global const uchar * srcptr, int src_step, int src_off
#endif
}
#ifdef OP_CALC2
temp2 = temp2 >= (dstT)(0) ? temp2 : -temp2;
if (maxval2 < temp2)
maxval2 = temp2;
#endif

View File

@@ -580,6 +580,9 @@ __kernel void reduce(__global const uchar * srcptr, int src_step, int src_offset
int id = get_global_id(0) * kercn;
srcptr += src_offset;
#ifdef HAVE_SRC2
src2ptr += src2_offset;
#endif
DECLARE_LOCAL_MEM;
DEFINE_ACCUMULATOR;