MCPcopy Create free account
hub / github.com/MaartenBaert/ssr / ImageGeneric

Method ImageGeneric

src/Benchmark.cpp:37–65  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

35 std::vector<int> m_stride;
36
37 ImageGeneric(const std::vector<unsigned int>& stride, const std::vector<unsigned int>& rows, std::mt19937& rng) {
38
39 // count planes
40 assert(stride.size() == rows.size());
41 unsigned int planes = stride.size();
42 m_data.resize(planes);
43 m_stride.resize(planes);
44
45 // calculate stride and total size
46 size_t totalsize = 0;
47 for(unsigned int p = 0; p < planes; ++p) {
48 m_stride[p] = grow_align16(stride[p]);
49 totalsize += m_stride[p] * rows[p];
50 }
51
52 // allocate buffer
53 m_buffer.Alloc(totalsize);
54 for(unsigned int i = 0; i < totalsize; ++i) {
55 m_buffer[i] = rng();
56 }
57
58 // set data
59 uint8_t *data = m_buffer.GetData();
60 for(unsigned int p = 0; p < planes; ++p) {
61 m_data[p] = data;
62 data += m_stride[p] * rows[p];
63 }
64
65 }
66
67};
68

Callers

nothing calls this directly

Calls 3

AllocMethod · 0.80
grow_align16Function · 0.70
GetDataMethod · 0.45

Tested by

no test coverage detected