aboutsummaryrefslogtreecommitdiff
path: root/chapters
diff options
context:
space:
mode:
authorDominic Symes <dominic.symes@arm.com>2022-09-28 13:10:27 +0100
committerDominic Symes <dominic.symes@arm.com>2022-09-28 13:10:27 +0100
commitccde4d76185f2010d522d3a751a5dac586bdfca8 (patch)
tree42a9b52f0da4fcfd42d7d900b21243e401ca5ce4 /chapters
parent5bb9a2a0ab667aac5517cf1fcbd725e2fa566938 (diff)
downloadspecification-ccde4d76185f2010d522d3a751a5dac586bdfca8.tar.gz
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 <dominic.symes@arm.com> Change-Id: I3214d92477688b95ba572f22d34aab3fef7d0f82
Diffstat (limited to 'chapters')
-rw-r--r--chapters/image.adoc10
1 files changed, 6 insertions, 4 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);