Width is in bytes or pixels..
| 47 | |
| 48 | // Width is in bytes or pixels.. |
| 49 | static void WriteData(const nvcv::TensorDataAccessStridedImagePlanar &data, uint8_t val, NVCVRectI region) |
| 50 | { |
| 51 | EXPECT_TRUE(data.layout() == NVCV_TENSOR_NHWC || data.layout() == NVCV_TENSOR_HWC); |
| 52 | EXPECT_LE(region.x + region.width, data.numCols()); |
| 53 | EXPECT_LE(region.y + region.height, data.numRows()); |
| 54 | |
| 55 | int bytesPerChan = data.dtype().bitsPerChannel()[0] / 8; |
| 56 | int bytesPerPixel = data.numChannels() * bytesPerChan; |
| 57 | uint8_t *impPtrTop = (uint8_t *)data.sampleData(0); |
| 58 | uint8_t *impPtr = nullptr; |
| 59 | int numImages = data.numSamples(); |
| 60 | int rowStride = data.rowStride(); |
| 61 | |
| 62 | EXPECT_NE(nullptr, impPtrTop); |
| 63 | for (int img = 0; img < numImages; img++) |
| 64 | { |
| 65 | impPtr = impPtrTop + (data.sampleStride() * img) + (region.x * bytesPerPixel) + (rowStride * region.y); |
| 66 | EXPECT_EQ(cudaSuccess, |
| 67 | cudaMemset2D((void *)impPtr, rowStride, val, region.width * bytesPerPixel, region.height)); |
| 68 | } |
| 69 | } |
| 70 | |
| 71 | static void setGoldBuffer(std::vector<uint8_t> &vect, const nvcv::TensorDataAccessStridedImagePlanar &data, |
| 72 | NVCVRectI region, uint8_t val) |
no test coverage detected