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

Function MinAreaRect

bench/BenchMinAreaRect.cpp:25–61  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

23
24template<typename T>
25inline void MinAreaRect(nvbench::state &state, nvbench::type_list<T>)
26try
27{
28 long2 shape = benchutils::GetShape<2>(state.get_string("shape"));
29 long varShape = state.get_int64("varShape");
30
31 state.add_global_memory_reads(shape.x * shape.y * sizeof(T));
32 state.add_global_memory_writes(shape.x * 8 * sizeof(float) + shape.x * sizeof(int));
33
34 cvcuda::MinAreaRect op(shape.x);
35
36 // clang-format off
37
38 if (varShape < 0) // negative var shape means use Tensor
39 {
40 nvcv::Tensor src({{shape.x, shape.y, 2}, "NWC"}, benchutils::GetDataType<T>());
41 nvcv::Tensor dst({{shape.x, 8}, "NW"}, nvcv::TYPE_F32);
42 nvcv::Tensor points({{1, shape.x}, "NW"}, nvcv::TYPE_S32);
43
44 benchutils::FillTensor<T>(src, benchutils::RandomValues<T>());
45 benchutils::FillTensor<float>(dst, benchutils::RandomValues<float>(0.f, 1.f));
46 benchutils::FillTensor<int>(points, benchutils::RandomValues<int>(10, 100));
47
48 state.exec(nvbench::exec_tag::sync, [&op, &src, &dst, &points, &shape](nvbench::launch &launch)
49 {
50 op(launch.get_stream(), src, dst, points, shape.x);
51 });
52 }
53 else // zero and positive var shape means use ImageBatchVarShape
54 {
55 throw std::invalid_argument("ImageBatchVarShape not implemented for this operator");
56 }
57}
58catch (const std::exception &err)
59{
60 state.skip(err.what());
61}
62
63// clang-format on
64

Callers

nothing calls this directly

Calls 1

whatMethod · 0.80

Tested by

no test coverage detected