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

Function LocSort

tests/cvcuda/system/TestOpMinMaxLoc.cpp:171–199  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

169// Sort min/max locations to be able to compare test vs. gold results
170
171inline void LocSort(std::vector<std::vector<int2>> &minLocTest, std::vector<std::vector<int2>> &maxLocTest,
172 int capacity, std::vector<uint8_t> &minLocVec, std::vector<uint8_t> &maxLocVec, long2 &locStrides,
173 std::vector<uint8_t> &numMinVec, std::vector<uint8_t> &numMaxVec, long1 &numStrides)
174{
175 ASSERT_EQ(minLocTest.size(), maxLocTest.size());
176
177 auto locLower = [](int2 loc1, int2 loc2)
178 {
179 return loc1.y == loc2.y ? loc1.x < loc2.x : loc1.y < loc2.y;
180 };
181
182 for (int z = 0; z < (int)minLocTest.size(); z++)
183 {
184 int nMin = test::ValueAt<int1>(numMinVec, numStrides, {z}).x;
185 int nMax = test::ValueAt<int1>(numMaxVec, numStrides, {z}).x;
186
187 for (int i = 0; i < nMin && i < capacity; i++)
188 {
189 minLocTest[z].push_back(test::ValueAt<int2>(minLocVec, locStrides, {i, z}));
190 }
191 for (int i = 0; i < nMax && i < capacity; i++)
192 {
193 maxLocTest[z].push_back(test::ValueAt<int2>(maxLocVec, locStrides, {i, z}));
194 }
195
196 std::sort(minLocTest[z].begin(), minLocTest[z].end(), locLower);
197 std::sort(maxLocTest[z].begin(), maxLocTest[z].end(), locLower);
198 }
199}
200
201// The full gold function includes preparing buffers, copying data and computing gold results
202

Callers 1

GoldMinMaxLocFunction · 0.85

Calls 4

sizeMethod · 0.45
push_backMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected