MCPcopy Create free account
hub / github.com/ARM-software/armnn / StbResize

Method StbResize

tests/InferenceTestImage.cpp:183–207  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

181
182
183void 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
209std::vector<float> InferenceTestImage::Resize(unsigned int newWidth,
210 unsigned int newHeight,

Callers

nothing calls this directly

Calls 9

stbir_resize_uint8Function · 0.85
resizeMethod · 0.80
GetNumChannelsMethod · 0.80
GetWidthMethod · 0.45
GetHeightMethod · 0.45
dataMethod · 0.45
swapMethod · 0.45

Tested by

no test coverage detected