diff options
Diffstat (limited to 'src/armnn/backends/RefWorkloads/ResizeBilinear.cpp')
-rw-r--r-- | src/armnn/backends/RefWorkloads/ResizeBilinear.cpp | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/armnn/backends/RefWorkloads/ResizeBilinear.cpp b/src/armnn/backends/RefWorkloads/ResizeBilinear.cpp index 7b386ed467..d8bca4be44 100644 --- a/src/armnn/backends/RefWorkloads/ResizeBilinear.cpp +++ b/src/armnn/backends/RefWorkloads/ResizeBilinear.cpp @@ -27,7 +27,7 @@ inline float Lerp(float a, float b, float w) void ResizeBilinear(const float* in, const TensorInfo& inputInfo, float* out, const TensorInfo& outputInfo) { - // We follow the definition of TensorFlow and AndroidNN: The top-left corner of a texel in the output + // We follow the definition of TensorFlow and AndroidNN: the top-left corner of a texel in the output // image is projected into the input image to figure out the interpolants and weights. Note that this // will yield different results than if projecting the centre of output texels. @@ -39,8 +39,8 @@ void ResizeBilinear(const float* in, const TensorInfo& inputInfo, float* out, co const unsigned int outputHeight = outputInfo.GetShape()[2]; const unsigned int outputWidth = outputInfo.GetShape()[3]; - // How much to scale pixel coordinates in the output image to get the corresponding pixel coordinates - // in the input image + // How much to scale pixel coordinates in the output image, to get the corresponding pixel coordinates + // in the input image. const float scaleY = boost::numeric_cast<float>(inputHeight) / boost::numeric_cast<float>(outputHeight); const float scaleX = boost::numeric_cast<float>(inputWidth) / boost::numeric_cast<float>(outputWidth); @@ -53,33 +53,33 @@ void ResizeBilinear(const float* in, const TensorInfo& inputInfo, float* out, co { for (unsigned int y = 0; y < outputHeight; ++y) { - // Corresponding real-valued height coordinate in input image + // Corresponding real-valued height coordinate in input image. const float iy = boost::numeric_cast<float>(y) * scaleY; - // Discrete height coordinate of top-left texel (in the 2x2 texel area used for interpolation) + // Discrete height coordinate of top-left texel (in the 2x2 texel area used for interpolation). const float fiy = floorf(iy); const unsigned int y0 = boost::numeric_cast<unsigned int>(fiy); - // Interpolation weight (range [0,1]) + // Interpolation weight (range [0,1]). const float yw = iy - fiy; for (unsigned int x = 0; x < outputWidth; ++x) { - // Real-valued and discrete width coordinates in input image + // Real-valued and discrete width coordinates in input image. const float ix = boost::numeric_cast<float>(x) * scaleX; const float fix = floorf(ix); const unsigned int x0 = boost::numeric_cast<unsigned int>(fix); - // Interpolation weight (range [0,1]) + // Interpolation weight (range [0,1]). const float xw = ix - fix; - // Discrete width/height coordinates of texels below and to the right of (x0, y0) + // Discrete width/height coordinates of texels below and to the right of (x0, y0). const unsigned int x1 = std::min(x0 + 1, inputWidth - 1u); const unsigned int y1 = std::min(y0 + 1, inputHeight - 1u); // Interpolation - const float ly0 = Lerp(input.Get(n, c, y0, x0), input.Get(n, c, y0, x1), xw); // lerp along row y0 - const float ly1 = Lerp(input.Get(n, c, y1, x0), input.Get(n, c, y1, x1), xw); // lerp along row y1 + const float ly0 = Lerp(input.Get(n, c, y0, x0), input.Get(n, c, y0, x1), xw); // lerp along row y0. + const float ly1 = Lerp(input.Get(n, c, y1, x0), input.Get(n, c, y1, x1), xw); // lerp along row y1. const float l = Lerp(ly0, ly1, yw); output.Get(n, c, y, x) = l; |