vx_api.h 68 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284
  1. /*
  2. * Copyright (c) 2012-2017 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. #ifndef _OPENVX_API_H_
  17. #define _OPENVX_API_H_
  18. /*!
  19. * \file
  20. * \brief The API definition for OpenVX.
  21. */
  22. #ifdef __cplusplus
  23. extern "C" {
  24. #endif
  25. /*==============================================================================
  26. CONTEXT
  27. =============================================================================*/
  28. /*! \brief Creates a <tt>\ref vx_context</tt>.
  29. * \details This creates a top-level object context for OpenVX.
  30. * \note This is required to do anything else.
  31. * \returns The reference to the implementation context <tt>\ref vx_context</tt>. Any possible errors
  32. * preventing a successful creation should be checked using <tt>\ref vxGetStatus</tt>.
  33. * \ingroup group_context
  34. * \post <tt>\ref vxReleaseContext</tt>
  35. */
  36. VX_API_ENTRY vx_context VX_API_CALL vxCreateContext(void);
  37. /*! \brief Releases the OpenVX object context.
  38. * \details All reference counted objects are garbage-collected by the return of this call.
  39. * No calls are possible using the parameter context after the context has been
  40. * released until a new reference from <tt>\ref vxCreateContext</tt> is returned.
  41. * All outstanding references to OpenVX objects from this context are invalid
  42. * after this call.
  43. * \param [in] context The pointer to the reference to the context.
  44. * \post After returning from this function the reference is zeroed.
  45. * \return A <tt>\ref vx_status_e</tt> enumeration.
  46. * \retval VX_SUCCESS No errors; any other value indicates failure.
  47. * \retval VX_ERROR_INVALID_REFERENCE context is not a valid <tt>\ref vx_context</tt> reference.
  48. * \ingroup group_context
  49. * \pre <tt>\ref vxCreateContext</tt>
  50. */
  51. VX_API_ENTRY vx_status VX_API_CALL vxReleaseContext(vx_context *context);
  52. /*! \brief Retrieves the context from any reference from within a context.
  53. * \param [in] reference The reference from which to extract the context.
  54. * \ingroup group_context
  55. * \return The overall context that created the particular
  56. * reference. Any possible errors preventing a successful completion of this function
  57. * should be checked using <tt>\ref vxGetStatus</tt>.
  58. */
  59. VX_API_ENTRY vx_context VX_API_CALL vxGetContext(vx_reference reference);
  60. /*! \brief Queries the context for some specific information.
  61. * \param [in] context The reference to the context.
  62. * \param [in] attribute The attribute to query. Use a <tt>\ref vx_context_attribute_e</tt>.
  63. * \param [out] ptr The location at which to store the resulting value.
  64. * \param [in] size The size in bytes of the container to which \a ptr points.
  65. * \return A <tt>\ref vx_status_e</tt> enumeration.
  66. * \retval VX_SUCCESS No errors; any other value indicates failure.
  67. * \retval VX_ERROR_INVALID_REFERENCE context is not a valid <tt>\ref vx_context</tt> reference.
  68. * \retval VX_ERROR_INVALID_PARAMETERS If any of the other parameters are incorrect.
  69. * \retval VX_ERROR_NOT_SUPPORTED If the attribute is not supported on this implementation.
  70. * \ingroup group_context
  71. */
  72. VX_API_ENTRY vx_status VX_API_CALL vxQueryContext(vx_context context, vx_enum attribute, void *ptr, vx_size size);
  73. /*! \brief Sets an attribute on the context.
  74. * \param [in] context The handle to the overall context.
  75. * \param [in] attribute The attribute to set from <tt>\ref vx_context_attribute_e</tt>.
  76. * \param [in] ptr The pointer to the data to which to set the attribute.
  77. * \param [in] size The size in bytes of the data to which \a ptr points.
  78. * \return A <tt>\ref vx_status_e</tt> enumeration.
  79. * \retval VX_SUCCESS No errors; any other value indicates failure.
  80. * \retval VX_ERROR_INVALID_REFERENCE context is not a valid <tt>\ref vx_context</tt> reference.
  81. * \retval VX_ERROR_INVALID_PARAMETERS If any of the other parameters are incorrect.
  82. * \retval VX_ERROR_NOT_SUPPORTED If the attribute is not settable.
  83. * \ingroup group_context
  84. */
  85. VX_API_ENTRY vx_status VX_API_CALL vxSetContextAttribute(vx_context context, vx_enum attribute, const void *ptr, vx_size size);
  86. /*! \brief Provides a generic API to give platform-specific hints to the implementation.
  87. * \param [in] reference The reference to the object to hint at.
  88. * This could be <tt>\ref vx_context</tt>, <tt>\ref vx_graph</tt>, <tt>\ref vx_node</tt>, <tt>\ref vx_image</tt>, <tt>\ref vx_array</tt>, or any other reference.
  89. * \param [in] hint A <tt>\ref vx_hint_e</tt> \a hint to give to a \ref vx_context. This is a platform-specific optimization or implementation mechanism.
  90. * \param [in] data Optional vendor specific data.
  91. * \param [in] data_size Size of the data structure \p data.
  92. * \return A <tt>\ref vx_status_e</tt> enumeration.
  93. * \retval VX_SUCCESS No errors; any other value indicates failure.
  94. * \retval VX_ERROR_INVALID_REFERENCE reference is not a valid <tt>\ref vx_reference</tt> reference.
  95. * \retval VX_ERROR_NOT_SUPPORTED If the hint is not supported.
  96. * \ingroup group_hint
  97. */
  98. VX_API_ENTRY vx_status VX_API_CALL vxHint(vx_reference reference, vx_enum hint, const void* data, vx_size data_size);
  99. /*! \brief Provides a generic API to give platform-specific directives to the implementations.
  100. * \param [in] reference The reference to the object to set the directive on.
  101. * This could be <tt>\ref vx_context</tt>, <tt>\ref vx_graph</tt>, <tt>\ref vx_node</tt>, <tt>\ref vx_image</tt>, <tt>\ref vx_array</tt>, or any other reference.
  102. * \param [in] directive The directive to set. See <tt>\ref vx_directive_e</tt>.
  103. * \return A <tt>\ref vx_status_e</tt> enumeration.
  104. * \retval VX_SUCCESS No errors; any other value indicates failure.
  105. * \retval VX_ERROR_INVALID_REFERENCE reference is not a valid <tt>\ref vx_reference</tt> reference.
  106. * \retval VX_ERROR_NOT_SUPPORTED If the directive is not supported.
  107. * \note The performance counter directives are only available for the reference \ref vx_context.
  108. * Error VX_ERROR_NOT_SUPPORTED is returned when used with any other reference.
  109. * \ingroup group_directive
  110. */
  111. VX_API_ENTRY vx_status VX_API_CALL vxDirective(vx_reference reference, vx_enum directive);
  112. /*! \brief Provides a generic API to return status values from Object constructors if they
  113. * fail.
  114. * \note Users do not need to strictly check every object creator as the errors
  115. * should properly propagate and be detected during verification time or run-time.
  116. * \code
  117. * vx_image img = vxCreateImage(context, 639, 480, VX_DF_IMAGE_UYVY);
  118. * vx_status status = vxGetStatus((vx_reference)img);
  119. * // status == VX_ERROR_INVALID_DIMENSIONS
  120. * vxReleaseImage(&img);
  121. * \endcode
  122. * \pre Appropriate Object Creator function.
  123. * \post Appropriate Object Release function.
  124. * \param [in] reference The reference to check for construction errors.
  125. * \return A <tt>\ref vx_status_e</tt> enumeration.
  126. * \retval VX_SUCCESS No errors; any other value indicates failure.
  127. * \retval * Some error occurred, please check enumeration list and constructor.
  128. * \ingroup group_basic_features
  129. */
  130. VX_API_ENTRY vx_status VX_API_CALL vxGetStatus(vx_reference reference);
  131. /*!
  132. * \brief Registers user-defined structures to the context.
  133. * \param [in] context The reference to the implementation context.
  134. * \param [in] size The size of user struct in bytes.
  135. * \return A <tt>\ref vx_enum</tt> value that is a type given to the User
  136. * to refer to their custom structure when declaring a <tt>\ref vx_array</tt>
  137. * of that structure.
  138. * \retval VX_TYPE_INVALID If the namespace of types has been exhausted.
  139. * \note This call should only be used once within the lifetime of a context for
  140. * a specific structure.
  141. * \ingroup group_adv_array
  142. */
  143. VX_API_ENTRY vx_enum VX_API_CALL vxRegisterUserStruct(vx_context context, vx_size size);
  144. /*!
  145. * \brief Allocates and registers user-defined kernel enumeration to a context.
  146. * The allocated enumeration is from available pool of 4096 enumerations reserved
  147. * for dynamic allocation from VX_KERNEL_BASE(VX_ID_USER,0).
  148. * \param [in] context The reference to the implementation context.
  149. * \param [out] pKernelEnumId pointer to return <tt>\ref vx_enum</tt> for user-defined kernel.
  150. * \retval VX_SUCCESS No errors; any other value indicates failure.
  151. * \retval VX_ERROR_INVALID_REFERENCE If the context is not a valid <tt>\ref vx_context</tt> reference.
  152. * \retval VX_ERROR_NO_RESOURCES The enumerations has been exhausted.
  153. * \ingroup group_user_kernels
  154. */
  155. VX_API_ENTRY vx_status VX_API_CALL vxAllocateUserKernelId(vx_context context, vx_enum * pKernelEnumId);
  156. /*!
  157. * \brief Allocates and registers user-defined kernel library ID to a context.
  158. *
  159. * The allocated library ID is from available pool of library IDs (1..255)
  160. * reserved for dynamic allocation. The returned libraryId can be used by
  161. * user-kernel library developer to specify individual kernel enum IDs in
  162. * a header file, shown below:
  163. * \code
  164. * #define MY_KERNEL_ID1(libraryId) (VX_KERNEL_BASE(VX_ID_USER,libraryId) + 0);
  165. * #define MY_KERNEL_ID2(libraryId) (VX_KERNEL_BASE(VX_ID_USER,libraryId) + 1);
  166. * #define MY_KERNEL_ID3(libraryId) (VX_KERNEL_BASE(VX_ID_USER,libraryId) + 2);
  167. * \endcode
  168. * \param [in] context The reference to the implementation context.
  169. * \param [out] pLibraryId pointer to <tt>\ref vx_enum</tt> for user-kernel libraryId.
  170. * \retval VX_SUCCESS No errors; any other value indicates failure.
  171. * \retval VX_ERROR_NO_RESOURCES The enumerations has been exhausted.
  172. * \ingroup group_user_kernels
  173. */
  174. VX_API_ENTRY vx_status VX_API_CALL vxAllocateUserKernelLibraryId(vx_context context, vx_enum * pLibraryId);
  175. /*! \brief Sets the default target of the immediate mode. Upon successful execution of this
  176. * function any future execution of immediate mode function is attempted on the new default
  177. * target of the context.
  178. * \param [in] context The reference to the implementation context.
  179. * \param [in] target_enum The default immediate mode target enum to be set
  180. * to the <tt>\ref vx_context</tt> object. Use a <tt>\ref vx_target_e</tt>.
  181. * \param [in] target_string The target name ASCII string. This contains a valid value
  182. * when target_enum is set to <tt>\ref VX_TARGET_STRING</tt>, otherwise it is ignored.
  183. * \ingroup group_context
  184. * \return A <tt>\ref vx_status_e</tt> enumeration.
  185. * \retval VX_SUCCESS Default target set; any other value indicates failure.
  186. * \retval VX_ERROR_INVALID_REFERENCE If the context is not a valid <tt>\ref vx_context</tt> reference.
  187. * \retval VX_ERROR_NOT_SUPPORTED If the specified target is not supported in this context.
  188. */
  189. VX_API_ENTRY vx_status VX_API_CALL vxSetImmediateModeTarget(vx_context context, vx_enum target_enum, const char* target_string);
  190. /*==============================================================================
  191. KERNEL
  192. =============================================================================*/
  193. /*! \brief Loads a library of kernels, called module, into a context.
  194. *
  195. * The module must be a dynamic library with by convention, two exported functions
  196. * named <tt>vxPublishKernels</tt> and <tt>vxUnpublishKernels</tt>.
  197. *
  198. * <tt>vxPublishKernels</tt> must have type <tt>\ref vx_publish_kernels_f</tt>,
  199. * and must add kernels to the context by calling <tt>\ref vxAddUserKernel</tt>
  200. * for each new kernel. <tt>vxPublishKernels</tt> is called by <tt>\ref vxLoadKernels</tt>.
  201. *
  202. * <tt>vxUnpublishKernels</tt> must have type <tt>\ref vx_unpublish_kernels_f</tt>,
  203. * and must remove kernels from the context by calling <tt>\ref vxRemoveKernel</tt>
  204. * for each kernel the <tt>vxPublishKernels</tt> has added.
  205. * <tt>vxUnpublishKernels</tt> is called by <tt>\ref vxUnloadKernels</tt>.
  206. *
  207. * \note When all references to loaded kernels are released, the module
  208. * may be automatically unloaded.
  209. * \param [in] context The reference to the context the kernels must be added to.
  210. * \param [in] module The short name of the module to load. On systems where
  211. * there are specific naming conventions for modules, the name passed
  212. * should ignore such conventions. For example: \c libxyz.so should be
  213. * passed as just \c xyz and the implementation will <i>do the right thing</i> that
  214. * the platform requires.
  215. * \note This API uses the system pre-defined paths for modules.
  216. * \return A <tt>\ref vx_status_e</tt> enumeration.
  217. * \retval VX_SUCCESS No errors; any other value indicates failure.
  218. * \retval VX_ERROR_INVALID_REFERENCE context is not a valid <tt>\ref vx_context</tt> reference.
  219. * \retval VX_ERROR_INVALID_PARAMETERS If any of the other parameters are incorrect.
  220. * \ingroup group_user_kernels
  221. * \see vxGetKernelByName
  222. */
  223. VX_API_ENTRY vx_status VX_API_CALL vxLoadKernels(vx_context context, const vx_char *module);
  224. /*! \brief Unloads all kernels from the OpenVX context that had been loaded from
  225. * the module using the \ref vxLoadKernels function.
  226. *
  227. * The kernel unloading is performed by calling the <tt>vxUnpublishKernels</tt>
  228. * exported function of the module.
  229. * \note <tt>vxUnpublishKernels</tt> is defined in the description of
  230. * <tt>\ref vxLoadKernels</tt>.
  231. *
  232. * \param [in] context The reference to the context the kernels must be removed from.
  233. * \param [in] module The short name of the module to unload. On systems where
  234. * there are specific naming conventions for modules, the name passed
  235. * should ignore such conventions. For example: \c libxyz.so should be
  236. * passed as just \c xyz and the implementation will <i>do the right thing</i>
  237. * that the platform requires.
  238. * \note This API uses the system pre-defined paths for modules.
  239. * \return A <tt>\ref vx_status_e</tt> enumeration.
  240. * \retval VX_SUCCESS No errors; any other value indicates failure.
  241. * \retval VX_ERROR_INVALID_REFERENCE context is not a valid <tt>\ref vx_context</tt> reference.
  242. * \retval VX_ERROR_INVALID_PARAMETERS If any of the other parameters are
  243. incorrect.
  244. * \ingroup group_user_kernels
  245. * \see vxLoadKernels
  246. */
  247. VX_API_ENTRY vx_status VX_API_CALL vxUnloadKernels(vx_context context, const vx_char *module);
  248. /*! \brief Obtains a reference to a kernel using a string to specify the name.
  249. * \details User Kernels follow a "dotted" heirarchical syntax. For example:
  250. * "com.company.example.xyz". The following are strings specifying the kernel names:
  251. * org.khronos.openvx.color_convert
  252. * org.khronos.openvx.channel_extract
  253. * org.khronos.openvx.channel_combine
  254. * org.khronos.openvx.sobel_3x3
  255. * org.khronos.openvx.magnitude
  256. * org.khronos.openvx.phase
  257. * org.khronos.openvx.scale_image
  258. * org.khronos.openvx.table_lookup
  259. * org.khronos.openvx.histogram
  260. * org.khronos.openvx.equalize_histogram
  261. * org.khronos.openvx.absdiff
  262. * org.khronos.openvx.mean_stddev
  263. * org.khronos.openvx.threshold
  264. * org.khronos.openvx.integral_image
  265. * org.khronos.openvx.dilate_3x3
  266. * org.khronos.openvx.erode_3x3
  267. * org.khronos.openvx.median_3x3
  268. * org.khronos.openvx.box_3x3
  269. * org.khronos.openvx.gaussian_3x3
  270. * org.khronos.openvx.custom_convolution
  271. * org.khronos.openvx.gaussian_pyramid
  272. * org.khronos.openvx.accumulate
  273. * org.khronos.openvx.accumulate_weighted
  274. * org.khronos.openvx.accumulate_square
  275. * org.khronos.openvx.minmaxloc
  276. * org.khronos.openvx.convertdepth
  277. * org.khronos.openvx.canny_edge_detector
  278. * org.khronos.openvx.and
  279. * org.khronos.openvx.or
  280. * org.khronos.openvx.xor
  281. * org.khronos.openvx.not
  282. * org.khronos.openvx.multiply
  283. * org.khronos.openvx.add
  284. * org.khronos.openvx.subtract
  285. * org.khronos.openvx.warp_affine
  286. * org.khronos.openvx.warp_perspective
  287. * org.khronos.openvx.harris_corners
  288. * org.khronos.openvx.fast_corners
  289. * org.khronos.openvx.optical_flow_pyr_lk
  290. * org.khronos.openvx.remap
  291. * org.khronos.openvx.halfscale_gaussian
  292. * org.khronos.openvx.laplacian_pyramid
  293. * org.khronos.openvx.laplacian_reconstruct
  294. * org.khronos.openvx.non_linear_filter
  295. * org.khronos.openvx.match_template
  296. * org.khronos.openvx.lbp
  297. * org.khronos.openvx.hough_lines_p
  298. * org.khronos.openvx.tensor_multiply
  299. * org.khronos.openvx.tensor_add
  300. * org.khronos.openvx.tensor_subtract
  301. * org.khronos.openvx.tensor_table_lookup
  302. * org.khronos.openvx.tensor_transpose
  303. * org.khronos.openvx.tensor_convert_depth
  304. * org.khronos.openvx.tensor_matrix_multiply
  305. * org.khronos.openvx.copy
  306. * org.khronos.openvx.non_max_suppression
  307. * org.khronos.openvx.scalar_operation
  308. * org.khronos.openvx.hog_features
  309. * org.khronos.openvx.hog_cells
  310. * org.khronos.openvx.bilateral_filter
  311. * org.khronos.openvx.select
  312. * org.khronos.openvx.min
  313. * org.khronos.openvx.max
  314. * \param [in] context The reference to the implementation context.
  315. * \param [in] name The string of the name of the kernel to get.
  316. * \return A kernel reference. Any possible errors preventing a successful
  317. * completion of the function should be checked using <tt>\ref vxGetStatus</tt>.
  318. * \ingroup group_kernel
  319. * \pre <tt>\ref vxLoadKernels</tt> if the kernel is not provided by the
  320. * OpenVX implementation.
  321. * \note User Kernels should follow a "dotted" hierarchical syntax. For example:
  322. * "com.company.example.xyz".
  323. */
  324. VX_API_ENTRY vx_kernel VX_API_CALL vxGetKernelByName(vx_context context, const vx_char *name);
  325. /*! \brief Obtains a reference to the kernel using the <tt>\ref vx_kernel_e</tt> enumeration.
  326. * \details Enum values above the standard set are assumed to apply to
  327. * loaded libraries.
  328. * \param [in] context The reference to the implementation context.
  329. * \param [in] kernel A value from <tt>\ref vx_kernel_e</tt> or a vendor or client-defined value.
  330. * \return A <tt>\ref vx_kernel</tt> reference. Any possible errors preventing a successful completion
  331. * of the function should be checked using <tt>\ref vxGetStatus</tt>.
  332. * \ingroup group_kernel
  333. * \pre <tt>\ref vxLoadKernels</tt> if the kernel is not provided by the
  334. * OpenVX implementation.
  335. */
  336. VX_API_ENTRY vx_kernel VX_API_CALL vxGetKernelByEnum(vx_context context, vx_enum kernel);
  337. /*! \brief This allows the client to query the kernel to get information about
  338. * the number of parameters, enum values, etc.
  339. * \param [in] kernel The kernel reference to query.
  340. * \param [in] attribute The attribute to query. Use a <tt>\ref vx_kernel_attribute_e</tt>.
  341. * \param [out] ptr The pointer to the location at which to store the resulting value.
  342. * \param [in] size The size of the container to which \a ptr points.
  343. * \return A <tt>\ref vx_status_e</tt> enumeration.
  344. * \retval VX_SUCCESS No errors; any other value indicates failure.
  345. * \retval VX_ERROR_INVALID_REFERENCE kernel is not a valid <tt>\ref vx_kernel</tt> reference.
  346. * \retval VX_ERROR_INVALID_PARAMETERS If any of the other parameters are incorrect.
  347. * \retval VX_ERROR_NOT_SUPPORTED If the attribute value is not supported in this implementation.
  348. * \ingroup group_kernel
  349. */
  350. VX_API_ENTRY vx_status VX_API_CALL vxQueryKernel(vx_kernel kernel, vx_enum attribute, void *ptr, vx_size size);
  351. /*! \brief Release the reference to the kernel.
  352. * The object may not be garbage collected until its total reference count is zero.
  353. * \param [in] kernel The pointer to the kernel reference to release.
  354. * \post After returning from this function the reference is zeroed.
  355. * \return A <tt>\ref vx_status_e</tt> enumeration.
  356. * \retval VX_SUCCESS No errors; any other value indicates failure.
  357. * \retval VX_ERROR_INVALID_REFERENCE kernel is not a valid <tt>\ref vx_kernel</tt> reference.
  358. * \ingroup group_kernel
  359. */
  360. VX_API_ENTRY vx_status VX_API_CALL vxReleaseKernel(vx_kernel *kernel);
  361. /*! \brief Allows users to add custom kernels to a context at run-time.
  362. * \param [in] context The reference to the context the kernel must be added to.
  363. * \param [in] name The string to use to match the kernel.
  364. * \param [in] enumeration The enumerated value of the kernel to be used by clients.
  365. * \param [in] func_ptr The process-local function pointer to be invoked.
  366. * \param [in] numParams The number of parameters for this kernel.
  367. * \param [in] validate The pointer to <tt>\ref vx_kernel_validate_f</tt>, which validates
  368. * parameters to this kernel.
  369. * \param [in] init The kernel initialization function.
  370. * \param [in] deinit The kernel de-initialization function.
  371. * \return A <tt>\ref vx_kernel</tt> reference. Any possible errors
  372. * preventing a successful creation should be checked using <tt>\ref vxGetStatus</tt>.
  373. * \ingroup group_user_kernels
  374. */
  375. VX_API_ENTRY vx_kernel VX_API_CALL vxAddUserKernel(vx_context context,
  376. const vx_char name[VX_MAX_KERNEL_NAME],
  377. vx_enum enumeration,
  378. vx_kernel_f func_ptr,
  379. vx_uint32 numParams,
  380. vx_kernel_validate_f validate,
  381. vx_kernel_initialize_f init,
  382. vx_kernel_deinitialize_f deinit);
  383. /*! \brief This API is called after all parameters have been added to the
  384. * kernel and the kernel is \e ready to be used. Notice that the reference to the kernel created
  385. * by vxAddUserKernel is still valid after the call to vxFinalizeKernel.
  386. * If an error occurs, the kernel is not available for usage by the clients of OpenVX. Typically
  387. * this is due to a mismatch between the number of parameters requested and given.
  388. * \param [in] kernel The reference to the loaded kernel from <tt>\ref vxAddUserKernel</tt>.
  389. * \return A <tt>\ref vx_status_e</tt> enumeration.
  390. * \retval VX_SUCCESS No errors; any other value indicates failure.
  391. * \retval VX_ERROR_INVALID_REFERENCE kernel is not a valid <tt>\ref vx_kernel</tt> reference.
  392. * \pre <tt>\ref vxAddUserKernel</tt> and <tt>\ref vxAddParameterToKernel</tt>
  393. * \ingroup group_user_kernels
  394. */
  395. VX_API_ENTRY vx_status VX_API_CALL vxFinalizeKernel(vx_kernel kernel);
  396. /*! \brief Allows users to set the signatures of the custom kernel.
  397. * \param [in] kernel The reference to the kernel added with <tt>\ref vxAddUserKernel</tt>.
  398. * \param [in] index The index of the parameter to add.
  399. * \param [in] dir The direction of the parameter. This must be either <tt>\ref VX_INPUT</tt> or
  400. * <tt>\ref VX_OUTPUT</tt>. <tt>\ref VX_BIDIRECTIONAL</tt> is not supported for this function.
  401. * \param [in] data_type The type of parameter. This must be a value from <tt>\ref vx_type_e</tt>.
  402. * \param [in] state The state of the parameter (required or not). This must be a value from <tt>\ref vx_parameter_state_e</tt>.
  403. * \return A <tt>\ref vx_status_e</tt> enumerated value.
  404. * \retval VX_SUCCESS Parameter is successfully set on kernel; any other value indicates failure.
  405. * \retval VX_ERROR_INVALID_REFERENCE kernel is not a valid <tt>\ref vx_kernel</tt> reference.
  406. * \retval VX_ERROR_INVALID_PARAMETERS If the parameter is not valid for any reason.
  407. * \pre <tt>\ref vxAddUserKernel</tt>
  408. * \ingroup group_user_kernels
  409. */
  410. VX_API_ENTRY vx_status VX_API_CALL vxAddParameterToKernel(vx_kernel kernel, vx_uint32 index, vx_enum dir, vx_enum data_type, vx_enum state);
  411. /*! \brief Removes a custom kernel from its context and releases it.
  412. * \param [in] kernel The reference to the kernel to remove. Returned from <tt>\ref vxAddUserKernel</tt>.
  413. * \note Any kernel enumerated in the base standard
  414. * cannot be removed; only kernels added through <tt>\ref vxAddUserKernel</tt> can
  415. * be removed.
  416. * \return A <tt>\ref vx_status_e</tt> enumeration. The function returns to the
  417. * application full control over the memory resources provided at the kernel creation time.
  418. * \retval VX_SUCCESS No errors; any other value indicates failure.
  419. * \retval VX_ERROR_INVALID_REFERENCE kernel is not a valid <tt>\ref vx_kernel</tt> reference.
  420. * \retval VX_ERROR_INVALID_PARAMETERS If a base kernel is passed in.
  421. * \retval VX_FAILURE If the application has not released all references to the kernel
  422. * object OR if the application has not released all references to a node that is using
  423. * this kernel OR if the application has not released all references to a graph which
  424. * has nodes that is using this kernel.
  425. * \ingroup group_user_kernels
  426. */
  427. VX_API_ENTRY vx_status VX_API_CALL vxRemoveKernel(vx_kernel kernel);
  428. /*! \brief Sets kernel attributes.
  429. * \param [in] kernel The reference to the kernel.
  430. * \param [in] attribute The enumeration of the attributes. See <tt>\ref vx_kernel_attribute_e</tt>.
  431. * \param [in] ptr The pointer to the location from which to read the attribute.
  432. * \param [in] size The size in bytes of the data area indicated by \a ptr in bytes.
  433. * \note After a kernel has been passed to <tt>\ref vxFinalizeKernel</tt>, no attributes
  434. * can be altered.
  435. * \return A <tt>\ref vx_status_e</tt> enumeration.
  436. * \retval VX_SUCCESS No errors; any other value indicates failure.
  437. * \retval VX_ERROR_INVALID_REFERENCE kernel is not a valid <tt>\ref vx_kernel</tt> reference.
  438. * \ingroup group_user_kernels
  439. */
  440. VX_API_ENTRY vx_status VX_API_CALL vxSetKernelAttribute(vx_kernel kernel, vx_enum attribute, const void *ptr, vx_size size);
  441. /*! \brief Retrieves a <tt>\ref vx_parameter</tt> from a <tt>\ref vx_kernel</tt>.
  442. * \param [in] kernel The reference to the kernel.
  443. * \param [in] index The index of the parameter.
  444. * \return A <tt>\ref vx_parameter</tt> reference. Any possible errors preventing a
  445. * successful completion of the function should be checked using <tt>\ref vxGetStatus</tt>.
  446. * \ingroup group_parameter
  447. */
  448. VX_API_ENTRY vx_parameter VX_API_CALL vxGetKernelParameterByIndex(vx_kernel kernel, vx_uint32 index);
  449. /*==============================================================================
  450. GRAPH
  451. =============================================================================*/
  452. /*! \brief Creates an empty graph.
  453. * \param [in] context The reference to the implementation context.
  454. * \returns A graph reference <tt>\ref vx_graph</tt>. Any possible errors preventing a
  455. * successful creation should be checked using <tt>\ref vxGetStatus</tt>.
  456. * \ingroup group_graph
  457. */
  458. VX_API_ENTRY vx_graph VX_API_CALL vxCreateGraph(vx_context context);
  459. /*! \brief Releases a reference to a graph.
  460. * The object may not be garbage collected until its total reference count is zero.
  461. * Once the reference count is zero, all node references in the graph are automatically
  462. * released as well. Releasing the graph will only release the nodes if the nodes were
  463. * not previously released by the application. Data referenced by those nodes may not
  464. * be released as the user may still have references to the data.
  465. * \param [in] graph The pointer to the graph to release.
  466. * \post After returning from this function the reference is zeroed.
  467. * \return A <tt>\ref vx_status_e</tt> enumeration.
  468. * \retval VX_SUCCESS No errors; any other value indicates failure.
  469. * \retval VX_ERROR_INVALID_REFERENCE graph is not a valid <tt>\ref vx_graph</tt> reference.
  470. * \ingroup group_graph
  471. */
  472. VX_API_ENTRY vx_status VX_API_CALL vxReleaseGraph(vx_graph *graph);
  473. /*! \brief Verifies the state of the graph before it is executed.
  474. * This is useful to catch programmer errors and contract errors. If not verified,
  475. * the graph verifies before being processed.
  476. * \pre Memory for data objects is not guarenteed to exist before
  477. * this call. \post After this call data objects exist unless
  478. * the implementation optimized them out.
  479. * \param [in] graph The reference to the graph to verify.
  480. * \return A status code for graphs with more than one error; it is
  481. * undefined which error will be returned. Register a log callback using <tt>\ref vxRegisterLogCallback</tt>
  482. * to receive each specific error in the graph.
  483. * \return A <tt>\ref vx_status_e</tt> enumeration.
  484. * \retval VX_SUCCESS No errors; any other value indicates failure.
  485. * \retval VX_ERROR_INVALID_REFERENCE graph is not a valid <tt>\ref vx_graph</tt> reference.
  486. * \retval VX_ERROR_MULTIPLE_WRITERS If the graph contains more than one writer
  487. * to any data object.
  488. * \retval VX_ERROR_INVALID_NODE If a node in the graph is invalid or failed be created.
  489. * \retval VX_ERROR_INVALID_GRAPH If the graph contains cycles or some other invalid topology.
  490. * \retval VX_ERROR_INVALID_TYPE If any parameter on a node is given the wrong type.
  491. * \retval VX_ERROR_INVALID_VALUE If any value of any parameter is out of bounds of specification.
  492. * \retval VX_ERROR_INVALID_FORMAT If the image format is not compatible.
  493. * \ingroup group_graph
  494. * \see vxProcessGraph
  495. */
  496. VX_API_ENTRY vx_status VX_API_CALL vxVerifyGraph(vx_graph graph);
  497. /*! \brief This function causes the synchronous processing of a graph. If the graph
  498. * has not been verified, then the implementation verifies the graph
  499. * immediately. If verification fails this function returns a status
  500. * identical to what <tt>\ref vxVerifyGraph</tt> would return. After
  501. * the graph verfies successfully then processing occurs. If the graph was
  502. * previously verified via <tt>\ref vxVerifyGraph</tt> or <tt>\ref vxProcessGraph</tt>
  503. * then the graph is processed. This function blocks until the graph is completed.
  504. * \param [in] graph The graph to execute.
  505. * \return A <tt>\ref vx_status_e</tt> enumeration.
  506. * \retval VX_SUCCESS Graph has been processed; any other value indicates failure.
  507. * \retval VX_ERROR_INVALID_REFERENCE graph is not a valid <tt>\ref vx_graph</tt> reference.
  508. * \retval VX_FAILURE A catastrophic error occurred during processing.
  509. * \ingroup group_graph
  510. */
  511. VX_API_ENTRY vx_status VX_API_CALL vxProcessGraph(vx_graph graph);
  512. VX_API_ENTRY vx_status VX_API_CALL vxProcessSubGraph(vx_graph graph, int start_blk_idx, int blk_count);
  513. /*! \brief Allows the user to query attributes of the Graph.
  514. * \param [in] graph The reference to the created graph.
  515. * \param [in] attribute The <tt>\ref vx_graph_attribute_e</tt> type needed.
  516. * \param [out] ptr The location at which to store the resulting value.
  517. * \param [in] size The size in bytes of the container to which \a ptr points.
  518. * \return A <tt>\ref vx_status_e</tt> enumeration.
  519. * \retval VX_SUCCESS No errors; any other value indicates failure.
  520. * \retval VX_ERROR_INVALID_REFERENCE graph is not a valid <tt>\ref vx_graph</tt> reference.
  521. * \ingroup group_graph
  522. */
  523. VX_API_ENTRY vx_status VX_API_CALL vxQueryGraph(vx_graph graph, vx_enum attribute, void *ptr, vx_size size);
  524. /*! \brief Allows the attributes of the Graph to be set to the provided value.
  525. * \param [in] graph The reference to the graph.
  526. * \param [in] attribute The <tt>\ref vx_graph_attribute_e</tt> type needed.
  527. * \param [in] ptr The location from which to read the value.
  528. * \param [in] size The size in bytes of the container to which \a ptr points.
  529. * \return A <tt>\ref vx_status_e</tt> enumeration.
  530. * \retval VX_SUCCESS No errors; any other value indicates failure.
  531. * \retval VX_ERROR_INVALID_REFERENCE graph is not a valid <tt>\ref vx_graph</tt> reference.
  532. * \ingroup group_graph
  533. */
  534. VX_API_ENTRY vx_status VX_API_CALL vxSetGraphAttribute(vx_graph graph, vx_enum attribute, const void *ptr, vx_size size);
  535. /*! \brief Adds the given parameter extracted from a <tt>\ref vx_node</tt> to the graph.
  536. * \param [in] graph The graph reference that contains the node.
  537. * \param [in] parameter The parameter reference to add to the graph from the node.
  538. * \return A <tt>\ref vx_status_e</tt> enumeration.
  539. * \retval VX_SUCCESS Parameter added to Graph; any other value indicates failure.
  540. * \retval VX_ERROR_INVALID_REFERENCE graph is not a valid <tt>\ref vx_graph</tt> reference or parameter is not a valid <tt>\ref vx_parameter</tt> reference.
  541. * \retval VX_ERROR_INVALID_PARAMETERS The parameter is of a node not in this
  542. * graph.
  543. * \ingroup group_graph_parameters
  544. */
  545. VX_API_ENTRY vx_status VX_API_CALL vxAddParameterToGraph(vx_graph graph, vx_parameter parameter);
  546. /*! \brief Sets a reference to the parameter on the graph. The implementation
  547. * must set this parameter on the originating node as well.
  548. * \param [in] graph The graph reference.
  549. * \param [in] index The parameter index.
  550. * \param [in] value The reference to set to the parameter.
  551. * \return A <tt>\ref vx_status_e</tt> enumeration.
  552. * \retval VX_SUCCESS Parameter set to Graph; any other value indicates failure.
  553. * \retval VX_ERROR_INVALID_REFERENCE graph is not a valid <tt>\ref vx_graph</tt> reference or
  554. * value is not a valid <tt>\ref vx_reference</tt>.
  555. * \retval VX_ERROR_INVALID_PARAMETERS The parameter index is out of bounds or the
  556. * dir parameter is incorrect.
  557. * \ingroup group_graph_parameters
  558. */
  559. VX_API_ENTRY vx_status VX_API_CALL vxSetGraphParameterByIndex(vx_graph graph, vx_uint32 index, vx_reference value);
  560. /*! \brief Retrieves a <tt>\ref vx_parameter</tt> from a <tt>\ref vx_graph</tt>.
  561. * \param [in] graph The graph.
  562. * \param [in] index The index of the parameter.
  563. * \return <tt>\ref vx_parameter</tt> reference. Any possible errors preventing a successful
  564. * function completion should be checked using <tt>\ref vxGetStatus</tt>.
  565. * \ingroup group_graph_parameters
  566. */
  567. VX_API_ENTRY vx_parameter VX_API_CALL vxGetGraphParameterByIndex(vx_graph graph, vx_uint32 index);
  568. /*! \brief Returns a Boolean to indicate the state of graph verification.
  569. * \param [in] graph The reference to the graph to check.
  570. * \return A <tt>\ref vx_bool</tt> value.
  571. * \retval vx_true_e The graph is verified.
  572. * \retval vx_false_e The graph is not verified. It must be verified before
  573. * execution either through <tt>\ref vxVerifyGraph</tt> or automatically through
  574. * <tt>\ref vxProcessGraph</tt> or <tt>\ref vxScheduleGraph</tt>.
  575. * \ingroup group_graph
  576. */
  577. VX_API_ENTRY vx_bool VX_API_CALL vxIsGraphVerified(vx_graph graph);
  578. /*==============================================================================
  579. NODE
  580. =============================================================================*/
  581. /*! \brief Creates a reference to a node object for a given kernel.
  582. * \details This node has no references assigned as parameters after completion.
  583. * The client is then required to set these parameters manually by <tt>\ref vxSetParameterByIndex</tt>.
  584. * When clients supply their own node creation functions (for use with User Kernels), this is the API
  585. * to use along with the parameter setting API.
  586. * \param [in] graph The reference to the graph in which this node exists.
  587. * \param [in] kernel The kernel reference to associate with this new node.
  588. * \returns A node reference <tt>\ref vx_node</tt>. Any possible errors preventing a
  589. * successful creation should be checked using <tt>\ref vxGetStatus</tt>.
  590. * \note A call to this API sets all parameters to NULL.
  591. * \ingroup group_adv_node
  592. * \post Call <tt>\ref vxSetParameterByIndex</tt> for as many parameters as needed to be set.
  593. */
  594. VX_API_ENTRY vx_node VX_API_CALL vxCreateGenericNode(vx_graph graph, vx_kernel kernel);
  595. /*! \brief Allows a user to query information out of a node.
  596. * \param [in] node The reference to the node to query.
  597. * \param [in] attribute Use <tt>\ref vx_node_attribute_e</tt> value to query for information.
  598. * \param [out] ptr The location at which to store the resulting value.
  599. * \param [in] size The size in bytesin bytes of the container to which \a ptr points.
  600. * \return A <tt>\ref vx_status_e</tt> enumeration.
  601. * \retval VX_SUCCESS No errors; any other value indicates failure.
  602. * \retval VX_ERROR_INVALID_REFERENCE node is not a valid <tt>\ref vx_node</tt> reference.
  603. * \retval VX_ERROR_INVALID_PARAMETERS The type or size is incorrect.
  604. * \ingroup group_node
  605. */
  606. VX_API_ENTRY vx_status VX_API_CALL vxQueryNode(vx_node node, vx_enum attribute, void *ptr, vx_size size);
  607. /*! \brief Allows a user to set attribute of a node before Graph Validation.
  608. * \param [in] node The reference to the node to set.
  609. * \param [in] attribute Use <tt>\ref vx_node_attribute_e</tt> value to set the desired attribute.
  610. * \param [in] ptr The pointer to the desired value of the attribute.
  611. * \param [in] size The size in bytes of the objects to which \a ptr points.
  612. * \note Some attributes are inherited from the <tt>\ref vx_kernel</tt>, which was used
  613. * to create the node. Some of these can be overridden using this API, notably
  614. * \ref VX_NODE_LOCAL_DATA_SIZE and \ref VX_NODE_LOCAL_DATA_PTR.
  615. * \ingroup group_node
  616. * \return A <tt>\ref vx_status_e</tt> enumeration.
  617. * \retval VX_SUCCESS The attribute was set; any other value indicates failure.
  618. * \retval VX_ERROR_INVALID_REFERENCE node is not a valid <tt>\ref vx_node</tt> reference.
  619. * \retval VX_ERROR_INVALID_PARAMETERS size is not correct for the type needed.
  620. */
  621. VX_API_ENTRY vx_status VX_API_CALL vxSetNodeAttribute(vx_node node, vx_enum attribute, const void *ptr, vx_size size);
  622. /*! \brief Releases a reference to a Node object.
  623. * The object may not be garbage collected until its total reference count is zero.
  624. * \param [in] node The pointer to the reference of the node to release.
  625. * \ingroup group_node
  626. * \post After returning from this function the reference is zeroed.
  627. * \return A <tt>\ref vx_status_e</tt> enumeration.
  628. * \retval VX_SUCCESS No errors; any other value indicates failure.
  629. * \retval VX_ERROR_INVALID_REFERENCE node is not a valid <tt>\ref vx_node</tt> reference.
  630. */
  631. VX_API_ENTRY vx_status VX_API_CALL vxReleaseNode(vx_node *node);
  632. /*! \brief Removes a Node from its parent Graph and releases it.
  633. * \param [in] node The pointer to the node to remove and release.
  634. * \ingroup group_node
  635. * \post After returning from this function the reference is zeroed.
  636. * \return A <tt>\ref vx_status_e</tt> enumeration.
  637. * \retval VX_SUCCESS No errors; any other value indicates failure.
  638. * \retval VX_ERROR_INVALID_REFERENCE node is not a valid <tt>\ref vx_node</tt> reference.
  639. */
  640. VX_API_ENTRY vx_status VX_API_CALL vxRemoveNode(vx_node *node);
  641. /*! \brief Assigns a callback to a node.
  642. * If a callback already exists in this node, this function must return an error
  643. * and the user may clear the callback by passing a NULL pointer as the callback.
  644. * \param [in] node The reference to the node.
  645. * \param [in] callback The callback to associate with completion of this
  646. * specific node.
  647. * \warning This must be used with <b><i>extreme</i></b> caution as it can \e ruin
  648. * optimizations in the power/performance efficiency of a graph.
  649. * \return A <tt>\ref vx_status_e</tt> enumeration.
  650. * \retval VX_SUCCESS Callback assigned; any other value indicates failure.
  651. * \retval VX_ERROR_INVALID_REFERENCE node is not a valid <tt>\ref vx_node</tt> reference.
  652. * \ingroup group_node_callback
  653. */
  654. VX_API_ENTRY vx_status VX_API_CALL vxAssignNodeCallback(vx_node node, vx_nodecomplete_f callback);
  655. /*! \brief Retrieves the current node callback function pointer set on the node.
  656. * \param [in] node The reference to the <tt>\ref vx_node</tt> object.
  657. * \ingroup group_node_callback
  658. * \return vx_nodecomplete_f The pointer to the callback function.
  659. * \retval NULL No callback is set.
  660. * \retval * The node callback function.
  661. */
  662. VX_API_ENTRY vx_nodecomplete_f VX_API_CALL vxRetrieveNodeCallback(vx_node node);
  663. /*! \brief Sets the node target to the provided value. A success invalidates the graph
  664. * that the node belongs to (<tt>\ref vxVerifyGraph</tt> must be called before the next execution)
  665. * \param [in] node The reference to the <tt>\ref vx_node</tt> object.
  666. * \param [in] target_enum The target enum to be set to the <tt>\ref vx_node</tt> object.
  667. * Use a <tt>\ref vx_target_e</tt>.
  668. * \param [in] target_string The target name ASCII string. This contains a valid value
  669. * when target_enum is set to <tt>\ref VX_TARGET_STRING</tt>, otherwise it is ignored.
  670. * \ingroup group_node
  671. * \return A <tt>\ref vx_status_e</tt> enumeration.
  672. * \retval VX_SUCCESS Node target set; any other value indicates failure.
  673. * \retval VX_ERROR_INVALID_REFERENCE node is not a valid <tt>\ref vx_node</tt> reference.
  674. * \retval VX_ERROR_NOT_SUPPORTED If the node kernel is not supported by the specified target.
  675. */
  676. VX_API_ENTRY vx_status VX_API_CALL vxSetNodeTarget(vx_node node, vx_enum target_enum, const char* target_string);
  677. /*! \brief Creates replicas of the same node first_node to process a set of objects
  678. * stored in <tt>\ref vx_pyramid</tt> or <tt>\ref vx_object_array</tt>.
  679. * first_node needs to have as parameter levels 0 of a <tt>\ref vx_pyramid</tt> or the index 0 of a <tt>\ref vx_object_array</tt>.
  680. * Replica nodes are not accessible by the application through any means. An application request for removal of
  681. * first_node from the graph will result in removal of all replicas. Any change of parameter or attribute of
  682. * first_node will be propagated to the replicas. <tt>\ref vxVerifyGraph</tt> shall enforce consistency of parameters and attributes
  683. * in the replicas.
  684. * \param [in] graph The reference to the graph.
  685. * \param [in] first_node The reference to the node in the graph that will be replicated.
  686. * \param [in] replicate an array of size equal to the number of node parameters, vx_true_e for the parameters
  687. * that should be iterated over (should be a reference to a vx_pyramid or a vx_object_array),
  688. * vx_false_e for the parameters that should be the same across replicated nodes and for optional
  689. * parameters that are not used. Should be vx_true_e for all output and bidirectional parameters.
  690. * \param [in] number_of_parameters number of elements in the replicate array
  691. * \return A <tt>\ref vx_status_e</tt> enumeration.
  692. * \retval VX_SUCCESS No errors; any other value indicates failure.
  693. * \retval VX_ERROR_INVALID_REFERENCE graph is not a valid <tt>\ref vx_graph</tt> reference, or first_node is not a
  694. * valid <tt>\ref vx_node</tt> reference.
  695. * \retval VX_ERROR_NOT_COMPATIBLE At least one of replicated parameters is not of level 0 of a pyramid or at index 0 of an object array.
  696. * \retval VX_FAILURE If the node does not belong to the graph, or the number of objects in the parent objects of inputs and output are not the same.
  697. * \ingroup group_node
  698. */
  699. VX_API_ENTRY vx_status VX_API_CALL vxReplicateNode(vx_graph graph, vx_node first_node, vx_bool replicate[], vx_uint32 number_of_parameters);
  700. /*==============================================================================
  701. PARAMETER
  702. =============================================================================*/
  703. /*! \brief Retrieves a <tt>\ref vx_parameter</tt> from a <tt>\ref vx_node</tt>.
  704. * \param [in] node The node from which to extract the parameter.
  705. * \param [in] index The index of the parameter to which to get a reference.
  706. * \return A parameter reference <tt>\ref vx_parameter</tt>. Any possible errors preventing a successful
  707. * completion of the function should be checked using <tt>\ref vxGetStatus</tt>.
  708. * \ingroup group_parameter
  709. */
  710. VX_API_ENTRY vx_parameter VX_API_CALL vxGetParameterByIndex(vx_node node, vx_uint32 index);
  711. /*! \brief Releases a reference to a parameter object.
  712. * The object may not be garbage collected until its total reference count is zero.
  713. * \param [in] param The pointer to the parameter to release.
  714. * \ingroup group_parameter
  715. * \post After returning from this function the reference is zeroed.
  716. * \return A <tt>\ref vx_status_e</tt> enumeration.
  717. * \retval VX_SUCCESS No errors; any other value indicates failure.
  718. * \retval VX_ERROR_INVALID_REFERENCE param is not a valid <tt>\ref vx_parameter</tt> reference.
  719. */
  720. VX_API_ENTRY vx_status VX_API_CALL vxReleaseParameter(vx_parameter *param);
  721. /*! \brief Sets the specified parameter data for a kernel on the node.
  722. * \param [in] node The node that contains the kernel.
  723. * \param [in] index The index of the parameter desired.
  724. * \param [in] value The desired value of the parameter.
  725. * \note A user may not provide a NULL value for a mandatory parameter of this API.
  726. * \return A <tt>\ref vx_status_e</tt> enumeration.
  727. * \retval VX_SUCCESS No errors; any other value indicates failure.
  728. * \retval VX_ERROR_INVALID_REFERENCE node is not a valid <tt>\ref vx_node</tt> reference, or value
  729. * is not a valid <tt>\ref vx_reference</tt> reference.
  730. * \ingroup group_parameter
  731. * \see vxSetParameterByReference
  732. */
  733. VX_API_ENTRY vx_status VX_API_CALL vxSetParameterByIndex(vx_node node, vx_uint32 index, vx_reference value);
  734. /*! \brief Associates a parameter reference and a data reference with a kernel
  735. * on a node.
  736. * \param [in] parameter The reference to the kernel parameter.
  737. * \param [in] value The value to associate with the kernel parameter.
  738. * \note A user may not provide a NULL value for a mandatory parameter of this API.
  739. * \return A <tt>\ref vx_status_e</tt> enumeration.
  740. * \retval VX_SUCCESS No errors; any other value indicates failure.
  741. * \retval VX_ERROR_INVALID_REFERENCE parameter is not a valid <tt>\ref vx_parameter</tt> reference,
  742. * or value is not a valid <tt>\ref vx_reference</tt> reference..
  743. * \ingroup group_parameter
  744. * \see vxGetParameterByIndex
  745. */
  746. VX_API_ENTRY vx_status VX_API_CALL vxSetParameterByReference(vx_parameter parameter, vx_reference value);
  747. /*! \brief Allows the client to query a parameter to determine its meta-information.
  748. * \param [in] parameter The reference to the parameter.
  749. * \param [in] attribute The attribute to query. Use a <tt>\ref vx_parameter_attribute_e</tt>.
  750. * \param [out] ptr The location at which to store the resulting value.
  751. * \param [in] size The size in bytes of the container to which \a ptr points.
  752. * \return A <tt>\ref vx_status_e</tt> enumeration.
  753. * \retval VX_SUCCESS No errors; any other value indicates failure.
  754. * \retval VX_ERROR_INVALID_REFERENCE parameter is not a valid <tt>\ref vx_parameter</tt> reference.
  755. * \ingroup group_parameter
  756. */
  757. VX_API_ENTRY vx_status VX_API_CALL vxQueryParameter(vx_parameter parameter, vx_enum attribute, void *ptr, vx_size size);
  758. /*==============================================================================
  759. SCALAR
  760. =============================================================================*/
  761. /*! \brief Creates a reference to a scalar object. Also see \ref sub_node_parameters.
  762. * \param [in] context The reference to the system context.
  763. * \param [in] data_type The type of data to hold. Must be greater than
  764. * <tt>\ref VX_TYPE_INVALID</tt> and less than or equal to <tt>\ref VX_TYPE_VENDOR_STRUCT_END</tt>.
  765. * Or must be a <tt>\ref vx_enum</tt> returned from <tt>\ref vxRegisterUserStruct</tt>.
  766. * \param [in] ptr The pointer to the initial value of the scalar.
  767. * \ingroup group_scalar
  768. * \returns A scalar reference <tt>\ref vx_scalar</tt>. Any possible errors preventing a
  769. * successful creation should be checked using <tt>\ref vxGetStatus</tt>.
  770. */
  771. VX_API_ENTRY vx_scalar VX_API_CALL vxCreateScalar(vx_context context, vx_enum data_type, const void *ptr);
  772. /*! \brief Creates a reference to a scalar object. Also see \ref sub_node_parameters.
  773. * \param [in] context The reference to the system context.
  774. * \param [in] data_type The type of data to hold. Must be greater than
  775. * <tt>\ref VX_TYPE_INVALID</tt> and less than or equal to <tt>\ref VX_TYPE_VENDOR_STRUCT_END</tt>.
  776. * Or must be a <tt>\ref vx_enum</tt> returned from <tt>\ref vxRegisterUserStruct</tt>.
  777. * \param [in] ptr The pointer to the initial value of the scalar.
  778. * \param [in] size Size of data at ptr in bytes.
  779. * \ingroup group_scalar
  780. * \returns A scalar reference <tt>\ref vx_scalar</tt>. Any possible errors preventing a
  781. * successful creation should be checked using <tt>\ref vxGetStatus</tt>.
  782. */
  783. VX_API_ENTRY vx_scalar VX_API_CALL vxCreateScalarWithSize(vx_context context, vx_enum data_type, const void *ptr, vx_size size);
  784. VX_API_ENTRY vx_scalar VX_API_CALL vxCreateGraphScalarWithSize(vx_graph graph, vx_enum data_type, const void* ptr, vx_size size);
  785. /*! \brief Creates an opaque reference to a scalar object with no direct user access.
  786. * \param [in] graph The reference to the parent graph.
  787. * \param [in] data_type The type of data to hold. Must be greater than
  788. * <tt>\ref VX_TYPE_INVALID</tt> and less than or equal to <tt>\ref VX_TYPE_VENDOR_STRUCT_END</tt>.
  789. * Or must be a <tt>\ref vx_enum</tt> returned from <tt>\ref vxRegisterUserStruct</tt>.
  790. * \see <tt>\ref vxCreateScalar</tt>
  791. * \ingroup group_scalar
  792. * \returns A scalar reference <tt>\ref vx_scalar</tt>. Any possible errors preventing a
  793. * successful creation should be checked using <tt>\ref vxGetStatus</tt>.
  794. */
  795. VX_API_ENTRY vx_scalar VX_API_CALL vxCreateVirtualScalar(vx_graph graph, vx_enum data_type);
  796. /*! \brief Releases a reference to a scalar object.
  797. * The object may not be garbage collected until its total reference count is zero.
  798. * \param [in] scalar The pointer to the scalar to release.
  799. * \ingroup group_scalar
  800. * \post After returning from this function the reference is zeroed.
  801. * \return A <tt>\ref vx_status_e</tt> enumeration.
  802. * \retval VX_SUCCESS No errors; any other value indicates failure.
  803. * \retval VX_ERROR_INVALID_REFERENCE scalar is not a valid <tt>\ref vx_scalar</tt> reference.
  804. */
  805. VX_API_ENTRY vx_status VX_API_CALL vxReleaseScalar(vx_scalar *scalar);
  806. /*! \brief Queries attributes from a scalar.
  807. * \param [in] scalar The scalar object.
  808. * \param [in] attribute The enumeration to query. Use a <tt>\ref vx_scalar_attribute_e</tt> enumeration.
  809. * \param [out] ptr The location at which to store the resulting value.
  810. * \param [in] size The size of the container to which \a ptr points.
  811. * \return A <tt>\ref vx_status_e</tt> enumeration.
  812. * \retval VX_SUCCESS No errors; any other value indicates failure.
  813. * \retval VX_ERROR_INVALID_REFERENCE scalar is not a valid <tt>\ref vx_scalar</tt> reference.
  814. * \ingroup group_scalar
  815. */
  816. VX_API_ENTRY vx_status VX_API_CALL vxQueryScalar(vx_scalar scalar, vx_enum attribute, void *ptr, vx_size size);
  817. /*! \brief Allows the application to copy from/into a scalar object.
  818. * \param [in] scalar The reference to the scalar object that is the source or the
  819. * destination of the copy.
  820. * \param [in] user_ptr The address of the memory location where to store the requested data
  821. * if the copy was requested in read mode, or from where to get the data to store into the
  822. * scalar object if the copy was requested in write mode. In the user memory, the scalar is
  823. * a variable of the type corresponding to <tt>\ref VX_SCALAR_TYPE</tt>.
  824. * The accessible memory must be large enough to contain this variable.
  825. * \param [in] usage This declares the effect of the copy with regard to the scalar object
  826. * using the <tt>\ref vx_accessor_e</tt> enumeration. Only <tt>\ref VX_READ_ONLY</tt> and <tt>\ref VX_WRITE_ONLY</tt>
  827. * are supported:
  828. * \arg <tt>\ref VX_READ_ONLY</tt> means that data are copied from the scalar object into the user memory.
  829. * \arg <tt>\ref VX_WRITE_ONLY</tt> means that data are copied into the scalar object from the user memory.
  830. * \param [in] user_mem_type A <tt>\ref vx_memory_type_e</tt> enumeration that specifies
  831. * the memory type of the memory referenced by the user_addr.
  832. * \return A <tt>\ref vx_status_e</tt> enumeration.
  833. * \retval VX_SUCCESS No errors; any other value indicates failure.
  834. * \retval VX_ERROR_INVALID_REFERENCE scalar is not a valid <tt>\ref vx_scalar</tt> reference.
  835. * \retval VX_ERROR_INVALID_PARAMETERS An other parameter is incorrect.
  836. * \ingroup group_scalar
  837. */
  838. VX_API_ENTRY vx_status VX_API_CALL vxCopyScalar(vx_scalar scalar, void *user_ptr, vx_enum usage, vx_enum user_mem_type);
  839. /*! \brief Allows the application to copy from/into a scalar object with size.
  840. * \param [in] scalar The reference to the scalar object that is the source or the
  841. * destination of the copy.
  842. * \param [in] size The size in bytes of the container to which \a user_ptr points.
  843. * \param [in] user_ptr The address of the memory location where to store the requested data
  844. * if the copy was requested in read mode, or from where to get the data to store into the
  845. * scalar object if the copy was requested in write mode. In the user memory, the scalar is
  846. * a variable of the type corresponding to <tt>\ref VX_SCALAR_TYPE</tt>.
  847. * The accessible memory must be large enough to contain this variable.
  848. * \param [in] usage This declares the effect of the copy with regard to the scalar object
  849. * using the <tt>\ref vx_accessor_e</tt> enumeration. Only <tt>\ref VX_READ_ONLY</tt> and <tt>\ref VX_WRITE_ONLY</tt>
  850. * are supported:
  851. * \arg <tt>\ref VX_READ_ONLY</tt> means that data are copied from the scalar object into the user memory.
  852. * \arg <tt>\ref VX_WRITE_ONLY</tt> means that data are copied into the scalar object from the user memory.
  853. * \param [in] user_mem_type A <tt>\ref vx_memory_type_e</tt> enumeration that specifies
  854. * the memory type of the memory referenced by the user_addr.
  855. * \return A <tt>\ref vx_status_e</tt> enumeration.
  856. * \retval VX_ERROR_INVALID_REFERENCE The scalar reference is not actually a scalar reference.
  857. * \retval VX_ERROR_INVALID_PARAMETERS An other parameter is incorrect.
  858. * \ingroup group_scalar
  859. */
  860. VX_API_ENTRY vx_status VX_API_CALL vxCopyScalarWithSize(vx_scalar scalar, vx_size size, void *user_ptr, vx_enum usage, vx_enum user_mem_type);
  861. /*==============================================================================
  862. REFERENCE
  863. =============================================================================*/
  864. /*! \brief Queries any reference type for some basic information like count or type.
  865. * \param [in] ref The reference to query.
  866. * \param [in] attribute The value for which to query. Use <tt>\ref vx_reference_attribute_e</tt>.
  867. * \param [out] ptr The location at which to store the resulting value.
  868. * \param [in] size The size in bytes of the container to which ptr points.
  869. * \return A <tt>\ref vx_status_e</tt> enumeration.
  870. * \retval VX_SUCCESS No errors; any other value indicates failure.
  871. * \retval VX_ERROR_INVALID_REFERENCE ref is not a valid <tt>\ref vx_reference</tt> reference.
  872. * \ingroup group_reference
  873. */
  874. VX_API_ENTRY vx_status VX_API_CALL vxQueryReference(vx_reference ref, vx_enum attribute, void *ptr, vx_size size);
  875. /*! \brief Releases a reference. The reference may potentially refer to multiple OpenVX objects of different types.
  876. * This function can be used instead of calling a specific release function for each individual object type
  877. * (e.g. vxRelease<object>). The object will not be destroyed until its total reference count is zero.
  878. * \note After returning from this function the reference is zeroed.
  879. * \param [in] ref_ptr The pointer to the reference of the object to release.
  880. * \return A <tt>\ref vx_status_e</tt> enumeration.
  881. * \retval VX_SUCCESS No errors; any other value indicates failure.
  882. * \retval VX_ERROR_INVALID_REFERENCE ref_ptr is not a valid <tt>\ref vx_reference</tt> reference.
  883. * \ingroup group_reference
  884. */
  885. VX_API_ENTRY vx_status VX_API_CALL vxReleaseReference(vx_reference* ref_ptr);
  886. /*!
  887. * \brief Increments the reference counter of an object
  888. * This function is used to express the fact that the OpenVX object is referenced
  889. * multiple times by an application. Each time this function is called for
  890. * an object, the application will need to release the object one additional
  891. * time before it can be destructed
  892. * \param [in] ref The reference to retain.
  893. * \return A <tt>\ref vx_status_e</tt> enumeration.
  894. * \retval VX_SUCCESS No errors; any other value indicates failure.
  895. * \retval VX_ERROR_INVALID_REFERENCE ref is not a valid <tt>\ref vx_reference</tt> reference.
  896. * \ingroup group_reference
  897. */
  898. VX_API_ENTRY vx_status VX_API_CALL vxRetainReference(vx_reference ref);
  899. VX_API_ENTRY vx_status VX_API_CALL vxRetainTensor(vx_tensor tensor);
  900. VX_API_ENTRY vx_status VX_API_CALL vxRetainNode(vx_node node);
  901. /*! \brief Name a reference
  902. * \ingroup group_reference
  903. *
  904. * This function is used to associate a name to a referenced object. This name
  905. * can be used by the OpenVX implementation in log messages and any
  906. * other reporting mechanisms.
  907. *
  908. * The OpenVX implementation will not check if the name is unique in
  909. * the reference scope (context or graph). Several references can then
  910. * have the same name.
  911. *
  912. * \param [in] ref The reference to the object to be named.
  913. * \param [in] name Pointer to the '\0' terminated string that identifies
  914. * the referenced object.
  915. * The string is copied by the function so that it
  916. * stays the property of the caller.
  917. * NULL means that the reference is not named.
  918. * The length of the string shall be lower than VX_MAX_REFERENCE_NAME bytes.
  919. * \return A <tt>\ref vx_status_e</tt> enumeration.
  920. * \retval VX_SUCCESS No errors; any other value indicates failure.
  921. * \retval VX_ERROR_INVALID_REFERENCE ref is not a valid <tt>\ref vx_reference</tt> reference.
  922. */
  923. VX_API_ENTRY vx_status VX_API_CALL vxSetReferenceName(vx_reference ref, const vx_char *name);
  924. /*==============================================================================
  925. DELAY
  926. =============================================================================*/
  927. /*! \brief Queries a <tt>\ref vx_delay</tt> object attribute.
  928. * \param [in] delay The reference to a delay object.
  929. * \param [in] attribute The attribute to query. Use a <tt>\ref vx_delay_attribute_e</tt> enumeration.
  930. * \param [out] ptr The location at which to store the resulting value.
  931. * \param [in] size The size of the container to which \a ptr points.
  932. * \return A <tt>\ref vx_status_e</tt> enumeration.
  933. * \retval VX_SUCCESS No errors; any other value indicates failure.
  934. * \retval VX_ERROR_INVALID_REFERENCE delay is not a valid <tt>\ref vx_delay</tt> reference.
  935. * \ingroup group_delay
  936. */
  937. VX_API_ENTRY vx_status VX_API_CALL vxQueryDelay(vx_delay delay, vx_enum attribute, void *ptr, vx_size size);
  938. /*! \brief Releases a reference to a delay object.
  939. * The object may not be garbage collected until its total reference count is zero.
  940. * \param [in] delay The pointer to the delay object reference to release.
  941. * \post After returning from this function the reference is zeroed.
  942. * \ingroup group_delay
  943. * \return A <tt>\ref vx_status_e</tt> enumeration.
  944. * \retval VX_SUCCESS No errors; any other value indicates failure.
  945. * \retval VX_ERROR_INVALID_REFERENCE delay is not a valid <tt>\ref vx_delay</tt> reference.
  946. */
  947. VX_API_ENTRY vx_status VX_API_CALL vxReleaseDelay(vx_delay *delay);
  948. /*! \brief Creates a Delay object.
  949. * \details This function creates a delay object with \p num_slots slots. Each slot
  950. * contains a clone of the exemplar. The clones only inherit the metadata of the
  951. * exemplar. The data content of the exemplar is ignored and the clones have their
  952. * data undefined at delay creation time.
  953. * The function does not alter the exemplar. Also, it doesn't retain or release the
  954. * reference to the exemplar.
  955. * \note For the definition of metadata attributes see \ref vxSetMetaFormatAttribute.
  956. * \param [in] context The reference to the context.
  957. * \param [in] exemplar The exemplar object. Supported exemplar object types are:<br>
  958. * \arg \ref VX_TYPE_ARRAY
  959. * \arg \ref VX_TYPE_CONVOLUTION
  960. * \arg \ref VX_TYPE_DISTRIBUTION
  961. * \arg \ref VX_TYPE_IMAGE
  962. * \arg \ref VX_TYPE_LUT
  963. * \arg \ref VX_TYPE_MATRIX
  964. * \arg \ref VX_TYPE_OBJECT_ARRAY
  965. * \arg \ref VX_TYPE_PYRAMID
  966. * \arg \ref VX_TYPE_REMAP
  967. * \arg \ref VX_TYPE_SCALAR
  968. * \arg \ref VX_TYPE_THRESHOLD
  969. * \arg \ref VX_TYPE_TENSOR
  970. * \param [in] num_slots The number of objects in the delay. This value must be greater than zero.
  971. * \returns A delay reference <tt>\ref vx_delay</tt>. Any possible errors preventing a
  972. * successful creation should be checked using <tt>\ref vxGetStatus</tt>.
  973. * \ingroup group_delay
  974. */
  975. VX_API_ENTRY vx_delay VX_API_CALL vxCreateDelay(vx_context context,
  976. vx_reference exemplar,
  977. vx_size num_slots);
  978. /*! \brief Retrieves a reference to a delay slot object.
  979. * \param [in] delay The reference to the delay object.
  980. * \param [in] index The index of the delay slot from which to extract the object reference.
  981. * \return <tt>\ref vx_reference</tt>. Any possible errors preventing a successful
  982. * completion of the function should be checked using <tt>\ref vxGetStatus</tt>.
  983. * \note The delay index is in the range \f$ [-count+1,0] \f$. 0 is always the
  984. * \e current object.
  985. * \ingroup group_delay
  986. * \note A reference retrieved with this function must not be given to its associated
  987. * release API (e.g. <tt>\ref vxReleaseImage</tt>) unless <tt>\ref vxRetainReference</tt> is used.
  988. */
  989. VX_API_ENTRY vx_reference VX_API_CALL vxGetReferenceFromDelay(vx_delay delay, vx_int32 index);
  990. /*! \brief Shifts the internal delay ring by one.
  991. *
  992. * This function performs a shift of the internal delay ring by one. This means that,
  993. * the data originally at index 0 move to index -1 and so forth until index
  994. * \f$ -count+1 \f$. The data originally at index \f$ -count+1 \f$ move to index 0.
  995. * Here \f$ count \f$ is the number of slots in delay ring.
  996. * When a delay is aged, any graph making use of this delay (delay object itself or data
  997. * objects in delay slots) gets its data automatically updated accordingly.
  998. * \param [in] delay
  999. * \return A <tt>\ref vx_status_e</tt> enumeration.
  1000. * \retval VX_SUCCESS Delay was aged; any other value indicates failure.
  1001. * \retval VX_ERROR_INVALID_REFERENCE delay is not a valid <tt>\ref vx_delay</tt> reference.
  1002. * \ingroup group_delay
  1003. */
  1004. VX_API_ENTRY vx_status VX_API_CALL vxAgeDelay(vx_delay delay);
  1005. /*! \brief Register a delay for auto-aging.
  1006. *
  1007. * This function registers a delay object to be auto-aged by the graph.
  1008. * This delay object will be automatically aged after each successful completion of
  1009. * this graph. Aging of a delay object cannot be called during graph execution.
  1010. * A graph abandoned due to a node callback will trigger an auto-aging.
  1011. *
  1012. * If a delay is registered for auto-aging multiple times in a same graph,
  1013. * the delay will be only aged a single time at each graph completion.
  1014. * If a delay is registered for auto-aging in multiple graphs, this delay will
  1015. * aged automatically after each successful completion of any of these graphs.
  1016. *
  1017. * \param [in] graph The graph to which the delay is registered for auto-aging.
  1018. * \param [in] delay The delay to automatically age.
  1019. *
  1020. * \return A <tt>\ref vx_status_e</tt> enumeration.
  1021. * \retval VX_SUCCESS No errors; any other value indicates failure.
  1022. * \retval VX_ERROR_INVALID_REFERENCE graph is not a valid <tt>\ref vx_graph</tt> reference, or
  1023. * delay is not a valid <tt>\ref vx_delay</tt> reference.
  1024. * \ingroup group_graph
  1025. */
  1026. VX_API_ENTRY vx_status VX_API_CALL vxRegisterAutoAging(vx_graph graph, vx_delay delay);
  1027. /*==============================================================================
  1028. META FORMAT
  1029. =============================================================================*/
  1030. /*! \brief This function allows a user to set the attributes of a <tt>\ref vx_meta_format</tt> object in a kernel output validator.
  1031. *
  1032. * The \ref vx_meta_format object contains two types of information: data object meta data and
  1033. * some specific information that defines how the valid region of an image changes
  1034. *
  1035. * The meta data attributes that can be set are identified by this list:
  1036. * - \ref vx_image : \ref VX_IMAGE_FORMAT, \ref VX_IMAGE_HEIGHT, \ref VX_IMAGE_WIDTH
  1037. * - \ref vx_array : \ref VX_ARRAY_CAPACITY, \ref VX_ARRAY_ITEMTYPE
  1038. * - \ref vx_pyramid : \ref VX_PYRAMID_FORMAT, \ref VX_PYRAMID_HEIGHT, \ref VX_PYRAMID_WIDTH, \ref VX_PYRAMID_LEVELS, \ref VX_PYRAMID_SCALE
  1039. * - \ref vx_scalar : \ref VX_SCALAR_TYPE
  1040. * - \ref vx_matrix : \ref VX_MATRIX_TYPE, \ref VX_MATRIX_ROWS, \ref VX_MATRIX_COLUMNS
  1041. * - \ref vx_distribution : \ref VX_DISTRIBUTION_BINS, \ref VX_DISTRIBUTION_OFFSET, \ref VX_DISTRIBUTION_RANGE
  1042. * - \ref vx_remap : \ref VX_REMAP_SOURCE_WIDTH, \ref VX_REMAP_SOURCE_HEIGHT, \ref VX_REMAP_DESTINATION_WIDTH, \ref VX_REMAP_DESTINATION_HEIGHT
  1043. * - \ref vx_lut : \ref VX_LUT_TYPE, \ref VX_LUT_COUNT
  1044. * - \ref vx_threshold : \ref VX_THRESHOLD_TYPE, \ref VX_THRESHOLD_INPUT_FORMAT, \ref VX_THRESHOLD_INPUT_FORMAT
  1045. * - \ref vx_object_array : \ref VX_OBJECT_ARRAY_NUMITEMS, \ref VX_OBJECT_ARRAY_ITEMTYPE
  1046. * - \ref vx_tensor : \ref VX_TENSOR_NUMBER_OF_DIMS, \ref VX_TENSOR_DIMS, \ref VX_TENSOR_DATA_TYPE, \ref VX_TENSOR_FIXED_POINT_POSITION
  1047. * - \ref VX_VALID_RECT_CALLBACK
  1048. * \note For vx_image, a specific attribute can be used to specify the valid region evolution. This information is not a meta data.
  1049. *
  1050. * \param [in] meta The reference to the \ref vx_meta_format struct to set
  1051. * \param [in] attribute Use the subset of data object attributes that define the meta data of this object or attributes from <tt>\ref vx_meta_format</tt>.
  1052. * \param [in] ptr The input pointer of the value to set on the meta format object.
  1053. * \param [in] size The size in bytes of the object to which \a ptr points.
  1054. * \ingroup group_user_kernels
  1055. * \return A <tt>\ref vx_status_e</tt> enumeration.
  1056. * \retval VX_SUCCESS The attribute was set; any other value indicates failure.
  1057. * \retval VX_ERROR_INVALID_REFERENCE meta is not a valid <tt>\ref vx_meta_format</tt> reference.
  1058. * \retval VX_ERROR_INVALID_PARAMETERS size was not correct for the type needed.
  1059. * \retval VX_ERROR_NOT_SUPPORTED the object attribute was not supported on the meta format object.
  1060. * \retval VX_ERROR_INVALID_TYPE attribute type did not match known meta format type.
  1061. */
  1062. VX_API_ENTRY vx_status VX_API_CALL vxSetMetaFormatAttribute(vx_meta_format meta, vx_enum attribute, const void *ptr, vx_size size);
  1063. /*! \brief Set a meta format object from an exemplar data object reference
  1064. *
  1065. * This function sets a \ref vx_meta_format object from the meta data of the exemplar
  1066. *
  1067. * \param [in] meta The meta format object to set
  1068. * \param [in] exemplar The exemplar data object.
  1069. * \ingroup group_user_kernels
  1070. * \return A <tt>\ref vx_status_e</tt> enumeration.
  1071. * \retval VX_SUCCESS The meta format was correctly set; any other value indicates failure.
  1072. * \retval VX_ERROR_INVALID_REFERENCE meta is not a valid <tt>\ref vx_meta_format</tt> reference,
  1073. * or exemplar is not a valid <tt>\ref vx_reference</tt> reference.
  1074. */
  1075. VX_API_ENTRY vx_status VX_API_CALL vxSetMetaFormatFromReference(vx_meta_format meta, vx_reference exemplar);
  1076. /*==============================================================================
  1077. TENSOR DATA FUNCTIONS
  1078. =============================================================================*/
  1079. /*! \brief Creates an opaque reference to a tensor data buffer.
  1080. * \details Not guaranteed to exist until the <tt>\ref vx_graph</tt> containing it has been verified.
  1081. * Since functions using tensors, need to understand the context of each dimension. We describe a layout of the dimensions in each function using tensors.
  1082. * That layout is not mandatory. It is done specifically to explain the functions and not to mandate layout. Different implementation may have different layout.
  1083. * Therefore the layout description is logical and not physical. It refers to the order of dimensions given in this function.
  1084. * \param [in] context The reference to the implementation context.
  1085. * \param [in] number_of_dims The number of dimensions.
  1086. * \param [in] dims Dimensions sizes in elements.
  1087. * \param [in] data_type The <tt>\ref vx_type_e</tt> that represents the data type of the tensor data elements.
  1088. * \param [in] fixed_point_position Specifies the fixed point position when the input element type is integer. if 0, calculations are performed in integer math.
  1089. * \return A tensor data reference. Any possible errors preventing a
  1090. * successful creation should be checked using <tt>\ref vxGetStatus</tt>.
  1091. * \ingroup group_object_tensor
  1092. */
  1093. VX_API_ENTRY vx_tensor VX_API_CALL vxCreateTensor(vx_context context, vx_size number_of_dims, const vx_size * dims, vx_enum data_type,vx_int8 fixed_point_position);
  1094. /*! \brief Creates a tensor data from another tensor data given a view. This second
  1095. * reference refers to the data in the original tensor data. Updates to this tensor data
  1096. * updates the parent tensor data. The view must be defined within the dimensions
  1097. * of the parent tensor data.
  1098. * \param [in] tensor The reference to the parent tensor data.
  1099. * \param [in] number_of_dims Number of dimensions in the view. Error return if 0 or greater than number of
  1100. * tensor dimensions. If smaller than number of tensor dimensions, the lower dimensions are assumed.
  1101. * \param [in] view_start View start coordinates
  1102. * \param [in] view_end View end coordinates
  1103. * \return The reference to the sub-tensor. Any possible errors preventing a
  1104. * successful creation should be checked using <tt>\ref vxGetStatus</tt>.
  1105. * \ingroup group_object_tensor
  1106. */
  1107. VX_API_ENTRY vx_tensor VX_API_CALL vxCreateTensorFromView(vx_tensor tensor, vx_size number_of_dims, const vx_size * view_start, const vx_size * view_end);
  1108. /*! \brief Retrieves various attributes of a tensor data.
  1109. * \param [in] tensor The reference to the tensor data to query.
  1110. * \param [in] attribute The attribute to query. Use a <tt>\ref vx_tensor_attribute_e</tt>.
  1111. * \param [out] ptr The location at which to store the resulting value.
  1112. * \param [in] size The size of the container to which \a ptr points.
  1113. * \return A <tt>\ref vx_status_e</tt> enumeration.
  1114. * \retval VX_SUCCESS No errors.
  1115. * \retval VX_ERROR_INVALID_REFERENCE If data is not a <tt>\ref vx_tensor</tt>.
  1116. * \retval VX_ERROR_INVALID_PARAMETERS If any of the other parameters are incorrect.
  1117. * \ingroup group_object_tensor
  1118. */
  1119. VX_API_ENTRY vx_status VX_API_CALL vxQueryTensor(vx_tensor tensor, vx_enum attribute, void *ptr, vx_size size);
  1120. /*! \brief Releases a reference to a tensor data object.
  1121. * The object may not be garbage collected until its total reference count is zero.
  1122. * \param [in] tensor The pointer to the tensor data to release.
  1123. * \post After returning from this function the reference is zeroed.
  1124. * \return A <tt>\ref vx_status_e</tt> enumeration.
  1125. * \retval VX_SUCCESS No errors; all other values indicate failure
  1126. * \retval * An error occurred. See <tt>\ref vx_status_e</tt>.
  1127. * \ingroup group_object_tensor
  1128. */
  1129. VX_API_ENTRY vx_status VX_API_CALL vxReleaseTensor(vx_tensor *tensor);
  1130. #ifdef __cplusplus
  1131. }
  1132. #endif
  1133. #endif