MCPcopy Create free account
hub / github.com/CVCUDA/CV-CUDA / item

Method item

tests/common/TensorDataUtils.hpp:173–186  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

171 */
172 template<class T>
173 T *item(const int x, const int y, const int c)
174 {
175 uint32_t byteIndex = 0;
176
177 if (!m_planar)
178 byteIndex = (c * m_bytesPerC) + (x * m_bytesPerC * m_numC) + (y * m_rowStride);
179 else
180 byteIndex = (c * m_planeStride) + (x * m_bytesPerC) + (y * m_rowStride);
181
182 if (byteIndex >= m_data.size())
183 throw std::runtime_error("Requested data out of bounds");
184
185 return reinterpret_cast<T *>(reinterpret_cast<unsigned char *>(m_data.data()) + byteIndex);
186 }
187
188private:
189 std::vector<uint8_t> m_data; // pointer to local data

Callers 1

runMethod · 0.80

Calls 2

sizeMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected