48 const int row_stride = input->row_stride;
49 const int elem_stride = input->elem_stride;
50 for (; !it.is_end(); ++it) {
54 const int start_x = std::max(0, x - delta);
55 const int start_y = std::max(0, y - delta);
56 const int end_x = std::min(x + delta, width - 1);
57 const int end_y = std::min(y + delta, height - 1);
58 const int x_len = end_x - start_x + 1;
59 const int y_len = end_y - start_y + 1;
61 const int total_count = x_len * y_len;
62 const int threshold_count =
ceil(
float(total_count) * 0.9f);
68 const float *main_elem = it.in(0);
69 const float value = *main_elem;
70 const float *row = input->get_elem(start_x, start_y);
71 const float *end_row = row + y_len * row_stride;
73 for (; ok ==
false && row < end_row; row += row_stride) {
74 const float *end_elem = row + x_len * elem_stride;
75 for (
const float *elem = row; ok ==
false && elem < end_elem; elem += elem_stride) {
76 const float current_value = *elem;
77 if (
fabsf(current_value - value) < tolerance) {
79 if (
count >= threshold_count) {
87 *it.out = ok ? 0.0f : 1.0f;