diff options
Diffstat (limited to 'arm_compute/core/WindowIterator.h')
-rw-r--r-- | arm_compute/core/WindowIterator.h | 35 |
1 files changed, 11 insertions, 24 deletions
diff --git a/arm_compute/core/WindowIterator.h b/arm_compute/core/WindowIterator.h index c15a50cf47..29302c410a 100644 --- a/arm_compute/core/WindowIterator.h +++ b/arm_compute/core/WindowIterator.h @@ -28,10 +28,6 @@ #include "arm_compute/core/ITensor.h" #include "arm_compute/core/Window.h" -//FIXME: Delete the "ARM_COMPUTE_PRINTF" before the release. In the meantime it's probably going to be useful to debug -//#define ARM_COMPUTE_PRINTF printf -#define ARM_COMPUTE_PRINTF(...) - namespace arm_compute { /** Convert an offset in window steps into absolute coordinates. @@ -44,7 +40,7 @@ namespace arm_compute inline Coordinates convert_window_coord_to_position(const Window &w, const Coordinates &offset) { Coordinates position; - for(unsigned int i = 0; i < Coordinates::num_max_dimensions; ++i) + for (unsigned int i = 0; i < Coordinates::num_max_dimensions; ++i) { position.set(i, w[i].start() + offset[i] * w[i].step()); } @@ -168,16 +164,14 @@ public: template <typename M> void iterate_3D(M &&on_new_row_size) { - while(_end.z() != _position.z()) + while (_end.z() != _position.z()) { - ARM_COMPUTE_PRINTF("New slice %d\n", _position.z()); iterate_2D_internal(on_new_row_size, _w.x().end() - _w.x().step(), _w.y().end() - _w.y().step()); _position[2] += _w.z().step(); _position[1] = _w.y().start(); _position[0] = _w.x().start(); } // Left over: - ARM_COMPUTE_PRINTF("Left over slice\n"); iterate_2D(on_new_row_size); } @@ -217,29 +211,25 @@ private: void iterate_2D_internal(M &&on_new_row_size, int end_x, int end_y) { //Is there more than one row to process ? - if(end_y == _position.y()) + if (end_y == _position.y()) { - // Single row: - ARM_COMPUTE_PRINTF("Partial row only\n"); // Both start and end belong to the same row: iterate_over_dim0(end_x + _w.x().step(), on_new_row_size); } else { // Do we start from the beginning of the row ? - if(_w.x().start() != _position.x()) + if (_w.x().start() != _position.x()) { //Start in the middle of a row: process left-over X - ARM_COMPUTE_PRINTF("Partial row first\n"); iterate_over_dim0(_w.x().end(), on_new_row_size); _position[1] += _w.y().step(); } //Middle rows bool no_leftover = end_x + _w.x().step() == _w.x().end(); - if(no_leftover) + if (no_leftover) { - ARM_COMPUTE_PRINTF("no left over\n"); //Switch to full row size: on_new_row_size(_w[0].start(), _w.x().end()); // Shouldn't be possible to reach that point and not have at least one entire row to process @@ -249,17 +239,14 @@ private: } else { - ARM_COMPUTE_PRINTF("with left over\n"); // Are there full rows to process ? - if(_position[1] != end_y) + if (_position[1] != end_y) { - ARM_COMPUTE_PRINTF("full rows\n"); //Switch to full row size: on_new_row_size(_w[0].start(), _w.x().end()); iterate_over_dim1(end_y); } - ARM_COMPUTE_PRINTF("Final leftover\n"); //Leftover end x _position[0] = _w.x().start(); iterate_over_dim0(end_x + _w.x().step(), on_new_row_size); @@ -273,7 +260,7 @@ private: */ void iterate_over_dim1(int end) { - for(; _position[1] != end; _position[1] += _w[1].step()) + for (; _position[1] != end; _position[1] += _w[1].step()) { _position[0] = _w[0].start(); iterate_over_dim0(_w[0].end()); @@ -298,10 +285,9 @@ private: */ void iterate_over_dim0(int end) { - ARM_COMPUTE_PRINTF("X [%d, %d, %d]\n", _position.x(), end, _w[0].step()); // Both start and end belong to the same row: ARM_COMPUTE_ERROR_ON(_position[0] > end); - for(; _position.x() < end; _position[0] += _w[0].step()) + for (; _position.x() < end; _position[0] += _w[0].step()) { _lambda_function(_position); } @@ -323,9 +309,10 @@ private: * @return A WindowIterator object. */ template <typename L> -WindowIterator<L> create_window_iterator(const Window &w, const Coordinates &start, const Coordinates &end, L &&lambda_function) +WindowIterator<L> +create_window_iterator(const Window &w, const Coordinates &start, const Coordinates &end, L &&lambda_function) { return WindowIterator<L>(w, start, end, std::move(lambda_function)); } -} +} // namespace arm_compute #endif /*ARM_COMPUTE_WINDOW_ITERATOR_H*/ |