TIOVX User Guide
vx_reference.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2012-2016 The Khronos Group Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 
18 
19 #ifndef VX_REFERENCE_H_
20 #define VX_REFERENCE_H_
21 
22 
23 
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27 
40 typedef enum _tivx_reftype_e {
41  VX_INTERNAL = 1,
42  VX_EXTERNAL = 2,
43  VX_BOTH = 3,
45 
51 
56 typedef vx_status (* VX_API_CALL tivx_reference_release_callback_f)(vx_reference *ref);
57 
66 typedef vx_status (*vx_kernel_callback_f)(vx_enum kernel_enum, vx_bool validate_only, const vx_reference input, const vx_reference output);
67 
73 typedef struct _vx_reference {
74 
76  uint32_t magic;
77 
80 
85 
92 
95 
101 
106 
110 
115 
118  tivx_reference_release_callback_f release_callback;
119 
120  /* \brief Object specific function that is called for generic kernel operations
121  * such as Copy and Select
122  */
123  vx_kernel_callback_f kernel_callback;
124 
127 
128  /* \brief This indicates if the object belongs to a delay */
129  vx_delay delay;
130  /* \brief This indicates the original delay slot index when the object belongs to a delay */
131  vx_int32 delay_slot_index;
132 
135 
140 
144 
151 
154 
157 
159 
170 vx_reference ownCreateReference(vx_context context, vx_enum ref_type, vx_enum reftype, vx_reference scope);
171 
180  vx_enum ref_type,
181  vx_enum reftype,
182  tivx_reference_callback_f destructor);
183 
190 
196 
202 
209 
216 
222 vx_bool ownIsValidType(vx_enum ref_type);
223 
235 
244 
253 
254 
263 
271 
276 
281 
282 
287 
288 
294 
301 
310 
319 
326 
333 
339 vx_status VX_CALLBACK ownKernelCallbackGeneric(vx_enum kernel_enum, vx_bool validate_only, const vx_reference input, const vx_reference output);
340 
341 #ifdef __cplusplus
342 }
343 #endif
344 
345 #endif
struct _vx_delay * vx_delay
vx_bool
Object descriptor.
void ownInitReferenceForDelay(vx_reference ref, vx_delay d, vx_int32 idx)
Used to initialize any vx_reference as a delay element.
struct tivx_vx_mutex_t * tivx_mutex
Typedef for a mutex.
Definition: tivx_mutex.h:82
#define VX_MAX_REFERENCE_NAME
vx_status ownReferenceUnlock(vx_reference ref)
Unlock the reference.
size_t vx_size
int32_t vx_enum
The most basic type in the OpenVX system. Any type that inherits from tivx_reference_t must have a vx...
Definition: vx_reference.h:73
tivx_obj_desc_t * obj_desc
object descriptor
Definition: vx_reference.h:153
vx_status VX_CALLBACK ownKernelCallbackGeneric(vx_enum kernel_enum, vx_bool validate_only, const vx_reference input, const vx_reference output)
Object specific function that is called for generic kernel operations such as Copy, move, swap and Select This API must only be called on the host.
int32_t vx_int32
vx_context context
Pointer to the top level context. If this reference is the context, this will be NULL.
Definition: vx_reference.h:84
uint32_t magic
Magic code which confirms this is a reference.
Definition: vx_reference.h:76
tivx_reftype_e
An internal enum for notating which sort of reference type we need.
Definition: vx_reference.h:40
vx_enum type
Set to an enum value in vx_type_e.
Definition: vx_reference.h:79
vx_enum vx_status
struct _vx_context * vx_context
vx_status ownReferenceAllocMem(vx_reference ref)
Alloc memory associated with this reference, typically data reference.
struct _vx_reference * vx_reference
vx_status ownDeleteReferenceLock(vx_reference ref)
Delete mutex used for locking context/graph.
vx_bool is_array_element
Indicates that the object is an element of a pyramid or object array.
Definition: vx_reference.h:143
tivx_mutex lock
Lock to take for the reference.
Definition: vx_reference.h:126
vx_bool ownIsValidReference(vx_reference ref)
Check if reference is valid.
vx_reference scope
The pointer to the object's scope parent. When virtual objects are scoped within a graph...
Definition: vx_reference.h:91
void ownReferenceSetScope(vx_reference ref, vx_reference scope)
Set scope of a reference.
vx_reference ownReferenceGetHandleFromObjDescId(uint16_t obj_desc_id)
Return reference given a obj desc ID This API must only be called on the host.
vx_reference ownCreateReference(vx_context context, vx_enum ref_type, vx_enum reftype, vx_reference scope)
Create a reference object.
vx_bool ownIsValidType(vx_enum ref_type)
This returns true if the type is within the definition of types in OpenVX.
struct _vx_user_data_object * vx_user_data_object
The User Data Object. User Data Object is a strongly-typed container for other data structures...
vx_status ownAllocReferenceBufferGeneric(vx_reference ref)
There are several reference types that are allocated in the same way This API generalizes this in ord...
uint16_t ownReferenceGetObjDescId(vx_reference ref)
Function to get the descriptor object from the given reference.
vx_status ownInitReference(vx_reference ref, vx_context context, vx_enum ref_type, vx_reference scope)
Init a reference object.
vx_status ownReleaseReferenceInt(vx_reference *ref, vx_enum ref_type, vx_enum reftype, tivx_reference_callback_f destructor)
Used to destroy a reference.
tivx_reference_callback_f destructor_callback
Object specific function that is called to destroy an object when reference count reaches zero...
Definition: vx_reference.h:114
vx_user_data_object supplementary_data
supplementary data
Definition: vx_reference.h:156
vx_bool is_accessible
Can this reference be accessed by user application Used for virtual reference's only.
Definition: vx_reference.h:139
vx_bool ownIsValidSpecificReference(vx_reference ref, vx_enum ref_type)
Used to validate everything but vx_context, vx_image.
vx_status ownCopyReferenceGeneric(vx_reference input, vx_reference output)
There are several reference types that are copied in the same way This API generalizes this in order ...
tivx_reference_release_callback_f release_callback
Object specific function that is called to release an object.
Definition: vx_reference.h:118
vx_size ownSizeOfEnumType(vx_enum item_type)
Get the size of the Type enum.
vx_uint32 ownIncrementReference(vx_reference ref, vx_enum reftype)
Increments the ref count.
#define VX_CALLBACK
vx_bool is_virtual
This indicates if the object is virtual or not.
Definition: vx_reference.h:134
vx_status ownReferenceLock(vx_reference ref)
Lock the reference.
uint32_t vx_uint32
vx_status ownDestructReferenceGeneric(vx_reference ref)
There are several reference types that are destructed in the same way This API generalizes this in or...
vx_uint32 external_count
The count of the number of users with this reference. When greater than 0, this can not be freed...
Definition: vx_reference.h:100
vx_uint32 ownDecrementReference(vx_reference ref, vx_enum reftype)
Decrements the ref count.
vx_uint32 internal_count
The count of the number of framework references. When greater than 0, this can not be freed...
Definition: vx_reference.h:105
vx_status(* vx_kernel_callback_f)(vx_enum kernel_enum, vx_bool validate_only, const vx_reference input, const vx_reference output)
Callback type used to validate or implement kernels for operations involving generic references...
Definition: vx_reference.h:66
vx_status(* tivx_reference_callback_f)(vx_reference ref)
Callback type used to register different callbacks from object derived from references.
Definition: vx_reference.h:50
vx_status ownSwapReferenceGeneric(vx_reference input, vx_reference output)
There are several reference types that are swaped in the same way This API generalizes this in order ...
tivx_reference_callback_f mem_alloc_callback
Object specific function that is called to allocate object memory.
Definition: vx_reference.h:109
vx_status(* VX_API_CALL)(vx_reference *ref)
Callback type used to register release callbacks from object derived from references.
Definition: vx_reference.h:56
vx_bool is_allocated
Is the buffer corresponding to this reference allocated This is only relevant to the data objects and...
Definition: vx_reference.h:150
vx_status ownCreateReferenceLock(vx_reference ref)
Create mutex used for locking context/graph.