Skip to content

Commit 8ffd0c7

Browse files
authored
Rework (#22)
* Updating coments * Added debug zone * Reworked array * Reworked matrix and convolution * Reworked distribution * Reworked pyramid * Reworked image * Reworked lut * Reworked remap * Reworked threshold * Reworked type pairs * Reworked user data object * Reworked tensor * More minor cleanup to type pairs * Reworked reference * Reworked object array * Reworked scalar * Reworked parameter * Reworked node * More node cleanup * Reworked graph * Reworked context * Reworked delay * Reworked error * Reworked import * Reworked kernel * Reworked log * Fixed broken integration test * Apply suggestion from @amikhail48 * Apply suggestion from @amikhail48 * Apply suggestion from @amikhail48 * Apply suggestion from @amikhail48 * Apply suggestion from @amikhail48 * Apply suggestion from @amikhail48
1 parent 2aa79d1 commit 8ffd0c7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+12217
-8371
lines changed

framework/include/vx_array.h

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,74 @@ class Array : public Reference
136136
*/
137137
vx_bool initVirtualArray(vx_enum item_type, vx_size capacity);
138138

139+
/**
140+
* @brief Add items to array
141+
*
142+
* @param count number of items to add
143+
* @param ptr pointer to data
144+
* @param stride size of stride
145+
* @return vx_status VX_SUCCESS if successful, any other value indicates failure.
146+
* @ingroup group_int_array
147+
*/
148+
vx_status addItems(vx_size count, const void *ptr, vx_size stride);
149+
150+
/**
151+
* @brief Truncate array to new number of items
152+
*
153+
* @param new_num_items new number of items
154+
* @return vx_status VX_SUCCESS if successful, any other value indicates failure.
155+
* @ingroup group_int_array
156+
*/
157+
vx_status truncate(vx_size new_num_items);
158+
159+
/**
160+
* @brief Get item type of the array
161+
*
162+
* @return vx_enum The item type of the array.
163+
* @ingroup group_int_array
164+
*/
165+
vx_enum itemType() const;
166+
167+
/**
168+
* @brief Get number of items in array
169+
*
170+
* @return vx_size The number of items in the array.
171+
* @ingroup group_int_array
172+
*/
173+
vx_size numItems() const;
174+
175+
/**
176+
* @brief Get capacity of array
177+
*
178+
* @return vx_size The capacity of the array.
179+
* @ingroup group_int_array
180+
*/
181+
vx_size totalCapacity() const;
182+
183+
/**
184+
* @brief Get item size in array
185+
*
186+
* @return vx_size Item size in bytes
187+
* @ingroup group_int_array
188+
*/
189+
vx_size itemSize() const;
190+
191+
/**
192+
* @brief Get total size of array
193+
*
194+
* @return vx_size Total size in bytes
195+
* @ingroup group_int_array
196+
*/
197+
vx_size totalSize() const;
198+
199+
/**
200+
* @brief Get offset value
201+
*
202+
* @return vx_uint32 Offset value
203+
* @ingroup group_int_array
204+
*/
205+
vx_uint32 offsetVal() const;
206+
139207
/**
140208
* @brief Access array range in object
141209
*

framework/include/vx_context.h

Lines changed: 240 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#define VX_CONTEXT_H
1818

1919
#include <memory>
20+
#include <vector>
2021

2122
#include "vx_event_queue.hpp"
2223
#include "vx_internal.h"
@@ -25,7 +26,6 @@
2526
/*!
2627
* \file
2728
* \brief
28-
* \author Erik Rainey <[email protected]>
2929
*
3030
* \defgroup group_int_context Internal Context API
3131
* \ingroup group_internal
@@ -53,6 +53,150 @@ class Context : public Reference
5353
*/
5454
~Context();
5555

56+
/**
57+
* @brief Get vendor id
58+
*
59+
* @return vx_uint16 The vendor id.
60+
* @ingroup group_int_context
61+
*/
62+
vx_uint16 vendorId() const;
63+
64+
/**
65+
* @brief Get version number
66+
*
67+
* @return vx_uint16 The version number.
68+
* @ingroup group_int_context
69+
*/
70+
vx_uint16 version() const;
71+
72+
/**
73+
* @brief Get number of loaded modules
74+
*
75+
* @return vx_uint32 The number of loaded modules.
76+
* @ingroup group_int_context
77+
*/
78+
vx_uint32 numModules() const;
79+
80+
/**
81+
* @brief Get number of references
82+
*
83+
* @return vx_uint32 The number of tracked references.
84+
* @ingroup group_int_context
85+
*/
86+
vx_uint32 numReferences() const;
87+
88+
/**
89+
* @brief Get the implementation name
90+
*
91+
* @return const vx_char* The implementation name.
92+
* @ingroup group_int_context
93+
*/
94+
const vx_char* implName() const;
95+
96+
/**
97+
* @brief Get the names of the extensions supported
98+
*
99+
* @return const vx_char* The names of the extensions supported
100+
* @ingroup group_int_context
101+
*/
102+
const vx_char* extensions() const;
103+
104+
/**
105+
* @brief Get the max dimensions of a convolution supported
106+
*
107+
* @return vx_size The max dimensions of a convolution supported.
108+
* @ingroup group_int_context
109+
*/
110+
vx_size convolutionMaxDim() const;
111+
112+
/**
113+
* @brief Get the max dimensions of a non linear supported
114+
*
115+
* @return vx_size The max dimensions of a non linear supported.
116+
* @ingroup group_int_context
117+
*/
118+
vx_size nonLinearMaxDim() const;
119+
120+
/**
121+
* @brief Get the optical flow max window dimension supported
122+
*
123+
* @return vx_size The optical flow max window dimension supported.
124+
* @ingroup group_int_context
125+
*/
126+
vx_size opticalFlowMaxWindowDim() const;
127+
128+
/**
129+
* @brief Get the immediate border
130+
*
131+
* @return vx_border_t The immediate border.
132+
* @ingroup group_int_context
133+
*/
134+
vx_border_t immediateBorder() const;
135+
136+
/**
137+
* @brief Get the immediate border policy
138+
*
139+
* @return vx_enum The immediate border policy.
140+
* @ingroup group_int_context
141+
*/
142+
vx_enum immediateBorderPolicy() const;
143+
144+
/**
145+
* @brief Get the number of unique kernels
146+
*
147+
* @return vx_uint32 The number of unique kernels.
148+
* @ingroup group_int_context
149+
*/
150+
vx_uint32 numUniqueKernels() const;
151+
152+
/**
153+
* @brief Get the max tensor dimensions supported
154+
*
155+
* @return vx_size The max tensor dimensions supported.
156+
* @ingroup group_int_context
157+
*/
158+
vx_size maxTensorDims() const;
159+
160+
/**
161+
* @brief Get the unique kernel information
162+
*
163+
* @return std::vector<vx_kernel_info_t> The unique kernel information table.
164+
* @ingroup group_int_context
165+
*/
166+
std::vector<vx_kernel_info_t> uniqueKernelTable();
167+
168+
/**
169+
* @brief Get the OpenCL context
170+
*
171+
* @return cl_context The OpenCL context.
172+
* @ingroup group_int_context
173+
*/
174+
cl_context clContext() const;
175+
176+
/**
177+
* @brief Get the OpenCL command queue
178+
*
179+
* @return cl_command_queue The OpenCL command queue.
180+
* @ingroup group_int_context
181+
*/
182+
cl_command_queue clCommandQueue() const;
183+
184+
/**
185+
* @brief Set the logging enabled state
186+
*
187+
* @param flag vx_bool indicating whether to enable or disable logging
188+
* @ingroup group_int_context
189+
*/
190+
void setLoggingEnabled(vx_bool flag);
191+
192+
/**
193+
* @brief Set the perf enabled state
194+
*
195+
* @param flag vx_bool indicating whether to enable or disable performance tracking
196+
* @ingroup group_int_context
197+
*/
198+
void setPerfEnabled(vx_bool flag);
199+
56200
/*! \brief This determines if a context is valid.
57201
* \param [in] context The pointer to the context to test.
58202
* \retval vx_true_e The context is valid.
@@ -106,12 +250,8 @@ class Context : public Reference
106250
* will allocate memory if needed.
107251
* \ingroup group_int_context
108252
*/
109-
vx_bool addAccessor(vx_size size,
110-
vx_enum usage,
111-
void*& ptr,
112-
vx_reference ref,
113-
vx_uint32 *pIndex,
114-
void *extra_data);
253+
vx_bool addAccessor(vx_size size, vx_enum usage, void*& ptr, vx_reference ref,
254+
vx_uint32* pIndex, void* extra_data);
115255

116256
/*! \brief Finds and removes an accessor from the list.
117257
* \ingroup group_int_context
@@ -174,21 +314,101 @@ class Context : public Reference
174314
/**
175315
* @brief Launch worker graph thread
176316
*
177-
* @param arg
178-
* @return vx_value_t
317+
* @param arg Optional argument to pass as parameter.
318+
* @return vx_value_t Thread return value.
179319
* @ingroup group_int_context
180320
*/
181321
static vx_value_t workerGraph(void *arg);
182322

183323
/**
184-
* @brief Launch worker node thread
324+
* @brief Launch worker node
185325
*
186-
* @param worker
187-
* @return vx_bool
326+
* @param worker The threadpool of the worker.
327+
* @return vx_bool vx_true_e if ran successful, vx_false_e otherwise
188328
* @ingroup group_int_context
189329
*/
190330
static vx_bool workerNode(vx_threadpool_worker_t *worker);
191331

332+
/**
333+
* @brief Register a user struct with a certain number of bytes
334+
*
335+
* @param size The size in bytes of the user struct.
336+
* @return vx_enum The user struct enumeration.
337+
* @ingroup group_int_context
338+
*/
339+
vx_enum registerUserStruct(vx_size size);
340+
341+
/**
342+
* @brief Get the User Struct By Name object
343+
*
344+
* @param name The user struct name.
345+
* @return vx_enum The user struct enumeration.
346+
* @ingroup group_int_context
347+
*/
348+
vx_enum getUserStructByName(const vx_char* name);
349+
350+
/**
351+
* @brief Get the User Struct Name By Enum object
352+
*
353+
* @param user_struct_type Enumeration for user struct type.
354+
* @param type_name Name of user struct type.
355+
* @param name_size Size of user struct name.
356+
* @return vx_status VX_SUCCESS if successful, otherwise a return status with an error
357+
* code.
358+
* @ingroup group_int_context
359+
*/
360+
vx_status getUserStructNameByEnum(vx_enum user_struct_type, vx_char* type_name,
361+
vx_size name_size);
362+
363+
/**
364+
* @brief Get the User Struct Enum By Name object
365+
*
366+
* @param type_name The user struct name.
367+
* @param user_struct_type The user struct type enumeration.
368+
* @return vx_status VX_SUCCESS if successful, otherwise a return status with an error
369+
* code.
370+
* @ingroup group_int_context
371+
*/
372+
vx_status getUserStructEnumByName(const vx_char* type_name, vx_enum* user_struct_type);
373+
374+
/**
375+
* @brief Register user struct with name
376+
*
377+
* @param size Size of user struct name.
378+
* @param type_name The user struct name.
379+
* @return vx_enum Enumeration of registered user struct
380+
* @ingroup group_int_context
381+
*/
382+
vx_enum registerUserStructWithName(vx_size size, const vx_char* type_name);
383+
384+
/**
385+
* @brief Allocate a unique kernel id
386+
*
387+
* @param pKernelEnumId Pointer to allocated kernel id by the framework.
388+
* @return vx_status VX_SUCCESS if successful, otherwise a return status with an error code.
389+
* @ingroup group_int_context
390+
*/
391+
vx_status allocateKernelId(vx_enum* pKernelEnumId);
392+
393+
/**
394+
* @brief Allocate a unique library id
395+
*
396+
* @param pLibraryId Pointer to allocated library id by the framework.
397+
* @return vx_status VX_SUCCESS if successful, otherwise a return status with an error code.
398+
* @ingroup group_int_context
399+
*/
400+
vx_status allocateLibraryId(vx_enum* pLibraryId);
401+
402+
/**
403+
* @brief Set the Immediate Mode Target
404+
*
405+
* @param target_enum The target enumeration.
406+
* @param target_string The target string.
407+
* @return vx_status VX_SUCCESS if successful, otherwise a return status with an error code.
408+
* @ingroup group_int_context
409+
*/
410+
vx_status setImmediateModeTarget(vx_enum target_enum, const char* target_string);
411+
192412
/*! \brief The pointer to process global lock */
193413
vx_sem_t* p_global_lock;
194414
/*! \brief The reference table which contains the handle for later garage collection if needed */
@@ -275,6 +495,14 @@ class Context : public Reference
275495
vx_value_set_t graph_queue[VX_INT_MAX_QUEUE_DEPTH];
276496
/*! \brief The number of graphs in the queue */
277497
vx_size numGraphsQueued;
498+
/*! \brief The vendor id */
499+
const vx_uint16 vendor_id;
500+
/*! \brief The version number this implements */
501+
const vx_uint16 version_number;
502+
/*! \brief The name of this impleemntation */
503+
const vx_char implementation[VX_MAX_IMPLEMENTATION_NAME];
504+
/*! \brief The name of additional extensions in this impleemntation */
505+
const vx_char* extension;
278506
};
279507

280508
#endif /* VX_CONTEXT_H */

0 commit comments

Comments
 (0)