26 #if defined(VEC_SIZE) && defined(DATA_TYPE) && defined(EPSILON) && defined(WIDTH) 47 __kernel
void mean_stddev_normalization(
76 sum_sq += data * data;
80 sum.s01234567 +=
sum.s89abcdef;
81 sum_sq.s01234567 += sum_sq.s89abcdef;
82 #endif // VEC_SIZE > 8 85 sum_sq.s0123 += sum_sq.s4567;
86 #endif // VEC_SIZE > 4 89 sum_sq.s01 += sum_sq.s23;
90 #endif // VEC_SIZE > 2 92 sum_sq.s0 += sum_sq.s1;
99 sum_sq.s0 += data * data;
103 DATA_TYPE var = (sum_sq.s0 / WIDTH) - (mean * mean);
104 DATA_TYPE stddev_inv = 1.f / sqrt(var + EPSILON);
113 res = (data - mean) * stddev_inv;
117 for(; i < WIDTH; ++i)
121 *((__global
DATA_TYPE *)
offset(&out, i, 0)) = (data - mean) * stddev_inv;
__global uchar * offset(const Image *img, int x, int y)
Get the pointer position of a Image.
#define CONVERT_TO_IMAGE_STRUCT(name)
DATA_TYPE sum(__global const DATA_TYPE *input)
Calculate sum of a vector.
#define IMAGE_DECLARATION(name)
Structure to hold Image information.
#define VEC_DATA_TYPE(type, size)