vx_api.h 182 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166
  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. IMAGE
  192. =============================================================================*/
  193. /*! \brief Creates an opaque reference to an image buffer.
  194. * \details Not guaranteed to exist until the <tt>\ref vx_graph</tt> containing it has been verified.
  195. * \param [in] context The reference to the implementation context.
  196. * \param [in] width The image width in pixels. The image in the formats of
  197. * <tt>\ref VX_DF_IMAGE_NV12</tt>, <tt>\ref VX_DF_IMAGE_NV21</tt>, <tt>\ref VX_DF_IMAGE_IYUV</tt>,
  198. * <tt>\ref VX_DF_IMAGE_UYVY</tt>, <tt>\ref VX_DF_IMAGE_YUYV</tt> must have even width.
  199. * \param [in] height The image height in pixels. The image in the formats of
  200. * <tt>\ref VX_DF_IMAGE_NV12</tt>, <tt>\ref VX_DF_IMAGE_NV21</tt>, <tt>\ref VX_DF_IMAGE_IYUV</tt>
  201. * must have even height.
  202. * \param [in] color The VX_DF_IMAGE (<tt>\ref vx_df_image_e</tt>) code that represents the format
  203. * of the image and the color space.
  204. * \returns An image reference <tt>\ref vx_image</tt>. Any possible errors preventing a successful
  205. * creation should be checked using <tt>\ref vxGetStatus</tt>.
  206. * \see vxMapImagePatch to obtain direct memory access to the image data.
  207. * \ingroup group_image
  208. */
  209. VX_API_ENTRY vx_image VX_API_CALL vxCreateImage(vx_context context, vx_uint32 width, vx_uint32 height, vx_df_image color);
  210. /*! \brief Creates an image from another image given a rectangle. This second
  211. * reference refers to the data in the original image. Updates to this image
  212. * updates the parent image. The rectangle must be defined within the pixel space
  213. * of the parent image.
  214. * \param [in] img The reference to the parent image.
  215. * \param [in] rect The region of interest rectangle. Must contain points within
  216. * the parent image pixel space.
  217. * \returns An image reference <tt>\ref vx_image</tt> to the sub-image. Any possible errors preventing a
  218. * successful creation should be checked using <tt>\ref vxGetStatus</tt>.
  219. * \ingroup group_image
  220. */
  221. VX_API_ENTRY vx_image VX_API_CALL vxCreateImageFromROI(vx_image img, const vx_rectangle_t *rect);
  222. /*! \brief Creates a reference to an image object that has a singular,
  223. * uniform value in all pixels. The uniform image created is read-only.
  224. * \param [in] context The reference to the implementation context.
  225. * \param [in] width The image width in pixels. The image in the formats of
  226. * <tt>\ref VX_DF_IMAGE_NV12</tt>, <tt>\ref VX_DF_IMAGE_NV21</tt>, <tt>\ref VX_DF_IMAGE_IYUV</tt>,
  227. * <tt>\ref VX_DF_IMAGE_UYVY</tt>, <tt>\ref VX_DF_IMAGE_YUYV</tt> must have even width.
  228. * \param [in] height The image height in pixels. The image in the formats of
  229. * <tt>\ref VX_DF_IMAGE_NV12</tt>, <tt>\ref VX_DF_IMAGE_NV21</tt>,
  230. * <tt>\ref VX_DF_IMAGE_IYUV</tt> must have even height.
  231. * \param [in] color The VX_DF_IMAGE (\ref vx_df_image_e) code that represents the format of the image and the color space.
  232. * \param [in] value The pointer to the pixel value to which to set all pixels. See <tt>\ref vx_pixel_value_t</tt>.
  233. * \returns An image reference <tt>\ref vx_image</tt>. Any possible errors preventing a
  234. * successful creation should be checked using <tt>\ref vxGetStatus</tt>.
  235. * <tt>\see vxMapImagePatch</tt> to obtain direct memory access to the image data.
  236. * \note <tt>\ref vxMapImagePatch</tt> and <tt>\ref vxUnmapImagePatch</tt> may be called with
  237. * a uniform image reference.
  238. * \ingroup group_image
  239. */
  240. VX_API_ENTRY vx_image VX_API_CALL vxCreateUniformImage(vx_context context, vx_uint32 width, vx_uint32 height, vx_df_image color, const vx_pixel_value_t *value);
  241. /*! \brief Creates an opaque reference to an image buffer with no direct
  242. * user access. This function allows setting the image width, height, or format.
  243. * \details Virtual data objects allow users to connect various nodes within a
  244. * graph via data references without access to that data, but they also permit the
  245. * implementation to take maximum advantage of possible optimizations. Use this
  246. * API to create a data reference to link two or more nodes together when the
  247. * intermediate data are not required to be accessed by outside entities. This API
  248. * in particular allows the user to define the image format of the data without
  249. * requiring the exact dimensions. Virtual objects are scoped within the graph
  250. * they are declared a part of, and can't be shared outside of this scope.
  251. * All of the following constructions of virtual images are valid.
  252. * \code
  253. * vx_context context = vxCreateContext();
  254. * vx_graph graph = vxCreateGraph(context);
  255. * vx_image virt[] = {
  256. * vxCreateVirtualImage(graph, 0, 0, VX_DF_IMAGE_U8), // no specified dimension
  257. * vxCreateVirtualImage(graph, 320, 240, VX_DF_IMAGE_VIRT), // no specified format
  258. * vxCreateVirtualImage(graph, 640, 480, VX_DF_IMAGE_U8), // no user access
  259. * };
  260. * \endcode
  261. * \param [in] graph The reference to the parent graph.
  262. * \param [in] width The width of the image in pixels. A value of zero informs the interface
  263. * that the value is unspecified. The image in the formats of <tt>\ref VX_DF_IMAGE_NV12</tt>,
  264. * <tt>\ref VX_DF_IMAGE_NV21</tt>, <tt>\ref VX_DF_IMAGE_IYUV</tt>, <tt>\ref VX_DF_IMAGE_UYVY</tt>,
  265. * <tt>\ref VX_DF_IMAGE_YUYV</tt> must have even width.
  266. * \param [in] height The height of the image in pixels. A value of zero informs the interface
  267. * that the value is unspecified. The image in the formats of <tt>\ref VX_DF_IMAGE_NV12</tt>,
  268. * <tt>\ref VX_DF_IMAGE_NV21</tt>, <tt>\ref VX_DF_IMAGE_IYUV</tt> must have even height.
  269. * \param [in] color The VX_DF_IMAGE (<tt>\ref vx_df_image_e</tt>) code that represents the format
  270. * of the image and the color space. A value of <tt>\ref VX_DF_IMAGE_VIRT</tt> informs the
  271. * interface that the format is unspecified.
  272. * \returns An image reference <tt>\ref vx_image</tt>. Any possible errors preventing a
  273. * successful creation should be checked using <tt>\ref vxGetStatus</tt>.
  274. * \note Passing this reference to <tt>\ref vxMapImagePatch</tt> will return an error.
  275. * \ingroup group_image
  276. */
  277. VX_API_ENTRY vx_image VX_API_CALL vxCreateVirtualImage(vx_graph graph, vx_uint32 width, vx_uint32 height, vx_df_image color);
  278. /*! \brief Creates a reference to an image object that was externally allocated.
  279. * \param [in] context The reference to the implementation context.
  280. * \param [in] color See the <tt>\ref vx_df_image_e</tt> codes. This mandates the
  281. * number of planes needed to be valid in the \a addrs and \a ptrs arrays based on the format given.
  282. * \param [in] addrs[] The array of image patch addressing structures that
  283. * define the dimension and stride of the array of pointers. See note below.
  284. * \param [in] ptrs[] The array of platform-defined references to each plane. See note below.
  285. * \param [in] memory_type <tt>\ref vx_memory_type_e</tt>. When giving <tt>\ref VX_MEMORY_TYPE_HOST</tt>
  286. * the \a ptrs array is assumed to be HOST accessible pointers to memory.
  287. * \returns An image reference <tt>\ref vx_image</tt>. Any possible errors preventing a
  288. * successful creation should be checked using <tt>\ref vxGetStatus</tt>.
  289. * \note The user must call vxMapImagePatch prior to accessing the pixels of an image, even if the
  290. * image was created via <tt>\ref vxCreateImageFromHandle</tt>. Reads or writes to memory referenced
  291. * by ptrs[ ] after calling <tt>\ref vxCreateImageFromHandle</tt> without first calling
  292. * <tt>\ref vxMapImagePatch</tt> will result in undefined behavior.
  293. * The property of addr[] and ptrs[] arrays is kept by the caller (It means that the implementation will
  294. * make an internal copy of the provided information. \a addr and \a ptrs can then simply be application's
  295. * local variables).
  296. * Only \a dim_x, \a dim_y, \a stride_x and \a stride_y fields of the <tt>\ref vx_imagepatch_addressing_t</tt> need to be
  297. * provided by the application. Other fields (\a step_x, \a step_y, \a scale_x & \a scale_y) are ignored by this function.
  298. * The layout of the imported memory must follow a row-major order. In other words, \a stride_x should be
  299. * sufficiently large so that there is no overlap between data elements corresponding to different
  300. * pixels, and \a stride_y >= \a stride_x * \a dim_x.
  301. *
  302. * In order to release the image back to the application we should use <tt>\ref vxSwapImageHandle</tt>.
  303. *
  304. * Import type of the created image is available via the image attribute <tt>\ref vx_image_attribute_e</tt> parameter.
  305. *
  306. * \ingroup group_image
  307. */
  308. VX_API_ENTRY vx_image VX_API_CALL vxCreateImageFromHandle(vx_context context, vx_df_image color, const vx_imagepatch_addressing_t addrs[], void *const ptrs[], vx_enum memory_type);
  309. /*! \brief Swaps the image handle of an image previously created from handle.
  310. *
  311. * This function sets the new image handle (i.e. pointer to all image planes)
  312. * and returns the previous one.
  313. *
  314. * Once this function call has completed, the application gets back the
  315. * ownership of the memory referenced by the previous handle. This memory
  316. * contains up-to-date pixel data, and the application can safely reuse or
  317. * release it.
  318. *
  319. * The memory referenced by the new handle must have been allocated
  320. * consistently with the image properties since the import type,
  321. * memory layout and dimensions are unchanged (see addrs, color, and
  322. * memory_type in <tt>\ref vxCreateImageFromHandle</tt>).
  323. *
  324. * All images created from ROI or channel with this image as parent or ancestor
  325. * will automatically use the memory referenced by the new handle.
  326. *
  327. * The behavior of <tt>\ref vxSwapImageHandle</tt> when called from a user node is undefined.
  328. * \param [in] image The reference to an image created from handle
  329. * \param [in] new_ptrs[] pointer to a caller owned array that contains
  330. * the new image handle (image plane pointers)
  331. * \arg new_ptrs is non NULL. new_ptrs[i] must be non NULL for each i such as
  332. * 0 < i < nbPlanes, otherwise, this is an error. The address of the storage memory
  333. * for image plane i is set to new_ptrs[i]
  334. * \arg new_ptrs is NULL: the previous image storage memory is reclaimed by the
  335. * caller, while no new handle is provided.
  336. * \param [out] prev_ptrs[] pointer to a caller owned array in which
  337. * the application returns the previous image handle
  338. * \arg prev_ptrs is non NULL. prev_ptrs must have at least as many
  339. * elements as the number of image planes. For each i such as
  340. * 0 < i < nbPlanes , prev_ptrs[i] is set to the address of the previous storage
  341. * memory for plane i.
  342. * \arg prev_ptrs NULL: the previous handle is not returned.
  343. * \param [in] num_planes Number of planes in the image. This must be set equal to the number of planes of the input image.
  344. * The number of elements in new_ptrs and prev_ptrs arrays must be equal to or greater than num_planes.
  345. * If either array has more than num_planes elements, the extra elements are ignored. If either array is smaller
  346. * than num_planes, the results are undefined.
  347. * \return A <tt>\ref vx_status_e</tt> enumeration.
  348. * \retval VX_SUCCESS No errors.
  349. * \retval VX_ERROR_INVALID_REFERENCE image is not a valid <tt>\ref vx_image</tt> reference.
  350. * reference.
  351. * \retval VX_ERROR_INVALID_PARAMETERS The image was not created from handle or
  352. * the content of new_ptrs is not valid.
  353. * \retval VX_FAILURE The image was already being accessed.
  354. * \ingroup group_image
  355. */
  356. VX_API_ENTRY vx_status VX_API_CALL vxSwapImageHandle(vx_image image, void* const new_ptrs[], void* prev_ptrs[], vx_size num_planes);
  357. /*! \brief Retrieves various attributes of an image.
  358. * \param [in] image The reference to the image to query.
  359. * \param [in] attribute The attribute to query. Use a <tt>\ref vx_image_attribute_e</tt>.
  360. * \param [out] ptr The location at which to store the resulting value.
  361. * \param [in] size The size in bytes of the container to which \a ptr points.
  362. * \return A <tt>\ref vx_status_e</tt> enumeration.
  363. * \retval VX_SUCCESS No errors; any other value indicates failure.
  364. * \retval VX_ERROR_INVALID_REFERENCE image is not a valid <tt>\ref vx_image</tt> reference.
  365. * \retval VX_ERROR_INVALID_PARAMETERS If any of the other parameters are incorrect.
  366. * \retval VX_ERROR_NOT_SUPPORTED If the attribute is not supported on this implementation.
  367. * \ingroup group_image
  368. */
  369. VX_API_ENTRY vx_status VX_API_CALL vxQueryImage(vx_image image, vx_enum attribute, void *ptr, vx_size size);
  370. /*! \brief Allows setting attributes on the image.
  371. * \param [in] image The reference to the image on which to set the attribute.
  372. * \param [in] attribute The attribute to set. Use a <tt>\ref vx_image_attribute_e</tt> enumeration.
  373. * \param [in] ptr The pointer to the location from which to read the value.
  374. * \param [in] size The size in bytes of the object pointed to by \a ptr.
  375. * \return A <tt>\ref vx_status_e</tt> enumeration.
  376. * \retval VX_SUCCESS No errors; any other value indicates failure.
  377. * \retval VX_ERROR_INVALID_REFERENCE image is not a valid <tt>\ref vx_image</tt> reference.
  378. * \retval VX_ERROR_INVALID_PARAMETERS If any of the other parameters are incorrect.
  379. * \ingroup group_image
  380. */
  381. VX_API_ENTRY vx_status VX_API_CALL vxSetImageAttribute(vx_image image, vx_enum attribute, const void *ptr, vx_size size);
  382. /*! \brief Initialize an image with the given pixel value.
  383. * \param [in] image The reference to the image to initialize.
  384. * \param [in] pixel_value The pointer to the constant pixel value to initialize all image pixels. See <tt>\ref vx_pixel_value_t</tt>.
  385. * \return A <tt>\ref vx_status_e</tt> enumeration.
  386. * \retval VX_SUCCESS No errors.
  387. * \retval VX_ERROR_INVALID_REFERENCE If the image is a uniform image, a virtual image, or not a <tt>\ref vx_image</tt>.
  388. * \retval VX_ERROR_INVALID_PARAMETERS If any of the other parameters are incorrect.
  389. * \note All pixels of the entire image are initialized to the indicated pixel value, independently from the valid region.
  390. * The valid region of the image is unaffected by this function. The image remains mutable after the call to this function,
  391. * so its pixels and mutable attributes may be changed by subsequent functions.
  392. * \ingroup group_image
  393. */
  394. VX_API_ENTRY vx_status VX_API_CALL vxSetImagePixelValues(vx_image image, const vx_pixel_value_t *pixel_value);
  395. /*! \brief Releases a reference to an image object.
  396. * The object may not be garbage collected until its total reference count is zero.
  397. *
  398. * An implementation may defer the actual object destruction after its total
  399. * reference count is zero (potentially until context destruction). Thus,
  400. * releasing an image created from handle
  401. * (see <tt>\ref vxCreateImageFromHandle</tt>) and all others objects that may
  402. * reference it (nodes, ROI, or channel for instance) are not sufficient to get back the
  403. * ownership of the memory referenced by the current image handle. The only way
  404. * for this is to call <tt>\ref vxSwapImageHandle</tt>) before releasing the
  405. * image.
  406. *
  407. * \param [in] image The pointer to the image to release.
  408. * \post After returning from this function the reference is zeroed.
  409. * \return A <tt>\ref vx_status_e</tt> enumeration.
  410. * \retval VX_SUCCESS No errors; any other value indicates failure.
  411. * \retval VX_ERROR_INVALID_REFERENCE image is not a valid <tt>\ref vx_image</tt> reference.
  412. * \ingroup group_image
  413. */
  414. VX_API_ENTRY vx_status VX_API_CALL vxReleaseImage(vx_image *image);
  415. /*!
  416. * \brief Accesses a specific indexed pixel in an image patch.
  417. * \param [in] ptr The base pointer of the patch as returned from <tt>\ref vxMapImagePatch</tt>.
  418. * \param [in] index The 0 based index of the pixel count in the patch. Indexes increase horizontally by 1 then wrap around to the next row.
  419. * \param [in] addr The pointer to the addressing mode information returned from <tt>\ref vxMapImagePatch</tt>.
  420. * \return void * Returns the pointer to the specified pixel.
  421. * \pre <tt>\ref vxMapImagePatch</tt>
  422. * \ingroup group_image
  423. */
  424. VX_API_ENTRY void * VX_API_CALL vxFormatImagePatchAddress1d(void *ptr, vx_uint32 index, const vx_imagepatch_addressing_t *addr);
  425. /*!
  426. * \brief Accesses a specific pixel at a 2d coordinate in an image patch.
  427. * \param [in] ptr The base pointer of the patch as returned from <tt>\ref vxMapImagePatch</tt>.
  428. * \param [in] x The x dimension within the patch.
  429. * \param [in] y The y dimension within the patch.
  430. * \param [in] addr The pointer to the addressing mode information returned from <tt>\ref vxMapImagePatch</tt>.
  431. * \return void * Returns the pointer to the specified pixel.
  432. * \pre <tt>\ref vxMapImagePatch</tt>
  433. * \ingroup group_image
  434. */
  435. VX_API_ENTRY void * VX_API_CALL vxFormatImagePatchAddress2d(void *ptr, vx_uint32 x, vx_uint32 y, const vx_imagepatch_addressing_t *addr);
  436. /*! \brief Retrieves the valid region of the image as a rectangle.
  437. * \param [in] image The image from which to retrieve the valid region.
  438. * \param [out] rect The destination rectangle.
  439. * \return A <tt>\ref vx_status_e</tt> enumeration.
  440. * \retval VX_SUCCESS No errors; any other value indicates failure.
  441. * \retval VX_ERROR_INVALID_REFERENCE image is not a valid <tt>\ref vx_image</tt> reference.
  442. * \retval VX_ERROR_INVALID_PARAMETERS Invalid rect.
  443. * \note This rectangle can be passed directly to <tt>\ref vxMapImagePatch</tt> to get
  444. * the full valid region of the image.
  445. * \ingroup group_image
  446. */
  447. VX_API_ENTRY vx_status VX_API_CALL vxGetValidRegionImage(vx_image image, vx_rectangle_t *rect);
  448. /*! \brief Allows the application to copy a rectangular patch from/into an image object plane.
  449. * \param [in] image The reference to the image object that is the source or the
  450. * destination of the copy.
  451. * \param [in] image_rect The coordinates of the image patch. The patch must be within
  452. * the bounds of the image. (start_x, start_y) gives the coordinates of the topleft
  453. * pixel inside the patch, while (end_x, end_y) gives the coordinates of the bottomright
  454. * element out of the patch. Must be 0 <= start < end <= number of pixels in the image dimension.
  455. * \param [in] image_plane_index The plane index of the image object that is the source or the
  456. * destination of the patch copy.
  457. * \param [in] user_addr The address of a structure describing the layout of the
  458. * user memory location pointed by user_ptr. In the structure, only dim_x, dim_y,
  459. * stride_x and stride_y fields must be provided, other fields are ignored by the function.
  460. * The layout of the user memory must follow a row major order:
  461. * stride_x >= pixel size in bytes, and stride_y >= stride_x * dim_x.
  462. * \param [in] user_ptr The address of the memory location where to store the requested data
  463. * if the copy was requested in read mode, or from where to get the data to store into the image
  464. * object if the copy was requested in write mode. The accessible memory must be large enough
  465. * to contain the specified patch with the specified layout:
  466. * accessible memory in bytes >= (end_y - start_y) * stride_y.
  467. * \param [in] usage This declares the effect of the copy with regard to the image object
  468. * using the <tt>\ref vx_accessor_e</tt> enumeration. For uniform images, only VX_READ_ONLY
  469. * is supported. For other images, Only <tt>\ref VX_READ_ONLY</tt> and <tt>\ref VX_WRITE_ONLY</tt> are supported:
  470. * \arg <tt>\ref VX_READ_ONLY</tt> means that data is copied from the image object into the application memory
  471. * \arg <tt>\ref VX_WRITE_ONLY</tt> means that data is copied into the image object from the application memory
  472. * \param [in] user_mem_type A <tt>\ref vx_memory_type_e</tt> enumeration that specifies
  473. * the memory type of the memory referenced by the user_addr.
  474. * \return A <tt>\ref vx_status_e</tt> enumeration.
  475. * \retval VX_SUCCESS No errors; any other value indicates failure.
  476. * \retval VX_ERROR_OPTIMIZED_AWAY This is a reference to a virtual image that cannot be
  477. * accessed by the application.
  478. * \retval VX_ERROR_INVALID_REFERENCE image is not a valid <tt>\ref vx_image</tt> reference.
  479. * \retval VX_ERROR_INVALID_PARAMETERS An other parameter is incorrect.
  480. * \note The application may ask for data outside the bounds of the valid region, but
  481. * such data has an undefined value.
  482. * \ingroup group_image
  483. */
  484. VX_API_ENTRY vx_status VX_API_CALL vxCopyImagePatch(vx_image image, const vx_rectangle_t *image_rect, vx_uint32 image_plane_index, const vx_imagepatch_addressing_t *user_addr, void * user_ptr, vx_enum usage, vx_enum user_mem_type);
  485. /*! \brief Allows the application to get direct access to a rectangular patch of an image object plane.
  486. * \param [in] image The reference to the image object that contains the patch to map.
  487. * \param [in] rect The coordinates of image patch. The patch must be within the
  488. * bounds of the image. (start_x, start_y) gives the coordinate of the topleft
  489. * element inside the patch, while (end_x, end_y) give the coordinate of
  490. * the bottomright element out of the patch. Must be 0 <= start < end.
  491. * \param [in] plane_index The plane index of the image object to be accessed.
  492. * \param [out] map_id The address of a <tt>\ref vx_map_id</tt> variable where the function
  493. * returns a map identifier.
  494. * \arg (*map_id) must eventually be provided as the map_id parameter of a call to
  495. * <tt>\ref vxUnmapImagePatch</tt>.
  496. * \param [out] addr The address of a structure describing the memory layout of the
  497. * image patch to access. The function fills the structure pointed by addr with the
  498. * layout information that the application must consult to access the pixel data
  499. * at address (*ptr). The layout of the mapped memory follows a row-major order:
  500. * stride_x>0, stride_y>0 and stride_y >= stride_x * dim_x.
  501. * If the image object being accessed was created via
  502. * <tt>\ref vxCreateImageFromHandle</tt>, then the returned memory layout will be
  503. * the identical to that of the addressing structure provided when
  504. * <tt>\ref vxCreateImageFromHandle</tt> was called.
  505. * \param [out] ptr The address of a pointer that the function sets to the
  506. * address where the requested data can be accessed. This returned (*ptr) address
  507. * is only valid between the call to this function and the corresponding call to
  508. * <tt>\ref vxUnmapImagePatch</tt>.
  509. * If image was created via <tt>\ref vxCreateImageFromHandle</tt> then the returned
  510. * address (*ptr) will be the address of the patch in the original pixel buffer
  511. * provided when image was created.
  512. * \param [in] usage This declares the access mode for the image patch, using
  513. * the <tt>\ref vx_accessor_e</tt> enumeration. For uniform images, only VX_READ_ONLY
  514. * is supported.
  515. * \arg <tt>\ref VX_READ_ONLY</tt>: after the function call, the content of the memory location
  516. * pointed by (*ptr) contains the image patch data. Writing into this memory location
  517. * is forbidden and its behavior is undefined.
  518. * \arg <tt>\ref VX_READ_AND_WRITE</tt>: after the function call, the content of the memory
  519. * location pointed by (*ptr) contains the image patch data; writing into this memory
  520. * is allowed only for the location of pixels only and will result in a modification
  521. * of the written pixels in the image object once the patch is unmapped. Writing into
  522. * a gap between pixels (when addr->stride_x > pixel size in bytes or addr->stride_y > addr->stride_x*addr->dim_x)
  523. * is forbidden and its behavior is undefined.
  524. * \arg <tt>\ref VX_WRITE_ONLY</tt>: after the function call, the memory location pointed by (*ptr)
  525. * contains undefined data; writing each pixel of the patch is required prior to
  526. * unmapping. Pixels not written by the application before unmap will become
  527. * undefined after unmap, even if they were well defined before map. Like for
  528. * VX_READ_AND_WRITE, writing into a gap between pixels is forbidden and its behavior
  529. * is undefined.
  530. * \param [in] mem_type A <tt>\ref vx_memory_type_e</tt> enumeration that
  531. * specifies the type of the memory where the image patch is requested to be mapped.
  532. * \param [in] flags An integer that allows passing options to the map operation.
  533. * Use the <tt>\ref vx_map_flag_e</tt> enumeration.
  534. * \return A <tt>\ref vx_status_e</tt> enumeration.
  535. * \retval VX_SUCCESS No errors; any other value indicates failure.
  536. * \retval VX_ERROR_OPTIMIZED_AWAY This is a reference to a virtual image that cannot be
  537. * accessed by the application.
  538. * \retval VX_ERROR_INVALID_REFERENCE image is not a valid <tt>\ref vx_image</tt> reference.
  539. * reference.
  540. * \retval VX_ERROR_INVALID_PARAMETERS An other parameter is incorrect.
  541. * \note The user may ask for data outside the bounds of the valid region, but
  542. * such data has an undefined value.
  543. * \ingroup group_image
  544. * \post <tt>\ref vxUnmapImagePatch </tt> with same (*map_id) value.
  545. */
  546. VX_API_ENTRY vx_status VX_API_CALL vxMapImagePatch(vx_image image, const vx_rectangle_t *rect, vx_uint32 plane_index, vx_map_id *map_id, vx_imagepatch_addressing_t *addr, void **ptr, vx_enum usage, vx_enum mem_type, vx_uint32 flags);
  547. /*! \brief Unmap and commit potential changes to a image object patch that were previously mapped.
  548. * Unmapping an image patch invalidates the memory location from which the patch could
  549. * be accessed by the application. Accessing this memory location after the unmap function
  550. * completes has an undefined behavior.
  551. * \param [in] image The reference to the image object to unmap.
  552. * \param [out] map_id The unique map identifier that was returned by <tt>\ref vxMapImagePatch</tt> .
  553. * \return A <tt>\ref vx_status_e</tt> enumeration.
  554. * \retval VX_SUCCESS No errors; any other value indicates failure.
  555. * \retval VX_ERROR_INVALID_REFERENCE image is not a valid <tt>\ref vx_image</tt> reference.
  556. * \retval VX_ERROR_INVALID_PARAMETERS An other parameter is incorrect.
  557. * \ingroup group_image
  558. * \pre <tt>\ref vxMapImagePatch</tt> with same map_id value
  559. */
  560. VX_API_ENTRY vx_status VX_API_CALL vxUnmapImagePatch(vx_image image, vx_map_id map_id);
  561. /*! \brief Create a sub-image from a single plane channel of another image.
  562. *
  563. * The sub-image refers to the data in the original image. Updates to this image
  564. * update the parent image and reversely.
  565. *
  566. * The function supports only channels that occupy an entire plane of a multi-planar
  567. * images, as listed below. Other cases are not supported.
  568. * VX_CHANNEL_Y from YUV4, IYUV, NV12, NV21
  569. * VX_CHANNEL_U from YUV4, IYUV
  570. * VX_CHANNEL_V from YUV4, IYUV
  571. *
  572. * \param [in] img The reference to the parent image.
  573. * \param [in] channel The <tt>\ref vx_channel_e</tt> channel to use.
  574. * \returns An image reference <tt>\ref vx_image</tt> to the sub-image. Any possible errors preventing a
  575. * successful creation should be checked using <tt>\ref vxGetStatus</tt>.
  576. * \ingroup group_image
  577. */
  578. VX_API_ENTRY vx_image VX_API_CALL vxCreateImageFromChannel(vx_image img, vx_enum channel);
  579. /*! \brief Sets the valid rectangle for an image according to a supplied rectangle.
  580. * \note Setting or changing the valid region from within a user node by means other than the call-back, for
  581. * example by calling <tt>\ref vxSetImageValidRectangle</tt>, might result in an incorrect valid region calculation
  582. * by the framework.
  583. * \param [in] image The reference to the image.
  584. * \param [in] rect The value to be set to the image valid rectangle. A NULL indicates that the valid region is the entire image.
  585. * \return A <tt>\ref vx_status_e</tt> enumeration.
  586. * \retval VX_SUCCESS No errors; any other value indicates failure.
  587. * \retval VX_ERROR_INVALID_REFERENCE image is not a valid <tt>\ref vx_image</tt> reference.
  588. * \retval VX_ERROR_INVALID_PARAMETERS The rect does not define a proper valid rectangle.
  589. * \ingroup group_image
  590. */
  591. VX_API_ENTRY vx_status VX_API_CALL vxSetImageValidRectangle(vx_image image, const vx_rectangle_t *rect);
  592. /*==============================================================================
  593. KERNEL
  594. =============================================================================*/
  595. /*! \brief Loads a library of kernels, called module, into a context.
  596. *
  597. * The module must be a dynamic library with by convention, two exported functions
  598. * named <tt>vxPublishKernels</tt> and <tt>vxUnpublishKernels</tt>.
  599. *
  600. * <tt>vxPublishKernels</tt> must have type <tt>\ref vx_publish_kernels_f</tt>,
  601. * and must add kernels to the context by calling <tt>\ref vxAddUserKernel</tt>
  602. * for each new kernel. <tt>vxPublishKernels</tt> is called by <tt>\ref vxLoadKernels</tt>.
  603. *
  604. * <tt>vxUnpublishKernels</tt> must have type <tt>\ref vx_unpublish_kernels_f</tt>,
  605. * and must remove kernels from the context by calling <tt>\ref vxRemoveKernel</tt>
  606. * for each kernel the <tt>vxPublishKernels</tt> has added.
  607. * <tt>vxUnpublishKernels</tt> is called by <tt>\ref vxUnloadKernels</tt>.
  608. *
  609. * \note When all references to loaded kernels are released, the module
  610. * may be automatically unloaded.
  611. * \param [in] context The reference to the context the kernels must be added to.
  612. * \param [in] module The short name of the module to load. On systems where
  613. * there are specific naming conventions for modules, the name passed
  614. * should ignore such conventions. For example: \c libxyz.so should be
  615. * passed as just \c xyz and the implementation will <i>do the right thing</i> that
  616. * the platform requires.
  617. * \note This API uses the system pre-defined paths for modules.
  618. * \return A <tt>\ref vx_status_e</tt> enumeration.
  619. * \retval VX_SUCCESS No errors; any other value indicates failure.
  620. * \retval VX_ERROR_INVALID_REFERENCE context is not a valid <tt>\ref vx_context</tt> reference.
  621. * \retval VX_ERROR_INVALID_PARAMETERS If any of the other parameters are incorrect.
  622. * \ingroup group_user_kernels
  623. * \see vxGetKernelByName
  624. */
  625. VX_API_ENTRY vx_status VX_API_CALL vxLoadKernels(vx_context context, const vx_char *module);
  626. /*! \brief Unloads all kernels from the OpenVX context that had been loaded from
  627. * the module using the \ref vxLoadKernels function.
  628. *
  629. * The kernel unloading is performed by calling the <tt>vxUnpublishKernels</tt>
  630. * exported function of the module.
  631. * \note <tt>vxUnpublishKernels</tt> is defined in the description of
  632. * <tt>\ref vxLoadKernels</tt>.
  633. *
  634. * \param [in] context The reference to the context the kernels must be removed from.
  635. * \param [in] module The short name of the module to unload. On systems where
  636. * there are specific naming conventions for modules, the name passed
  637. * should ignore such conventions. For example: \c libxyz.so should be
  638. * passed as just \c xyz and the implementation will <i>do the right thing</i>
  639. * that the platform requires.
  640. * \note This API uses the system pre-defined paths for modules.
  641. * \return A <tt>\ref vx_status_e</tt> enumeration.
  642. * \retval VX_SUCCESS No errors; any other value indicates failure.
  643. * \retval VX_ERROR_INVALID_REFERENCE context is not a valid <tt>\ref vx_context</tt> reference.
  644. * \retval VX_ERROR_INVALID_PARAMETERS If any of the other parameters are
  645. incorrect.
  646. * \ingroup group_user_kernels
  647. * \see vxLoadKernels
  648. */
  649. VX_API_ENTRY vx_status VX_API_CALL vxUnloadKernels(vx_context context, const vx_char *module);
  650. /*! \brief Obtains a reference to a kernel using a string to specify the name.
  651. * \details User Kernels follow a "dotted" heirarchical syntax. For example:
  652. * "com.company.example.xyz". The following are strings specifying the kernel names:
  653. * org.khronos.openvx.color_convert
  654. * org.khronos.openvx.channel_extract
  655. * org.khronos.openvx.channel_combine
  656. * org.khronos.openvx.sobel_3x3
  657. * org.khronos.openvx.magnitude
  658. * org.khronos.openvx.phase
  659. * org.khronos.openvx.scale_image
  660. * org.khronos.openvx.table_lookup
  661. * org.khronos.openvx.histogram
  662. * org.khronos.openvx.equalize_histogram
  663. * org.khronos.openvx.absdiff
  664. * org.khronos.openvx.mean_stddev
  665. * org.khronos.openvx.threshold
  666. * org.khronos.openvx.integral_image
  667. * org.khronos.openvx.dilate_3x3
  668. * org.khronos.openvx.erode_3x3
  669. * org.khronos.openvx.median_3x3
  670. * org.khronos.openvx.box_3x3
  671. * org.khronos.openvx.gaussian_3x3
  672. * org.khronos.openvx.custom_convolution
  673. * org.khronos.openvx.gaussian_pyramid
  674. * org.khronos.openvx.accumulate
  675. * org.khronos.openvx.accumulate_weighted
  676. * org.khronos.openvx.accumulate_square
  677. * org.khronos.openvx.minmaxloc
  678. * org.khronos.openvx.convertdepth
  679. * org.khronos.openvx.canny_edge_detector
  680. * org.khronos.openvx.and
  681. * org.khronos.openvx.or
  682. * org.khronos.openvx.xor
  683. * org.khronos.openvx.not
  684. * org.khronos.openvx.multiply
  685. * org.khronos.openvx.add
  686. * org.khronos.openvx.subtract
  687. * org.khronos.openvx.warp_affine
  688. * org.khronos.openvx.warp_perspective
  689. * org.khronos.openvx.harris_corners
  690. * org.khronos.openvx.fast_corners
  691. * org.khronos.openvx.optical_flow_pyr_lk
  692. * org.khronos.openvx.remap
  693. * org.khronos.openvx.halfscale_gaussian
  694. * org.khronos.openvx.laplacian_pyramid
  695. * org.khronos.openvx.laplacian_reconstruct
  696. * org.khronos.openvx.non_linear_filter
  697. * org.khronos.openvx.match_template
  698. * org.khronos.openvx.lbp
  699. * org.khronos.openvx.hough_lines_p
  700. * org.khronos.openvx.tensor_multiply
  701. * org.khronos.openvx.tensor_add
  702. * org.khronos.openvx.tensor_subtract
  703. * org.khronos.openvx.tensor_table_lookup
  704. * org.khronos.openvx.tensor_transpose
  705. * org.khronos.openvx.tensor_convert_depth
  706. * org.khronos.openvx.tensor_matrix_multiply
  707. * org.khronos.openvx.copy
  708. * org.khronos.openvx.non_max_suppression
  709. * org.khronos.openvx.scalar_operation
  710. * org.khronos.openvx.hog_features
  711. * org.khronos.openvx.hog_cells
  712. * org.khronos.openvx.bilateral_filter
  713. * org.khronos.openvx.select
  714. * org.khronos.openvx.min
  715. * org.khronos.openvx.max
  716. * \param [in] context The reference to the implementation context.
  717. * \param [in] name The string of the name of the kernel to get.
  718. * \return A kernel reference. Any possible errors preventing a successful
  719. * completion of the function should be checked using <tt>\ref vxGetStatus</tt>.
  720. * \ingroup group_kernel
  721. * \pre <tt>\ref vxLoadKernels</tt> if the kernel is not provided by the
  722. * OpenVX implementation.
  723. * \note User Kernels should follow a "dotted" hierarchical syntax. For example:
  724. * "com.company.example.xyz".
  725. */
  726. VX_API_ENTRY vx_kernel VX_API_CALL vxGetKernelByName(vx_context context, const vx_char *name);
  727. /*! \brief Obtains a reference to the kernel using the <tt>\ref vx_kernel_e</tt> enumeration.
  728. * \details Enum values above the standard set are assumed to apply to
  729. * loaded libraries.
  730. * \param [in] context The reference to the implementation context.
  731. * \param [in] kernel A value from <tt>\ref vx_kernel_e</tt> or a vendor or client-defined value.
  732. * \return A <tt>\ref vx_kernel</tt> reference. Any possible errors preventing a successful completion
  733. * of the function should be checked using <tt>\ref vxGetStatus</tt>.
  734. * \ingroup group_kernel
  735. * \pre <tt>\ref vxLoadKernels</tt> if the kernel is not provided by the
  736. * OpenVX implementation.
  737. */
  738. VX_API_ENTRY vx_kernel VX_API_CALL vxGetKernelByEnum(vx_context context, vx_enum kernel);
  739. /*! \brief This allows the client to query the kernel to get information about
  740. * the number of parameters, enum values, etc.
  741. * \param [in] kernel The kernel reference to query.
  742. * \param [in] attribute The attribute to query. Use a <tt>\ref vx_kernel_attribute_e</tt>.
  743. * \param [out] ptr The pointer to the location at which to store the resulting value.
  744. * \param [in] size The size of the container to which \a ptr points.
  745. * \return A <tt>\ref vx_status_e</tt> enumeration.
  746. * \retval VX_SUCCESS No errors; any other value indicates failure.
  747. * \retval VX_ERROR_INVALID_REFERENCE kernel is not a valid <tt>\ref vx_kernel</tt> reference.
  748. * \retval VX_ERROR_INVALID_PARAMETERS If any of the other parameters are incorrect.
  749. * \retval VX_ERROR_NOT_SUPPORTED If the attribute value is not supported in this implementation.
  750. * \ingroup group_kernel
  751. */
  752. VX_API_ENTRY vx_status VX_API_CALL vxQueryKernel(vx_kernel kernel, vx_enum attribute, void *ptr, vx_size size);
  753. /*! \brief Release the reference to the kernel.
  754. * The object may not be garbage collected until its total reference count is zero.
  755. * \param [in] kernel The pointer to the kernel reference to release.
  756. * \post After returning from this function the reference is zeroed.
  757. * \return A <tt>\ref vx_status_e</tt> enumeration.
  758. * \retval VX_SUCCESS No errors; any other value indicates failure.
  759. * \retval VX_ERROR_INVALID_REFERENCE kernel is not a valid <tt>\ref vx_kernel</tt> reference.
  760. * \ingroup group_kernel
  761. */
  762. VX_API_ENTRY vx_status VX_API_CALL vxReleaseKernel(vx_kernel *kernel);
  763. /*! \brief Allows users to add custom kernels to a context at run-time.
  764. * \param [in] context The reference to the context the kernel must be added to.
  765. * \param [in] name The string to use to match the kernel.
  766. * \param [in] enumeration The enumerated value of the kernel to be used by clients.
  767. * \param [in] func_ptr The process-local function pointer to be invoked.
  768. * \param [in] numParams The number of parameters for this kernel.
  769. * \param [in] validate The pointer to <tt>\ref vx_kernel_validate_f</tt>, which validates
  770. * parameters to this kernel.
  771. * \param [in] init The kernel initialization function.
  772. * \param [in] deinit The kernel de-initialization function.
  773. * \return A <tt>\ref vx_kernel</tt> reference. Any possible errors
  774. * preventing a successful creation should be checked using <tt>\ref vxGetStatus</tt>.
  775. * \ingroup group_user_kernels
  776. */
  777. VX_API_ENTRY vx_kernel VX_API_CALL vxAddUserKernel(vx_context context,
  778. const vx_char name[VX_MAX_KERNEL_NAME],
  779. vx_enum enumeration,
  780. vx_kernel_f func_ptr,
  781. vx_uint32 numParams,
  782. vx_kernel_validate_f validate,
  783. vx_kernel_initialize_f init,
  784. vx_kernel_deinitialize_f deinit);
  785. /*! \brief This API is called after all parameters have been added to the
  786. * kernel and the kernel is \e ready to be used. Notice that the reference to the kernel created
  787. * by vxAddUserKernel is still valid after the call to vxFinalizeKernel.
  788. * If an error occurs, the kernel is not available for usage by the clients of OpenVX. Typically
  789. * this is due to a mismatch between the number of parameters requested and given.
  790. * \param [in] kernel The reference to the loaded kernel from <tt>\ref vxAddUserKernel</tt>.
  791. * \return A <tt>\ref vx_status_e</tt> enumeration.
  792. * \retval VX_SUCCESS No errors; any other value indicates failure.
  793. * \retval VX_ERROR_INVALID_REFERENCE kernel is not a valid <tt>\ref vx_kernel</tt> reference.
  794. * \pre <tt>\ref vxAddUserKernel</tt> and <tt>\ref vxAddParameterToKernel</tt>
  795. * \ingroup group_user_kernels
  796. */
  797. VX_API_ENTRY vx_status VX_API_CALL vxFinalizeKernel(vx_kernel kernel);
  798. /*! \brief Allows users to set the signatures of the custom kernel.
  799. * \param [in] kernel The reference to the kernel added with <tt>\ref vxAddUserKernel</tt>.
  800. * \param [in] index The index of the parameter to add.
  801. * \param [in] dir The direction of the parameter. This must be either <tt>\ref VX_INPUT</tt> or
  802. * <tt>\ref VX_OUTPUT</tt>. <tt>\ref VX_BIDIRECTIONAL</tt> is not supported for this function.
  803. * \param [in] data_type The type of parameter. This must be a value from <tt>\ref vx_type_e</tt>.
  804. * \param [in] state The state of the parameter (required or not). This must be a value from <tt>\ref vx_parameter_state_e</tt>.
  805. * \return A <tt>\ref vx_status_e</tt> enumerated value.
  806. * \retval VX_SUCCESS Parameter is successfully set on kernel; any other value indicates failure.
  807. * \retval VX_ERROR_INVALID_REFERENCE kernel is not a valid <tt>\ref vx_kernel</tt> reference.
  808. * \retval VX_ERROR_INVALID_PARAMETERS If the parameter is not valid for any reason.
  809. * \pre <tt>\ref vxAddUserKernel</tt>
  810. * \ingroup group_user_kernels
  811. */
  812. 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);
  813. /*! \brief Removes a custom kernel from its context and releases it.
  814. * \param [in] kernel The reference to the kernel to remove. Returned from <tt>\ref vxAddUserKernel</tt>.
  815. * \note Any kernel enumerated in the base standard
  816. * cannot be removed; only kernels added through <tt>\ref vxAddUserKernel</tt> can
  817. * be removed.
  818. * \return A <tt>\ref vx_status_e</tt> enumeration. The function returns to the
  819. * application full control over the memory resources provided at the kernel creation time.
  820. * \retval VX_SUCCESS No errors; any other value indicates failure.
  821. * \retval VX_ERROR_INVALID_REFERENCE kernel is not a valid <tt>\ref vx_kernel</tt> reference.
  822. * \retval VX_ERROR_INVALID_PARAMETERS If a base kernel is passed in.
  823. * \retval VX_FAILURE If the application has not released all references to the kernel
  824. * object OR if the application has not released all references to a node that is using
  825. * this kernel OR if the application has not released all references to a graph which
  826. * has nodes that is using this kernel.
  827. * \ingroup group_user_kernels
  828. */
  829. VX_API_ENTRY vx_status VX_API_CALL vxRemoveKernel(vx_kernel kernel);
  830. /*! \brief Sets kernel attributes.
  831. * \param [in] kernel The reference to the kernel.
  832. * \param [in] attribute The enumeration of the attributes. See <tt>\ref vx_kernel_attribute_e</tt>.
  833. * \param [in] ptr The pointer to the location from which to read the attribute.
  834. * \param [in] size The size in bytes of the data area indicated by \a ptr in bytes.
  835. * \note After a kernel has been passed to <tt>\ref vxFinalizeKernel</tt>, no attributes
  836. * can be altered.
  837. * \return A <tt>\ref vx_status_e</tt> enumeration.
  838. * \retval VX_SUCCESS No errors; any other value indicates failure.
  839. * \retval VX_ERROR_INVALID_REFERENCE kernel is not a valid <tt>\ref vx_kernel</tt> reference.
  840. * \ingroup group_user_kernels
  841. */
  842. VX_API_ENTRY vx_status VX_API_CALL vxSetKernelAttribute(vx_kernel kernel, vx_enum attribute, const void *ptr, vx_size size);
  843. /*! \brief Retrieves a <tt>\ref vx_parameter</tt> from a <tt>\ref vx_kernel</tt>.
  844. * \param [in] kernel The reference to the kernel.
  845. * \param [in] index The index of the parameter.
  846. * \return A <tt>\ref vx_parameter</tt> reference. Any possible errors preventing a
  847. * successful completion of the function should be checked using <tt>\ref vxGetStatus</tt>.
  848. * \ingroup group_parameter
  849. */
  850. VX_API_ENTRY vx_parameter VX_API_CALL vxGetKernelParameterByIndex(vx_kernel kernel, vx_uint32 index);
  851. /*==============================================================================
  852. GRAPH
  853. =============================================================================*/
  854. /*! \brief Creates an empty graph.
  855. * \param [in] context The reference to the implementation context.
  856. * \returns A graph reference <tt>\ref vx_graph</tt>. Any possible errors preventing a
  857. * successful creation should be checked using <tt>\ref vxGetStatus</tt>.
  858. * \ingroup group_graph
  859. */
  860. VX_API_ENTRY vx_graph VX_API_CALL vxCreateGraph(vx_context context);
  861. /*! \brief Releases a reference to a graph.
  862. * The object may not be garbage collected until its total reference count is zero.
  863. * Once the reference count is zero, all node references in the graph are automatically
  864. * released as well. Releasing the graph will only release the nodes if the nodes were
  865. * not previously released by the application. Data referenced by those nodes may not
  866. * be released as the user may still have references to the data.
  867. * \param [in] graph The pointer to the graph to release.
  868. * \post After returning from this function the reference is zeroed.
  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 graph is not a valid <tt>\ref vx_graph</tt> reference.
  872. * \ingroup group_graph
  873. */
  874. VX_API_ENTRY vx_status VX_API_CALL vxReleaseGraph(vx_graph *graph);
  875. /*! \brief Verifies the state of the graph before it is executed.
  876. * This is useful to catch programmer errors and contract errors. If not verified,
  877. * the graph verifies before being processed.
  878. * \pre Memory for data objects is not guarenteed to exist before
  879. * this call. \post After this call data objects exist unless
  880. * the implementation optimized them out.
  881. * \param [in] graph The reference to the graph to verify.
  882. * \return A status code for graphs with more than one error; it is
  883. * undefined which error will be returned. Register a log callback using <tt>\ref vxRegisterLogCallback</tt>
  884. * to receive each specific error in the graph.
  885. * \return A <tt>\ref vx_status_e</tt> enumeration.
  886. * \retval VX_SUCCESS No errors; any other value indicates failure.
  887. * \retval VX_ERROR_INVALID_REFERENCE graph is not a valid <tt>\ref vx_graph</tt> reference.
  888. * \retval VX_ERROR_MULTIPLE_WRITERS If the graph contains more than one writer
  889. * to any data object.
  890. * \retval VX_ERROR_INVALID_NODE If a node in the graph is invalid or failed be created.
  891. * \retval VX_ERROR_INVALID_GRAPH If the graph contains cycles or some other invalid topology.
  892. * \retval VX_ERROR_INVALID_TYPE If any parameter on a node is given the wrong type.
  893. * \retval VX_ERROR_INVALID_VALUE If any value of any parameter is out of bounds of specification.
  894. * \retval VX_ERROR_INVALID_FORMAT If the image format is not compatible.
  895. * \ingroup group_graph
  896. * \see vxProcessGraph
  897. */
  898. VX_API_ENTRY vx_status VX_API_CALL vxVerifyGraph(vx_graph graph);
  899. /*! \brief This function causes the synchronous processing of a graph. If the graph
  900. * has not been verified, then the implementation verifies the graph
  901. * immediately. If verification fails this function returns a status
  902. * identical to what <tt>\ref vxVerifyGraph</tt> would return. After
  903. * the graph verfies successfully then processing occurs. If the graph was
  904. * previously verified via <tt>\ref vxVerifyGraph</tt> or <tt>\ref vxProcessGraph</tt>
  905. * then the graph is processed. This function blocks until the graph is completed.
  906. * \param [in] graph The graph to execute.
  907. * \return A <tt>\ref vx_status_e</tt> enumeration.
  908. * \retval VX_SUCCESS Graph has been processed; any other value indicates failure.
  909. * \retval VX_ERROR_INVALID_REFERENCE graph is not a valid <tt>\ref vx_graph</tt> reference.
  910. * \retval VX_FAILURE A catastrophic error occurred during processing.
  911. * \ingroup group_graph
  912. */
  913. VX_API_ENTRY vx_status VX_API_CALL vxProcessGraph(vx_graph graph);
  914. #if DUMP_GRAPH
  915. VX_API_ENTRY vx_status VX_API_CALL vxDumpGraph(vx_graph graph, void * info_file);
  916. #endif
  917. /*! \brief Schedules a graph for future execution. If the graph
  918. * has not been verified, then the implementation verifies the graph
  919. * immediately. If verification fails this function returns a status
  920. * identical to what <tt>\ref vxVerifyGraph</tt> would return. After
  921. * the graph verfies successfully then processing occurs. If the graph was
  922. * previously verified via <tt>\ref vxVerifyGraph</tt> or <tt>\ref vxProcessGraph</tt>
  923. * then the graph is processed.
  924. * \param [in] graph The graph to schedule.
  925. * \return A <tt>\ref vx_status_e</tt> enumeration.
  926. * \retval VX_SUCCESS The graph has been scheduled; any other value indicates failure.
  927. * \retval VX_ERROR_INVALID_REFERENCE graph is not a valid <tt>\ref vx_graph</tt> reference.
  928. * \retval VX_ERROR_NO_RESOURCES The graph cannot be scheduled now.
  929. * \retval VX_ERROR_NOT_SUFFICIENT The graph is not verified and has failed
  930. * forced verification.
  931. * \ingroup group_graph
  932. */
  933. VX_API_ENTRY vx_status VX_API_CALL vxScheduleGraph(vx_graph graph);
  934. /*! \brief Waits for a specific graph to complete. If the graph has been scheduled multiple
  935. * times since the last call to vxWaitGraph, then vxWaitGraph returns only when the last
  936. * scheduled execution completes.
  937. * \param [in] graph The graph to wait on.
  938. * \return A <tt>\ref vx_status_e</tt> enumeration.
  939. * \retval VX_SUCCESS The graph has successfully completed execution and its outputs are the
  940. * valid results of the most recent execution; any other value indicates failure.
  941. * \retval VX_ERROR_INVALID_REFERENCE graph is not a valid <tt>\ref vx_graph</tt> reference.
  942. * \retval VX_FAILURE An error occurred or the graph was never scheduled. Output data of the
  943. * graph is undefined.
  944. * \pre <tt>\ref vxScheduleGraph</tt>
  945. * \ingroup group_graph
  946. */
  947. VX_API_ENTRY vx_status VX_API_CALL vxWaitGraph(vx_graph graph);
  948. /*! \brief Allows the user to query attributes of the Graph.
  949. * \param [in] graph The reference to the created graph.
  950. * \param [in] attribute The <tt>\ref vx_graph_attribute_e</tt> type needed.
  951. * \param [out] ptr The location at which to store the resulting value.
  952. * \param [in] size The size in bytes of the container to which \a ptr points.
  953. * \return A <tt>\ref vx_status_e</tt> enumeration.
  954. * \retval VX_SUCCESS No errors; any other value indicates failure.
  955. * \retval VX_ERROR_INVALID_REFERENCE graph is not a valid <tt>\ref vx_graph</tt> reference.
  956. * \ingroup group_graph
  957. */
  958. VX_API_ENTRY vx_status VX_API_CALL vxQueryGraph(vx_graph graph, vx_enum attribute, void *ptr, vx_size size);
  959. /*! \brief Allows the attributes of the Graph to be set to the provided value.
  960. * \param [in] graph The reference to the graph.
  961. * \param [in] attribute The <tt>\ref vx_graph_attribute_e</tt> type needed.
  962. * \param [in] ptr The location from which to read the value.
  963. * \param [in] size The size in bytes of the container to which \a ptr points.
  964. * \return A <tt>\ref vx_status_e</tt> enumeration.
  965. * \retval VX_SUCCESS No errors; any other value indicates failure.
  966. * \retval VX_ERROR_INVALID_REFERENCE graph is not a valid <tt>\ref vx_graph</tt> reference.
  967. * \ingroup group_graph
  968. */
  969. VX_API_ENTRY vx_status VX_API_CALL vxSetGraphAttribute(vx_graph graph, vx_enum attribute, const void *ptr, vx_size size);
  970. /*! \brief Adds the given parameter extracted from a <tt>\ref vx_node</tt> to the graph.
  971. * \param [in] graph The graph reference that contains the node.
  972. * \param [in] parameter The parameter reference to add to the graph from the node.
  973. * \return A <tt>\ref vx_status_e</tt> enumeration.
  974. * \retval VX_SUCCESS Parameter added to Graph; any other value indicates failure.
  975. * \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.
  976. * \retval VX_ERROR_INVALID_PARAMETERS The parameter is of a node not in this
  977. * graph.
  978. * \ingroup group_graph_parameters
  979. */
  980. VX_API_ENTRY vx_status VX_API_CALL vxAddParameterToGraph(vx_graph graph, vx_parameter parameter);
  981. /*! \brief Sets a reference to the parameter on the graph. The implementation
  982. * must set this parameter on the originating node as well.
  983. * \param [in] graph The graph reference.
  984. * \param [in] index The parameter index.
  985. * \param [in] value The reference to set to the parameter.
  986. * \return A <tt>\ref vx_status_e</tt> enumeration.
  987. * \retval VX_SUCCESS Parameter set to Graph; any other value indicates failure.
  988. * \retval VX_ERROR_INVALID_REFERENCE graph is not a valid <tt>\ref vx_graph</tt> reference or
  989. * value is not a valid <tt>\ref vx_reference</tt>.
  990. * \retval VX_ERROR_INVALID_PARAMETERS The parameter index is out of bounds or the
  991. * dir parameter is incorrect.
  992. * \ingroup group_graph_parameters
  993. */
  994. VX_API_ENTRY vx_status VX_API_CALL vxSetGraphParameterByIndex(vx_graph graph, vx_uint32 index, vx_reference value);
  995. /*! \brief Retrieves a <tt>\ref vx_parameter</tt> from a <tt>\ref vx_graph</tt>.
  996. * \param [in] graph The graph.
  997. * \param [in] index The index of the parameter.
  998. * \return <tt>\ref vx_parameter</tt> reference. Any possible errors preventing a successful
  999. * function completion should be checked using <tt>\ref vxGetStatus</tt>.
  1000. * \ingroup group_graph_parameters
  1001. */
  1002. VX_API_ENTRY vx_parameter VX_API_CALL vxGetGraphParameterByIndex(vx_graph graph, vx_uint32 index);
  1003. /*! \brief Returns a Boolean to indicate the state of graph verification.
  1004. * \param [in] graph The reference to the graph to check.
  1005. * \return A <tt>\ref vx_bool</tt> value.
  1006. * \retval vx_true_e The graph is verified.
  1007. * \retval vx_false_e The graph is not verified. It must be verified before
  1008. * execution either through <tt>\ref vxVerifyGraph</tt> or automatically through
  1009. * <tt>\ref vxProcessGraph</tt> or <tt>\ref vxScheduleGraph</tt>.
  1010. * \ingroup group_graph
  1011. */
  1012. VX_API_ENTRY vx_bool VX_API_CALL vxIsGraphVerified(vx_graph graph);
  1013. /*==============================================================================
  1014. NODE
  1015. =============================================================================*/
  1016. /*! \brief Creates a reference to a node object for a given kernel.
  1017. * \details This node has no references assigned as parameters after completion.
  1018. * The client is then required to set these parameters manually by <tt>\ref vxSetParameterByIndex</tt>.
  1019. * When clients supply their own node creation functions (for use with User Kernels), this is the API
  1020. * to use along with the parameter setting API.
  1021. * \param [in] graph The reference to the graph in which this node exists.
  1022. * \param [in] kernel The kernel reference to associate with this new node.
  1023. * \returns A node reference <tt>\ref vx_node</tt>. Any possible errors preventing a
  1024. * successful creation should be checked using <tt>\ref vxGetStatus</tt>.
  1025. * \note A call to this API sets all parameters to NULL.
  1026. * \ingroup group_adv_node
  1027. * \post Call <tt>\ref vxSetParameterByIndex</tt> for as many parameters as needed to be set.
  1028. */
  1029. VX_API_ENTRY vx_node VX_API_CALL vxCreateGenericNode(vx_graph graph, vx_kernel kernel);
  1030. /*! \brief Allows a user to query information out of a node.
  1031. * \param [in] node The reference to the node to query.
  1032. * \param [in] attribute Use <tt>\ref vx_node_attribute_e</tt> value to query for information.
  1033. * \param [out] ptr The location at which to store the resulting value.
  1034. * \param [in] size The size in bytesin bytes of the container to which \a ptr points.
  1035. * \return A <tt>\ref vx_status_e</tt> enumeration.
  1036. * \retval VX_SUCCESS No errors; any other value indicates failure.
  1037. * \retval VX_ERROR_INVALID_REFERENCE node is not a valid <tt>\ref vx_node</tt> reference.
  1038. * \retval VX_ERROR_INVALID_PARAMETERS The type or size is incorrect.
  1039. * \ingroup group_node
  1040. */
  1041. VX_API_ENTRY vx_status VX_API_CALL vxQueryNode(vx_node node, vx_enum attribute, void *ptr, vx_size size);
  1042. /*! \brief Allows a user to set attribute of a node before Graph Validation.
  1043. * \param [in] node The reference to the node to set.
  1044. * \param [in] attribute Use <tt>\ref vx_node_attribute_e</tt> value to set the desired attribute.
  1045. * \param [in] ptr The pointer to the desired value of the attribute.
  1046. * \param [in] size The size in bytes of the objects to which \a ptr points.
  1047. * \note Some attributes are inherited from the <tt>\ref vx_kernel</tt>, which was used
  1048. * to create the node. Some of these can be overridden using this API, notably
  1049. * \ref VX_NODE_LOCAL_DATA_SIZE and \ref VX_NODE_LOCAL_DATA_PTR.
  1050. * \ingroup group_node
  1051. * \return A <tt>\ref vx_status_e</tt> enumeration.
  1052. * \retval VX_SUCCESS The attribute was set; any other value indicates failure.
  1053. * \retval VX_ERROR_INVALID_REFERENCE node is not a valid <tt>\ref vx_node</tt> reference.
  1054. * \retval VX_ERROR_INVALID_PARAMETERS size is not correct for the type needed.
  1055. */
  1056. VX_API_ENTRY vx_status VX_API_CALL vxSetNodeAttribute(vx_node node, vx_enum attribute, const void *ptr, vx_size size);
  1057. /*! \brief Releases a reference to a Node object.
  1058. * The object may not be garbage collected until its total reference count is zero.
  1059. * \param [in] node The pointer to the reference of the node to release.
  1060. * \ingroup group_node
  1061. * \post After returning from this function the reference is zeroed.
  1062. * \return A <tt>\ref vx_status_e</tt> enumeration.
  1063. * \retval VX_SUCCESS No errors; any other value indicates failure.
  1064. * \retval VX_ERROR_INVALID_REFERENCE node is not a valid <tt>\ref vx_node</tt> reference.
  1065. */
  1066. VX_API_ENTRY vx_status VX_API_CALL vxReleaseNode(vx_node *node);
  1067. /*! \brief Removes a Node from its parent Graph and releases it.
  1068. * \param [in] node The pointer to the node to remove and release.
  1069. * \ingroup group_node
  1070. * \post After returning from this function the reference is zeroed.
  1071. * \return A <tt>\ref vx_status_e</tt> enumeration.
  1072. * \retval VX_SUCCESS No errors; any other value indicates failure.
  1073. * \retval VX_ERROR_INVALID_REFERENCE node is not a valid <tt>\ref vx_node</tt> reference.
  1074. */
  1075. VX_API_ENTRY vx_status VX_API_CALL vxRemoveNode(vx_node *node);
  1076. /*! \brief Assigns a callback to a node.
  1077. * If a callback already exists in this node, this function must return an error
  1078. * and the user may clear the callback by passing a NULL pointer as the callback.
  1079. * \param [in] node The reference to the node.
  1080. * \param [in] callback The callback to associate with completion of this
  1081. * specific node.
  1082. * \warning This must be used with <b><i>extreme</i></b> caution as it can \e ruin
  1083. * optimizations in the power/performance efficiency of a graph.
  1084. * \return A <tt>\ref vx_status_e</tt> enumeration.
  1085. * \retval VX_SUCCESS Callback assigned; any other value indicates failure.
  1086. * \retval VX_ERROR_INVALID_REFERENCE node is not a valid <tt>\ref vx_node</tt> reference.
  1087. * \ingroup group_node_callback
  1088. */
  1089. VX_API_ENTRY vx_status VX_API_CALL vxAssignNodeCallback(vx_node node, vx_nodecomplete_f callback);
  1090. /*! \brief Retrieves the current node callback function pointer set on the node.
  1091. * \param [in] node The reference to the <tt>\ref vx_node</tt> object.
  1092. * \ingroup group_node_callback
  1093. * \return vx_nodecomplete_f The pointer to the callback function.
  1094. * \retval NULL No callback is set.
  1095. * \retval * The node callback function.
  1096. */
  1097. VX_API_ENTRY vx_nodecomplete_f VX_API_CALL vxRetrieveNodeCallback(vx_node node);
  1098. /*! \brief Sets the node target to the provided value. A success invalidates the graph
  1099. * that the node belongs to (<tt>\ref vxVerifyGraph</tt> must be called before the next execution)
  1100. * \param [in] node The reference to the <tt>\ref vx_node</tt> object.
  1101. * \param [in] target_enum The target enum to be set to the <tt>\ref vx_node</tt> object.
  1102. * Use a <tt>\ref vx_target_e</tt>.
  1103. * \param [in] target_string The target name ASCII string. This contains a valid value
  1104. * when target_enum is set to <tt>\ref VX_TARGET_STRING</tt>, otherwise it is ignored.
  1105. * \ingroup group_node
  1106. * \return A <tt>\ref vx_status_e</tt> enumeration.
  1107. * \retval VX_SUCCESS Node target set; any other value indicates failure.
  1108. * \retval VX_ERROR_INVALID_REFERENCE node is not a valid <tt>\ref vx_node</tt> reference.
  1109. * \retval VX_ERROR_NOT_SUPPORTED If the node kernel is not supported by the specified target.
  1110. */
  1111. VX_API_ENTRY vx_status VX_API_CALL vxSetNodeTarget(vx_node node, vx_enum target_enum, const char* target_string);
  1112. /*! \brief Creates replicas of the same node first_node to process a set of objects
  1113. * stored in <tt>\ref vx_pyramid</tt> or <tt>\ref vx_object_array</tt>.
  1114. * 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>.
  1115. * Replica nodes are not accessible by the application through any means. An application request for removal of
  1116. * first_node from the graph will result in removal of all replicas. Any change of parameter or attribute of
  1117. * first_node will be propagated to the replicas. <tt>\ref vxVerifyGraph</tt> shall enforce consistency of parameters and attributes
  1118. * in the replicas.
  1119. * \param [in] graph The reference to the graph.
  1120. * \param [in] first_node The reference to the node in the graph that will be replicated.
  1121. * \param [in] replicate an array of size equal to the number of node parameters, vx_true_e for the parameters
  1122. * that should be iterated over (should be a reference to a vx_pyramid or a vx_object_array),
  1123. * vx_false_e for the parameters that should be the same across replicated nodes and for optional
  1124. * parameters that are not used. Should be vx_true_e for all output and bidirectional parameters.
  1125. * \param [in] number_of_parameters number of elements in the replicate array
  1126. * \return A <tt>\ref vx_status_e</tt> enumeration.
  1127. * \retval VX_SUCCESS No errors; any other value indicates failure.
  1128. * \retval VX_ERROR_INVALID_REFERENCE graph is not a valid <tt>\ref vx_graph</tt> reference, or first_node is not a
  1129. * valid <tt>\ref vx_node</tt> reference.
  1130. * \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.
  1131. * \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.
  1132. * \ingroup group_node
  1133. */
  1134. VX_API_ENTRY vx_status VX_API_CALL vxReplicateNode(vx_graph graph, vx_node first_node, vx_bool replicate[], vx_uint32 number_of_parameters);
  1135. /*==============================================================================
  1136. PARAMETER
  1137. =============================================================================*/
  1138. /*! \brief Retrieves a <tt>\ref vx_parameter</tt> from a <tt>\ref vx_node</tt>.
  1139. * \param [in] node The node from which to extract the parameter.
  1140. * \param [in] index The index of the parameter to which to get a reference.
  1141. * \return A parameter reference <tt>\ref vx_parameter</tt>. Any possible errors preventing a successful
  1142. * completion of the function should be checked using <tt>\ref vxGetStatus</tt>.
  1143. * \ingroup group_parameter
  1144. */
  1145. VX_API_ENTRY vx_parameter VX_API_CALL vxGetParameterByIndex(vx_node node, vx_uint32 index);
  1146. /*! \brief Releases a reference to a parameter object.
  1147. * The object may not be garbage collected until its total reference count is zero.
  1148. * \param [in] param The pointer to the parameter to release.
  1149. * \ingroup group_parameter
  1150. * \post After returning from this function the reference is zeroed.
  1151. * \return A <tt>\ref vx_status_e</tt> enumeration.
  1152. * \retval VX_SUCCESS No errors; any other value indicates failure.
  1153. * \retval VX_ERROR_INVALID_REFERENCE param is not a valid <tt>\ref vx_parameter</tt> reference.
  1154. */
  1155. VX_API_ENTRY vx_status VX_API_CALL vxReleaseParameter(vx_parameter *param);
  1156. /*! \brief Sets the specified parameter data for a kernel on the node.
  1157. * \param [in] node The node that contains the kernel.
  1158. * \param [in] index The index of the parameter desired.
  1159. * \param [in] value The desired value of the parameter.
  1160. * \note A user may not provide a NULL value for a mandatory parameter of this API.
  1161. * \return A <tt>\ref vx_status_e</tt> enumeration.
  1162. * \retval VX_SUCCESS No errors; any other value indicates failure.
  1163. * \retval VX_ERROR_INVALID_REFERENCE node is not a valid <tt>\ref vx_node</tt> reference, or value
  1164. * is not a valid <tt>\ref vx_reference</tt> reference.
  1165. * \ingroup group_parameter
  1166. * \see vxSetParameterByReference
  1167. */
  1168. VX_API_ENTRY vx_status VX_API_CALL vxSetParameterByIndex(vx_node node, vx_uint32 index, vx_reference value);
  1169. /*! \brief Associates a parameter reference and a data reference with a kernel
  1170. * on a node.
  1171. * \param [in] parameter The reference to the kernel parameter.
  1172. * \param [in] value The value to associate with the kernel parameter.
  1173. * \note A user may not provide a NULL value for a mandatory parameter of this API.
  1174. * \return A <tt>\ref vx_status_e</tt> enumeration.
  1175. * \retval VX_SUCCESS No errors; any other value indicates failure.
  1176. * \retval VX_ERROR_INVALID_REFERENCE parameter is not a valid <tt>\ref vx_parameter</tt> reference,
  1177. * or value is not a valid <tt>\ref vx_reference</tt> reference..
  1178. * \ingroup group_parameter
  1179. * \see vxGetParameterByIndex
  1180. */
  1181. VX_API_ENTRY vx_status VX_API_CALL vxSetParameterByReference(vx_parameter parameter, vx_reference value);
  1182. /*! \brief Allows the client to query a parameter to determine its meta-information.
  1183. * \param [in] parameter The reference to the parameter.
  1184. * \param [in] attribute The attribute to query. Use a <tt>\ref vx_parameter_attribute_e</tt>.
  1185. * \param [out] ptr The location at which to store the resulting value.
  1186. * \param [in] size The size in bytes of the container to which \a ptr points.
  1187. * \return A <tt>\ref vx_status_e</tt> enumeration.
  1188. * \retval VX_SUCCESS No errors; any other value indicates failure.
  1189. * \retval VX_ERROR_INVALID_REFERENCE parameter is not a valid <tt>\ref vx_parameter</tt> reference.
  1190. * \ingroup group_parameter
  1191. */
  1192. VX_API_ENTRY vx_status VX_API_CALL vxQueryParameter(vx_parameter parameter, vx_enum attribute, void *ptr, vx_size size);
  1193. /*==============================================================================
  1194. SCALAR
  1195. =============================================================================*/
  1196. /*! \brief Creates a reference to a scalar object. Also see \ref sub_node_parameters.
  1197. * \param [in] context The reference to the system context.
  1198. * \param [in] data_type The type of data to hold. Must be greater than
  1199. * <tt>\ref VX_TYPE_INVALID</tt> and less than or equal to <tt>\ref VX_TYPE_VENDOR_STRUCT_END</tt>.
  1200. * Or must be a <tt>\ref vx_enum</tt> returned from <tt>\ref vxRegisterUserStruct</tt>.
  1201. * \param [in] ptr The pointer to the initial value of the scalar.
  1202. * \ingroup group_scalar
  1203. * \returns A scalar reference <tt>\ref vx_scalar</tt>. Any possible errors preventing a
  1204. * successful creation should be checked using <tt>\ref vxGetStatus</tt>.
  1205. */
  1206. VX_API_ENTRY vx_scalar VX_API_CALL vxCreateScalar(vx_context context, vx_enum data_type, const void *ptr);
  1207. /*! \brief Creates a reference to a scalar object. Also see \ref sub_node_parameters.
  1208. * \param [in] context The reference to the system context.
  1209. * \param [in] data_type The type of data to hold. Must be greater than
  1210. * <tt>\ref VX_TYPE_INVALID</tt> and less than or equal to <tt>\ref VX_TYPE_VENDOR_STRUCT_END</tt>.
  1211. * Or must be a <tt>\ref vx_enum</tt> returned from <tt>\ref vxRegisterUserStruct</tt>.
  1212. * \param [in] ptr The pointer to the initial value of the scalar.
  1213. * \param [in] size Size of data at ptr in bytes.
  1214. * \ingroup group_scalar
  1215. * \returns A scalar reference <tt>\ref vx_scalar</tt>. Any possible errors preventing a
  1216. * successful creation should be checked using <tt>\ref vxGetStatus</tt>.
  1217. */
  1218. VX_API_ENTRY vx_scalar VX_API_CALL vxCreateScalarWithSize(vx_context context, vx_enum data_type, const void *ptr, vx_size size);
  1219. /*! \brief Creates an opaque reference to a scalar object with no direct user access.
  1220. * \param [in] graph The reference to the parent graph.
  1221. * \param [in] data_type The type of data to hold. Must be greater than
  1222. * <tt>\ref VX_TYPE_INVALID</tt> and less than or equal to <tt>\ref VX_TYPE_VENDOR_STRUCT_END</tt>.
  1223. * Or must be a <tt>\ref vx_enum</tt> returned from <tt>\ref vxRegisterUserStruct</tt>.
  1224. * \see <tt>\ref vxCreateScalar</tt>
  1225. * \ingroup group_scalar
  1226. * \returns A scalar reference <tt>\ref vx_scalar</tt>. Any possible errors preventing a
  1227. * successful creation should be checked using <tt>\ref vxGetStatus</tt>.
  1228. */
  1229. VX_API_ENTRY vx_scalar VX_API_CALL vxCreateVirtualScalar(vx_graph graph, vx_enum data_type);
  1230. /*! \brief Releases a reference to a scalar object.
  1231. * The object may not be garbage collected until its total reference count is zero.
  1232. * \param [in] scalar The pointer to the scalar to release.
  1233. * \ingroup group_scalar
  1234. * \post After returning from this function the reference is zeroed.
  1235. * \return A <tt>\ref vx_status_e</tt> enumeration.
  1236. * \retval VX_SUCCESS No errors; any other value indicates failure.
  1237. * \retval VX_ERROR_INVALID_REFERENCE scalar is not a valid <tt>\ref vx_scalar</tt> reference.
  1238. */
  1239. VX_API_ENTRY vx_status VX_API_CALL vxReleaseScalar(vx_scalar *scalar);
  1240. /*! \brief Queries attributes from a scalar.
  1241. * \param [in] scalar The scalar object.
  1242. * \param [in] attribute The enumeration to query. Use a <tt>\ref vx_scalar_attribute_e</tt> enumeration.
  1243. * \param [out] ptr The location at which to store the resulting value.
  1244. * \param [in] size The size of the container to which \a ptr points.
  1245. * \return A <tt>\ref vx_status_e</tt> enumeration.
  1246. * \retval VX_SUCCESS No errors; any other value indicates failure.
  1247. * \retval VX_ERROR_INVALID_REFERENCE scalar is not a valid <tt>\ref vx_scalar</tt> reference.
  1248. * \ingroup group_scalar
  1249. */
  1250. VX_API_ENTRY vx_status VX_API_CALL vxQueryScalar(vx_scalar scalar, vx_enum attribute, void *ptr, vx_size size);
  1251. /*! \brief Allows the application to copy from/into a scalar object.
  1252. * \param [in] scalar The reference to the scalar object that is the source or the
  1253. * destination of the copy.
  1254. * \param [in] user_ptr The address of the memory location where to store the requested data
  1255. * if the copy was requested in read mode, or from where to get the data to store into the
  1256. * scalar object if the copy was requested in write mode. In the user memory, the scalar is
  1257. * a variable of the type corresponding to <tt>\ref VX_SCALAR_TYPE</tt>.
  1258. * The accessible memory must be large enough to contain this variable.
  1259. * \param [in] usage This declares the effect of the copy with regard to the scalar object
  1260. * using the <tt>\ref vx_accessor_e</tt> enumeration. Only <tt>\ref VX_READ_ONLY</tt> and <tt>\ref VX_WRITE_ONLY</tt>
  1261. * are supported:
  1262. * \arg <tt>\ref VX_READ_ONLY</tt> means that data are copied from the scalar object into the user memory.
  1263. * \arg <tt>\ref VX_WRITE_ONLY</tt> means that data are copied into the scalar object from the user memory.
  1264. * \param [in] user_mem_type A <tt>\ref vx_memory_type_e</tt> enumeration that specifies
  1265. * the memory type of the memory referenced by the user_addr.
  1266. * \return A <tt>\ref vx_status_e</tt> enumeration.
  1267. * \retval VX_SUCCESS No errors; any other value indicates failure.
  1268. * \retval VX_ERROR_INVALID_REFERENCE scalar is not a valid <tt>\ref vx_scalar</tt> reference.
  1269. * \retval VX_ERROR_INVALID_PARAMETERS An other parameter is incorrect.
  1270. * \ingroup group_scalar
  1271. */
  1272. VX_API_ENTRY vx_status VX_API_CALL vxCopyScalar(vx_scalar scalar, void *user_ptr, vx_enum usage, vx_enum user_mem_type);
  1273. /*! \brief Allows the application to copy from/into a scalar object with size.
  1274. * \param [in] scalar The reference to the scalar object that is the source or the
  1275. * destination of the copy.
  1276. * \param [in] size The size in bytes of the container to which \a user_ptr points.
  1277. * \param [in] user_ptr The address of the memory location where to store the requested data
  1278. * if the copy was requested in read mode, or from where to get the data to store into the
  1279. * scalar object if the copy was requested in write mode. In the user memory, the scalar is
  1280. * a variable of the type corresponding to <tt>\ref VX_SCALAR_TYPE</tt>.
  1281. * The accessible memory must be large enough to contain this variable.
  1282. * \param [in] usage This declares the effect of the copy with regard to the scalar object
  1283. * using the <tt>\ref vx_accessor_e</tt> enumeration. Only <tt>\ref VX_READ_ONLY</tt> and <tt>\ref VX_WRITE_ONLY</tt>
  1284. * are supported:
  1285. * \arg <tt>\ref VX_READ_ONLY</tt> means that data are copied from the scalar object into the user memory.
  1286. * \arg <tt>\ref VX_WRITE_ONLY</tt> means that data are copied into the scalar object from the user memory.
  1287. * \param [in] user_mem_type A <tt>\ref vx_memory_type_e</tt> enumeration that specifies
  1288. * the memory type of the memory referenced by the user_addr.
  1289. * \return A <tt>\ref vx_status_e</tt> enumeration.
  1290. * \retval VX_ERROR_INVALID_REFERENCE The scalar reference is not actually a scalar reference.
  1291. * \retval VX_ERROR_INVALID_PARAMETERS An other parameter is incorrect.
  1292. * \ingroup group_scalar
  1293. */
  1294. 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);
  1295. /*==============================================================================
  1296. REFERENCE
  1297. =============================================================================*/
  1298. /*! \brief Queries any reference type for some basic information like count or type.
  1299. * \param [in] ref The reference to query.
  1300. * \param [in] attribute The value for which to query. Use <tt>\ref vx_reference_attribute_e</tt>.
  1301. * \param [out] ptr The location at which to store the resulting value.
  1302. * \param [in] size The size in bytes of the container to which ptr points.
  1303. * \return A <tt>\ref vx_status_e</tt> enumeration.
  1304. * \retval VX_SUCCESS No errors; any other value indicates failure.
  1305. * \retval VX_ERROR_INVALID_REFERENCE ref is not a valid <tt>\ref vx_reference</tt> reference.
  1306. * \ingroup group_reference
  1307. */
  1308. VX_API_ENTRY vx_status VX_API_CALL vxQueryReference(vx_reference ref, vx_enum attribute, void *ptr, vx_size size);
  1309. /*! \brief Releases a reference. The reference may potentially refer to multiple OpenVX objects of different types.
  1310. * This function can be used instead of calling a specific release function for each individual object type
  1311. * (e.g. vxRelease<object>). The object will not be destroyed until its total reference count is zero.
  1312. * \note After returning from this function the reference is zeroed.
  1313. * \param [in] ref_ptr The pointer to the reference of the object to release.
  1314. * \return A <tt>\ref vx_status_e</tt> enumeration.
  1315. * \retval VX_SUCCESS No errors; any other value indicates failure.
  1316. * \retval VX_ERROR_INVALID_REFERENCE ref_ptr is not a valid <tt>\ref vx_reference</tt> reference.
  1317. * \ingroup group_reference
  1318. */
  1319. VX_API_ENTRY vx_status VX_API_CALL vxReleaseReference(vx_reference* ref_ptr);
  1320. /*!
  1321. * \brief Increments the reference counter of an object
  1322. * This function is used to express the fact that the OpenVX object is referenced
  1323. * multiple times by an application. Each time this function is called for
  1324. * an object, the application will need to release the object one additional
  1325. * time before it can be destructed
  1326. * \param [in] ref The reference to retain.
  1327. * \return A <tt>\ref vx_status_e</tt> enumeration.
  1328. * \retval VX_SUCCESS No errors; any other value indicates failure.
  1329. * \retval VX_ERROR_INVALID_REFERENCE ref is not a valid <tt>\ref vx_reference</tt> reference.
  1330. * \ingroup group_reference
  1331. */
  1332. VX_API_ENTRY vx_status VX_API_CALL vxRetainReference(vx_reference ref);
  1333. VX_API_ENTRY vx_status VX_API_CALL vxRetainTensor(vx_tensor tensor);
  1334. /*! \brief Name a reference
  1335. * \ingroup group_reference
  1336. *
  1337. * This function is used to associate a name to a referenced object. This name
  1338. * can be used by the OpenVX implementation in log messages and any
  1339. * other reporting mechanisms.
  1340. *
  1341. * The OpenVX implementation will not check if the name is unique in
  1342. * the reference scope (context or graph). Several references can then
  1343. * have the same name.
  1344. *
  1345. * \param [in] ref The reference to the object to be named.
  1346. * \param [in] name Pointer to the '\0' terminated string that identifies
  1347. * the referenced object.
  1348. * The string is copied by the function so that it
  1349. * stays the property of the caller.
  1350. * NULL means that the reference is not named.
  1351. * The length of the string shall be lower than VX_MAX_REFERENCE_NAME bytes.
  1352. * \return A <tt>\ref vx_status_e</tt> enumeration.
  1353. * \retval VX_SUCCESS No errors; any other value indicates failure.
  1354. * \retval VX_ERROR_INVALID_REFERENCE ref is not a valid <tt>\ref vx_reference</tt> reference.
  1355. */
  1356. VX_API_ENTRY vx_status VX_API_CALL vxSetReferenceName(vx_reference ref, const vx_char *name);
  1357. /*==============================================================================
  1358. DELAY
  1359. =============================================================================*/
  1360. /*! \brief Queries a <tt>\ref vx_delay</tt> object attribute.
  1361. * \param [in] delay The reference to a delay object.
  1362. * \param [in] attribute The attribute to query. Use a <tt>\ref vx_delay_attribute_e</tt> enumeration.
  1363. * \param [out] ptr The location at which to store the resulting value.
  1364. * \param [in] size The size of the container to which \a ptr points.
  1365. * \return A <tt>\ref vx_status_e</tt> enumeration.
  1366. * \retval VX_SUCCESS No errors; any other value indicates failure.
  1367. * \retval VX_ERROR_INVALID_REFERENCE delay is not a valid <tt>\ref vx_delay</tt> reference.
  1368. * \ingroup group_delay
  1369. */
  1370. VX_API_ENTRY vx_status VX_API_CALL vxQueryDelay(vx_delay delay, vx_enum attribute, void *ptr, vx_size size);
  1371. /*! \brief Releases a reference to a delay object.
  1372. * The object may not be garbage collected until its total reference count is zero.
  1373. * \param [in] delay The pointer to the delay object reference to release.
  1374. * \post After returning from this function the reference is zeroed.
  1375. * \ingroup group_delay
  1376. * \return A <tt>\ref vx_status_e</tt> enumeration.
  1377. * \retval VX_SUCCESS No errors; any other value indicates failure.
  1378. * \retval VX_ERROR_INVALID_REFERENCE delay is not a valid <tt>\ref vx_delay</tt> reference.
  1379. */
  1380. VX_API_ENTRY vx_status VX_API_CALL vxReleaseDelay(vx_delay *delay);
  1381. /*! \brief Creates a Delay object.
  1382. * \details This function creates a delay object with \p num_slots slots. Each slot
  1383. * contains a clone of the exemplar. The clones only inherit the metadata of the
  1384. * exemplar. The data content of the exemplar is ignored and the clones have their
  1385. * data undefined at delay creation time.
  1386. * The function does not alter the exemplar. Also, it doesn't retain or release the
  1387. * reference to the exemplar.
  1388. * \note For the definition of metadata attributes see \ref vxSetMetaFormatAttribute.
  1389. * \param [in] context The reference to the context.
  1390. * \param [in] exemplar The exemplar object. Supported exemplar object types are:<br>
  1391. * \arg \ref VX_TYPE_ARRAY
  1392. * \arg \ref VX_TYPE_CONVOLUTION
  1393. * \arg \ref VX_TYPE_DISTRIBUTION
  1394. * \arg \ref VX_TYPE_IMAGE
  1395. * \arg \ref VX_TYPE_LUT
  1396. * \arg \ref VX_TYPE_MATRIX
  1397. * \arg \ref VX_TYPE_OBJECT_ARRAY
  1398. * \arg \ref VX_TYPE_PYRAMID
  1399. * \arg \ref VX_TYPE_REMAP
  1400. * \arg \ref VX_TYPE_SCALAR
  1401. * \arg \ref VX_TYPE_THRESHOLD
  1402. * \arg \ref VX_TYPE_TENSOR
  1403. * \param [in] num_slots The number of objects in the delay. This value must be greater than zero.
  1404. * \returns A delay reference <tt>\ref vx_delay</tt>. Any possible errors preventing a
  1405. * successful creation should be checked using <tt>\ref vxGetStatus</tt>.
  1406. * \ingroup group_delay
  1407. */
  1408. VX_API_ENTRY vx_delay VX_API_CALL vxCreateDelay(vx_context context,
  1409. vx_reference exemplar,
  1410. vx_size num_slots);
  1411. /*! \brief Retrieves a reference to a delay slot object.
  1412. * \param [in] delay The reference to the delay object.
  1413. * \param [in] index The index of the delay slot from which to extract the object reference.
  1414. * \return <tt>\ref vx_reference</tt>. Any possible errors preventing a successful
  1415. * completion of the function should be checked using <tt>\ref vxGetStatus</tt>.
  1416. * \note The delay index is in the range \f$ [-count+1,0] \f$. 0 is always the
  1417. * \e current object.
  1418. * \ingroup group_delay
  1419. * \note A reference retrieved with this function must not be given to its associated
  1420. * release API (e.g. <tt>\ref vxReleaseImage</tt>) unless <tt>\ref vxRetainReference</tt> is used.
  1421. */
  1422. VX_API_ENTRY vx_reference VX_API_CALL vxGetReferenceFromDelay(vx_delay delay, vx_int32 index);
  1423. /*! \brief Shifts the internal delay ring by one.
  1424. *
  1425. * This function performs a shift of the internal delay ring by one. This means that,
  1426. * the data originally at index 0 move to index -1 and so forth until index
  1427. * \f$ -count+1 \f$. The data originally at index \f$ -count+1 \f$ move to index 0.
  1428. * Here \f$ count \f$ is the number of slots in delay ring.
  1429. * When a delay is aged, any graph making use of this delay (delay object itself or data
  1430. * objects in delay slots) gets its data automatically updated accordingly.
  1431. * \param [in] delay
  1432. * \return A <tt>\ref vx_status_e</tt> enumeration.
  1433. * \retval VX_SUCCESS Delay was aged; any other value indicates failure.
  1434. * \retval VX_ERROR_INVALID_REFERENCE delay is not a valid <tt>\ref vx_delay</tt> reference.
  1435. * \ingroup group_delay
  1436. */
  1437. VX_API_ENTRY vx_status VX_API_CALL vxAgeDelay(vx_delay delay);
  1438. /*! \brief Register a delay for auto-aging.
  1439. *
  1440. * This function registers a delay object to be auto-aged by the graph.
  1441. * This delay object will be automatically aged after each successful completion of
  1442. * this graph. Aging of a delay object cannot be called during graph execution.
  1443. * A graph abandoned due to a node callback will trigger an auto-aging.
  1444. *
  1445. * If a delay is registered for auto-aging multiple times in a same graph,
  1446. * the delay will be only aged a single time at each graph completion.
  1447. * If a delay is registered for auto-aging in multiple graphs, this delay will
  1448. * aged automatically after each successful completion of any of these graphs.
  1449. *
  1450. * \param [in] graph The graph to which the delay is registered for auto-aging.
  1451. * \param [in] delay The delay to automatically age.
  1452. *
  1453. * \return A <tt>\ref vx_status_e</tt> enumeration.
  1454. * \retval VX_SUCCESS No errors; any other value indicates failure.
  1455. * \retval VX_ERROR_INVALID_REFERENCE graph is not a valid <tt>\ref vx_graph</tt> reference, or
  1456. * delay is not a valid <tt>\ref vx_delay</tt> reference.
  1457. * \ingroup group_graph
  1458. */
  1459. VX_API_ENTRY vx_status VX_API_CALL vxRegisterAutoAging(vx_graph graph, vx_delay delay);
  1460. /*==============================================================================
  1461. LOGGING
  1462. =============================================================================*/
  1463. /*! \brief Adds a line to the log.
  1464. * \param [in] ref The reference to add the log entry against. Some valid value must be provided.
  1465. * \param [in] status The status code. <tt>\ref VX_SUCCESS</tt> status entries are ignored and not added.
  1466. * \param [in] message The human readable message to add to the log.
  1467. * \param [in] ... a list of variable arguments to the message.
  1468. * \note Messages may not exceed <tt>\ref VX_MAX_LOG_MESSAGE_LEN</tt> bytes and will be truncated in the log if they exceed this limit.
  1469. * \ingroup group_log
  1470. */
  1471. VX_API_ENTRY void VX_API_CALL vxAddLogEntry(vx_reference ref, vx_status status, const char *message, ...);
  1472. /*! \brief Registers a callback facility to the OpenVX implementation to receive error logs.
  1473. * \param [in] context The overall context to OpenVX.
  1474. * \param [in] callback The callback function. If NULL, the previous callback is removed.
  1475. * \param [in] reentrant If reentrancy flag is <tt>\ref vx_true_e</tt>, then the callback may be entered from multiple
  1476. * simultaneous tasks or threads (if the host OS supports this).
  1477. * \ingroup group_log
  1478. */
  1479. VX_API_ENTRY void VX_API_CALL vxRegisterLogCallback(vx_context context, vx_log_callback_f callback, vx_bool reentrant);
  1480. /*==============================================================================
  1481. LUT
  1482. =============================================================================*/
  1483. /*! \brief Creates LUT object of a given type. The value of <tt>\ref VX_LUT_OFFSET</tt> is equal to 0
  1484. * for data_type = <tt>\ref VX_TYPE_UINT8</tt>, and (vx_uint32)(count/2) for <tt>\ref VX_TYPE_INT16</tt>.
  1485. * \param [in] context The reference to the context.
  1486. * \param [in] data_type The type of data stored in the LUT.
  1487. * \param [in] count The number of entries desired.
  1488. * \note data_type can only be \ref VX_TYPE_UINT8 or \ref VX_TYPE_INT16. If data_type
  1489. * is \ref VX_TYPE_UINT8, count should be not greater than 256. If data_type is \ref VX_TYPE_INT16,
  1490. * count should not be greater than 65536.
  1491. * \returns An LUT reference <tt>\ref vx_lut</tt>. Any possible errors preventing a successful creation should be checked using <tt>\ref vxGetStatus</tt>.
  1492. * \ingroup group_lut
  1493. */
  1494. VX_API_ENTRY vx_lut VX_API_CALL vxCreateLUT(vx_context context, vx_enum data_type, vx_size count);
  1495. /*! \brief Creates an opaque reference to a LUT object with no direct user access.
  1496. * \param [in] graph The reference to the parent graph.
  1497. * \param [in] data_type The type of data stored in the LUT.
  1498. * \param [in] count The number of entries desired.
  1499. * \see <tt>\ref vxCreateLUT</tt>
  1500. * \note data_type can only be \ref VX_TYPE_UINT8 or \ref VX_TYPE_INT16. If data_type
  1501. * is \ref VX_TYPE_UINT8, count should be not greater than 256. If data_type is \ref VX_TYPE_INT16,
  1502. * count should not be greater than 65536.
  1503. * \returns An LUT reference <tt>\ref vx_lut</tt>. Any possible errors preventing a successful creation should be checked using <tt>\ref vxGetStatus</tt>.
  1504. * \ingroup group_lut
  1505. */
  1506. VX_API_ENTRY vx_lut VX_API_CALL vxCreateVirtualLUT(vx_graph graph, vx_enum data_type, vx_size count);
  1507. /*! \brief Releases a reference to a LUT object.
  1508. * The object may not be garbage collected until its total reference count is zero.
  1509. * \param [in] lut The pointer to the LUT to release.
  1510. * \post After returning from this function the reference is zeroed.
  1511. * \return A <tt>\ref vx_status_e</tt> enumeration.
  1512. * \retval VX_SUCCESS No errors; any other value indicates failure.
  1513. * \retval VX_ERROR_INVALID_REFERENCE lut is not a valid <tt>\ref vx_lut</tt> reference.
  1514. * \ingroup group_lut
  1515. */
  1516. VX_API_ENTRY vx_status VX_API_CALL vxReleaseLUT(vx_lut *lut);
  1517. /*! \brief Queries attributes from a LUT.
  1518. * \param [in] lut The LUT to query.
  1519. * \param [in] attribute The attribute to query. Use a <tt>\ref vx_lut_attribute_e</tt> enumeration.
  1520. * \param [out] ptr The location at which to store the resulting value.
  1521. * \param [in] size The size in bytes of the container to which \a ptr points.
  1522. * \return A <tt>\ref vx_status_e</tt> enumeration.
  1523. * \retval VX_SUCCESS No errors; any other value indicates failure.
  1524. * \retval VX_ERROR_INVALID_REFERENCE lut is not a valid <tt>\ref vx_lut</tt> reference.
  1525. * \ingroup group_lut
  1526. */
  1527. VX_API_ENTRY vx_status VX_API_CALL vxQueryLUT(vx_lut lut, vx_enum attribute, void *ptr, vx_size size);
  1528. /*! \brief Allows the application to copy from/into a LUT object.
  1529. * \param [in] lut The reference to the LUT object that is the source or the
  1530. * destination of the copy.
  1531. * \param [in] user_ptr The address of the memory location where to store the requested data
  1532. * if the copy was requested in read mode, or from where to get the data to store into the LUT
  1533. * object if the copy was requested in write mode. In the user memory, the LUT is
  1534. * represented as a array with elements of the type corresponding to
  1535. * <tt>\ref VX_LUT_TYPE</tt>, and with a number of elements equal to the value
  1536. * returned via <tt>\ref VX_LUT_COUNT</tt>. The accessible memory must be large enough
  1537. * to contain this array:
  1538. * accessible memory in bytes >= sizeof(data_element) * count.
  1539. * \param [in] usage This declares the effect of the copy with regard to the LUT object
  1540. * using the <tt>\ref vx_accessor_e</tt> enumeration. Only <tt>\ref VX_READ_ONLY</tt> and <tt>\ref VX_WRITE_ONLY</tt>
  1541. * are supported:
  1542. * \arg <tt>\ref VX_READ_ONLY</tt> means that data are copied from the LUT object into the user memory.
  1543. * \arg <tt>\ref VX_WRITE_ONLY</tt> means that data are copied into the LUT object from the user memory.
  1544. * \param [in] user_mem_type A <tt>\ref vx_memory_type_e</tt> enumeration that specifies
  1545. * the memory type of the memory referenced by the user_addr.
  1546. * \return A <tt>\ref vx_status_e</tt> enumeration.
  1547. * \retval VX_SUCCESS No errors; any other value indicates failure.
  1548. * \retval VX_ERROR_INVALID_REFERENCE lut is not a valid <tt>\ref vx_lut</tt> reference.
  1549. * \retval VX_ERROR_INVALID_PARAMETERS An other parameter is incorrect.
  1550. * \ingroup group_lut
  1551. */
  1552. VX_API_ENTRY vx_status VX_API_CALL vxCopyLUT(vx_lut lut, void *user_ptr, vx_enum usage, vx_enum user_mem_type);
  1553. /*! \brief Allows the application to get direct access to LUT object.
  1554. * \param [in] lut The reference to the LUT object to map.
  1555. * \param [out] map_id The address of a <tt>\ref vx_map_id</tt> variable where the function
  1556. * returns a map identifier.
  1557. * \arg (*map_id) must eventually be provided as the map_id parameter of a call to
  1558. * <tt>\ref vxUnmapLUT</tt>.
  1559. * \param [out] ptr The address of a pointer that the function sets to the
  1560. * address where the requested data can be accessed. In the mapped memory area,
  1561. * the LUT data are structured as an array with elements of the type corresponding
  1562. * to <tt>\ref VX_LUT_TYPE</tt>, with a number of elements equal to
  1563. * the value returned via <tt>\ref VX_LUT_COUNT</tt>. Accessing the
  1564. * memory out of the bound of this array is forbidden and has an undefined behavior.
  1565. * The returned (*ptr) address is only valid between the call to the function and
  1566. * the corresponding call to <tt>\ref vxUnmapLUT</tt>.
  1567. * \param [in] usage This declares the access mode for the LUT, using
  1568. * the <tt>\ref vx_accessor_e</tt> enumeration.
  1569. * \arg <tt>\ref VX_READ_ONLY</tt>: after the function call, the content of the memory location
  1570. * pointed by (*ptr) contains the LUT data. Writing into this memory location
  1571. * is forbidden and its behavior is undefined.
  1572. * \arg <tt>\ref VX_READ_AND_WRITE</tt>: after the function call, the content of the memory
  1573. * location pointed by (*ptr) contains the LUT data; writing into this memory
  1574. * is allowed only for the location of entries and will result in a modification
  1575. * of the affected entries in the LUT object once the LUT is unmapped.
  1576. * \arg <tt>\ref VX_WRITE_ONLY</tt>: after the function call, the memory location pointed by(*ptr)
  1577. * contains undefined data; writing each entry of LUT is required prior to
  1578. * unmapping. Entries not written by the application before unmap will become
  1579. * undefined after unmap, even if they were well defined before map.
  1580. * \param [in] mem_type A <tt>\ref vx_memory_type_e</tt> enumeration that
  1581. * specifies the type of the memory where the LUT is requested to be mapped.
  1582. * \param [in] flags An integer that allows passing options to the map operation.
  1583. * Use 0 for this option.
  1584. * \return A <tt>\ref vx_status_e</tt> enumeration.
  1585. * \retval VX_SUCCESS No errors; any other value indicates failure.
  1586. * \retval VX_ERROR_INVALID_REFERENCE lut is not a valid <tt>\ref vx_lut</tt> reference.
  1587. * \retval VX_ERROR_INVALID_PARAMETERS An other parameter is incorrect.
  1588. * \ingroup group_lut
  1589. * \post <tt>\ref vxUnmapLUT </tt> with same (*map_id) value.
  1590. */
  1591. VX_API_ENTRY vx_status VX_API_CALL vxMapLUT(vx_lut lut, vx_map_id *map_id, void **ptr, vx_enum usage, vx_enum mem_type, vx_bitfield flags);
  1592. /*! \brief Unmap and commit potential changes to LUT object that was previously mapped.
  1593. * Unmapping a LUT invalidates the memory location from which the LUT data could
  1594. * be accessed by the application. Accessing this memory location after the unmap function
  1595. * completes has an undefined behavior.
  1596. * \param [in] lut The reference to the LUT object to unmap.
  1597. * \param [out] map_id The unique map identifier that was returned when calling
  1598. * <tt>\ref vxMapLUT</tt> .
  1599. * \return A <tt>\ref vx_status_e</tt> enumeration.
  1600. * \retval VX_SUCCESS No errors; any other value indicates failure.
  1601. * \retval VX_ERROR_INVALID_REFERENCE lut is not a valid <tt>\ref vx_lut</tt> reference.
  1602. * \retval VX_ERROR_INVALID_PARAMETERS An other parameter is incorrect.
  1603. * \ingroup group_lut
  1604. * \pre <tt>\ref vxMapLUT</tt> returning the same map_id value
  1605. */
  1606. VX_API_ENTRY vx_status VX_API_CALL vxUnmapLUT(vx_lut lut, vx_map_id map_id);
  1607. /*==============================================================================
  1608. DISTRIBUTION
  1609. =============================================================================*/
  1610. /*! \brief Creates a reference to a 1D Distribution of a consecutive interval [offset, offset + range - 1]
  1611. * defined by a start offset and valid range, divided equally into numBins parts.
  1612. * \param [in] context The reference to the overall context.
  1613. * \param [in] numBins The number of bins in the distribution.
  1614. * \param [in] offset The start offset into the range value that marks the begining of the 1D Distribution.
  1615. * \param [in] range The total number of the consecutive values of the distribution interval.
  1616. * \returns A distribution reference <tt>\ref vx_distribution</tt>. Any possible errors preventing a
  1617. * successful creation should be checked using <tt>\ref vxGetStatus</tt>.
  1618. * \ingroup group_distribution
  1619. */
  1620. VX_API_ENTRY vx_distribution VX_API_CALL vxCreateDistribution(vx_context context, vx_size numBins, vx_int32 offset, vx_uint32 range);
  1621. /*! \brief Creates an opaque reference to a 1D Distribution object without direct user access.
  1622. * \param [in] graph The reference to the parent graph.
  1623. * \param [in] numBins The number of bins in the distribution.
  1624. * \param [in] offset The start offset into the range value that marks the begining of the 1D Distribution.
  1625. * \param [in] range The total number of the consecutive values of the distribution interval.
  1626. * \see <tt>\ref vxCreateDistribution</tt>
  1627. * \returns A distribution reference <tt>\ref vx_distribution</tt>. Any possible errors preventing a
  1628. * successful creation should be checked using <tt>\ref vxGetStatus</tt>.
  1629. * \ingroup group_distribution
  1630. */
  1631. VX_API_ENTRY vx_distribution VX_API_CALL vxCreateVirtualDistribution(vx_graph graph, vx_size numBins, vx_int32 offset, vx_uint32 range);
  1632. /*! \brief Releases a reference to a distribution object.
  1633. * The object may not be garbage collected until its total reference count is zero.
  1634. * \param [in] distribution The reference to the distribution to release.
  1635. * \post After returning from this function the reference is zeroed.
  1636. * \return A <tt>\ref vx_status_e</tt> enumeration.
  1637. * \retval VX_SUCCESS No errors; any other value indicates failure.
  1638. * \retval VX_ERROR_INVALID_REFERENCE distribution is not a valid <tt>\ref vx_distribution</tt> reference.
  1639. * \ingroup group_distribution
  1640. */
  1641. VX_API_ENTRY vx_status VX_API_CALL vxReleaseDistribution(vx_distribution *distribution);
  1642. /*! \brief Queries a Distribution object.
  1643. * \param [in] distribution The reference to the distribution to query.
  1644. * \param [in] attribute The attribute to query. Use a <tt>\ref vx_distribution_attribute_e</tt> enumeration.
  1645. * \param [out] ptr The location at which to store the resulting value.
  1646. * \param [in] size The size in bytes of the container to which \a ptr points.
  1647. * \return A <tt>\ref vx_status_e</tt> enumeration.
  1648. * \retval VX_SUCCESS No errors; any other value indicates failure.
  1649. * \retval VX_ERROR_INVALID_REFERENCE distribution is not a valid <tt>\ref vx_distribution</tt> reference.
  1650. * \ingroup group_distribution
  1651. */
  1652. VX_API_ENTRY vx_status VX_API_CALL vxQueryDistribution(vx_distribution distribution, vx_enum attribute, void *ptr, vx_size size);
  1653. /*! \brief Allows the application to copy from/into a distribution object.
  1654. * \param [in] distribution The reference to the distribution object that is the source or the
  1655. * destination of the copy.
  1656. * \param [in] user_ptr The address of the memory location where to store the requested data
  1657. * if the copy was requested in read mode, or from where to get the data to store into the distribution
  1658. * object if the copy was requested in write mode. In the user memory, the distribution is
  1659. * represented as a <tt>\ref vx_uint32</tt> array with a number of elements equal to the value returned via
  1660. * <tt>\ref VX_DISTRIBUTION_BINS</tt>. The accessible memory must be large enough
  1661. * to contain this vx_uint32 array:
  1662. * accessible memory in bytes >= sizeof(vx_uint32) * num_bins.
  1663. * \param [in] usage This declares the effect of the copy with regard to the distribution object
  1664. * using the <tt>\ref vx_accessor_e</tt> enumeration. Only <tt>\ref VX_READ_ONLY</tt> and <tt>\ref VX_WRITE_ONLY</tt>
  1665. * are supported:
  1666. * \arg <tt>\ref VX_READ_ONLY</tt> means that data are copied from the distribution object into the user memory.
  1667. * \arg <tt>\ref VX_WRITE_ONLY</tt> means that data are copied into the distribution object from the user memory.
  1668. * \param [in] user_mem_type A <tt>\ref vx_memory_type_e</tt> enumeration that specifies
  1669. * the memory type of the memory referenced by the user_addr.
  1670. * \return A <tt>\ref vx_status_e</tt> enumeration.
  1671. * \retval VX_SUCCESS No errors; any other value indicates failure.
  1672. * \retval VX_ERROR_INVALID_REFERENCE distribution is not a valid <tt>\ref vx_distribution</tt> reference.
  1673. * \retval VX_ERROR_INVALID_PARAMETERS An other parameter is incorrect.
  1674. * \ingroup group_distribution
  1675. */
  1676. VX_API_ENTRY vx_status VX_API_CALL vxCopyDistribution(vx_distribution distribution, void *user_ptr, vx_enum usage, vx_enum user_mem_type);
  1677. /*! \brief Allows the application to get direct access to distribution object.
  1678. * \param [in] distribution The reference to the distribution object to map.
  1679. * \param [out] map_id The address of a <tt>\ref vx_map_id</tt> variable where the function
  1680. * returns a map identifier.
  1681. * \arg (*map_id) must eventually be provided as the map_id parameter of a call to
  1682. * <tt>\ref vxUnmapDistribution</tt>.
  1683. * \param [out] ptr The address of a pointer that the function sets to the
  1684. * address where the requested data can be accessed. In the mapped memory area,
  1685. * data are structured as a vx_uint32 array with a number of elements equal to
  1686. * the value returned via <tt>\ref VX_DISTRIBUTION_BINS</tt>. Each
  1687. * element of this array corresponds to a bin of the distribution, with a range-major
  1688. * ordering. Accessing the memory out of the bound of this array
  1689. * is forbidden and has an undefined behavior. The returned (*ptr) address
  1690. * is only valid between the call to the function and the corresponding call to
  1691. * <tt>\ref vxUnmapDistribution</tt>.
  1692. * \param [in] usage This declares the access mode for the distribution, using
  1693. * the <tt>\ref vx_accessor_e</tt> enumeration.
  1694. * \arg <tt>\ref VX_READ_ONLY</tt>: after the function call, the content of the memory location
  1695. * pointed by (*ptr) contains the distribution data. Writing into this memory location
  1696. * is forbidden and its behavior is undefined.
  1697. * \arg <tt>\ref VX_READ_AND_WRITE</tt>: after the function call, the content of the memory
  1698. * location pointed by (*ptr) contains the distribution data; writing into this memory
  1699. * is allowed only for the location of bins and will result in a modification of the
  1700. * affected bins in the distribution object once the distribution is unmapped.
  1701. * \arg <tt>\ref VX_WRITE_ONLY</tt>: after the function call, the memory location pointed by (*ptr)
  1702. * contains undefined data; writing each bin of distribution is required prior to
  1703. * unmapping. Bins not written by the application before unmap will become
  1704. * undefined after unmap, even if they were well defined before map.
  1705. * \param [in] mem_type A <tt>\ref vx_memory_type_e</tt> enumeration that
  1706. * specifies the type of the memory where the distribution is requested to be mapped.
  1707. * \param [in] flags An integer that allows passing options to the map operation.
  1708. * Use 0 for this option.
  1709. * \return A <tt>\ref vx_status_e</tt> enumeration.
  1710. * \retval VX_SUCCESS No errors; any other value indicates failure.
  1711. * \retval VX_ERROR_INVALID_REFERENCE distribution is not a valid <tt>\ref vx_distribution</tt> reference.
  1712. * reference.
  1713. * \retval VX_ERROR_INVALID_PARAMETERS An other parameter is incorrect.
  1714. * \ingroup group_distribution
  1715. * \post <tt>\ref vxUnmapDistribution </tt> with same (*map_id) value.
  1716. */
  1717. VX_API_ENTRY vx_status VX_API_CALL vxMapDistribution(vx_distribution distribution, vx_map_id *map_id, void **ptr, vx_enum usage, vx_enum mem_type, vx_bitfield flags);
  1718. /*! \brief Unmap and commit potential changes to distribution object that was previously mapped.
  1719. * Unmapping a distribution invalidates the memory location from which the distribution data
  1720. * could be accessed by the application. Accessing this memory location after the unmap
  1721. * function completes has an undefined behavior.
  1722. * \param [in] distribution The reference to the distribution object to unmap.
  1723. * \param [out] map_id The unique map identifier that was returned when calling
  1724. * <tt>\ref vxMapDistribution</tt> .
  1725. * \return A <tt>\ref vx_status_e</tt> enumeration.
  1726. * \retval VX_SUCCESS No errors; any other value indicates failure.
  1727. * \retval VX_ERROR_INVALID_REFERENCE distribution is not a valid <tt>\ref vx_distribution</tt> reference.
  1728. * \retval VX_ERROR_INVALID_PARAMETERS An other parameter is incorrect.
  1729. * \ingroup group_distribution
  1730. * \pre <tt>\ref vxMapDistribution</tt> returning the same map_id value
  1731. */
  1732. VX_API_ENTRY vx_status VX_API_CALL vxUnmapDistribution(vx_distribution distribution, vx_map_id map_id);
  1733. /*==============================================================================
  1734. THRESHOLD
  1735. =============================================================================*/
  1736. /*! \brief Creates a threshold object and returns a reference to it.
  1737. *
  1738. * The threshold object defines the parameters of a thresholding operation
  1739. * to an input image, that generates an output image that can have a different
  1740. * format. The thresholding 'false' or 'true' output values are specified per
  1741. * pixel channels of the output format and can be modified with
  1742. * <tt>\ref vxCopyThresholdOutput</tt>. The default 'false' output value of
  1743. * pixels channels should be 0, and the default 'true' value should be non-zero.
  1744. * For standard image formats, default output pixel values are defined as
  1745. * following:
  1746. * \arg \ref VX_DF_IMAGE_RGB : false={0, 0, 0}, true={255,255,255}
  1747. * \arg \ref VX_DF_IMAGE_RGBX : false={0, 0, 0, 0}, true={255,255,255,255}
  1748. * \arg \ref VX_DF_IMAGE_NV12 : false={0, 0, 0}, true={255,255,255}
  1749. * \arg \ref VX_DF_IMAGE_NV21 : false={0, 0, 0}, true={255,255,255}
  1750. * \arg \ref VX_DF_IMAGE_UYVY : false={0, 0, 0}, true={255,255,255}
  1751. * \arg \ref VX_DF_IMAGE_YUYV : false={0, 0, 0}, true={255,255,255}
  1752. * \arg \ref VX_DF_IMAGE_IYUV : false={0, 0, 0}, true={255,255,255}
  1753. * \arg \ref VX_DF_IMAGE_YUV4 : false={0, 0, 0}, true={255,255,255}
  1754. * \arg \ref VX_DF_IMAGE_U8 : false=0, true=0xFF
  1755. * \arg \ref VX_DF_IMAGE_S16 : false=0, true=-1
  1756. * \arg \ref VX_DF_IMAGE_U16 : false=0, true=0xFFFF
  1757. * \arg \ref VX_DF_IMAGE_S32 : false=0, true=-1
  1758. * \arg \ref VX_DF_IMAGE_U32 : false=0, true=0xFFFFFFFF
  1759. * \param [in] context The reference to the context in which the object is
  1760. * created.
  1761. * \param [in] thresh_type The type of thresholding operation.
  1762. * \param [in] input_format The format of images that will be used as input of
  1763. * the thresholding operation.
  1764. * \param [in] output_format The format of images that will be generated by the
  1765. * thresholding operation.
  1766. * \returns A threshold reference <tt>\ref vx_threshold</tt>. Any possible
  1767. * errors preventing a successful creation should be checked using
  1768. * <tt>\ref vxGetStatus</tt>.
  1769. * \ingroup group_threshold
  1770. */
  1771. VX_API_ENTRY vx_threshold VX_API_CALL vxCreateThresholdForImage(vx_context context,
  1772. vx_enum thresh_type,
  1773. vx_df_image input_format,
  1774. vx_df_image output_format);
  1775. /*! \brief Creates an opaque reference to a threshold object without direct user access.
  1776. *
  1777. * \param [in] graph The reference to the parent graph.
  1778. * \param [in] thresh_type The type of thresholding operation.
  1779. * \param [in] input_format The format of images that will be used as input of
  1780. * the thresholding operation.
  1781. * \param [in] output_format The format of images that will be generated by the
  1782. * thresholding operation.
  1783. * \see <tt>\ref vxCreateThresholdForImage</tt>
  1784. * \returns A threshold reference <tt>\ref vx_threshold</tt>. Any possible
  1785. * errors preventing a successful creation should be checked using
  1786. * <tt>\ref vxGetStatus</tt>.
  1787. * \ingroup group_threshold
  1788. */
  1789. VX_API_ENTRY vx_threshold VX_API_CALL vxCreateVirtualThresholdForImage(vx_graph graph,
  1790. vx_enum thresh_type,
  1791. vx_df_image input_format,
  1792. vx_df_image output_format);
  1793. /*! \brief Allows the application to copy the thresholding value from/into a
  1794. * threshold object with type <tt>\ref VX_THRESHOLD_TYPE_BINARY</tt>.
  1795. * \param [in] thresh The reference to the threshold object that is the source
  1796. * or the destination of the copy.
  1797. * \param [in,out] value_ptr The address of the memory location where to store
  1798. * the thresholding value if the copy was requested in read mode, or from where
  1799. * to get the thresholding value to store into the threshold object if the copy
  1800. * was requested in write mode.
  1801. * \param [in] usage This declares the effect of the copy with regard to the
  1802. * threshold object using the <tt>\ref vx_accessor_e</tt> enumeration. Only
  1803. * <tt>\ref VX_READ_ONLY</tt> and <tt>\ref VX_WRITE_ONLY</tt> are supported:
  1804. * \arg <tt>\ref VX_READ_ONLY</tt> means that the thresholding value is copied
  1805. * from the threshold object into the user memory. After the copy, only the
  1806. * field of the (*value_ptr) union that corresponds to the input image format
  1807. * of the threshold object is meaningful.
  1808. * \arg <tt>\ref VX_WRITE_ONLY</tt> means the field of the (*value_ptr) union
  1809. * corresponding to the input format of the threshold object is copied into
  1810. * the threshold object.
  1811. * \param [in] user_mem_type A <tt>\ref vx_memory_type_e</tt> enumeration that
  1812. * specifies the type of the memory referenced by \p value_ptr.
  1813. * \return A <tt>\ref vx_status_e</tt> enumeration.
  1814. * \retval VX_ERROR_INVALID_REFERENCE The threshold reference is not actually a
  1815. * threshold reference.
  1816. * \retval VX_ERROR_NOT_COMPATIBLE The threshold object doesn't have type
  1817. * <tt>\ref VX_THRESHOLD_TYPE_BINARY</tt>
  1818. * \retval VX_ERROR_INVALID_PARAMETERS An other parameter is incorrect.
  1819. * \ingroup group_threshold
  1820. */
  1821. VX_API_ENTRY vx_status VX_API_CALL vxCopyThresholdValue(vx_threshold thresh,
  1822. vx_pixel_value_t * value_ptr,
  1823. vx_enum usage,
  1824. vx_enum user_mem_type
  1825. );
  1826. /*! \brief Allows the application to copy thresholding values from/into a
  1827. * threshold object with type <tt>\ref VX_THRESHOLD_TYPE_RANGE</tt>.
  1828. * \param [in] thresh The reference to the threshold object that is the source
  1829. * or the destination of the copy.
  1830. * \param [in,out] lower_value_ptr The address of the memory location where to
  1831. * store the lower thresholding value if the copy was requested in read mode,
  1832. * or from where to get the lower thresholding value to store into the threshold
  1833. * object if the copy was requested in write mode.
  1834. * \param [in,out] upper_value_ptr The address of the memory location where to
  1835. * store the upper thresholding value if the copy was requested in read mode, or
  1836. * from where to get the upper thresholding value to store into the threshold
  1837. * object if the copy was requested in write mode.
  1838. * \param [in] usage This declares the effect of the copy with regard to the
  1839. * threshold object using the <tt>\ref vx_accessor_e</tt> enumeration. Only
  1840. * <tt>\ref VX_READ_ONLY</tt> and <tt>\ref VX_WRITE_ONLY</tt> are supported:
  1841. * \arg <tt>\ref VX_READ_ONLY</tt> means that thresholding values are copied
  1842. * from the threshold object into the user memory. After the copy, only the
  1843. * field of (*lower_value_ptr) and (*upper_value_ptr) unions that corresponds
  1844. * to the input image format of the threshold object is meaningful.
  1845. * \arg <tt>\ref VX_WRITE_ONLY</tt> means the field of the (*lower_value_ptr)
  1846. * and (*upper_value_ptr) unions corresponding to the input format of the
  1847. * threshold object is copied into the threshold object.
  1848. * \param [in] user_mem_type A <tt>\ref vx_memory_type_e</tt> enumeration that
  1849. * specifies the type of the memory referenced by \p lower_value_ptr and
  1850. * \p upper_value_ptr.
  1851. * \return A <tt>\ref vx_status_e</tt> enumeration.
  1852. * \retval VX_ERROR_INVALID_REFERENCE The threshold reference is not actually
  1853. * a threshold reference.
  1854. * \retval VX_ERROR_NOT_COMPATIBLE The threshold object doesn't have type
  1855. * <tt>\ref VX_THRESHOLD_TYPE_RANGE</tt>
  1856. * \retval VX_ERROR_INVALID_PARAMETERS An other parameter is incorrect.
  1857. * \ingroup group_threshold
  1858. */
  1859. VX_API_ENTRY vx_status VX_API_CALL vxCopyThresholdRange(vx_threshold thresh,
  1860. vx_pixel_value_t * lower_value_ptr,
  1861. vx_pixel_value_t * upper_value_ptr,
  1862. vx_enum usage,
  1863. vx_enum user_mem_type);
  1864. /*! \brief Allows the application to copy the true and false output values
  1865. * from/into a threshold object.
  1866. * \param [in] thresh The reference to the threshold object that is the source
  1867. * or the destination of the copy.
  1868. * \param [in,out] true_value_ptr The address of the memory location where to
  1869. * store the true output value if the copy was requested in read mode,
  1870. * or from where to get the true output value to store into the threshold
  1871. * object if the copy was requested in write mode.
  1872. * \param [in,out] false_value_ptr The address of the memory location where to
  1873. * store the false output value if the copy was requested in read mode, or
  1874. * from where to get the false output value to store into the threshold
  1875. * object if the copy was requested in write mode.
  1876. * \param [in] usage This declares the effect of the copy with regard to the
  1877. * threshold object using the <tt>\ref vx_accessor_e</tt> enumeration. Only
  1878. * <tt>\ref VX_READ_ONLY</tt> and <tt>\ref VX_WRITE_ONLY</tt> are supported:
  1879. * \arg <tt>\ref VX_READ_ONLY</tt> means that true and false output values
  1880. * are copied from the threshold object into the user memory. After the copy,
  1881. * only the field of (*true_value_ptr) and (*false_value_ptr) unions that
  1882. * corresponds to the output image format of the threshold object is meaningful.
  1883. * \arg <tt>\ref VX_WRITE_ONLY</tt> means the field of the (*true_value_ptr)
  1884. * and (*false_value_ptr) unions corresponding to the output format of the
  1885. * threshold object is copied into the threshold object.
  1886. * \param [in] user_mem_type A <tt>\ref vx_memory_type_e</tt> enumeration that
  1887. * specifies the type of the memory referenced by \p true_value_ptr and
  1888. * \p false_value_ptr.
  1889. * \return A <tt>\ref vx_status_e</tt> enumeration.
  1890. * \retval VX_ERROR_INVALID_REFERENCE The threshold reference is not actually
  1891. * a threshold reference.
  1892. * \retval VX_ERROR_INVALID_PARAMETERS An other parameter is incorrect.
  1893. * \ingroup group_threshold
  1894. */
  1895. VX_API_ENTRY vx_status VX_API_CALL vxCopyThresholdOutput(vx_threshold thresh,
  1896. vx_pixel_value_t * true_value_ptr,
  1897. vx_pixel_value_t * false_value_ptr,
  1898. vx_enum usage,
  1899. vx_enum user_mem_type);
  1900. /*! \brief Releases a reference to a threshold object.
  1901. * The object may not be garbage collected until its total reference count is zero.
  1902. * \param [in] thresh The pointer to the threshold to release.
  1903. * \post After returning from this function the reference is zeroed.
  1904. * \return A <tt>\ref vx_status_e</tt> enumeration.
  1905. * \retval VX_SUCCESS No errors; any other value indicates failure.
  1906. * \retval VX_ERROR_INVALID_REFERENCE thresh is not a valid <tt>\ref vx_threshold</tt> reference.
  1907. * \ingroup group_threshold
  1908. */
  1909. VX_API_ENTRY vx_status VX_API_CALL vxReleaseThreshold(vx_threshold *thresh);
  1910. /*! \brief Sets attributes on the threshold object.
  1911. * \param [in] thresh The threshold object to set.
  1912. * \param [in] attribute The attribute to modify. Use a <tt>\ref vx_threshold_attribute_e</tt> enumeration.
  1913. * \param [in] ptr The pointer to the value to which to set the attribute.
  1914. * \param [in] size The size of the data pointed to by \a ptr.
  1915. * \return A <tt>\ref vx_status_e</tt> enumeration.
  1916. * \retval VX_SUCCESS No errors; any other value indicates failure.
  1917. * \retval VX_ERROR_INVALID_REFERENCE thresh is not a valid <tt>\ref vx_threshold</tt> reference.
  1918. * \ingroup group_threshold
  1919. */
  1920. VX_API_ENTRY vx_status VX_API_CALL vxSetThresholdAttribute(vx_threshold thresh, vx_enum attribute, const void *ptr, vx_size size);
  1921. /*! \brief Queries an attribute on the threshold object.
  1922. * \param [in] thresh The threshold object to set.
  1923. * \param [in] attribute The attribute to query. Use a <tt>\ref vx_threshold_attribute_e</tt> enumeration.
  1924. * \param [out] ptr The location at which to store the resulting value.
  1925. * \param [in] size The size of the container to which \a ptr points.
  1926. * \return A <tt>\ref vx_status_e</tt> enumeration.
  1927. * \retval VX_SUCCESS No errors; any other value indicates failure.
  1928. * \retval VX_ERROR_INVALID_REFERENCE thresh is not a valid <tt>\ref vx_threshold</tt> reference.
  1929. * \ingroup group_threshold
  1930. */
  1931. VX_API_ENTRY vx_status VX_API_CALL vxQueryThreshold(vx_threshold thresh, vx_enum attribute, void *ptr, vx_size size);
  1932. /*==============================================================================
  1933. MATRIX
  1934. =============================================================================*/
  1935. /*! \brief Creates a reference to a matrix object.
  1936. * \param [in] c The reference to the overall context.
  1937. * \param [in] data_type The unit format of the matrix. <tt>\ref VX_TYPE_UINT8</tt> or <tt>\ref VX_TYPE_INT32</tt> or <tt>\ref VX_TYPE_FLOAT32</tt>.
  1938. * \param [in] columns The first dimensionality.
  1939. * \param [in] rows The second dimensionality.
  1940. * \returns An matrix reference <tt>\ref vx_matrix</tt>. Any possible errors preventing a
  1941. * successful creation should be checked using <tt>\ref vxGetStatus</tt>.
  1942. * \ingroup group_matrix
  1943. */
  1944. VX_API_ENTRY vx_matrix VX_API_CALL vxCreateMatrix(vx_context c, vx_enum data_type, vx_size columns, vx_size rows);
  1945. /*! \brief Creates an opaque reference to a matrix object without direct user access.
  1946. * \param [in] graph The reference to the parent graph.
  1947. * \param [in] data_type The unit format of the matrix. <tt>\ref VX_TYPE_UINT8</tt> or <tt>\ref VX_TYPE_INT32</tt> or <tt>\ref VX_TYPE_FLOAT32</tt>.
  1948. * \param [in] columns The first dimensionality.
  1949. * \param [in] rows The second dimensionality.
  1950. * \see <tt>\ref vxCreateMatrix</tt>
  1951. * \returns An matrix reference <tt>\ref vx_matrix</tt>. Any possible errors preventing a
  1952. * successful creation should be checked using <tt>\ref vxGetStatus</tt>.
  1953. * \ingroup group_matrix
  1954. */
  1955. VX_API_ENTRY vx_matrix VX_API_CALL vxCreateVirtualMatrix(vx_graph graph, vx_enum data_type, vx_size columns, vx_size rows);
  1956. /*! \brief Releases a reference to a matrix object.
  1957. * The object may not be garbage collected until its total reference count is zero.
  1958. * \param [in] mat The matrix reference to release.
  1959. * \post After returning from this function the reference is zeroed.
  1960. * \return A <tt>\ref vx_status_e</tt> enumeration.
  1961. * \retval VX_SUCCESS No errors; any other value indicates failure.
  1962. * \retval VX_ERROR_INVALID_REFERENCE mat is not a valid <tt>\ref vx_matrix</tt> reference.
  1963. * \ingroup group_matrix
  1964. */
  1965. VX_API_ENTRY vx_status VX_API_CALL vxReleaseMatrix(vx_matrix *mat);
  1966. /*! \brief Queries an attribute on the matrix object.
  1967. * \param [in] mat The matrix object to set.
  1968. * \param [in] attribute The attribute to query. Use a <tt>\ref vx_matrix_attribute_e</tt> enumeration.
  1969. * \param [out] ptr The location at which to store the resulting value.
  1970. * \param [in] size The size in bytes of the container to which \a ptr points.
  1971. * \return A <tt>\ref vx_status_e</tt> enumeration.
  1972. * \retval VX_SUCCESS No errors; any other value indicates failure.
  1973. * \retval VX_ERROR_INVALID_REFERENCE mat is not a valid <tt>\ref vx_matrix</tt> reference.
  1974. * \ingroup group_matrix
  1975. */
  1976. VX_API_ENTRY vx_status VX_API_CALL vxQueryMatrix(vx_matrix mat, vx_enum attribute, void *ptr, vx_size size);
  1977. /*! \brief Allows the application to copy from/into a matrix object.
  1978. * \param [in] matrix The reference to the matrix object that is the source or the
  1979. * destination of the copy.
  1980. * \param [in] user_ptr The address of the memory location where to store the requested data
  1981. * if the copy was requested in read mode, or from where to get the data to store into the matrix
  1982. * object if the copy was requested in write mode. In the user memory, the matrix is
  1983. * structured as a row-major 2D array with elements of the type corresponding to
  1984. * <tt>\ref VX_MATRIX_TYPE</tt>, with a number of rows corresponding to
  1985. * <tt>\ref VX_MATRIX_ROWS</tt> and a number of columns corresponding to
  1986. * <tt>\ref VX_MATRIX_COLUMNS</tt>. The accessible memory must be large
  1987. * enough to contain this 2D array:
  1988. * accessible memory in bytes >= sizeof(data_element) * rows * columns.
  1989. * \param [in] usage This declares the effect of the copy with regard to the matrix object
  1990. * using the <tt>\ref vx_accessor_e</tt> enumeration. Only <tt>\ref VX_READ_ONLY</tt> and <tt>\ref VX_WRITE_ONLY</tt>
  1991. * are supported:
  1992. * \arg <tt>\ref VX_READ_ONLY</tt> means that data are copied from the matrix object into the user memory.
  1993. * \arg <tt>\ref VX_WRITE_ONLY</tt> means that data are copied into the matrix object from the user memory.
  1994. * \param [in] user_mem_type A <tt>\ref vx_memory_type_e</tt> enumeration that specifies
  1995. * the memory type of the memory referenced by the user_addr.
  1996. * \return A <tt>\ref vx_status_e</tt> enumeration.
  1997. * \retval VX_SUCCESS No errors; any other value indicates failure.
  1998. * \retval VX_ERROR_INVALID_REFERENCE matrix is not a valid <tt>\ref vx_matrix</tt> reference.
  1999. * \retval VX_ERROR_INVALID_PARAMETERS An other parameter is incorrect.
  2000. * \ingroup group_matrix
  2001. */
  2002. VX_API_ENTRY vx_status VX_API_CALL vxCopyMatrix(vx_matrix matrix, void *user_ptr, vx_enum usage, vx_enum user_mem_type);
  2003. /*! \brief Creates a reference to a matrix object from a boolean pattern.
  2004. * \see <tt>\ref vxCreateMatrixFromPatternAndOrigin</tt> for a description of the matrix patterns.
  2005. * \param [in] context The reference to the overall context.
  2006. * \param [in] pattern The pattern of the matrix. See <tt>\ref VX_MATRIX_PATTERN</tt>.
  2007. * \param [in] columns The first dimensionality.
  2008. * \param [in] rows The second dimensionality.
  2009. * \returns A matrix reference <tt>\ref vx_matrix</tt> of type <tt>\ref VX_TYPE_UINT8</tt>. Any possible errors preventing a
  2010. * successful creation should be checked using <tt>\ref vxGetStatus</tt>.
  2011. * \ingroup group_matrix
  2012. */
  2013. VX_API_ENTRY vx_matrix VX_API_CALL vxCreateMatrixFromPattern(vx_context context, vx_enum pattern, vx_size columns, vx_size rows);
  2014. /*! \brief Creates a reference to a matrix object from a boolean pattern, with a user-specified origin.
  2015. *
  2016. * The matrix created by this function is of type <tt>\ref VX_TYPE_UINT8</tt>, with the value 0 representing False,
  2017. * and the value 255 representing True. It supports the patterns as described below:
  2018. * - VX_PATTERN_BOX is a matrix with dimensions equal to the given number of rows and columns, and all cells equal to 255.
  2019. * Dimensions of 3x3 and 5x5 must be supported.
  2020. * - VX_PATTERN_CROSS is a matrix with dimensions equal to the given number of rows and columns, which both must be odd numbers.
  2021. * All cells in the center row and center column are equal to 255, and the rest are equal to zero.
  2022. * Dimensions of 3x3 and 5x5 must be supported.
  2023. * - VX_PATTERN_DISK is a matrix with dimensions equal to the given number of rows (R) and columns (C),
  2024. * where R and C are odd and cell (c, r) is 255 if: \n
  2025. * (r-R/2 + 0.5)^2 / (R/2)^2 + (c-C/2 + 0.5)^2/(C/2)^2 is less than or equal to 1,\n and 0 otherwise.
  2026. *
  2027. * A matrix created from pattern is read-only. The behavior when attempting to modify such a matrix is undefined.
  2028. *
  2029. * \param [in] context The reference to the overall context.
  2030. * \param [in] pattern The pattern of the matrix. See <tt>\ref VX_MATRIX_PATTERN</tt>.
  2031. * \param [in] columns The first dimensionality.
  2032. * \param [in] rows The second dimensionality.
  2033. * \param [in] origin_col The origin (first dimensionality).
  2034. * \param [in] origin_row The origin (second dimensionality).
  2035. * \returns A matrix reference <tt>\ref vx_matrix</tt> of type <tt>\ref VX_TYPE_UINT8</tt>. Any possible errors
  2036. * preventing a successful creation should be checked using <tt>\ref vxGetStatus</tt>.
  2037. * \ingroup group_matrix
  2038. */
  2039. VX_API_ENTRY vx_matrix VX_API_CALL vxCreateMatrixFromPatternAndOrigin(vx_context context, vx_enum pattern, vx_size columns, vx_size rows, vx_size origin_col, vx_size origin_row);
  2040. /*==============================================================================
  2041. CONVOLUTION
  2042. =============================================================================*/
  2043. /*! \brief Creates a reference to a convolution matrix object.
  2044. * \param [in] context The reference to the overall context.
  2045. * \param [in] columns The columns dimension of the convolution.
  2046. * Must be odd and greater than or equal to 3 and less than the value returned
  2047. * from <tt>\ref VX_CONTEXT_CONVOLUTION_MAX_DIMENSION</tt>.
  2048. * \param [in] rows The rows dimension of the convolution.
  2049. * Must be odd and greater than or equal to 3 and less than the value returned
  2050. * from <tt>\ref VX_CONTEXT_CONVOLUTION_MAX_DIMENSION</tt>.
  2051. * \returns A convolution reference <tt>\ref vx_convolution</tt>. Any possible errors preventing a
  2052. * successful creation should be checked using <tt>\ref vxGetStatus</tt>.
  2053. * \ingroup group_convolution
  2054. */
  2055. VX_API_ENTRY vx_convolution VX_API_CALL vxCreateConvolution(vx_context context, vx_size columns, vx_size rows);
  2056. /*! \brief Creates an opaque reference to a convolution matrix object without direct user access.
  2057. * \param [in] graph The reference to the parent graph.
  2058. * \param [in] columns The columns dimension of the convolution.
  2059. * Must be odd and greater than or equal to 3 and less than the value returned
  2060. * from <tt>\ref VX_CONTEXT_CONVOLUTION_MAX_DIMENSION</tt>.
  2061. * \param [in] rows The rows dimension of the convolution.
  2062. * Must be odd and greater than or equal to 3 and less than the value returned
  2063. * from <tt>\ref VX_CONTEXT_CONVOLUTION_MAX_DIMENSION</tt>.
  2064. * \see <tt>\ref vxCreateConvolution</tt>
  2065. * \returns A convolution reference <tt>\ref vx_convolution</tt>. Any possible errors preventing a
  2066. * successful creation should be checked using <tt>\ref vxGetStatus</tt>.
  2067. * \ingroup group_convolution
  2068. */
  2069. VX_API_ENTRY vx_convolution VX_API_CALL vxCreateVirtualConvolution(vx_graph graph, vx_size columns, vx_size rows);
  2070. /*! \brief Releases the reference to a convolution matrix.
  2071. * The object may not be garbage collected until its total reference count is zero.
  2072. * \param [in] conv The pointer to the convolution matrix to release.
  2073. * \post After returning from this function the reference is zeroed.
  2074. * \return A <tt>\ref vx_status_e</tt> enumeration.
  2075. * \retval VX_SUCCESS No errors; any other value indicates failure.
  2076. * \retval VX_ERROR_INVALID_REFERENCE conv is not a valid <tt>\ref vx_convolution</tt> reference.
  2077. * \ingroup group_convolution
  2078. */
  2079. VX_API_ENTRY vx_status VX_API_CALL vxReleaseConvolution(vx_convolution *conv);
  2080. /*! \brief Queries an attribute on the convolution matrix object.
  2081. * \param [in] conv The convolution matrix object to set.
  2082. * \param [in] attribute The attribute to query. Use a <tt>\ref vx_convolution_attribute_e</tt> enumeration.
  2083. * \param [out] ptr The location at which to store the resulting value.
  2084. * \param [in] size The size in bytes of the container to which \a ptr points.
  2085. * \return A <tt>\ref vx_status_e</tt> enumeration.
  2086. * \retval VX_SUCCESS No errors; any other value indicates failure.
  2087. * \retval VX_ERROR_INVALID_REFERENCE conv is not a valid <tt>\ref vx_convolution</tt> reference.
  2088. * \ingroup group_convolution
  2089. */
  2090. VX_API_ENTRY vx_status VX_API_CALL vxQueryConvolution(vx_convolution conv, vx_enum attribute, void *ptr, vx_size size);
  2091. /*! \brief Sets attributes on the convolution object.
  2092. * \param [in] conv The coordinates object to set.
  2093. * \param [in] attribute The attribute to modify. Use a <tt>\ref vx_convolution_attribute_e</tt> enumeration.
  2094. * \param [in] ptr The pointer to the value to which to set the attribute.
  2095. * \param [in] size The size in bytes of the data pointed to by \a ptr.
  2096. * \return A <tt>\ref vx_status_e</tt> enumeration.
  2097. * \retval VX_SUCCESS No errors; any other value indicates failure.
  2098. * \retval VX_ERROR_INVALID_REFERENCE conv is not a valid <tt>\ref vx_convolution</tt> reference.
  2099. * \ingroup group_convolution
  2100. */
  2101. VX_API_ENTRY vx_status VX_API_CALL vxSetConvolutionAttribute(vx_convolution conv, vx_enum attribute, const void *ptr, vx_size size);
  2102. /*! \brief Allows the application to copy coefficients from/into a convolution object.
  2103. * \param [in] conv The reference to the convolution object that is the source or the destination of the copy.
  2104. * \param [in] user_ptr The address of the memory location where to store the requested
  2105. * coefficient data if the copy was requested in read mode, or from where to get the
  2106. * coefficient data to store into the convolution object if the copy was requested in
  2107. * write mode. In the user memory, the convolution coefficient data is structured as a
  2108. * row-major 2D array with elements of the type corresponding
  2109. * to <tt>\ref VX_TYPE_CONVOLUTION</tt>, with a number of rows corresponding to
  2110. * <tt>\ref VX_CONVOLUTION_ROWS</tt> and a number of columns corresponding to
  2111. * <tt>\ref VX_CONVOLUTION_COLUMNS</tt>. The accessible memory must be large
  2112. * enough to contain this 2D array:
  2113. * accessible memory in bytes >= sizeof(data_element) * rows * columns.
  2114. * \param [in] usage This declares the effect of the copy with regard to the convolution object
  2115. * using the <tt>\ref vx_accessor_e</tt> enumeration. Only <tt>\ref VX_READ_ONLY</tt> and <tt>\ref VX_WRITE_ONLY</tt>
  2116. * are supported:
  2117. * \arg <tt>\ref VX_READ_ONLY</tt> means that data are copied from the convolution object into the user memory.
  2118. * \arg <tt>\ref VX_WRITE_ONLY</tt> means that data are copied into the convolution object from the user memory.
  2119. * \param [in] user_mem_type A <tt>\ref vx_memory_type_e</tt> enumeration that specifies
  2120. * the memory type of the memory referenced by the user_addr.
  2121. * \return A <tt>\ref vx_status_e</tt> enumeration.
  2122. * \retval VX_SUCCESS No errors; any other value indicates failure.
  2123. * \retval VX_ERROR_INVALID_REFERENCE conv is not a valid <tt>\ref vx_convolution</tt> reference.
  2124. * \retval VX_ERROR_INVALID_PARAMETERS An other parameter is incorrect.
  2125. * \ingroup group_convolution
  2126. */
  2127. VX_API_ENTRY vx_status VX_API_CALL vxCopyConvolutionCoefficients(vx_convolution conv, void *user_ptr, vx_enum usage, vx_enum user_mem_type);
  2128. /*==============================================================================
  2129. PYRAMID
  2130. =============================================================================*/
  2131. /*! \brief Creates a reference to a pyramid object of the supplied number of levels.
  2132. * \param [in] context The reference to the overall context.
  2133. * \param [in] levels The number of levels desired. This is required to be a non-zero value.
  2134. * \param [in] scale Used to indicate the scale between pyramid levels. This is required to be a non-zero positive value.
  2135. * <tt>\ref VX_SCALE_PYRAMID_HALF</tt> and <tt>\ref VX_SCALE_PYRAMID_ORB</tt> must be supported.
  2136. * \param [in] width The width of the 0th level image in pixels.
  2137. * \param [in] height The height of the 0th level image in pixels.
  2138. * \param [in] format The format of all images in the pyramid. NV12, NV21, IYUV, UYVY and YUYV formats are not supported.
  2139. * \returns A pyramid reference <tt>\ref vx_pyramid</tt> containing the sub-images. Any possible errors preventing a
  2140. * successful creation should be checked using <tt>\ref vxGetStatus</tt>.
  2141. * \ingroup group_pyramid
  2142. */
  2143. VX_API_ENTRY vx_pyramid VX_API_CALL vxCreatePyramid(vx_context context, vx_size levels, vx_float32 scale, vx_uint32 width, vx_uint32 height, vx_df_image format);
  2144. /*! \brief Creates a reference to a virtual pyramid object of the supplied number of levels.
  2145. * \details Virtual Pyramids can be used to connect Nodes together when the contents of the pyramids will
  2146. * not be accessed by the user of the API.
  2147. * All of the following constructions are valid:
  2148. * \code
  2149. * vx_context context = vxCreateContext();
  2150. * vx_graph graph = vxCreateGraph(context);
  2151. * vx_pyramid virt[] = {
  2152. * vxCreateVirtualPyramid(graph, 4, VX_SCALE_PYRAMID_HALF, 0, 0, VX_DF_IMAGE_VIRT), // no dimension and format specified for level 0
  2153. * vxCreateVirtualPyramid(graph, 4, VX_SCALE_PYRAMID_HALF, 640, 480, VX_DF_IMAGE_VIRT), // no format specified.
  2154. * vxCreateVirtualPyramid(graph, 4, VX_SCALE_PYRAMID_HALF, 640, 480, VX_DF_IMAGE_U8), // no access
  2155. * };
  2156. * \endcode
  2157. * \param [in] graph The reference to the parent graph.
  2158. * \param [in] levels The number of levels desired. This is required to be a non-zero value.
  2159. * \param [in] scale Used to indicate the scale between pyramid levels. This is required to be a non-zero positive value.
  2160. * <tt>\ref VX_SCALE_PYRAMID_HALF</tt> and <tt>\ref VX_SCALE_PYRAMID_ORB</tt> must be supported.
  2161. * \param [in] width The width of the 0th level image in pixels. This may be set to zero to indicate to the interface that the value is unspecified.
  2162. * \param [in] height The height of the 0th level image in pixels. This may be set to zero to indicate to the interface that the value is unspecified.
  2163. * \param [in] format The format of all images in the pyramid. This may be set to <tt>\ref VX_DF_IMAGE_VIRT</tt> to indicate that the format is unspecified.
  2164. * \returns A pyramid reference <tt>\ref vx_pyramid</tt>. Any possible errors preventing a
  2165. * successful creation should be checked using <tt>\ref vxGetStatus</tt>.
  2166. * \note Images extracted with <tt>\ref vxGetPyramidLevel</tt> behave as Virtual Images and
  2167. * cause <tt>\ref vxMapImagePatch</tt> to return errors.
  2168. * \ingroup group_pyramid
  2169. */
  2170. VX_API_ENTRY vx_pyramid VX_API_CALL vxCreateVirtualPyramid(vx_graph graph, vx_size levels, vx_float32 scale, vx_uint32 width, vx_uint32 height, vx_df_image format);
  2171. /*! \brief Releases a reference to a pyramid object.
  2172. * The object may not be garbage collected until its total reference count is zero.
  2173. * \param [in] pyr The pointer to the pyramid to release.
  2174. * \ingroup group_pyramid
  2175. * \return A <tt>\ref vx_status_e</tt> enumeration.
  2176. * \retval VX_SUCCESS No errors; any other value indicates failure.
  2177. * \retval VX_ERROR_INVALID_REFERENCE pyr is not a valid <tt>\ref vx_pyramid</tt> reference.
  2178. * \post After returning from this function the reference is zeroed.
  2179. */
  2180. VX_API_ENTRY vx_status VX_API_CALL vxReleasePyramid(vx_pyramid *pyr);
  2181. /*! \brief Queries an attribute from an image pyramid.
  2182. * \param [in] pyr The pyramid to query.
  2183. * \param [in] attribute The attribute for which to query. Use a <tt>\ref vx_pyramid_attribute_e</tt> enumeration.
  2184. * \param [out] ptr The location at which to store the resulting value.
  2185. * \param [in] size The size in bytes of the container to which \a ptr points.
  2186. * \return A <tt>\ref vx_status_e</tt> enumeration.
  2187. * \retval VX_SUCCESS No errors; any other value indicates failure.
  2188. * \retval VX_ERROR_INVALID_REFERENCE pyr is not a valid <tt>\ref vx_pyramid</tt> reference.
  2189. * \ingroup group_pyramid
  2190. */
  2191. VX_API_ENTRY vx_status VX_API_CALL vxQueryPyramid(vx_pyramid pyr, vx_enum attribute, void *ptr, vx_size size);
  2192. /*! \brief Retrieves a level of the pyramid as a <tt>\ref vx_image</tt>, which can be used
  2193. * elsewhere in OpenVX. A call to vxReleaseImage is necessary to release an image for each
  2194. * call of vxGetPyramidLevel.
  2195. * \param [in] pyr The pyramid object.
  2196. * \param [in] index The index of the level, such that index is less than levels.
  2197. * \return A <tt>\ref vx_image</tt> reference. Any possible errors preventing a successful
  2198. * function completion should be checked using <tt>\ref vxGetStatus</tt>.
  2199. * \ingroup group_pyramid
  2200. */
  2201. VX_API_ENTRY vx_image VX_API_CALL vxGetPyramidLevel(vx_pyramid pyr, vx_uint32 index);
  2202. /*==============================================================================
  2203. REMAP
  2204. =============================================================================*/
  2205. /*! \brief Creates a remap table object.
  2206. * \param [in] context The reference to the overall context.
  2207. * \param [in] src_width Width of the source image in pixel.
  2208. * \param [in] src_height Height of the source image in pixels.
  2209. * \param [in] dst_width Width of the destination image in pixels.
  2210. * \param [in] dst_height Height of the destination image in pixels.
  2211. * \ingroup group_remap
  2212. * \returns A remap reference <tt>\ref vx_remap</tt>. Any possible errors preventing a
  2213. * successful creation should be checked using <tt>\ref vxGetStatus</tt>.
  2214. */
  2215. VX_API_ENTRY vx_remap VX_API_CALL vxCreateRemap(vx_context context,
  2216. vx_uint32 src_width,
  2217. vx_uint32 src_height,
  2218. vx_uint32 dst_width,
  2219. vx_uint32 dst_height);
  2220. /*! \brief Creates an opaque reference to a remap table object without direct user access.
  2221. * \param [in] graph The reference to the parent graph.
  2222. * \param [in] src_width Width of the source image in pixel.
  2223. * \param [in] src_height Height of the source image in pixels.
  2224. * \param [in] dst_width Width of the destination image in pixels.
  2225. * \param [in] dst_height Height of the destination image in pixels.
  2226. * \see <tt>\ref vxCreateRemap</tt>
  2227. * \ingroup group_remap
  2228. * \returns A remap reference <tt>\ref vx_remap</tt>. Any possible errors preventing a
  2229. * successful creation should be checked using <tt>\ref vxGetStatus</tt>.
  2230. */
  2231. VX_API_ENTRY vx_remap VX_API_CALL vxCreateVirtualRemap(vx_graph graph,
  2232. vx_uint32 src_width,
  2233. vx_uint32 src_height,
  2234. vx_uint32 dst_width,
  2235. vx_uint32 dst_height);
  2236. /*! \brief Releases a reference to a remap table object. The object may not be
  2237. * garbage collected until its total reference count is zero.
  2238. * \param [in] table The pointer to the remap table to release.
  2239. * \post After returning from this function the reference is zeroed.
  2240. * \return A <tt>\ref vx_status_e</tt> enumeration.
  2241. * \retval VX_SUCCESS No errors; any other value indicates failure.
  2242. * \retval VX_ERROR_INVALID_REFERENCE table is not a valid <tt>\ref vx_remap</tt> reference.
  2243. * \ingroup group_remap
  2244. */
  2245. VX_API_ENTRY vx_status VX_API_CALL vxReleaseRemap(vx_remap *table);
  2246. /*! \brief Allows the application to get direct access to a rectangular patch of a remap object.
  2247. *
  2248. * The patch is specified within the destination dimensions and its
  2249. * data provide the corresponding coordinate within the source dimensions.
  2250. * The patch is mapped as a 2D array of elements of the type associated
  2251. * with the \p coordinate_type parameter (i.e., <tt>\ref vx_coordinates2df_t</tt>
  2252. * for <tt>\ref VX_TYPE_COORDINATES2DF</tt>).
  2253. * The memory layout of the mapped 2D array follows a row-major order where rows are
  2254. * compact (without any gap between elements), and where the potential
  2255. * padding after each lines is determined by (* \p stride_y).
  2256. *
  2257. * \param [in] remap The reference to the remap object that contains the
  2258. * patch to map.
  2259. *
  2260. * \param [in] rect The coordinates of remap patch. The patch must be specified
  2261. * within the bounds of the remap destination dimensions
  2262. * (<tt>\ref VX_REMAP_DESTINATION_WIDTH</tt> x <tt>\ref VX_REMAP_DESTINATION_HEIGHT</tt>).
  2263. * (start_x, start_y) gives the coordinate of the topleft element inside the patch,
  2264. * while (end_x, end_y) gives the coordinate of the bottomright element out of the patch.
  2265. *
  2266. * \param [out] map_id The address of a <tt>\ref vx_map_id</tt> variable
  2267. * where the function returns a map identifier.
  2268. * \arg (*map_id) must eventually be provided as the map_id parameter of a call
  2269. * to <tt>\ref vxUnmapRemapPatch</tt>.
  2270. *
  2271. * \param [out] stride_y The address of a vx_size variable where the function
  2272. * returns the difference between the address of the first element of two
  2273. * successive lines in the mapped remap patch. The stride value follows the
  2274. * following rule :
  2275. * (*stride_y) >= sizeof(<ELEMENT_TYPE>) * (rect->end_x - rect->start_x)
  2276. *
  2277. * \param [out] ptr The address of a pointer where the function returns where
  2278. * remap patch data can be accessed. (*ptr) is the address of the the top-left
  2279. * element of the remap patch.
  2280. * The returned (*ptr) address is only valid between the call to this function
  2281. * and the corresponding call to <tt>\ref vxUnmapRemapPatch</tt>.
  2282. *
  2283. * \param [in] coordinate_type This declares the type of the source coordinate
  2284. * data that the application wants to access in the remap patch.
  2285. * It must be <tt>\ref VX_TYPE_COORDINATES2DF</tt>.
  2286. *
  2287. * \param [in] usage This declares the access mode for the remap patch, using
  2288. * the <tt>\ref vx_accessor_e</tt> enumeration.
  2289. * \arg <tt>\ref VX_READ_ONLY</tt>: after the function call, the content of the
  2290. * memory location pointed by (*ptr) contains the remap patch data. Writing into
  2291. * this memory location is forbidden and its behavior is undefined.
  2292. * \arg <tt>\ref VX_READ_AND_WRITE</tt>: after the function call, the content of
  2293. * the memory location pointed by (*ptr) contains the remap patch data; writing
  2294. * into this memory is allowed for the location of elements only and will
  2295. * result in a modification of the written elements in the remap object once the
  2296. * patch is unmapped. Writing into a gap between element lines
  2297. * (when (*stride_y) > sizeof(<ELEMENT_TYPE>) * (rect->end_x - rect->start_x))
  2298. * is forbidden and its behavior is undefined.
  2299. * \arg <tt>\ref VX_WRITE_ONLY</tt>: after the function call, the memory location
  2300. * pointed by (*ptr) contains undefined data; writing each element of the patch is
  2301. * required prior to unmapping. Elements not written by the application before
  2302. * unmap will become undefined after unmap, even if they were well defined before
  2303. * map. Like for <tt>\ref VX_READ_AND_WRITE</tt>, writing into a gap between
  2304. * element lines is forbidden and its behavior is undefined.
  2305. *
  2306. * \param [in] mem_type A <tt>\ref vx_memory_type_e</tt> enumeration that
  2307. * specifies the type of the memory where the remap patch is requested to be mapped.
  2308. *
  2309. * \return A <tt>\ref vx_status_e</tt> enumeration.
  2310. * \retval VX_SUCCESS No errors; any other value indicates failure.
  2311. * \retval VX_ERROR_INVALID_REFERENCE remap is not a valid <tt>\ref vx_remap</tt> reference.
  2312. * \retval VX_ERROR_INVALID_PARAMETERS An other parameter is incorrect.
  2313. *
  2314. * \ingroup group_remap
  2315. * \post <tt>\ref vxUnmapRemapPatch </tt> with same (*map_id) value.
  2316. */
  2317. VX_API_ENTRY vx_status VX_API_CALL vxMapRemapPatch(vx_remap remap,
  2318. const vx_rectangle_t *rect,
  2319. vx_map_id *map_id,
  2320. vx_size *stride_y,
  2321. void **ptr,
  2322. vx_enum coordinate_type,
  2323. vx_enum usage,
  2324. vx_enum mem_type);
  2325. /*! \brief Unmap and commit potential changes to a remap object patch that was previously mapped.
  2326. *
  2327. * Unmapping a remap patch invalidates the memory location from which the patch could
  2328. * be accessed by the application. Accessing this memory location after the unmap function
  2329. * completes has an undefined behavior.
  2330. * \param [in] remap The reference to the remap object to unmap.
  2331. * \param [out] map_id The unique map identifier that was returned by <tt>\ref vxMapRemapPatch</tt> .
  2332. * \return A <tt>\ref vx_status_e</tt> enumeration.
  2333. * \retval VX_SUCCESS No errors; any other value indicates failure.
  2334. * \retval VX_ERROR_INVALID_REFERENCE remap is not a valid <tt>\ref vx_remap</tt> reference.
  2335. * \retval VX_ERROR_INVALID_PARAMETERS An other parameter is incorrect.
  2336. * \ingroup group_remap
  2337. * \pre <tt>\ref vxMapRemapPatch</tt> with same map_id value
  2338. */
  2339. VX_API_ENTRY vx_status VX_API_CALL vxUnmapRemapPatch(vx_remap remap, vx_map_id map_id);
  2340. /*! \brief Allows the application to copy a rectangular patch from/into a remap object.
  2341. *
  2342. * The patch is specified within the destination dimensions and its
  2343. * data provide the corresponding coordinate within the source dimensions.
  2344. * The patch in user memory is a 2D array of elements of the type associated with the
  2345. * \p coordinate_type parameter (i.e., <tt>\ref vx_coordinates2df_t</tt> for
  2346. * <tt>\ref VX_TYPE_COORDINATES2DF</tt>).
  2347. * The memory layout of this array follows a row-major order where rows are
  2348. * compact (without any gap between elements), and where the potential padding
  2349. * after each line is determined by the \p user_stride_y parameter.
  2350. * \param [in] remap The reference to the remap object that is the source or the
  2351. * destination of the patch copy.
  2352. *
  2353. * \param [in] rect The coordinates of remap patch. The patch must be specified
  2354. * within the bounds of the remap destination dimensions
  2355. * (<tt>\ref VX_REMAP_DESTINATION_WIDTH</tt> x <tt>\ref VX_REMAP_DESTINATION_HEIGHT</tt>).
  2356. * (start_x, start_y) gives the coordinate of the topleft element inside the patch,
  2357. * while (end_x, end_y) gives the coordinate of the bottomright element out of the patch.
  2358. *
  2359. * \param [in] user_stride_y The difference between the address of the first element
  2360. * of two successive lines of the remap patch in user memory (pointed by
  2361. * \p user_ptr). The layout of the user memory must follow a row major order and user_stride_y
  2362. * must follow the following rule :
  2363. * user_stride_y >= sizeof(<ELEMENT_TYPE>) * (rect->end_x - rect->start_x).
  2364. *
  2365. * \param [in] user_ptr The address of the user memory location where to store the requested
  2366. * remap data if the copy was requested in read mode, or from where to get the remap data to
  2367. * store into the remap object if the copy was requested in write mode. \p user_ptr is the
  2368. * address of the the top-left element of the remap patch.
  2369. * The accessible user memory must be large enough to contain the specified patch with
  2370. * the specified layout:
  2371. * accessible memory in bytes >= (rect->end_y - rect->start_y) * user_stride_y.
  2372. *
  2373. * \param [in] user_coordinate_type This declares the type of the source coordinate remap
  2374. * data in the user memory. It must be <tt>\ref VX_TYPE_COORDINATES2DF</tt>.
  2375. *
  2376. * \param [in] usage This declares the effect of the copy with regard to the remap object
  2377. * using the <tt>\ref vx_accessor_e</tt> enumeration. Only VX_READ_ONLY and VX_WRITE_ONLY are
  2378. * supported:
  2379. * \arg <tt>\ref VX_READ_ONLY</tt> means that data is copied from the remap object into the user
  2380. * memory pointer by \p user_ptr. The potential padding after each line in user
  2381. * memory will stay unchanged.
  2382. * \arg <tt>\ref VX_WRITE_ONLY</tt> means that data is copied into the remap object from
  2383. * the user memory.
  2384. *
  2385. * \param [in] user_mem_type A <tt>\ref vx_memory_type_e</tt> enumeration that specifies
  2386. * the type of the memory pointer by \p user_ptr.
  2387. *
  2388. * \return A <tt>\ref vx_status_e</tt> enumeration.
  2389. * \retval VX_SUCCESS No errors; any other value indicates failure.
  2390. * \retval VX_ERROR_INVALID_REFERENCE remap is not a valid <tt>\ref vx_remap</tt> reference.
  2391. * \retval VX_ERROR_INVALID_PARAMETERS An other parameter is incorrect.
  2392. *
  2393. * \ingroup group_remap
  2394. */
  2395. VX_API_ENTRY vx_status VX_API_CALL vxCopyRemapPatch(vx_remap remap,
  2396. const vx_rectangle_t *rect,
  2397. vx_size user_stride_y,
  2398. void * user_ptr,
  2399. vx_enum user_coordinate_type,
  2400. vx_enum usage,
  2401. vx_enum user_mem_type);
  2402. /*! \brief Queries attributes from a Remap table.
  2403. * \param [in] table The remap to query.
  2404. * \param [in] attribute The attribute to query. Use a <tt>\ref vx_remap_attribute_e</tt> enumeration.
  2405. * \param [out] ptr The location at which to store the resulting value.
  2406. * \param [in] size The size in bytes of the container to which \a ptr points.
  2407. * \return A <tt>\ref vx_status_e</tt> enumeration.
  2408. * \retval VX_SUCCESS No errors; any other value indicates failure.
  2409. * \retval VX_ERROR_INVALID_REFERENCE table is not a valid <tt>\ref vx_remap</tt> reference.
  2410. * \ingroup group_remap
  2411. */
  2412. VX_API_ENTRY vx_status VX_API_CALL vxQueryRemap(vx_remap table, vx_enum attribute, void *ptr, vx_size size);
  2413. /*==============================================================================
  2414. ARRAY
  2415. =============================================================================*/
  2416. /*!
  2417. * \brief Creates a reference to an Array object.
  2418. *
  2419. * User must specify the Array capacity (i.e., the maximal number of items that the array can hold).
  2420. *
  2421. * \param [in] context The reference to the overall Context.
  2422. * \param [in] item_type The type of data to hold. Must be greater than
  2423. * <tt>\ref VX_TYPE_INVALID</tt> and less than or equal to <tt>\ref VX_TYPE_VENDOR_STRUCT_END</tt>.
  2424. * Or must be a <tt>\ref vx_enum</tt> returned from <tt>\ref vxRegisterUserStruct</tt>.
  2425. * \param [in] capacity The maximal number of items that the array can hold. This value must be greater than zero.
  2426. *
  2427. * \returns An array reference <tt>\ref vx_array</tt>. Any possible errors preventing a
  2428. * successful creation should be checked using <tt>\ref vxGetStatus</tt>.
  2429. *
  2430. * \ingroup group_array
  2431. */
  2432. VX_API_ENTRY vx_array VX_API_CALL vxCreateArray(vx_context context, vx_enum item_type, vx_size capacity);
  2433. /*!
  2434. * \brief Creates an opaque reference to a virtual Array with no direct user access.
  2435. *
  2436. * Virtual Arrays are useful when item type or capacity are unknown ahead of time
  2437. * and the Array is used as internal graph edge. Virtual arrays are scoped within the parent graph only.
  2438. *
  2439. * All of the following constructions are allowed.
  2440. * \code
  2441. * vx_context context = vxCreateContext();
  2442. * vx_graph graph = vxCreateGraph(context);
  2443. * vx_array virt[] = {
  2444. * vxCreateVirtualArray(graph, 0, 0), // totally unspecified
  2445. * vxCreateVirtualArray(graph, VX_TYPE_KEYPOINT, 0), // unspecified capacity
  2446. * vxCreateVirtualArray(graph, VX_TYPE_KEYPOINT, 1000), // no access
  2447. * };
  2448. * \endcode
  2449. *
  2450. * \param [in] graph The reference to the parent graph.
  2451. * \param [in] item_type The type of data to hold. Must be greater than
  2452. * <tt>\ref VX_TYPE_INVALID</tt> and less than or equal to <tt>\ref VX_TYPE_VENDOR_STRUCT_END</tt>.
  2453. * Or must be a <tt>\ref vx_enum</tt> returned from <tt>\ref vxRegisterUserStruct</tt>.
  2454. * This may to set to zero to indicate an unspecified item type.
  2455. * \param [in] capacity The maximal number of items that the array can hold.
  2456. * This may be to set to zero to indicate an unspecified capacity.
  2457. * \see vxCreateArray for a type list.
  2458. * \returns A array reference <tt>\ref vx_array</tt>. Any possible errors preventing a
  2459. * successful creation should be checked using <tt>\ref vxGetStatus</tt>.
  2460. *
  2461. * \ingroup group_array
  2462. */
  2463. VX_API_ENTRY vx_array VX_API_CALL vxCreateVirtualArray(vx_graph graph, vx_enum item_type, vx_size capacity);
  2464. /*!
  2465. * \brief Releases a reference of an Array object.
  2466. * The object may not be garbage collected until its total reference count is zero.
  2467. * After returning from this function the reference is zeroed.
  2468. * \param [in] arr The pointer to the Array to release.
  2469. * \return A <tt>\ref vx_status_e</tt> enumeration.
  2470. * \retval VX_SUCCESS No errors; any other value indicates failure.
  2471. * \retval VX_ERROR_INVALID_REFERENCE arr is not a valid <tt>\ref vx_array</tt> reference.
  2472. * \ingroup group_array
  2473. */
  2474. VX_API_ENTRY vx_status VX_API_CALL vxReleaseArray(vx_array *arr);
  2475. /*!
  2476. * \brief Queries the Array for some specific information.
  2477. *
  2478. * \param [in] arr The reference to the Array.
  2479. * \param [in] attribute The attribute to query. Use a <tt>\ref vx_array_attribute_e</tt>.
  2480. * \param [out] ptr The location at which to store the resulting value.
  2481. * \param [in] size The size in bytes of the container to which \a ptr points.
  2482. *
  2483. * \return A <tt>\ref vx_status_e</tt> enumeration.
  2484. * \retval VX_SUCCESS No errors; any other value indicates failure.
  2485. * \retval VX_ERROR_INVALID_REFERENCE arr is not a valid <tt>\ref vx_array</tt> reference.
  2486. * \retval VX_ERROR_NOT_SUPPORTED If the \a attribute is not a value supported on this implementation.
  2487. * \retval VX_ERROR_INVALID_PARAMETERS If any of the other parameters are incorrect.
  2488. *
  2489. * \ingroup group_array
  2490. */
  2491. VX_API_ENTRY vx_status VX_API_CALL vxQueryArray(vx_array arr, vx_enum attribute, void *ptr, vx_size size);
  2492. /*!
  2493. * \brief Adds items to the Array.
  2494. *
  2495. * This function increases the container size.
  2496. *
  2497. * By default, the function does not reallocate memory,
  2498. * so if the container is already full (number of elements is equal to capacity)
  2499. * or it doesn't have enough space,
  2500. * the function returns <tt>\ref VX_FAILURE</tt> error code.
  2501. *
  2502. * \param [in] arr The reference to the Array.
  2503. * \param [in] count The total number of elements to insert.
  2504. * \param [in] ptr The location from which to read the input values.
  2505. * \param [in] stride The number of bytes between the beginning of two consecutive elements.
  2506. *
  2507. * \return A <tt>\ref vx_status_e</tt> enumeration.
  2508. * \retval VX_SUCCESS No errors; any other value indicates failure.
  2509. * \retval VX_ERROR_INVALID_REFERENCE arr is not a valid <tt>\ref vx_array</tt> reference.
  2510. * \retval VX_FAILURE If the Array is full.
  2511. * \retval VX_ERROR_INVALID_PARAMETERS If any of the other parameters are incorrect.
  2512. *
  2513. * \ingroup group_array
  2514. */
  2515. VX_API_ENTRY vx_status VX_API_CALL vxAddArrayItems(vx_array arr, vx_size count, const void *ptr, vx_size stride);
  2516. /*!
  2517. * \brief Truncates an Array (remove items from the end).
  2518. *
  2519. * \param [in,out] arr The reference to the Array.
  2520. * \param [in] new_num_items The new number of items for the Array.
  2521. *
  2522. * \return A <tt>\ref vx_status_e</tt> enumeration.
  2523. * \retval VX_SUCCESS No errors; any other value indicates failure.
  2524. * \retval VX_ERROR_INVALID_REFERENCE arr is not a valid <tt>\ref vx_array</tt> reference.
  2525. * \retval VX_ERROR_INVALID_PARAMETERS The \a new_size is greater than the current size.
  2526. *
  2527. * \ingroup group_array
  2528. */
  2529. VX_API_ENTRY vx_status VX_API_CALL vxTruncateArray(vx_array arr, vx_size new_num_items);
  2530. /*! \brief Allows the application to copy a range from/into an array object.
  2531. * \param [in] array The reference to the array object that is the source or the
  2532. * destination of the copy.
  2533. * \param [in] range_start The index of the first item of the array object to copy.
  2534. * \param [in] range_end The index of the item following the last item of the
  2535. * array object to copy. (range_end range_start) items are copied from index
  2536. * range_start included. The range must be within the bounds of the array:
  2537. * 0 <= range_start < range_end <= number of items in the array.
  2538. * \param [in] user_stride The number of bytes between the beginning of two consecutive
  2539. * items in the user memory pointed by user_ptr. The layout of the user memory must
  2540. * follow an item major order:
  2541. * user_stride >= element size in bytes.
  2542. * \param [in] user_ptr The address of the memory location where to store the requested data
  2543. * if the copy was requested in read mode, or from where to get the data to store into the array
  2544. * object if the copy was requested in write mode. The accessible memory must be large enough
  2545. * to contain the specified range with the specified stride:
  2546. * accessible memory in bytes >= (range_end range_start) * user_stride.
  2547. * \param [in] usage This declares the effect of the copy with regard to the array object
  2548. * using the <tt>\ref vx_accessor_e</tt> enumeration. Only <tt>\ref VX_READ_ONLY</tt> and <tt>\ref VX_WRITE_ONLY</tt>
  2549. * are supported:
  2550. * \arg <tt>\ref VX_READ_ONLY</tt> means that data are copied from the array object into the user memory.
  2551. * \arg <tt>\ref VX_WRITE_ONLY</tt> means that data are copied into the array object from the user memory.
  2552. * \param [in] user_mem_type A <tt>\ref vx_memory_type_e</tt> enumeration that specifies
  2553. * the memory type of the memory referenced by the user_addr.
  2554. * \return A <tt>\ref vx_status_e</tt> enumeration.
  2555. * \retval VX_SUCCESS No errors; any other value indicates failure.
  2556. * \retval VX_ERROR_OPTIMIZED_AWAY This is a reference to a virtual array that cannot be
  2557. * accessed by the application.
  2558. * \retval VX_ERROR_INVALID_REFERENCE array is not a valid <tt>\ref vx_array</tt> reference.
  2559. * \retval VX_ERROR_INVALID_PARAMETERS An other parameter is incorrect.
  2560. * \ingroup group_array
  2561. */
  2562. VX_API_ENTRY vx_status VX_API_CALL vxCopyArrayRange(vx_array array, vx_size range_start, vx_size range_end, vx_size user_stride, void *user_ptr, vx_enum usage, vx_enum user_mem_type);
  2563. /*! \brief Allows the application to get direct access to a range of an array object.
  2564. * \param [in] array The reference to the array object that contains the range to map.
  2565. * \param [in] range_start The index of the first item of the array object to map.
  2566. * \param [in] range_end The index of the item following the last item of the
  2567. * array object to map. (range_end range_start) items are mapped, starting from index
  2568. * range_start included. The range must be within the bounds of the array:
  2569. * Must be 0 <= range_start < range_end <= number of items.
  2570. * \param [out] map_id The address of a <tt>\ref vx_map_id</tt> variable where the function
  2571. * returns a map identifier.
  2572. * \arg (*map_id) must eventually be provided as the map_id parameter of a call to
  2573. * <tt>\ref vxUnmapArrayRange</tt>.
  2574. * \param [out] stride The address of a vx_size variable where the function
  2575. * returns the memory layout of the mapped array range. The function sets (*stride)
  2576. * to the number of bytes between the beginning of two consecutive items.
  2577. * The application must consult (*stride) to access the array items starting from
  2578. * address (*ptr). The layout of the mapped array follows an item major order:
  2579. * (*stride) >= item size in bytes.
  2580. * \param [out] ptr The address of a pointer that the function sets to the
  2581. * address where the requested data can be accessed. The returned (*ptr) address
  2582. * is only valid between the call to the function and the corresponding call to
  2583. * <tt>\ref vxUnmapArrayRange</tt>.
  2584. * \param [in] usage This declares the access mode for the array range, using
  2585. * the <tt>\ref vx_accessor_e</tt> enumeration.
  2586. * \arg <tt>\ref VX_READ_ONLY</tt>: after the function call, the content of the memory location
  2587. * pointed by (*ptr) contains the array range data. Writing into this memory location
  2588. * is forbidden and its behavior is undefined.
  2589. * \arg <tt>\ref VX_READ_AND_WRITE</tt>: after the function call, the content of the memory
  2590. * location pointed by (*ptr) contains the array range data; writing into this memory
  2591. * is allowed only for the location of items and will result in a modification of the
  2592. * affected items in the array object once the range is unmapped. Writing into
  2593. * a gap between items (when (*stride) > item size in bytes) is forbidden and its
  2594. * behavior is undefined.
  2595. * \arg <tt>\ref VX_WRITE_ONLY</tt>: after the function call, the memory location pointed by (*ptr)
  2596. * contains undefined data; writing each item of the range is required prior to
  2597. * unmapping. Items not written by the application before unmap will become
  2598. * undefined after unmap, even if they were well defined before map. Like for
  2599. * VX_READ_AND_WRITE, writing into a gap between items is forbidden and its behavior
  2600. * is undefined.
  2601. * \param [in] mem_type A <tt>\ref vx_memory_type_e</tt> enumeration that
  2602. * specifies the type of the memory where the array range is requested to be mapped.
  2603. * \param [in] flags An integer that allows passing options to the map operation.
  2604. * Use the <tt>\ref vx_map_flag_e</tt> enumeration.
  2605. * \return A <tt>\ref vx_status_e</tt> enumeration.
  2606. * \retval VX_SUCCESS No errors; any other value indicates failure.
  2607. * \retval VX_ERROR_OPTIMIZED_AWAY This is a reference to a virtual array that cannot be
  2608. * accessed by the application.
  2609. * \retval VX_ERROR_INVALID_REFERENCE array is not a valid <tt>\ref vx_array</tt> reference.
  2610. * \retval VX_ERROR_INVALID_PARAMETERS An other parameter is incorrect.
  2611. * \ingroup group_array
  2612. * \post <tt>\ref vxUnmapArrayRange </tt> with same (*map_id) value.
  2613. */
  2614. VX_API_ENTRY vx_status VX_API_CALL vxMapArrayRange(vx_array array, vx_size range_start, vx_size range_end, vx_map_id *map_id, vx_size *stride, void **ptr, vx_enum usage, vx_enum mem_type, vx_uint32 flags);
  2615. /*! \brief Unmap and commit potential changes to an array object range that was previously mapped.
  2616. * Unmapping an array range invalidates the memory location from which the range could
  2617. * be accessed by the application. Accessing this memory location after the unmap function
  2618. * completes has an undefined behavior.
  2619. * \param [in] array The reference to the array object to unmap.
  2620. * \param [out] map_id The unique map identifier that was returned when calling
  2621. * <tt>\ref vxMapArrayRange</tt> .
  2622. * \return A <tt>\ref vx_status_e</tt> enumeration.
  2623. * \retval VX_SUCCESS No errors; any other value indicates failure.
  2624. * \retval VX_ERROR_INVALID_REFERENCE array is not a valid <tt>\ref vx_array</tt> reference.
  2625. * \retval VX_ERROR_INVALID_PARAMETERS An other parameter is incorrect.
  2626. * \ingroup group_array
  2627. * \pre <tt>\ref vxMapArrayRange</tt> returning the same map_id value
  2628. */
  2629. VX_API_ENTRY vx_status VX_API_CALL vxUnmapArrayRange(vx_array array, vx_map_id map_id);
  2630. /*!
  2631. * \brief Accesses a specific indexed element in an array.
  2632. * \param [in] ptr The base pointer for the array range.
  2633. * \param [in] index The index of the element, not byte, to access.
  2634. * \param [in] stride The 'number of bytes' between the beginning of two consecutive elements.
  2635. * \ingroup group_array
  2636. */
  2637. #define vxFormatArrayPointer(ptr, index, stride) \
  2638. (&(((vx_uint8*)(ptr))[(index) * (stride)]))
  2639. /*!
  2640. * \brief Allows access to an array item as a typecast pointer deference.
  2641. * \param [in] type The type of the item to access.
  2642. * \param [in] ptr The base pointer for the array range.
  2643. * \param [in] index The index of the element, not byte, to access.
  2644. * \param [in] stride The 'number of bytes' between the beginning of two consecutive elements.
  2645. * \ingroup group_array
  2646. */
  2647. #define vxArrayItem(type, ptr, index, stride) \
  2648. (*(type *)(vxFormatArrayPointer((ptr), (index), (stride))))
  2649. /*==============================================================================
  2650. OBJECT ARRAY
  2651. =============================================================================*/
  2652. /*!
  2653. * \brief Creates a reference to an ObjectArray of count objects.
  2654. *
  2655. * It uses the metadata of the exemplar to determine the object attributes,
  2656. * ignoring the object data. It does not alter the exemplar or keep or release
  2657. * the reference to the exemplar. For the definition of supported attributes see
  2658. * <tt>\ref vxSetMetaFormatAttribute</tt>. In case the exemplar is a virtual object
  2659. * it must be of immutable metadata, thus it is not allowed to be dimensionless or formatless.
  2660. *
  2661. * \param [in] context The reference to the overall Context.
  2662. * \param [in] exemplar The exemplar object that defines the metadata of the created objects in the ObjectArray.
  2663. * \param [in] count Number of Objects to create in the ObjectArray. This value must be greater than zero.
  2664. *
  2665. * \returns An ObjectArray reference <tt>\ref vx_object_array</tt>. Any possible errors preventing a
  2666. * successful creation should be checked using <tt>\ref vxGetStatus</tt>. Data objects are not initialized by this function.
  2667. *
  2668. * \ingroup group_object_array
  2669. */
  2670. VX_API_ENTRY vx_object_array VX_API_CALL vxCreateObjectArray(vx_context context, vx_reference exemplar, vx_size count);
  2671. /*!
  2672. * \brief Creates an opaque reference to a virtual ObjectArray with no direct user access.
  2673. *
  2674. * This function creates an ObjectArray of count objects with similar behavior as
  2675. * <tt>\ref vxCreateObjectArray</tt>. The only difference is that the objects that are
  2676. * created are virtual in the given graph.
  2677. *
  2678. * \param [in] graph Reference to the graph where to create the virtual ObjectArray.
  2679. * \param [in] exemplar The exemplar object that defines the type of object in the ObjectArray.
  2680. * Only exemplar type of <tt>\ref vx_image</tt>, <tt>\ref vx_array</tt> and
  2681. * <tt>\ref vx_pyramid</tt> are allowed.
  2682. * \param [in] count Number of Objects to create in the ObjectArray.
  2683. * \returns A ObjectArray reference <tt>\ref vx_object_array</tt>. Any possible errors preventing a
  2684. * successful creation should be checked using <tt>\ref vxGetStatus</tt>.
  2685. * \ingroup group_object_array
  2686. */
  2687. VX_API_ENTRY vx_object_array VX_API_CALL vxCreateVirtualObjectArray(vx_graph graph, vx_reference exemplar, vx_size count);
  2688. /*!
  2689. * \brief Retrieves the reference to the OpenVX Object in location index of the ObjectArray.
  2690. *
  2691. * This is a vx_reference, which can be used elsewhere in OpenVX. A call to vxRelease<Object> or <tt>\ref vxReleaseReference</tt>
  2692. * is necessary to release the Object for each call to this function.
  2693. *
  2694. * \param [in] arr The ObjectArray.
  2695. * \param [in] index The index of the object in the ObjectArray.
  2696. * \return A reference to an OpenVX data object. Any possible errors preventing a successful
  2697. * completion of the function should be checked using <tt>\ref vxGetStatus</tt>.
  2698. * \ingroup group_object_array
  2699. */
  2700. VX_API_ENTRY vx_reference VX_API_CALL vxGetObjectArrayItem(vx_object_array arr, vx_uint32 index);
  2701. /*!
  2702. * \brief Releases a reference of an ObjectArray object.
  2703. *
  2704. * The object may not be garbage collected until its total reference and its contained objects
  2705. * count is zero. After returning from this function the reference is zeroed/cleared.
  2706. *
  2707. * \param [in] arr The pointer to the ObjectArray to release.
  2708. * \return A <tt>\ref vx_status_e</tt> enumeration.
  2709. * \retval VX_SUCCESS No errors; any other value indicates failure.
  2710. * \retval VX_ERROR_INVALID_REFERENCE arr is not a valid <tt>\ref vx_object_array</tt> reference.
  2711. * \ingroup group_object_array
  2712. */
  2713. VX_API_ENTRY vx_status VX_API_CALL vxReleaseObjectArray(vx_object_array *arr);
  2714. /*!
  2715. * \brief Queries an atribute from the ObjectArray.
  2716. *
  2717. * \param [in] arr The reference to the ObjectArray.
  2718. * \param [in] attribute The attribute to query. Use a <tt>\ref vx_object_array_attribute_e</tt>.
  2719. * \param [out] ptr The location at which to store the resulting value.
  2720. * \param [in] size The size in bytes of the container to which \a ptr points.
  2721. * \return A <tt>\ref vx_status_e</tt> enumeration.
  2722. * \retval VX_SUCCESS No errors; any other value indicates failure.
  2723. * \retval VX_ERROR_INVALID_REFERENCE arr is not a valid <tt>\ref vx_object_array</tt> reference.
  2724. * \retval VX_ERROR_NOT_SUPPORTED If the \a attribute is not a value supported on this implementation.
  2725. * \retval VX_ERROR_INVALID_PARAMETERS If any of the other parameters are incorrect.
  2726. *
  2727. * \ingroup group_object_array
  2728. */
  2729. VX_API_ENTRY vx_status VX_API_CALL vxQueryObjectArray(vx_object_array arr, vx_enum attribute, void *ptr, vx_size size);
  2730. /*==============================================================================
  2731. META FORMAT
  2732. =============================================================================*/
  2733. /*! \brief This function allows a user to set the attributes of a <tt>\ref vx_meta_format</tt> object in a kernel output validator.
  2734. *
  2735. * The \ref vx_meta_format object contains two types of information: data object meta data and
  2736. * some specific information that defines how the valid region of an image changes
  2737. *
  2738. * The meta data attributes that can be set are identified by this list:
  2739. * - \ref vx_image : \ref VX_IMAGE_FORMAT, \ref VX_IMAGE_HEIGHT, \ref VX_IMAGE_WIDTH
  2740. * - \ref vx_array : \ref VX_ARRAY_CAPACITY, \ref VX_ARRAY_ITEMTYPE
  2741. * - \ref vx_pyramid : \ref VX_PYRAMID_FORMAT, \ref VX_PYRAMID_HEIGHT, \ref VX_PYRAMID_WIDTH, \ref VX_PYRAMID_LEVELS, \ref VX_PYRAMID_SCALE
  2742. * - \ref vx_scalar : \ref VX_SCALAR_TYPE
  2743. * - \ref vx_matrix : \ref VX_MATRIX_TYPE, \ref VX_MATRIX_ROWS, \ref VX_MATRIX_COLUMNS
  2744. * - \ref vx_distribution : \ref VX_DISTRIBUTION_BINS, \ref VX_DISTRIBUTION_OFFSET, \ref VX_DISTRIBUTION_RANGE
  2745. * - \ref vx_remap : \ref VX_REMAP_SOURCE_WIDTH, \ref VX_REMAP_SOURCE_HEIGHT, \ref VX_REMAP_DESTINATION_WIDTH, \ref VX_REMAP_DESTINATION_HEIGHT
  2746. * - \ref vx_lut : \ref VX_LUT_TYPE, \ref VX_LUT_COUNT
  2747. * - \ref vx_threshold : \ref VX_THRESHOLD_TYPE, \ref VX_THRESHOLD_INPUT_FORMAT, \ref VX_THRESHOLD_INPUT_FORMAT
  2748. * - \ref vx_object_array : \ref VX_OBJECT_ARRAY_NUMITEMS, \ref VX_OBJECT_ARRAY_ITEMTYPE
  2749. * - \ref vx_tensor : \ref VX_TENSOR_NUMBER_OF_DIMS, \ref VX_TENSOR_DIMS, \ref VX_TENSOR_DATA_TYPE, \ref VX_TENSOR_FIXED_POINT_POSITION
  2750. * - \ref VX_VALID_RECT_CALLBACK
  2751. * \note For vx_image, a specific attribute can be used to specify the valid region evolution. This information is not a meta data.
  2752. *
  2753. * \param [in] meta The reference to the \ref vx_meta_format struct to set
  2754. * \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>.
  2755. * \param [in] ptr The input pointer of the value to set on the meta format object.
  2756. * \param [in] size The size in bytes of the object to which \a ptr points.
  2757. * \ingroup group_user_kernels
  2758. * \return A <tt>\ref vx_status_e</tt> enumeration.
  2759. * \retval VX_SUCCESS The attribute was set; any other value indicates failure.
  2760. * \retval VX_ERROR_INVALID_REFERENCE meta is not a valid <tt>\ref vx_meta_format</tt> reference.
  2761. * \retval VX_ERROR_INVALID_PARAMETERS size was not correct for the type needed.
  2762. * \retval VX_ERROR_NOT_SUPPORTED the object attribute was not supported on the meta format object.
  2763. * \retval VX_ERROR_INVALID_TYPE attribute type did not match known meta format type.
  2764. */
  2765. VX_API_ENTRY vx_status VX_API_CALL vxSetMetaFormatAttribute(vx_meta_format meta, vx_enum attribute, const void *ptr, vx_size size);
  2766. /*! \brief Set a meta format object from an exemplar data object reference
  2767. *
  2768. * This function sets a \ref vx_meta_format object from the meta data of the exemplar
  2769. *
  2770. * \param [in] meta The meta format object to set
  2771. * \param [in] exemplar The exemplar data object.
  2772. * \ingroup group_user_kernels
  2773. * \return A <tt>\ref vx_status_e</tt> enumeration.
  2774. * \retval VX_SUCCESS The meta format was correctly set; any other value indicates failure.
  2775. * \retval VX_ERROR_INVALID_REFERENCE meta is not a valid <tt>\ref vx_meta_format</tt> reference,
  2776. * or exemplar is not a valid <tt>\ref vx_reference</tt> reference.
  2777. */
  2778. VX_API_ENTRY vx_status VX_API_CALL vxSetMetaFormatFromReference(vx_meta_format meta, vx_reference exemplar);
  2779. /*==============================================================================
  2780. TENSOR DATA FUNCTIONS
  2781. =============================================================================*/
  2782. /*! \brief Creates an opaque reference to a tensor data buffer.
  2783. * \details Not guaranteed to exist until the <tt>\ref vx_graph</tt> containing it has been verified.
  2784. * Since functions using tensors, need to understand the context of each dimension. We describe a layout of the dimensions in each function using tensors.
  2785. * That layout is not mandatory. It is done specifically to explain the functions and not to mandate layout. Different implementation may have different layout.
  2786. * Therefore the layout description is logical and not physical. It refers to the order of dimensions given in this function.
  2787. * \param [in] context The reference to the implementation context.
  2788. * \param [in] number_of_dims The number of dimensions.
  2789. * \param [in] dims Dimensions sizes in elements.
  2790. * \param [in] data_type The <tt>\ref vx_type_e</tt> that represents the data type of the tensor data elements.
  2791. * \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.
  2792. * \return A tensor data reference. Any possible errors preventing a
  2793. * successful creation should be checked using <tt>\ref vxGetStatus</tt>.
  2794. * \ingroup group_object_tensor
  2795. */
  2796. 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);
  2797. /*! \brief Creates an array of images into the multi-dimension data, this can be adjacent 2D images or not depending on the stride value.
  2798. * The stride value is representing bytes in the third dimension.
  2799. * The OpenVX image object that points to a three dimension data and access it as an array of images.
  2800. * This has to be portion of the third lowest dimension, and the stride correspond to that third dimension.
  2801. * The returned Object array is an array of images. Where the image data is pointing to a specific memory in the input tensor.
  2802. * \param [in] tensor The tensor data from which to extract the images. Has to be a 3d tensor.
  2803. * \param [in] rect Image coordinates within tensor data.
  2804. * \param [in] array_size Number of images to extract.
  2805. * \param [in] jump Delta between two images in the array.
  2806. * \param [in] image_format The requested image format. Should match the tensor data's data type.
  2807. * \return An array of images pointing to the tensor data's data.
  2808. * \ingroup group_object_tensor
  2809. */
  2810. VX_API_ENTRY vx_object_array VX_API_CALL vxCreateImageObjectArrayFromTensor(vx_tensor tensor, const vx_rectangle_t *rect, vx_size array_size, vx_size jump, vx_df_image image_format);
  2811. /*! \brief Creates a tensor data from another tensor data given a view. This second
  2812. * reference refers to the data in the original tensor data. Updates to this tensor data
  2813. * updates the parent tensor data. The view must be defined within the dimensions
  2814. * of the parent tensor data.
  2815. * \param [in] tensor The reference to the parent tensor data.
  2816. * \param [in] number_of_dims Number of dimensions in the view. Error return if 0 or greater than number of
  2817. * tensor dimensions. If smaller than number of tensor dimensions, the lower dimensions are assumed.
  2818. * \param [in] view_start View start coordinates
  2819. * \param [in] view_end View end coordinates
  2820. * \return The reference to the sub-tensor. Any possible errors preventing a
  2821. * successful creation should be checked using <tt>\ref vxGetStatus</tt>.
  2822. * \ingroup group_object_tensor
  2823. */
  2824. 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);
  2825. /*! \brief Creates an opaque reference to a tensor data buffer with no direct
  2826. * user access. This function allows setting the tensor data dimensions or data format.
  2827. * \details Virtual data objects allow users to connect various nodes within a
  2828. * graph via data references without access to that data, but they also permit the
  2829. * implementation to take maximum advantage of possible optimizations. Use this
  2830. * API to create a data reference to link two or more nodes together when the
  2831. * intermediate data are not required to be accessed by outside entities. This API
  2832. * in particular allows the user to define the tensor data format of the data without
  2833. * requiring the exact dimensions. Virtual objects are scoped within the graph
  2834. * they are declared a part of, and can't be shared outside of this scope.
  2835. * Since functions using tensors, need to understand the context of each dimension. We describe a layout of the dimensions in each function.
  2836. * That layout is not mandated. It is done specifically to explain the functions and not to mandate layout. Different implementation may have different layout.
  2837. * Therfore the layout description is logical and not physical. It refers to the order of dimensions given in <tt>\ref vxCreateTensor</tt> and <tt>\ref vxCreateVirtualTensor</tt>.
  2838. * \param [in] graph The reference to the parent graph.
  2839. * \param [in] number_of_dims The number of dimensions.
  2840. * \param [in] dims Dimensions sizes in elements.
  2841. * \param [in] data_type The <tt>\ref vx_type_e</tt> that represents the data type of the tensor data elements.
  2842. * \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.
  2843. * \return A tensor data reference.Any possible errors preventing a
  2844. * successful creation should be checked using <tt>\ref vxGetStatus</tt>.
  2845. * \note Passing this reference to <tt>\ref vxCopyTensorPatch</tt> will return an error.
  2846. * \ingroup group_object_tensor
  2847. */
  2848. VX_API_ENTRY vx_tensor VX_API_CALL vxCreateVirtualTensor(vx_graph graph, vx_size number_of_dims, const vx_size *dims, vx_enum data_type, vx_int8 fixed_point_position);
  2849. /*! \brief Allows the application to copy a view patch from/into an tensor object .
  2850. * \param [in] tensor The reference to the tensor object that is the source or the
  2851. * destination of the copy.
  2852. * \param [in] number_of_dims Number of patch dimension. Error return if 0 or greater than number of
  2853. * tensor dimensions. If smaller than number of tensor dimensions, the lower dimensions are assumed.
  2854. * \param [in] view_start Array of patch start points in each dimension
  2855. * \param [in] view_end Array of patch end points in each dimension
  2856. * \param [in] user_stride Array of user memory strides in each dimension
  2857. * \param [in] user_ptr The address of the memory location where to store the requested data
  2858. * if the copy was requested in read mode, or from where to get the data to store into the tensor
  2859. * object if the copy was requested in write mode. The accessible memory must be large enough
  2860. * to contain the specified patch with the specified layout:\n
  2861. * accessible memory in bytes >= (end[last_dimension] - start[last_dimension]) * stride[last_dimension].\n
  2862. * The layout of the user memory must follow a row major order.
  2863. * \param [in] usage This declares the effect of the copy with regard to the tensor object
  2864. * using the <tt>\ref vx_accessor_e</tt> enumeration. Only <tt>\ref VX_READ_ONLY</tt> and <tt>\ref VX_WRITE_ONLY</tt> are supported:
  2865. * \arg <tt>\ref VX_READ_ONLY</tt> means that data is copied from the tensor object into the application memory
  2866. * \arg <tt>\ref VX_WRITE_ONLY</tt> means that data is copied into the tensor object from the application memory
  2867. * \param [in] user_memory_type A <tt>\ref vx_memory_type_e</tt> enumeration that specifies
  2868. * the memory type of the memory referenced by the user_addr.
  2869. * \return A <tt>\ref vx_status_e</tt> enumeration.
  2870. * \retval VX_ERROR_OPTIMIZED_AWAY This is a reference to a virtual tensor that cannot be
  2871. * accessed by the application.
  2872. * \retval VX_ERROR_INVALID_REFERENCE The tensor reference is not actually an tensor reference.
  2873. * \retval VX_ERROR_INVALID_PARAMETERS An other parameter is incorrect.
  2874. * \ingroup group_object_tensor
  2875. */
  2876. VX_API_ENTRY vx_status VX_API_CALL vxCopyTensorPatch(vx_tensor tensor, vx_size number_of_dims, const vx_size * view_start, const vx_size * view_end,
  2877. const vx_size * user_stride, void * user_ptr, vx_enum usage, vx_enum user_memory_type);
  2878. /*! \brief Retrieves various attributes of a tensor data.
  2879. * \param [in] tensor The reference to the tensor data to query.
  2880. * \param [in] attribute The attribute to query. Use a <tt>\ref vx_tensor_attribute_e</tt>.
  2881. * \param [out] ptr The location at which to store the resulting value.
  2882. * \param [in] size The size of the container to which \a ptr points.
  2883. * \return A <tt>\ref vx_status_e</tt> enumeration.
  2884. * \retval VX_SUCCESS No errors.
  2885. * \retval VX_ERROR_INVALID_REFERENCE If data is not a <tt>\ref vx_tensor</tt>.
  2886. * \retval VX_ERROR_INVALID_PARAMETERS If any of the other parameters are incorrect.
  2887. * \ingroup group_object_tensor
  2888. */
  2889. VX_API_ENTRY vx_status VX_API_CALL vxQueryTensor(vx_tensor tensor, vx_enum attribute, void *ptr, vx_size size);
  2890. /*! \brief Releases a reference to a tensor data object.
  2891. * The object may not be garbage collected until its total reference count is zero.
  2892. * \param [in] tensor The pointer to the tensor data to release.
  2893. * \post After returning from this function the reference is zeroed.
  2894. * \return A <tt>\ref vx_status_e</tt> enumeration.
  2895. * \retval VX_SUCCESS No errors; all other values indicate failure
  2896. * \retval * An error occurred. See <tt>\ref vx_status_e</tt>.
  2897. * \ingroup group_object_tensor
  2898. */
  2899. VX_API_ENTRY vx_status VX_API_CALL vxReleaseTensor(vx_tensor *tensor);
  2900. #ifdef __cplusplus
  2901. }
  2902. #endif
  2903. #endif