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

Method Init

tests/cvcuda/system/TestOpInpaint.cpp:80–112  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

78
79public:
80 bool Init(const vector<uint8_t> &f, int height, int width)
81 {
82 int i, j;
83 for (i = num = 0; i < height; i++)
84 {
85 for (j = 0; j < width; j++) num += (f[i * width + j] != 0);
86 }
87 if (num <= 0)
88 return false;
89 mem = (HeapElem *)malloc((num + 2) * sizeof(HeapElem));
90 if (mem == NULL)
91 return false;
92
93 head = mem;
94 head->i = head->j = -1;
95 head->prev = NULL;
96 head->next = mem + 1;
97 head->T = -FLT_MAX;
98 empty = mem + 1;
99 for (i = 1; i <= num; i++)
100 {
101 mem[i].prev = mem + i - 1;
102 mem[i].next = mem + i + 1;
103 mem[i].i = -1;
104 mem[i].T = FLT_MAX;
105 }
106 tail = mem + i;
107 tail->i = tail->j = -1;
108 tail->prev = mem + i - 1;
109 tail->next = NULL;
110 tail->T = FLT_MAX;
111 return true;
112 }
113
114 bool Add(const vector<uint8_t> &f, int height, int width)
115 {

Callers 1

InpaintFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected