| 181 | |
| 182 | |
| 183 | void InferenceTestImage::StbResize(InferenceTestImage& im, const unsigned int newWidth, const unsigned int newHeight) |
| 184 | { |
| 185 | std::vector<uint8_t> newData; |
| 186 | newData.resize(newWidth * newHeight * im.GetNumChannels() * im.GetSingleElementSizeInBytes()); |
| 187 | |
| 188 | // armnn::numeric_cast<>() is used for user-provided data (protecting about overflows). |
| 189 | // static_cast<> is ok for internal data (assumes that, when internal data was originally provided by a user, |
| 190 | // a armnn::numeric_cast<>() handled the conversion). |
| 191 | const int nW = armnn::numeric_cast<int>(newWidth); |
| 192 | const int nH = armnn::numeric_cast<int>(newHeight); |
| 193 | |
| 194 | const int w = static_cast<int>(im.GetWidth()); |
| 195 | const int h = static_cast<int>(im.GetHeight()); |
| 196 | const int numChannels = static_cast<int>(im.GetNumChannels()); |
| 197 | |
| 198 | const int res = stbir_resize_uint8(im.m_Data.data(), w, h, 0, newData.data(), nW, nH, 0, numChannels); |
| 199 | if (res == 0) |
| 200 | { |
| 201 | throw InferenceTestImageResizeFailed("The resizing operation failed"); |
| 202 | } |
| 203 | |
| 204 | im.m_Data.swap(newData); |
| 205 | im.m_Width = newWidth; |
| 206 | im.m_Height = newHeight; |
| 207 | } |
| 208 | |
| 209 | std::vector<float> InferenceTestImage::Resize(unsigned int newWidth, |
| 210 | unsigned int newHeight, |
nothing calls this directly
no test coverage detected