From ccde4d76185f2010d522d3a751a5dac586bdfca8 Mon Sep 17 00:00:00 2001 From: Dominic Symes Date: Wed, 28 Sep 2022 13:10:27 +0100 Subject: RESIZE: Clarify floating point types Change resize_t to use the same type as in_t and out_t for floating point data. Signed-off-by: Dominic Symes Change-Id: I3214d92477688b95ba572f22d34aab3fef7d0f82 --- chapters/image.adoc | 10 ++++++---- tosa.xml | 4 ++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/chapters/image.adoc b/chapters/image.adoc index 2c23e79..bcef73f 100644 --- a/chapters/image.adoc +++ b/chapters/image.adoc @@ -89,13 +89,15 @@ for_each(0 <= n < N, 0 <= oy < OH, 0 <= ox < OW; 0 <= c < C) { int32_t x = ox * scale_x_d + offset_x; int16_t iy = floor(y / scale_y_n); int16_t ix = floor(x / scale_x_n); + int16_t ry = y - iy * scale_y_n; // (y % scale_y_n) + int16_t rx = x - ix * scale_x_n; // (x % scale_x_n) if (is_floating_point(resize_t)) { - dy = ((resize_t)y / (resize_t)scale_y_n) - iy; - dx = ((resize_t)x / (resize_t)scale_x_n) - ix; + dy = (resize_t)ry / (resize_t)scale_y_n; + dx = (resize_t)rx / (resize_t)scale_x_n; } else { - dy = y - iy * scale_y_n; - dx = y - ix * scale_x_n; + dy = ry; + dx = rx; } // Note that -1 <= iy < IH and -1 <= ix < IW int16_t iy0 = apply_max(iy, 0); diff --git a/tosa.xml b/tosa.xml index bc86354..c17545b 100644 --- a/tosa.xml +++ b/tosa.xml @@ -1886,11 +1886,11 @@ used. - + - + -- cgit v1.2.1