You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

acl_dvpp.h 78 kB

4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418
  1. /**
  2. * Copyright 2019-2020 Huawei Technologies Co., Ltd
  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. #if !defined(ENABLE_DVPP_INTERFACE)
  17. #if defined(_MSC_VER)
  18. #error message("if you want to use dvpp funtions ,please use the macro definition (ENABLE_DVPP_INTERFACE).")
  19. #else
  20. #error "if you want to use dvpp funtions ,please use the macro definition (ENABLE_DVPP_INTERFACE)."
  21. #endif
  22. #endif
  23. #ifndef INC_EXTERNAL_ACL_OPS_ACL_DVPP_H_
  24. #define INC_EXTERNAL_ACL_OPS_ACL_DVPP_H_
  25. #include <stdint.h>
  26. #include <stddef.h>
  27. #include "acl/acl.h"
  28. #include "acl/acl_base.h"
  29. #ifdef __cplusplus
  30. extern "C" {
  31. #endif
  32. typedef struct acldvppPicDesc acldvppPicDesc;
  33. typedef struct acldvppBatchPicDesc acldvppBatchPicDesc;
  34. typedef struct acldvppRoiConfig acldvppRoiConfig;
  35. typedef struct acldvppResizeConfig acldvppResizeConfig;
  36. typedef struct acldvppBorderConfig acldvppBorderConfig;
  37. typedef struct acldvppLutMap acldvppLutMap;
  38. typedef struct acldvppChannelDesc acldvppChannelDesc;
  39. typedef struct acldvppJpegeConfig acldvppJpegeConfig;
  40. typedef struct aclvdecChannelDesc aclvdecChannelDesc;
  41. typedef struct acldvppStreamDesc acldvppStreamDesc;
  42. typedef struct aclvdecFrameConfig aclvdecFrameConfig;
  43. typedef struct aclvencChannelDesc aclvencChannelDesc;
  44. typedef struct aclvencFrameConfig aclvencFrameConfig;
  45. typedef struct acldvppHist acldvppHist;
  46. typedef void (*aclvdecCallback)(acldvppStreamDesc *input, acldvppPicDesc *output, void *userData);
  47. typedef void (*aclvencCallback)(acldvppPicDesc *input, acldvppStreamDesc *output, void *userdata);
  48. // Supported Pixel Format
  49. enum acldvppPixelFormat {
  50. PIXEL_FORMAT_YUV_400 = 0, // 0
  51. PIXEL_FORMAT_YUV_SEMIPLANAR_420 = 1, // 1
  52. PIXEL_FORMAT_YVU_SEMIPLANAR_420 = 2, // 2
  53. PIXEL_FORMAT_YUV_SEMIPLANAR_422 = 3, // 3
  54. PIXEL_FORMAT_YVU_SEMIPLANAR_422 = 4, // 4
  55. PIXEL_FORMAT_YUV_SEMIPLANAR_444 = 5, // 5
  56. PIXEL_FORMAT_YVU_SEMIPLANAR_444 = 6, // 6
  57. PIXEL_FORMAT_YUYV_PACKED_422 = 7, // 7
  58. PIXEL_FORMAT_UYVY_PACKED_422 = 8, // 8
  59. PIXEL_FORMAT_YVYU_PACKED_422 = 9, // 9
  60. PIXEL_FORMAT_VYUY_PACKED_422 = 10, // 10
  61. PIXEL_FORMAT_YUV_PACKED_444 = 11, // 11
  62. PIXEL_FORMAT_RGB_888 = 12, // 12
  63. PIXEL_FORMAT_BGR_888 = 13, // 13
  64. PIXEL_FORMAT_ARGB_8888 = 14, // 14
  65. PIXEL_FORMAT_ABGR_8888 = 15, // 15
  66. PIXEL_FORMAT_RGBA_8888 = 16, // 16
  67. PIXEL_FORMAT_BGRA_8888 = 17, // 17
  68. PIXEL_FORMAT_YUV_SEMI_PLANNER_420_10BIT = 18, // 18
  69. PIXEL_FORMAT_YVU_SEMI_PLANNER_420_10BIT = 19, // 19
  70. PIXEL_FORMAT_YVU_PLANAR_420 = 20, // 20
  71. PIXEL_FORMAT_YVU_PLANAR_422,
  72. PIXEL_FORMAT_YVU_PLANAR_444,
  73. PIXEL_FORMAT_RGB_444 = 23,
  74. PIXEL_FORMAT_BGR_444,
  75. PIXEL_FORMAT_ARGB_4444,
  76. PIXEL_FORMAT_ABGR_4444,
  77. PIXEL_FORMAT_RGBA_4444,
  78. PIXEL_FORMAT_BGRA_4444,
  79. PIXEL_FORMAT_RGB_555,
  80. PIXEL_FORMAT_BGR_555,
  81. PIXEL_FORMAT_RGB_565,
  82. PIXEL_FORMAT_BGR_565,
  83. PIXEL_FORMAT_ARGB_1555,
  84. PIXEL_FORMAT_ABGR_1555,
  85. PIXEL_FORMAT_RGBA_1555,
  86. PIXEL_FORMAT_BGRA_1555,
  87. PIXEL_FORMAT_ARGB_8565,
  88. PIXEL_FORMAT_ABGR_8565,
  89. PIXEL_FORMAT_RGBA_8565,
  90. PIXEL_FORMAT_BGRA_8565,
  91. PIXEL_FORMAT_RGB_BAYER_8BPP = 50,
  92. PIXEL_FORMAT_RGB_BAYER_10BPP,
  93. PIXEL_FORMAT_RGB_BAYER_12BPP,
  94. PIXEL_FORMAT_RGB_BAYER_14BPP,
  95. PIXEL_FORMAT_RGB_BAYER_16BPP,
  96. PIXEL_FORMAT_BGR_888_PLANAR = 70,
  97. PIXEL_FORMAT_HSV_888_PACKAGE,
  98. PIXEL_FORMAT_HSV_888_PLANAR,
  99. PIXEL_FORMAT_LAB_888_PACKAGE,
  100. PIXEL_FORMAT_LAB_888_PLANAR,
  101. PIXEL_FORMAT_S8C1,
  102. PIXEL_FORMAT_S8C2_PACKAGE,
  103. PIXEL_FORMAT_S8C2_PLANAR,
  104. PIXEL_FORMAT_S16C1,
  105. PIXEL_FORMAT_U8C1,
  106. PIXEL_FORMAT_U16C1,
  107. PIXEL_FORMAT_S32C1,
  108. PIXEL_FORMAT_U32C1,
  109. PIXEL_FORMAT_U64C1,
  110. PIXEL_FORMAT_S64C1,
  111. PIXEL_FORMAT_YUV_SEMIPLANAR_440 = 1000,
  112. PIXEL_FORMAT_YVU_SEMIPLANAR_440,
  113. PIXEL_FORMAT_FLOAT32,
  114. PIXEL_FORMAT_BUTT,
  115. PIXEL_FORMAT_UNKNOWN = 10000
  116. };
  117. // Stream Format
  118. enum acldvppStreamFormat { H265_MAIN_LEVEL = 0, H264_BASELINE_LEVEL, H264_MAIN_LEVEL, H264_HIGH_LEVEL };
  119. // Supported Channel Mode
  120. enum acldvppChannelMode { DVPP_CHNMODE_VPC = 1, DVPP_CHNMODE_JPEGD = 2, DVPP_CHNMODE_JPEGE = 4 };
  121. // Supported Border Type
  122. enum acldvppBorderType { BORDER_CONSTANT = 0, BORDER_REPLICATE, BORDER_REFLECT, BORDER_REFLECT_101 };
  123. // Venc parameter type
  124. enum aclvencChannelDescParamType {
  125. ACL_VENC_THREAD_ID_UINT64 = 0,
  126. ACL_VENC_CALLBACK_PTR,
  127. ACL_VENC_PIXEL_FORMAT_UINT32,
  128. ACL_VENC_ENCODE_TYPE_UINT32,
  129. ACL_VENC_PIC_WIDTH_UINT32,
  130. ACL_VENC_PIC_HEIGHT_UINT32,
  131. ACL_VENC_KEY_FRAME_INTERVAL_UINT32,
  132. ACL_VENC_BUF_ADDR_PTR,
  133. ACL_VENC_BUF_SIZE_UINT32,
  134. ACL_VENC_RC_MODE_UINT32,
  135. ACL_VENC_SRC_RATE_UINT32,
  136. ACL_VENC_MAX_BITRATE_UINT32,
  137. ACL_VENC_MAX_IP_PROP_UINT32
  138. };
  139. // Jpeg picture format
  140. enum acldvppJpegFormat {
  141. ACL_JPEG_CSS_444 = 0,
  142. ACL_JPEG_CSS_422,
  143. ACL_JPEG_CSS_420,
  144. ACL_JPEG_CSS_GRAY,
  145. ACL_JPEG_CSS_440,
  146. ACL_JPEG_CSS_411,
  147. ACL_JPEG_CSS_UNKNOWN = 1000
  148. };
  149. /**
  150. * @ingroup AscendCL
  151. * @brief alloc device memory for dvpp.
  152. *
  153. * @par Function
  154. * @li It's mainly used for allocating memory to device media data processing.
  155. * The requested memory meets the data processing requirements.
  156. * After calling this interface to request memory,
  157. * you must release the memory using the acldvppFree interface.
  158. * @li When calling the acldvppMalloc interface to apply for memory,
  159. * the size entered by the user is aligned upwards to 32 integer multiples,
  160. * and an additional 32 bytes are applied.
  161. *
  162. * @par Restriction
  163. * If the user uses the acldvppMalloc interface to apply for a large block of
  164. * memory and divide and manage the memory by himself,
  165. * when applying for memory, the user needs to align up to 32 integer
  166. * times + 32 bytes (ALIGN_UP [len] +32 words) according to
  167. * the actual data size of each picture Section) to manage memory.
  168. *
  169. * @param devPtr [OUT] memory pointer.
  170. * @param size [IN] memory size.
  171. *
  172. * @retval ACL_SUCCESS The function is successfully executed.
  173. * @retval OtherValues Failure
  174. *
  175. * @see acldvppFree
  176. */
  177. ACL_FUNC_VISIBILITY aclError acldvppMalloc(void **devPtr, size_t size);
  178. /**
  179. * @ingroup AscendCL
  180. * @brief free device memory for dvpp.
  181. *
  182. * @par Function
  183. * Free the memory requested through the acldvppMalloc interface
  184. * @param devPtr [IN] memory pointer to free.
  185. *
  186. * @retval ACL_SUCCESS The function is successfully executed.
  187. * @retval OtherValues Failure
  188. *
  189. * @see acldvppMalloc
  190. */
  191. ACL_FUNC_VISIBILITY aclError acldvppFree(void *devPtr);
  192. /**
  193. * @ingroup AscendCL
  194. * @brief create DvppChannelDesc.
  195. *
  196. * @par Function
  197. * Create a channel for image data processing.
  198. * The same channel can be reused
  199. * and is no longer available after destruction
  200. *
  201. * @retval null for failed.
  202. * @retval OtherValues success.
  203. */
  204. ACL_FUNC_VISIBILITY acldvppChannelDesc *acldvppCreateChannelDesc();
  205. /**
  206. * @ingroup AscendCL
  207. * @brief destroy dvppChannelDesc.
  208. *
  209. * @par Function
  210. * Can only destroy channels created by the acldvppCreateChannel interface
  211. * @param channelDesc [IN] the channel description.
  212. *
  213. * @retval ACL_SUCCESS The function is successfully executed.
  214. * @retval OtherValues Failure
  215. *
  216. * @see acldvppCreateChannelDesc | acldvppDestroyChannel
  217. */
  218. ACL_FUNC_VISIBILITY aclError acldvppDestroyChannelDesc(acldvppChannelDesc *channelDesc);
  219. /**
  220. * @ingroup AscendCL
  221. * @brief Get dvpp channel Id.
  222. *
  223. * @par Restriction
  224. * Interface calling sequence:
  225. * acldvppCreateChannelDesc --> acldvppCreateChannel -->
  226. * acldvppGetChannelDescChannelId
  227. *
  228. * @param channelDesc [IN] the channel description.
  229. *
  230. * @retval channel id.
  231. *
  232. * @see acldvppCreateChannelDesc | acldvppCreateChannel
  233. */
  234. ACL_FUNC_VISIBILITY uint64_t acldvppGetChannelDescChannelId(const acldvppChannelDesc *channelDesc);
  235. /**
  236. * @ingroup AscendCL
  237. * @brief Create dvpp picture description.
  238. *
  239. * @retval null for failed.
  240. * @retval OtherValues success.
  241. */
  242. ACL_FUNC_VISIBILITY acldvppPicDesc *acldvppCreatePicDesc();
  243. /**
  244. * @ingroup AscendCL
  245. * @brief Destroy dvpp picture description.
  246. *
  247. * @par Function
  248. * Can only destroy picture description information created
  249. * through acldvppCreatePicDesc interface.
  250. * @param picDesc [IN] dvpp picture description.
  251. *
  252. * @retval ACL_SUCCESS The function is successfully executed.
  253. * @retval OtherValues Failure
  254. *
  255. * @see acldvppCreatePicDesc
  256. */
  257. ACL_FUNC_VISIBILITY aclError acldvppDestroyPicDesc(acldvppPicDesc *picDesc);
  258. /**
  259. * @ingroup AscendCL
  260. * @brief Set dvpp picture description's data.
  261. *
  262. * @param picDesc [OUT] dvpp picture description.
  263. * @param dataDev [IN] dvpp picture dataDev.Must be the memory
  264. * requested using the acldvppMalloc interface.
  265. *
  266. * @retval ACL_SUCCESS The function is successfully executed.
  267. * @retval OtherValues Failure
  268. *
  269. * @see acldvppMalloc
  270. */
  271. ACL_FUNC_VISIBILITY aclError acldvppSetPicDescData(acldvppPicDesc *picDesc, void *dataDev);
  272. /**
  273. * @ingroup AscendCL
  274. * @brief Set dvpp picture description's size.
  275. *
  276. * @param picDesc [OUT] dvpp picture description.
  277. * @param size dvpp [IN] picture size.
  278. *
  279. * @retval ACL_SUCCESS The function is successfully executed.
  280. * @retval OtherValues Failure
  281. */
  282. ACL_FUNC_VISIBILITY aclError acldvppSetPicDescSize(acldvppPicDesc *picDesc, uint32_t size);
  283. /**
  284. * @ingroup AscendCL
  285. * @brief Set dvpp picture description's format.
  286. *
  287. * @param picDesc [OUT] dvpp picture description.
  288. * @param format [IN] dvpp picture format.
  289. *
  290. * @retval ACL_SUCCESS The function is successfully executed.
  291. * @retval OtherValues Failure
  292. */
  293. ACL_FUNC_VISIBILITY aclError acldvppSetPicDescFormat(acldvppPicDesc *picDesc, acldvppPixelFormat format);
  294. /**
  295. * @ingroup AscendCL
  296. * @brief Set dvpp picture description's width.
  297. *
  298. * @param picDesc [OUT] dvpp picture description.
  299. * @param width [IN] dvpp picture width.
  300. *
  301. * @retval ACL_SUCCESS The function is successfully executed.
  302. * @retval OtherValues Failure
  303. */
  304. ACL_FUNC_VISIBILITY aclError acldvppSetPicDescWidth(acldvppPicDesc *picDesc, uint32_t width);
  305. /**
  306. * @ingroup AscendCL
  307. * @brief Set dvpp picture description's height.
  308. *
  309. * @param picDesc [OUT] dvpp picture description.
  310. * @param height [IN] dvpp picture height.
  311. *
  312. * @retval ACL_SUCCESS The function is successfully executed.
  313. * @retval OtherValues Failure
  314. */
  315. ACL_FUNC_VISIBILITY aclError acldvppSetPicDescHeight(acldvppPicDesc *picDesc, uint32_t height);
  316. /**
  317. * @ingroup AscendCL
  318. * @brief Set dvpp picture description's widthStride.
  319. *
  320. * @par Restriction
  321. * Width alignment requirements:
  322. * @li The minimum stride is 32 and the maximum is 4096 * 4
  323. * (that is, an image in argb format with a width of 4096);
  324. * @li For 8K scaling, widthStride is required to be aligned to 2;
  325. * @li For non 8K scaling, the calculation formula for widthStride
  326. * is different for different image formats:
  327. * @li yuv400sp, yuv420sp, yuv422sp, yuv444sp: input image width aligned to 16
  328. * @li yuv422packed: input image width * 2 and then align to 16
  329. * @li yuv444packed, rgb888: input image width alignment * 3, alignment to 16
  330. * @li xrgb8888: input image width * 4, align to 16
  331. * @li HFBC:input image width
  332. *
  333. * @param picDesc [OUT] dvpp picture description.
  334. * @param widthStride [IN] dvpp picture widthStride.
  335. *
  336. * @retval ACL_SUCCESS The function is successfully executed.
  337. * @retval OtherValues Failure
  338. */
  339. ACL_FUNC_VISIBILITY aclError acldvppSetPicDescWidthStride(acldvppPicDesc *picDesc, uint32_t widthStride);
  340. /**
  341. * @ingroup AscendCL
  342. * @brief Set dvpp picture description's heightStride.
  343. *
  344. * @par Restriction
  345. * Height alignment requirements:
  346. * @li The height of the input image is aligned to 2.
  347. * High stride minimum 6 and maximum 4096.
  348. *
  349. * @param picDesc [OUT] dvpp picture description.
  350. * @param heightStride [IN] dvpp picture heightStride.
  351. *
  352. * @retval ACL_SUCCESS The function is successfully executed.
  353. * @retval OtherValues Failure
  354. */
  355. ACL_FUNC_VISIBILITY aclError acldvppSetPicDescHeightStride(acldvppPicDesc *picDesc, uint32_t heightStride);
  356. /**
  357. * @ingroup AscendCL
  358. * @brief Set dvpp picture description's retcode.
  359. *
  360. * @param picDesc [OUT] dvpp picture description.
  361. * @param retCode [IN] dvpp picture retcode.
  362. *
  363. * @retval ACL_SUCCESS The function is successfully executed.
  364. * @retval OtherValues Failure
  365. */
  366. ACL_FUNC_VISIBILITY aclError acldvppSetPicDescRetCode(acldvppPicDesc *picDesc, uint32_t retCode);
  367. /**
  368. * @ingroup AscendCL
  369. * @brief Get picture data.
  370. *
  371. * @param picDesc [IN] dvpp picture description.
  372. *
  373. * @retval picture data addr.
  374. * @retval default nullptr.
  375. */
  376. ACL_FUNC_VISIBILITY void *acldvppGetPicDescData(const acldvppPicDesc *picDesc);
  377. /**
  378. * @ingroup AscendCL
  379. * @brief Get picture data size.
  380. *
  381. * @param picDesc [IN] dvpp picture description.
  382. *
  383. * @retval picture data size.
  384. * @retval default 0.
  385. */
  386. ACL_FUNC_VISIBILITY uint32_t acldvppGetPicDescSize(const acldvppPicDesc *picDesc);
  387. /**
  388. * @ingroup AscendCL
  389. * @brief Get dvpp picture desc's format.
  390. *
  391. * @param picDesc [IN] dvpp picture description.
  392. *
  393. * @retval format
  394. * @retval default PIXEL_FORMAT_YUV_400.
  395. */
  396. ACL_FUNC_VISIBILITY acldvppPixelFormat acldvppGetPicDescFormat(const acldvppPicDesc *picDesc);
  397. /**
  398. * @ingroup AscendCL
  399. * @brief Get dvpp picture desc's width.
  400. *
  401. * @param picDesc [IN] dvpp picture description.
  402. *
  403. * @retval width.
  404. * @retval default 0.
  405. */
  406. ACL_FUNC_VISIBILITY uint32_t acldvppGetPicDescWidth(const acldvppPicDesc *picDesc);
  407. /**
  408. * @ingroup AscendCL
  409. * @brief Get dvpp picture desc's height.
  410. *
  411. * @param picDesc [IN] dvpp picture description.
  412. *
  413. * @retval height.
  414. * @retval default 0.
  415. */
  416. ACL_FUNC_VISIBILITY uint32_t acldvppGetPicDescHeight(const acldvppPicDesc *picDesc);
  417. /**
  418. * @ingroup AscendCL
  419. * @brief Get dvpp picture desc's widthStride.
  420. *
  421. * @par Restriction
  422. * Width alignment requirements:
  423. * @li The minimum stride is 32 and the maximum is 4096 * 4
  424. * (that is, an image in argb format with a width of 4096);
  425. * @li For 8K scaling, widthStride is required to be aligned to 2;
  426. * @li For non 8K scaling, the calculation formula for widthStride
  427. * is different for different image formats:
  428. * @li yuv400sp, yuv420sp, yuv422sp, yuv444sp: input image width aligned to 16
  429. * @li yuv422packed: input image width * 2 and then align to 16
  430. * @li yuv444packed, rgb888: input image width alignment * 3, alignment to 16
  431. * @li xrgb8888: input image width * 4, align to 16
  432. * @li HFBC:input image width
  433. *
  434. * @param picDesc [IN] dvpp picture description.
  435. *
  436. * @retval stride width.
  437. * @retval default 0.
  438. */
  439. ACL_FUNC_VISIBILITY uint32_t acldvppGetPicDescWidthStride(const acldvppPicDesc *picDesc);
  440. /**
  441. * @ingroup AscendCL
  442. * @brief Get dvpp picture desc's heightStride.
  443. *
  444. * @par Restriction
  445. * Height alignment requirements:
  446. * @li The height of the input image is aligned to 2.
  447. * High stride minimum 6 and maximum 4096.
  448. *
  449. * @param picDesc [IN] dvpp picture description.
  450. *
  451. * @retval stride height.
  452. * @retval default 0.
  453. */
  454. ACL_FUNC_VISIBILITY uint32_t acldvppGetPicDescHeightStride(const acldvppPicDesc *picDesc);
  455. /**
  456. * @ingroup AscendCL
  457. * @brief Get dvpp picture desc's retcode.
  458. *
  459. * @param picDesc [IN] dvpp picture description.
  460. *
  461. * @retval ret code.
  462. * @retval default 0.
  463. */
  464. ACL_FUNC_VISIBILITY uint32_t acldvppGetPicDescRetCode(const acldvppPicDesc *picDesc);
  465. /**
  466. * @ingroup AscendCL
  467. * @brief Create dvpp roi config.
  468. *
  469. * @param left [IN] the left offset, must be even
  470. * @param right [IN] the right offset, must be odd
  471. * @param top [IN] the top offset, must be even
  472. * @param bottom [IN] the bottom offset, must be odd
  473. *
  474. * @retval null for failed.
  475. * @retval other success
  476. */
  477. ACL_FUNC_VISIBILITY acldvppRoiConfig *acldvppCreateRoiConfig(uint32_t left, uint32_t right, uint32_t top,
  478. uint32_t bottom);
  479. /**
  480. * @ingroup AscendCL
  481. * @brief Destroy dvpp roi config.
  482. *
  483. * @par Function
  484. * Destroys data created through the acldvppCreateRoiConfig interface
  485. * @param roiConfig [IN] dvpp roi config.
  486. *
  487. * @retval ACL_SUCCESS The function is successfully executed.
  488. * @retval OtherValues Failure
  489. *
  490. * @see acldvppCreateRoiConfig
  491. */
  492. ACL_FUNC_VISIBILITY aclError acldvppDestroyRoiConfig(acldvppRoiConfig *roiConfig);
  493. /**
  494. * @ingroup AscendCL
  495. * @brief Set left of RoiConfig.
  496. *
  497. * @param config [OUT] RoiConfig
  498. * @param left [IN] left offset
  499. *
  500. * @retval ACL_SUCCESS The function is successfully executed.
  501. * @retval OtherValues Failure
  502. */
  503. ACL_FUNC_VISIBILITY aclError acldvppSetRoiConfigLeft(acldvppRoiConfig *config, uint32_t left);
  504. /**
  505. * @ingroup AscendCL
  506. * @brief Set right of RoiConfig.
  507. *
  508. * @param config [OUT] RoiConfig
  509. * @param right [IN] right offset
  510. *
  511. * @retval ACL_SUCCESS The function is successfully executed.
  512. * @retval OtherValues Failure
  513. */
  514. ACL_FUNC_VISIBILITY aclError acldvppSetRoiConfigRight(acldvppRoiConfig *config, uint32_t right);
  515. /**
  516. * @ingroup AscendCL
  517. * @brief Set top of RoiConfig.
  518. *
  519. * @param config [OUT] RoiConfig
  520. * @param top [IN] top offset
  521. *
  522. * @retval ACL_SUCCESS The function is successfully executed.
  523. * @retval OtherValues Failure
  524. */
  525. ACL_FUNC_VISIBILITY aclError acldvppSetRoiConfigTop(acldvppRoiConfig *config, uint32_t top);
  526. /**
  527. * @ingroup AscendCL
  528. * @brief Set bottom of RoiConfig.
  529. *
  530. * @param config [OUT] RoiConfig
  531. * @param bottom [IN] bottom offset
  532. *
  533. * @retval ACL_SUCCESS The function is successfully executed.
  534. * @retval OtherValues Failure
  535. */
  536. ACL_FUNC_VISIBILITY aclError acldvppSetRoiConfigBottom(acldvppRoiConfig *config, uint32_t bottom);
  537. /**
  538. * @ingroup AscendCL
  539. * @brief Set RoiConfig.
  540. *
  541. * @param config [OUT] RoiConfig
  542. * @param left [IN] left offset
  543. * @param right [IN] right offset
  544. * @param top [IN] top offset
  545. * @param bottom [IN] bottom offset
  546. *
  547. * @retval ACL_SUCCESS The function is successfully executed.
  548. * @retval OtherValues Failure
  549. */
  550. ACL_FUNC_VISIBILITY aclError acldvppSetRoiConfig(acldvppRoiConfig *config, uint32_t left, uint32_t right, uint32_t top,
  551. uint32_t bottom);
  552. /**
  553. * @ingroup AscendCL
  554. * @brief Create dvpp resize config.
  555. * The specified scaling algorithm is not supported.
  556. * The default scaling algorithm is "nearest neighbor interpolation".
  557. *
  558. * @retval null for failed.
  559. * @retval other success.
  560. */
  561. ACL_FUNC_VISIBILITY acldvppResizeConfig *acldvppCreateResizeConfig();
  562. /**
  563. * @ingroup AscendCL
  564. * @brief Destroy dvpp resize config.
  565. *
  566. * @par Function
  567. * Destroys the scaling configuration data created by
  568. * the acldvppCreateResizeConfig interface
  569. *
  570. * @param resizeConfig [IN] resize config.
  571. *
  572. * @retval ACL_SUCCESS The function is successfully executed.
  573. * @retval OtherValues Failure
  574. *
  575. * @see acldvppCreateResizeConfig
  576. */
  577. ACL_FUNC_VISIBILITY aclError acldvppDestroyResizeConfig(acldvppResizeConfig *resizeConfig);
  578. /**
  579. * @ingroup AscendCL
  580. * @brief Create jpege config.
  581. *
  582. * @retval null for failed.
  583. * @retval other success.
  584. */
  585. ACL_FUNC_VISIBILITY acldvppJpegeConfig *acldvppCreateJpegeConfig();
  586. /**
  587. * @ingroup AscendCL
  588. * @brief Destroy jpege config.
  589. *
  590. * @par Function
  591. * Destroys the encoding configuration data created by
  592. * the acldvppCreateJpegeConfig interface
  593. * @param jpegeConfig [IN] config pointer to destroy.
  594. *
  595. * @retval ACL_SUCCESS The function is successfully executed.
  596. * @retval OtherValues Failure
  597. *
  598. * @see acldvppCreateJpegeConfig
  599. */
  600. ACL_FUNC_VISIBILITY aclError acldvppDestroyJpegeConfig(acldvppJpegeConfig *jpegeConfig);
  601. /**
  602. * @ingroup AscendCL
  603. * @brief Set jpege config's level.
  604. *
  605. * @param jpegeConfig [OUT] Call the acldvppCreateJpegeConfig
  606. * interface to create acldvppJpegeConfig data
  607. * @param level [IN] Encoding quality range [0, 100],
  608. * where level 0 encoding quality is similar to level 100,
  609. * and the smaller the value in [1, 100],
  610. * the worse the quality of the output picture.
  611. *
  612. * @retval ACL_SUCCESS The function is successfully executed.
  613. * @retval OtherValues Failure
  614. */
  615. ACL_FUNC_VISIBILITY aclError acldvppSetJpegeConfigLevel(acldvppJpegeConfig *jpegeConfig, uint32_t level);
  616. /**
  617. * @ingroup AscendCL
  618. * @brief Get jpege config's level.
  619. *
  620. * @param jpegeConfig [IN] jpege config.
  621. *
  622. * @retval compression level.
  623. * @retval default 0.
  624. */
  625. ACL_FUNC_VISIBILITY uint32_t acldvppGetJpegeConfigLevel(const acldvppJpegeConfig *jpegeConfig);
  626. /**
  627. * @ingroup AscendCL
  628. * @brief create vdecChannelDesc.Channel description information
  629. * when creating a video data processing channel.
  630. *
  631. * @retval null for failed.
  632. * @retval other success
  633. */
  634. ACL_FUNC_VISIBILITY aclvdecChannelDesc *aclvdecCreateChannelDesc();
  635. /**
  636. * @ingroup AscendCL
  637. * @brief destroy vdecChannelDesc.
  638. *
  639. * @par Function
  640. * Can only destroy aclvdecChannelDesc type created
  641. * through aclvdecCreateChannelDesc interface
  642. * @param channelDesc [IN] channel description.
  643. *
  644. * @retval ACL_SUCCESS The function is successfully executed.
  645. * @retval OtherValues Failure
  646. * @see aclvdecCreateChannelDesc
  647. */
  648. ACL_FUNC_VISIBILITY aclError aclvdecDestroyChannelDesc(aclvdecChannelDesc *channelDesc);
  649. /**
  650. * @ingroup AscendCL
  651. * @brief Set vdec channel description's channel id.
  652. *
  653. * @param channelDesc [OUT] vdec channel description.
  654. * @param channelId [IN] decoding channel id: 0~15.
  655. *
  656. * @retval ACL_SUCCESS The function is successfully executed.
  657. * @retval OtherValues Failure
  658. */
  659. ACL_FUNC_VISIBILITY aclError aclvdecSetChannelDescChannelId(aclvdecChannelDesc *channelDesc, uint32_t channelId);
  660. /**
  661. * @ingroup AscendCL
  662. * @brief Set vdec channel description's thread id.
  663. *
  664. * @param channelDesc [OUT] vdec channel description.
  665. * @param threadId [IN] thread id.
  666. *
  667. * @retval ACL_SUCCESS The function is successfully executed.
  668. * @retval OtherValues Failure
  669. */
  670. ACL_FUNC_VISIBILITY aclError aclvdecSetChannelDescThreadId(aclvdecChannelDesc *channelDesc, uint64_t threadId);
  671. /**
  672. * @ingroup AscendCL
  673. * @brief Set vdec channel description's callback function.
  674. *
  675. * @param channelDesc [OUT] vdec channel description.
  676. * @param callback [IN] function callback.Function prototype:
  677. * void (* aclvdecCallback)
  678. * (acldvppStreamDesc * input, acldvppPicDesc * output, void* userdata)
  679. *
  680. * @retval ACL_SUCCESS The function is successfully executed.
  681. * @retval OtherValues Failure
  682. *
  683. * @see aclvdecCallback
  684. */
  685. ACL_FUNC_VISIBILITY aclError aclvdecSetChannelDescCallback(aclvdecChannelDesc *channelDesc, aclvdecCallback callback);
  686. /**
  687. * @ingroup AscendCL
  688. * @brief Set vdec channel description's video encoding type.
  689. *
  690. * @param channelDesc [OUT] vdec channel description.
  691. * @param enType [IN] video encoding type.
  692. *
  693. * @retval ACL_SUCCESS The function is successfully executed.
  694. * @retval OtherValues Failure
  695. */
  696. ACL_FUNC_VISIBILITY aclError aclvdecSetChannelDescEnType(aclvdecChannelDesc *channelDesc, acldvppStreamFormat enType);
  697. /**
  698. * @ingroup AscendCL
  699. * @brief Set vdec channel description's out picture format.
  700. *
  701. * @param channelDesc [OUT] vdec channel description.
  702. * @param outPicFormat [IN] out picture format (acldvppPixelFormat).
  703. *
  704. * @retval ACL_SUCCESS The function is successfully executed.
  705. * @retval OtherValues Failure
  706. */
  707. ACL_FUNC_VISIBILITY aclError aclvdecSetChannelDescOutPicFormat(aclvdecChannelDesc *channelDesc,
  708. acldvppPixelFormat outPicFormat);
  709. /**
  710. * @ingroup AscendCL
  711. * @brief Set vdec channel description's out picture width.
  712. *
  713. * @param channelDesc [OUT] vdec channel description.
  714. * @param outPicWidth [IN] out picture width.
  715. *
  716. * @retval ACL_SUCCESS The function is successfully executed.
  717. * @retval OtherValues Failure
  718. */
  719. ACL_FUNC_VISIBILITY aclError aclvdecSetChannelDescOutPicWidth(aclvdecChannelDesc *channelDesc, uint32_t outPicWidth);
  720. /**
  721. * @ingroup AscendCL
  722. * @brief Set vdec channel description's out picture height.
  723. *
  724. * @param channelDesc [OUT] vdec channel description.
  725. * @param outPicHeight [IN] out picture height.
  726. *
  727. * @retval ACL_SUCCESS The function is successfully executed.
  728. * @retval OtherValues Failure
  729. */
  730. ACL_FUNC_VISIBILITY aclError aclvdecSetChannelDescOutPicHeight(aclvdecChannelDesc *channelDesc, uint32_t outPicHeight);
  731. /**
  732. * @ingroup AscendCL
  733. * @brief Set vdec channel description's reference frame num.
  734. *
  735. * @param channelDesc [OUT] vdec channel description.
  736. * @param refFrameNum [IN] reference frame num.
  737. *
  738. * @retval ACL_SUCCESS The function is successfully executed.
  739. * @retval OtherValues Failure
  740. */
  741. ACL_FUNC_VISIBILITY aclError aclvdecSetChannelDescRefFrameNum(aclvdecChannelDesc *channelDesc, uint32_t refFrameNum);
  742. /**
  743. * @ingroup AscendCL
  744. * @brief Set vdec channel description's bit depth.
  745. *
  746. * @param channelDesc [OUT] vdec channel description.
  747. * @param bitDepth [IN] bit depth.
  748. *
  749. * @retval ACL_SUCCESS The function is successfully executed.
  750. * @retval OtherValues Failure
  751. */
  752. ACL_FUNC_VISIBILITY aclError aclvdecSetChannelDescBitDepth(aclvdecChannelDesc *channelDesc, uint32_t bitDepth);
  753. /**
  754. * @ingroup AscendCL
  755. * @brief Get vdec channel description's channel id.
  756. *
  757. * @param channelDesc [IN] vdec channel description.
  758. *
  759. * @retval decoding channel id: 0~15.
  760. * @retval default 0.
  761. */
  762. ACL_FUNC_VISIBILITY uint32_t aclvdecGetChannelDescChannelId(const aclvdecChannelDesc *channelDesc);
  763. /**
  764. * @ingroup AscendCL
  765. * @brief Get vdec channel description's thread id.
  766. *
  767. * @param channelDesc [IN] vdec channel description.
  768. *
  769. * @retval thread id.
  770. * @retval default 0.
  771. */
  772. ACL_FUNC_VISIBILITY uint64_t aclvdecGetChannelDescThreadId(const aclvdecChannelDesc *channelDesc);
  773. /**
  774. * @ingroup AscendCL
  775. * @brief Get vdec channel description's callback function.
  776. *
  777. * @param channelDesc [IN] vdec channel description.
  778. *
  779. * @retval function callback.Function prototype:
  780. * void (* aclvdecCallback)
  781. * (acldvppStreamDesc * input, acldvppPicDesc * output, void* userdata)
  782. * @retval default null.
  783. *
  784. * @see aclvdecCallback
  785. */
  786. ACL_FUNC_VISIBILITY aclvdecCallback aclvdecGetChannelDescCallback(const aclvdecChannelDesc *channelDesc);
  787. /**
  788. * @ingroup AscendCL
  789. * @brief Get vdec channel description's video encoding type.
  790. *
  791. * @param channelDesc [IN] vdec channel description.
  792. *
  793. * @retval video encoding type.
  794. * @retval default H265_MAIN_LEVEL.
  795. */
  796. ACL_FUNC_VISIBILITY acldvppStreamFormat aclvdecGetChannelDescEnType(const aclvdecChannelDesc *channelDesc);
  797. /**
  798. * @ingroup AscendCL
  799. * @brief Get vdec channel description's out picture format.
  800. *
  801. * @param channelDesc [IN] vdec channel description.
  802. *
  803. * @retval out picture format.
  804. * @retval default DVPP_OUTPUT_YUV420SP_UV.
  805. */
  806. ACL_FUNC_VISIBILITY acldvppPixelFormat aclvdecGetChannelDescOutPicFormat(const aclvdecChannelDesc *channelDesc);
  807. /**
  808. * @ingroup AscendCL
  809. * @brief Get vdec channel description's out picture width.
  810. *
  811. * @param channelDesc [IN] vdec channel description.
  812. *
  813. * @retval out picture width.
  814. * @retval default 0.
  815. */
  816. ACL_FUNC_VISIBILITY uint32_t aclvdecGetChannelDescOutPicWidth(const aclvdecChannelDesc *channelDesc);
  817. /**
  818. * @ingroup AscendCL
  819. * @brief Get vdec channel description's out picture height.
  820. *
  821. * @param channelDesc [IN] vdec channel description.
  822. *
  823. * @retval out picture height (for vdec malloc memory).
  824. * @retval default 0.
  825. */
  826. ACL_FUNC_VISIBILITY uint32_t aclvdecGetChannelDescOutPicHeight(const aclvdecChannelDesc *channelDesc);
  827. /**
  828. * @ingroup AscendCL
  829. * @brief Get vdec channel description's bit depth.
  830. *
  831. * @param channelDesc [IN] vdec channel description.
  832. *
  833. * @retval bit depth.
  834. * @retval default 0.
  835. */
  836. ACL_FUNC_VISIBILITY uint32_t aclvdecGetChannelDescBitDepth(const aclvdecChannelDesc *channelDesc);
  837. /**
  838. * @ingroup AscendCL
  839. * @brief Get vdec channel description's reference frame num.
  840. *
  841. * @param channelDesc [IN] vdec channel description.
  842. *
  843. * @retval reference frame num.
  844. * @retval default 0.
  845. */
  846. ACL_FUNC_VISIBILITY uint32_t aclvdecGetChannelDescRefFrameNum(const aclvdecChannelDesc *channelDesc);
  847. /**
  848. * @ingroup AscendCL
  849. * @brief create vencChannelDesc.
  850. *
  851. * @retval null for failed, other success
  852. */
  853. ACL_FUNC_VISIBILITY aclvencChannelDesc *aclvencCreateChannelDesc();
  854. /**
  855. * @ingroup AscendCL
  856. * @brief destroy vencChannelDesc.
  857. *
  858. * @param channelDesc [IN] channel desc.
  859. *
  860. * @retval ACL_SUCCESS:success, other:failed
  861. */
  862. ACL_FUNC_VISIBILITY aclError aclvencDestroyChannelDesc(aclvencChannelDesc *channelDesc);
  863. /**
  864. * @ingroup AscendCL
  865. * @brief Set decoding thread id for venc channel desc.
  866. *
  867. * @param channelDesc [OUT] venc channel desc
  868. * @param threadId [IN] thread id
  869. *
  870. * @retval ACL_SUCCESS for success, other for failure
  871. */
  872. ACL_FUNC_VISIBILITY aclError aclvencSetChannelDescThreadId(aclvencChannelDesc *channelDesc, uint64_t threadId);
  873. /**
  874. * @ingroup AscendCL
  875. * @brief Set func callback for venc channel desc.
  876. *
  877. * @param channelDesc [OUT] venc channel desc
  878. * @param callback [IN] func callback
  879. *
  880. * @retval ACL_SUCCESS for success, other for failure
  881. */
  882. ACL_FUNC_VISIBILITY aclError aclvencSetChannelDescCallback(aclvencChannelDesc *channelDesc, aclvencCallback callback);
  883. /**
  884. * @ingroup AscendCL
  885. * @brief Set video encoding type for venc channel desc.
  886. *
  887. * @param channelDesc [OUT] venc channel desc
  888. * @param enType [IN] video encoding type
  889. *
  890. * @retval ACL_SUCCESS for success, other for failure
  891. */
  892. ACL_FUNC_VISIBILITY aclError aclvencSetChannelDescEnType(aclvencChannelDesc *channelDesc, acldvppStreamFormat enType);
  893. /**
  894. * @ingroup AscendCL
  895. * @brief Set pic format for venc channel desc.
  896. *
  897. * @param channelDesc [OUT] venc channel desc
  898. * @param picFormat [IN] pic format
  899. *
  900. * @retval ACL_SUCCESS for success, other for failure
  901. */
  902. ACL_FUNC_VISIBILITY aclError aclvencSetChannelDescPicFormat(aclvencChannelDesc *channelDesc,
  903. acldvppPixelFormat picFormat);
  904. /**
  905. * @ingroup AscendCL
  906. * @brief Set out pic width for venc channel desc.
  907. *
  908. * @param channelDesc [OUT] venc channel desc
  909. * @param picWidth [IN] pic width
  910. *
  911. * @retval ACL_SUCCESS for success, other for failure
  912. */
  913. ACL_FUNC_VISIBILITY aclError aclvencSetChannelDescPicWidth(aclvencChannelDesc *channelDesc, uint32_t picWidth);
  914. /**
  915. * @ingroup AscendCL
  916. * @brief Set pic height for venc channel desc.
  917. *
  918. * @param channelDesc [OUT] venc channel desc
  919. * @param picHeight [IN] pic height
  920. *
  921. * @retval ACL_SUCCESS for success, other for failure
  922. */
  923. ACL_FUNC_VISIBILITY aclError aclvencSetChannelDescPicHeight(aclvencChannelDesc *channelDesc, uint32_t picHeight);
  924. /**
  925. * @ingroup AscendCL
  926. * @brief Set key frame interval for venc channel desc.
  927. *
  928. * @param channelDesc [OUT] venc channel desc
  929. * @param keyFrameInterval [IN] Interval of key frame
  930. *
  931. * @retval ACL_SUCCESS for success, other for failure
  932. */
  933. ACL_FUNC_VISIBILITY aclError aclvencSetChannelDescKeyFrameInterval(aclvencChannelDesc *channelDesc,
  934. uint32_t keyFrameInterval);
  935. /**
  936. * @ingroup AscendCL
  937. * @brief Set output buffer address for venc channel desc.
  938. *
  939. * @param channelDesc [OUT] venc channel desc
  940. * @param bufAddr [IN] output buffer address
  941. *
  942. * @retval ACL_SUCCESS for success, other for failure
  943. */
  944. ACL_FUNC_VISIBILITY aclError aclvencSetChannelDescBufAddr(aclvencChannelDesc *channelDesc, void *bufAddr);
  945. /**
  946. * @ingroup AscendCL
  947. * @brief Set output buffer size for venc channel desc.
  948. *
  949. * @param channelDesc [OUT] venc channel desc
  950. * @param bufSize [IN] output buffer size
  951. *
  952. * @retval ACL_SUCCESS for success, other for failure
  953. */
  954. ACL_FUNC_VISIBILITY aclError aclvencSetChannelDescBufSize(aclvencChannelDesc *channelDesc, uint32_t bufSize);
  955. /**
  956. * @ingroup AscendCL
  957. * @brief Set rc model for venc channel desc.
  958. *
  959. * @param channelDesc [OUT] venc channel desc
  960. * @param rcMode [IN] venc rc mode(VBR=1, CBR=2)
  961. *
  962. * @retval ACL_SUCCESS for success, other for failure
  963. */
  964. ACL_FUNC_VISIBILITY aclError aclvencSetChannelDescRcMode(aclvencChannelDesc *channelDesc, uint32_t rcMode);
  965. /**
  966. * @ingroup AscendCL
  967. * @brief Set source rate for venc channel desc.
  968. *
  969. * @param channelDesc [OUT] venc channel desc
  970. * @param srcRate [IN] source rate
  971. *
  972. * @retval ACL_SUCCESS for success, other for failure
  973. */
  974. ACL_FUNC_VISIBILITY aclError aclvencSetChannelDescSrcRate(aclvencChannelDesc *channelDesc, uint32_t srcRate);
  975. /**
  976. * @ingroup AscendCL
  977. * @brief Set max bit rate for venc channel desc.
  978. *
  979. * @param channelDesc [OUT] venc channel desc
  980. * @param maxBitRate [IN] max bit rate
  981. *
  982. * @retval ACL_SUCCESS for success, other for failure
  983. */
  984. ACL_FUNC_VISIBILITY aclError aclvencSetChannelDescMaxBitRate(aclvencChannelDesc *channelDesc, uint32_t maxBitRate);
  985. /**
  986. * @ingroup AscendCL
  987. * @brief Set venc parameter for venc channel desc.
  988. *
  989. * @param channelDesc [OUT] venc channel desc
  990. * @param paramType [IN] parameter type
  991. * @param length [IN] parameter length
  992. * @param param [IN] pointer to parameter value
  993. *
  994. * @retval ACL_SUCCESS for success, other for failure
  995. */
  996. ACL_FUNC_VISIBILITY aclError aclvencSetChannelDescParam(aclvencChannelDesc *channelDesc,
  997. aclvencChannelDescParamType paramType, size_t length,
  998. const void *param);
  999. /**
  1000. * @ingroup AscendCL
  1001. * @brief Get output buffer address for venc channel desc.
  1002. *
  1003. * @param channelDesc[IN] venc channel desc
  1004. *
  1005. * @retval output buffer address
  1006. */
  1007. ACL_FUNC_VISIBILITY void *aclvencGetChannelDescBufAddr(const aclvencChannelDesc *channelDesc);
  1008. /**
  1009. * @ingroup AscendCL
  1010. * @brief Get output buffer size for venc channel desc.
  1011. *
  1012. * @param channelDesc [IN] venc channel desc
  1013. *
  1014. * @retval output buffer size
  1015. */
  1016. ACL_FUNC_VISIBILITY uint32_t aclvencGetChannelDescBufSize(const aclvencChannelDesc *channelDesc);
  1017. /**
  1018. * @ingroup AscendCL
  1019. * @brief Get decoding channel id for venc channel desc.
  1020. *
  1021. * @param channelDesc [IN] venc channel desc
  1022. *
  1023. * @retval decoding channel id: 0~15, default 0
  1024. */
  1025. ACL_FUNC_VISIBILITY uint32_t aclvencGetChannelDescChannelId(const aclvencChannelDesc *channelDesc);
  1026. /**
  1027. * @ingroup AscendCL
  1028. * @brief Get decoding thread id for venc channel desc.
  1029. *
  1030. * @param channelDesc [IN] venc channel desc
  1031. *
  1032. * @retval thread id, default 0
  1033. */
  1034. ACL_FUNC_VISIBILITY uint64_t aclvencGetChannelDescThreadId(const aclvencChannelDesc *channelDesc);
  1035. /**
  1036. * @ingroup AscendCL
  1037. * @brief Get func callback for venc channel desc.
  1038. *
  1039. * @param channelDesc [IN] venc channel desc
  1040. *
  1041. * @retval func callback, default null
  1042. */
  1043. ACL_FUNC_VISIBILITY aclvencCallback aclvencGetChannelDescCallback(const aclvencChannelDesc *channelDesc);
  1044. /**
  1045. * @ingroup AscendCL
  1046. * @brief Get video encoding type for venc channel desc.
  1047. *
  1048. * @param channelDesc [IN] venc channel desc
  1049. *
  1050. * @retval video encoding type, default H265_MAIN_LEVEL
  1051. */
  1052. ACL_FUNC_VISIBILITY acldvppStreamFormat aclvencGetChannelDescEnType(const aclvencChannelDesc *channelDesc);
  1053. /**
  1054. * @ingroup AscendCL
  1055. * @brief Get pic format for venc channel desc.
  1056. *
  1057. * @param channelDesc [IN] venc channel desc
  1058. *
  1059. * @retval pic format
  1060. */
  1061. ACL_FUNC_VISIBILITY acldvppPixelFormat aclvencGetChannelDescPicFormat(const aclvencChannelDesc *channelDesc);
  1062. /**
  1063. * @ingroup AscendCL
  1064. * @brief Get pic width for venc channel desc.
  1065. *
  1066. * @param channelDesc [IN] venc channel desc
  1067. *
  1068. * @retval pic width, default 0
  1069. */
  1070. ACL_FUNC_VISIBILITY uint32_t aclvencGetChannelDescPicWidth(const aclvencChannelDesc *channelDesc);
  1071. /**
  1072. * @ingroup AscendCL
  1073. * @brief Get pic height for venc channel desc.
  1074. *
  1075. * @param channelDesc [IN] venc channel desc
  1076. *
  1077. * @retval pic height, default 0
  1078. */
  1079. ACL_FUNC_VISIBILITY uint32_t aclvencGetChannelDescPicHeight(const aclvencChannelDesc *channelDesc);
  1080. /**
  1081. * @ingroup AscendCL
  1082. * @brief Get interval of key frame for venc channel desc.
  1083. *
  1084. * @param channelDesc [IN] venc channel desc
  1085. *
  1086. * @retval interval of key frame, default 0
  1087. */
  1088. ACL_FUNC_VISIBILITY uint32_t aclvencGetChannelDescKeyFrameInterval(const aclvencChannelDesc *channelDesc);
  1089. /**
  1090. * @ingroup AscendCL
  1091. *
  1092. * @brief Get rc mode for venc channel desc.
  1093. *
  1094. * @param channelDesc [IN] venc channel desc
  1095. *
  1096. * @retval rc mode, default 0
  1097. */
  1098. ACL_FUNC_VISIBILITY uint32_t aclvencGetChannelDescRcMode(const aclvencChannelDesc *channelDesc);
  1099. /**
  1100. * @ingroup AscendCL
  1101. *
  1102. * @brief Get source rate for venc channel desc.
  1103. *
  1104. * @param channelDesc [IN] venc channel desc
  1105. *
  1106. * @retval source rate, default 0
  1107. */
  1108. ACL_FUNC_VISIBILITY uint32_t aclvencGetChannelDescSrcRate(const aclvencChannelDesc *channelDesc);
  1109. /**
  1110. * @ingroup AscendCL
  1111. *
  1112. * @brief Get max bit rate for venc channel desc.
  1113. *
  1114. * @param channelDesc [IN] venc channel desc
  1115. *
  1116. * @retval max bit rate, default 0
  1117. */
  1118. ACL_FUNC_VISIBILITY uint32_t aclvencGetChannelDescMaxBitRate(const aclvencChannelDesc *channelDesc);
  1119. /**
  1120. * @ingroup AscendCL
  1121. *
  1122. * @brief Get venc parameter for venc channel desc.
  1123. *
  1124. * @param channelDesc [IN] venc channel desc
  1125. * @param paramType [IN] parameter type
  1126. * @param length [IN] parameter length
  1127. * @param paramRetSize [OUT] pointer to parameter real length
  1128. * @param param [OUT] pointer to parameter value
  1129. *
  1130. * @retval ACL_SUCCESS for success, other for failure
  1131. */
  1132. ACL_FUNC_VISIBILITY aclError aclvencGetChannelDescParam(const aclvencChannelDesc *channelDesc,
  1133. aclvencChannelDescParamType paramType, size_t length,
  1134. size_t *paramRetSize, void *param);
  1135. /**
  1136. * @ingroup AscendCL
  1137. * @brief get forced restart of I-frame interval from config
  1138. *
  1139. * @param config [IN] venc frame config
  1140. *
  1141. * @retval 0: Not forced; 1: Forced restart of I-frame -1: error
  1142. */
  1143. ACL_FUNC_VISIBILITY uint8_t aclvencGetFrameConfigForceIFrame(const aclvencFrameConfig *config);
  1144. /**
  1145. * @ingroup AscendCL
  1146. * @brief get forced restart of I-frame interval from config
  1147. *
  1148. * @param config [IN] venc frame config
  1149. *
  1150. * @retval Whether it is the end frame: 0: no; 1: end frame
  1151. */
  1152. ACL_FUNC_VISIBILITY uint8_t aclvencGetFrameConfigEos(const aclvencFrameConfig *config);
  1153. /**
  1154. * @ingroup AscendCL
  1155. * @brief set single frame encoding configuration parameters
  1156. *
  1157. * @param config [OUT] venc frame config
  1158. * @param forceFrame [IN] forced restart of I-frame interval: 0: Not forced; 1: Forced restart of I-frame
  1159. *
  1160. * @retval ACL_SUCCESS for ok, others for fail
  1161. */
  1162. ACL_FUNC_VISIBILITY aclError aclvencSetFrameConfigForceIFrame(aclvencFrameConfig *config, uint8_t forceIFrame);
  1163. /**
  1164. * @ingroup AscendCL
  1165. * @brief set single frame encoding configuration parameters
  1166. *
  1167. * @param config [OUT] venc frame config
  1168. * @param eos [IN] Whether it is the end frame: 0: no; 1: end frame
  1169. *
  1170. * @retval ACL_SUCCESS for ok, others for fail
  1171. */
  1172. ACL_FUNC_VISIBILITY aclError aclvencSetFrameConfigEos(aclvencFrameConfig *config, uint8_t eos);
  1173. /**
  1174. * @ingroup AscendCL
  1175. * @brief dvpp venc destroy frame config
  1176. *
  1177. * @param config [IN] venc frame config
  1178. *
  1179. * @retval ACL_SUCCESS for ok, others for fail
  1180. */
  1181. ACL_FUNC_VISIBILITY aclError aclvencDestroyFrameConfig(aclvencFrameConfig *config);
  1182. /**
  1183. * @ingroup AscendCL
  1184. * @brief Create dvpp venc frame config.
  1185. *
  1186. * @retval null for failed, other aclvencFrameConfig ptr
  1187. */
  1188. ACL_FUNC_VISIBILITY aclvencFrameConfig *aclvencCreateFrameConfig();
  1189. /**
  1190. * @ingroup AscendCL
  1191. * @brief Create dvpp venc channel.
  1192. *
  1193. * @param channelDesc [IN|OUT] venc channel desc
  1194. *
  1195. * @retval ACL_SUCCESS for ok, others for fail
  1196. */
  1197. ACL_FUNC_VISIBILITY aclError aclvencCreateChannel(aclvencChannelDesc *channelDesc);
  1198. /**
  1199. * @ingroup AscendCL
  1200. * @brief Destroy dvpp venc channel.
  1201. *
  1202. * @param channelDesc [IN] venc channel desc
  1203. *
  1204. * @retval ACL_SUCCESS for ok, others for fail
  1205. */
  1206. ACL_FUNC_VISIBILITY aclError aclvencDestroyChannel(aclvencChannelDesc *channelDesc);
  1207. /**
  1208. * @ingroup AscendCL
  1209. * @brief dvpp venc launch send frame task.
  1210. *
  1211. * @param channelDesc [IN] venc channel desc
  1212. * @param input [IN] input picture desc
  1213. * @param reserve [IN] reserve parameter
  1214. * @param config [IN] dvpp frame config
  1215. * @param userdata [IN] user callback function
  1216. *
  1217. * @retval ACL_SUCCESS for ok, others for fail
  1218. */
  1219. ACL_FUNC_VISIBILITY aclError aclvencSendFrame(aclvencChannelDesc *channelDesc, acldvppPicDesc *input, void *reserve,
  1220. aclvencFrameConfig *config, void *userdata);
  1221. /**
  1222. * @ingroup AscendCL
  1223. * @brief Create dvpp stream description.
  1224. *
  1225. * @retval null for failed.
  1226. * @retval other success.
  1227. */
  1228. ACL_FUNC_VISIBILITY acldvppStreamDesc *acldvppCreateStreamDesc();
  1229. /**
  1230. * @ingroup AscendCL
  1231. * @brief Destroy dvpp stream description.
  1232. *
  1233. * @par Function
  1234. * Can only destroy acldvppStreamDesc type created through
  1235. * acldvppCreateStreamDesc interface.
  1236. *
  1237. * @param streamDesc [IN] dvpp stream description.
  1238. *
  1239. * @retval ACL_SUCCESS The function is successfully executed.
  1240. * @retval OtherValues Failure
  1241. *
  1242. * @see acldvppCreateStreamDesc
  1243. */
  1244. ACL_FUNC_VISIBILITY aclError acldvppDestroyStreamDesc(acldvppStreamDesc *streamDesc);
  1245. /**
  1246. * @ingroup AscendCL
  1247. * @brief Set stream description's data addr.
  1248. *
  1249. * @param streamDesc [OUT] dvpp stream description.
  1250. * @param dataDev [IN] data addr.
  1251. *
  1252. * @retval ACL_SUCCESS The function is successfully executed.
  1253. * @retval OtherValues Failure
  1254. */
  1255. ACL_FUNC_VISIBILITY aclError acldvppSetStreamDescData(acldvppStreamDesc *streamDesc, void *dataDev);
  1256. /**
  1257. * @ingroup AscendCL
  1258. * @brief Set stream description's data size.
  1259. *
  1260. * @param streamDesc [OUT] dvpp stream description.
  1261. * @param size [IN] data size.
  1262. *
  1263. * @retval ACL_SUCCESS The function is successfully executed.
  1264. * @retval OtherValues Failure
  1265. */
  1266. ACL_FUNC_VISIBILITY aclError acldvppSetStreamDescSize(acldvppStreamDesc *streamDesc, uint32_t size);
  1267. /**
  1268. * @ingroup AscendCL
  1269. * @brief Set stream description's format.
  1270. *
  1271. * @param streamDesc [OUT] dvpp stream description.
  1272. * @param format [IN] stream format.
  1273. *
  1274. * @retval ACL_SUCCESS The function is successfully executed.
  1275. * @retval OtherValues Failure
  1276. */
  1277. ACL_FUNC_VISIBILITY aclError acldvppSetStreamDescFormat(acldvppStreamDesc *streamDesc, acldvppStreamFormat format);
  1278. /**
  1279. * @ingroup AscendCL
  1280. * @brief Set stream description's timestamp.
  1281. *
  1282. * @param streamDesc [OUT] dvpp stream description.
  1283. * @param timestamp [IN] current timestamp.
  1284. *
  1285. * @retval ACL_SUCCESS The function is successfully executed.
  1286. * @retval OtherValues Failure
  1287. */
  1288. ACL_FUNC_VISIBILITY aclError acldvppSetStreamDescTimestamp(acldvppStreamDesc *streamDesc, uint64_t timestamp);
  1289. /**
  1290. * @ingroup AscendCL
  1291. * @brief Set stream description's ret code.
  1292. *
  1293. * @param streamDesc [OUT] dvpp stream description.
  1294. * @param retCode [IN] result code.
  1295. *
  1296. * @retval ACL_SUCCESS The function is successfully executed.
  1297. * @retval OtherValues Failure
  1298. */
  1299. ACL_FUNC_VISIBILITY aclError acldvppSetStreamDescRetCode(acldvppStreamDesc *streamDesc, uint32_t retCode);
  1300. /**
  1301. * @ingroup AscendCL
  1302. * @brief Set stream description's eos.
  1303. *
  1304. * @param streamDesc [OUT] dvpp stream description.
  1305. * @param eos [IN] end flag of sequence.
  1306. *
  1307. * @retval ACL_SUCCESS The function is successfully executed.
  1308. * @retval OtherValues Failure
  1309. */
  1310. ACL_FUNC_VISIBILITY aclError acldvppSetStreamDescEos(acldvppStreamDesc *streamDesc, uint8_t eos);
  1311. /**
  1312. * @ingroup AscendCL
  1313. * @brief Get stream description's data addr.
  1314. *
  1315. * @param streamDesc [IN] dvpp stream description.
  1316. *
  1317. * @retval data addr.
  1318. * @retval deault nullptr.
  1319. */
  1320. ACL_FUNC_VISIBILITY void *acldvppGetStreamDescData(const acldvppStreamDesc *streamDesc);
  1321. /**
  1322. * @ingroup AscendCL
  1323. * @brief Get stream description's data size.
  1324. *
  1325. * @param streamDesc [IN] dvpp stream description.
  1326. *
  1327. * @retval data size.
  1328. * @retval default 0.
  1329. */
  1330. ACL_FUNC_VISIBILITY uint32_t acldvppGetStreamDescSize(const acldvppStreamDesc *streamDesc);
  1331. /**
  1332. * @ingroup AscendCL
  1333. * @brief Get stream description's format.
  1334. *
  1335. * @param streamDesc [IN] dvpp stream description.
  1336. *
  1337. * @retval stream format.
  1338. * @retval default ACL_DVPP_STREAM_H264.
  1339. */
  1340. ACL_FUNC_VISIBILITY acldvppStreamFormat acldvppGetStreamDescFormat(const acldvppStreamDesc *streamDesc);
  1341. /**
  1342. * @ingroup AscendCL
  1343. * @brief Get stream description's timestamp.
  1344. *
  1345. * @param streamDesc [IN] dvpp stream description.
  1346. *
  1347. * @retval current timestamp.
  1348. * @retval default 0.
  1349. */
  1350. ACL_FUNC_VISIBILITY uint64_t acldvppGetStreamDescTimestamp(const acldvppStreamDesc *streamDesc);
  1351. /**
  1352. * @ingroup AscendCL
  1353. * @brief Get stream description's retCode.
  1354. *
  1355. * @param streamDesc [IN] dvpp stream description.
  1356. *
  1357. * @retval result code.
  1358. * @retval default 0.
  1359. */
  1360. ACL_FUNC_VISIBILITY uint32_t acldvppGetStreamDescRetCode(const acldvppStreamDesc *streamDesc);
  1361. /**
  1362. * @ingroup AscendCL
  1363. * @brief Get stream description's eos.
  1364. *
  1365. * @param streamDesc [IN] dvpp stream description.
  1366. *
  1367. * @retval end flag of sequence.
  1368. * @retval default 0(false).
  1369. */
  1370. ACL_FUNC_VISIBILITY uint8_t acldvppGetStreamDescEos(const acldvppStreamDesc *streamDesc);
  1371. /**
  1372. * @ingroup AscendCL
  1373. * @brief Create vdec frame config.
  1374. *
  1375. * @retval null for failed.
  1376. * @retval other success.
  1377. */
  1378. ACL_FUNC_VISIBILITY aclvdecFrameConfig *aclvdecCreateFrameConfig();
  1379. /**
  1380. * @ingroup AscendCL
  1381. * @brief Destroy vdec frame config.
  1382. *
  1383. * @par Function
  1384. * Can only destroy aclvdecFrameConfig type created through
  1385. * aclvdecCreateFrameConfig interface
  1386. *
  1387. * @param vdecFrameConfig [IN] vdec frame config.
  1388. *
  1389. * @retval ACL_SUCCESS The function is successfully executed.
  1390. * @retval OtherValues Failure
  1391. *
  1392. * @see aclvdecCreateFrameConfig
  1393. */
  1394. ACL_FUNC_VISIBILITY aclError aclvdecDestroyFrameConfig(aclvdecFrameConfig *vdecFrameConfig);
  1395. /**
  1396. * @ingroup AscendCL
  1397. * @brief Get image width and height of jpeg.
  1398. *
  1399. * @param data [IN] image data in host memory
  1400. * @param size [IN] the size of image data
  1401. * @param width [OUT] the width of image from image header
  1402. * @param height [OUT] the height of image from image header
  1403. * @param components [OUT] the components of image from image header
  1404. *
  1405. * @retval ACL_SUCCESS The function is successfully executed.
  1406. * @retval OtherValues Failure
  1407. */
  1408. ACL_FUNC_VISIBILITY aclError acldvppJpegGetImageInfo(const void *data, uint32_t size, uint32_t *width, uint32_t *height,
  1409. int32_t *components);
  1410. /**
  1411. * @ingroup AscendCL
  1412. * @brief Get image width and height of jpeg.
  1413. *
  1414. * @param data [IN] image data in host memory
  1415. * @param size [IN] the size of image data
  1416. * @param width [OUT] the width of image from image header
  1417. * @param height [OUT] the height of image from image header
  1418. * @param components [OUT] the components of image from image header
  1419. * @param format [OUT] the format of image from image header
  1420. *
  1421. * @retval ACL_SUCCESS The function is successfully executed.
  1422. * @retval OtherValues Failure
  1423. */
  1424. ACL_FUNC_VISIBILITY aclError acldvppJpegGetImageInfoV2(const void *data, uint32_t size, uint32_t *width,
  1425. uint32_t *height, int32_t *components,
  1426. acldvppJpegFormat *format);
  1427. /**
  1428. * @ingroup AscendCL
  1429. * @brief Predict encode size of jpeg image.
  1430. *
  1431. * @param inputDesc [IN] dvpp image desc
  1432. * @param config [IN] jpeg encode config
  1433. * @param size [OUT] the size predicted of image
  1434. *
  1435. * @retval ACL_SUCCESS The function is successfully executed.
  1436. * @retval OtherValues Failure
  1437. */
  1438. ACL_FUNC_VISIBILITY aclError acldvppJpegPredictEncSize(const acldvppPicDesc *inputDesc,
  1439. const acldvppJpegeConfig *config, uint32_t *size);
  1440. /**
  1441. * @ingroup AscendCL
  1442. * @brief Predict decode size of jpeg image.
  1443. *
  1444. * @param data [IN] origin image data in host memory
  1445. * @param dataSize [IN] the size of origin image data
  1446. * @param outputPixelFormat [IN] the pixel format jpeg decode
  1447. * @param decSize [OUT] the size predicted for decode image
  1448. *
  1449. * @retval ACL_SUCCESS The function is successfully executed.
  1450. * @retval OtherValues Failure
  1451. */
  1452. ACL_FUNC_VISIBILITY aclError acldvppJpegPredictDecSize(const void *data, uint32_t dataSize,
  1453. acldvppPixelFormat outputPixelFormat, uint32_t *decSize);
  1454. /**
  1455. * @ingroup AscendCL
  1456. * @brief Get image width and height of png.
  1457. *
  1458. * @param data [IN] image data in host memory
  1459. * @param size [IN] the size of image data
  1460. * @param width [OUT] the width of image from image header
  1461. * @param height [OUT] the height of image from image header
  1462. * @param components [OUT] the components of image from image header
  1463. *
  1464. * @retval ACL_SUCCESS The function is successfully executed.
  1465. * @retval OtherValues Failure
  1466. */
  1467. ACL_FUNC_VISIBILITY aclError acldvppPngGetImageInfo(const void *data, uint32_t dataSize, uint32_t *width,
  1468. uint32_t *height, int32_t *components);
  1469. /**
  1470. * @ingroup AscendCL
  1471. * @brief Predict decode size of png image.
  1472. *
  1473. * @param data [IN] origin image data in host memory
  1474. * @param dataSize [IN] the size of origin image data
  1475. * @param outputPixelFormat [IN] the pixel format jpeg decode
  1476. * @param decSize [OUT] the size predicted for decode image
  1477. *
  1478. * @retval ACL_SUCCESS The function is successfully executed.
  1479. * @retval OtherValues Failure
  1480. */
  1481. ACL_FUNC_VISIBILITY aclError acldvppPngPredictDecSize(const void *data, uint32_t dataSize,
  1482. acldvppPixelFormat outputPixelFormat, uint32_t *decSize);
  1483. /**
  1484. * @ingroup AscendCL
  1485. * @brief Create dvpp channel, the same channel can be reused
  1486. * and is no longer available after destruction.
  1487. *
  1488. * @param channelDesc [IN|OUT] the channel destruction
  1489. *
  1490. * @retval ACL_SUCCESS The function is successfully executed.
  1491. * @retval OtherValues Failure
  1492. *
  1493. * @see acldvppCreateChannelDesc
  1494. */
  1495. ACL_FUNC_VISIBILITY aclError acldvppCreateChannel(acldvppChannelDesc *channelDesc);
  1496. /**
  1497. * @ingroup AscendCL
  1498. * @brief Destroy dvpp channel.
  1499. *
  1500. * @par Restriction
  1501. * Can only destroy channel created through the acldvppCreateChannel interface
  1502. *
  1503. * @param channelDesc [IN] the channel destruction
  1504. *
  1505. * @retval ACL_SUCCESS The function is successfully executed.
  1506. * @retval OtherValues Failure
  1507. *
  1508. * @see acldvppCreateChannel
  1509. */
  1510. ACL_FUNC_VISIBILITY aclError acldvppDestroyChannel(acldvppChannelDesc *channelDesc);
  1511. /**
  1512. * @ingroup AscendCL
  1513. * @brief dvpp vpc resize.
  1514. *
  1515. * @par Restriction
  1516. * Width alignment requirements:
  1517. * @li The minimum stride is 32 and the maximum is 4096 * 4
  1518. * (that is, an image in argb format with a width of 4096);
  1519. * @li For 8K scaling, widthStride is required to be aligned to 2;
  1520. * @li For non 8K scaling, the calculation formula for widthStride
  1521. * is different for different image formats:
  1522. * @li yuv400sp, yuv420sp, yuv422sp, yuv444sp: input image width aligned to 16
  1523. * @li yuv422packed: input image width * 2 and then align to 16
  1524. * @li yuv444packed, rgb888: input image width alignment * 3, alignment to 16
  1525. * @li xrgb8888: input image width * 4, align to 16
  1526. * @li HFBC:input image width
  1527. * Height alignment requirements:
  1528. * @li The height of the input image is aligned to 2.
  1529. * High stride minimum 6 and maximum 4096.
  1530. *
  1531. * @param channelDesc [IN] the channel destruction
  1532. * @param inputDesc [IN] resize input picture destruction
  1533. * @param outputDesc [IN|OUT] resize output picture destruction
  1534. * @param resizeConfig [IN] resize config
  1535. * @param stream [IN] resize task stream
  1536. *
  1537. * @retval ACL_SUCCESS The function is successfully executed.
  1538. * @retval OtherValues Failure
  1539. *
  1540. * @see acldvppCreateChannel | acldvppCreatePicDesc
  1541. * | acldvppCreateResizeConfig
  1542. */
  1543. ACL_FUNC_VISIBILITY aclError acldvppVpcResizeAsync(acldvppChannelDesc *channelDesc, acldvppPicDesc *inputDesc,
  1544. acldvppPicDesc *outputDesc, acldvppResizeConfig *resizeConfig,
  1545. aclrtStream stream);
  1546. /**
  1547. * @ingroup AscendCL
  1548. * @brief dvpp vpc crop.
  1549. *
  1550. * @par Function
  1551. * crop the input picture according to the specified area,
  1552. * and then store the picture in the output memory as the output picture
  1553. *
  1554. * @par Restriction
  1555. * Width alignment requirements:
  1556. * @li The minimum stride is 32 and the maximum is 4096 * 4
  1557. * (that is, an image in argb format with a width of 4096);
  1558. * @li For 8K scaling, widthStride is required to be aligned to 2;
  1559. * @li For non 8K scaling, the calculation formula for widthStride
  1560. * is different for different image formats:
  1561. * @li yuv400sp, yuv420sp, yuv422sp, yuv444sp: input image width aligned to 16
  1562. * @li yuv422packed: input image width * 2 and then align to 16
  1563. * @li yuv444packed, rgb888: input image width alignment * 3, alignment to 16
  1564. * @li xrgb8888: input image width * 4, align to 16
  1565. * @li HFBC:input image width
  1566. * Height alignment requirements:
  1567. * @li The height of the input image is aligned to 2.
  1568. * High stride minimum 6 and maximum 4096.
  1569. *
  1570. * @param channelDesc [IN] the channel destruction
  1571. * @param inputDesc [IN] crop input picture destruction
  1572. * @param outputDesc [IN|OUT] crop output picture destruction
  1573. * @param cropArea [IN] crop area config
  1574. * @param stream [IN] crop task stream
  1575. *
  1576. * @retval ACL_SUCCESS The function is successfully executed.
  1577. * @retval OtherValues Failure
  1578. */
  1579. ACL_FUNC_VISIBILITY aclError acldvppVpcCropAsync(acldvppChannelDesc *channelDesc, acldvppPicDesc *inputDesc,
  1580. acldvppPicDesc *outputDesc, acldvppRoiConfig *cropArea,
  1581. aclrtStream stream);
  1582. /**
  1583. * @ingroup AscendCL
  1584. * @brief dvpp vpc batch crop.
  1585. *
  1586. * @par Function
  1587. * crop the input batch picture according to the specified area
  1588. * as the output batch pictures
  1589. *
  1590. * @param channelDesc [IN] the channel destruction
  1591. * @param srcBatchPicDescs [IN] crop input batch picture destruction
  1592. * @param roiNums [IN] roi config numbers
  1593. * @param size [IN] roiNum size
  1594. * @param dstBatchPicDescs [IN|OUT] crop output batch picture destruction
  1595. * @param cropAreas [IN] crop area configs
  1596. * @param stream [IN] crop batch task stream
  1597. *
  1598. * @retval ACL_SUCCESS The function is successfully executed.
  1599. * @retval OtherValues Failure
  1600. *
  1601. * @see acldvppCreateChannel | acldvppCreateBatchPicDesc | acldvppCreateRoiConfig
  1602. */
  1603. ACL_FUNC_VISIBILITY aclError acldvppVpcBatchCropAsync(acldvppChannelDesc *channelDesc,
  1604. acldvppBatchPicDesc *srcBatchPicDescs, uint32_t *roiNums,
  1605. uint32_t size, acldvppBatchPicDesc *dstBatchPicDescs,
  1606. acldvppRoiConfig *cropAreas[], aclrtStream stream);
  1607. /**
  1608. * @ingroup AscendCL
  1609. * @brief dvpp vpc crop and paste.
  1610. *
  1611. * @par Function
  1612. * crop the input picture according to the specified area,
  1613. * and paste the picture to the specified position of the target picture
  1614. * as the output picture
  1615. *
  1616. * @param channelDesc [IN] thechannel destruction
  1617. * @param inputDesc [IN] crop and paste input picture destruction
  1618. * @param outputDesc [IN|OUT] crop and paste output picture destruction
  1619. * @param cropArea [IN] crop area config
  1620. * @param pasteArea [IN] paste area config
  1621. * @param stream [IN] crop and paste task stream
  1622. *
  1623. * @retval ACL_SUCCESS The function is successfully executed.
  1624. * @retval OtherValues Failure
  1625. *
  1626. * @see acldvppCreateChannel | acldvppCreatePicDesc | acldvppCreateRoiConfig
  1627. */
  1628. ACL_FUNC_VISIBILITY aclError acldvppVpcCropAndPasteAsync(acldvppChannelDesc *channelDesc, acldvppPicDesc *inputDesc,
  1629. acldvppPicDesc *outputDesc, acldvppRoiConfig *cropArea,
  1630. acldvppRoiConfig *pasteArea, aclrtStream stream);
  1631. /**
  1632. * @ingroup AscendCL
  1633. * @brief dvpp vpc batch crop and paste.
  1634. *
  1635. * @par Function
  1636. * crop the input batch picture according to the specified area,
  1637. * and paste the pictures to the specified position of the target pictures
  1638. * as the output batch pictures
  1639. *
  1640. * @param channelDesc [IN] the channel destruction
  1641. * @param srcBatchPicDescs [IN] crop input batch picture destruction
  1642. * @param roiNums [IN] roi config numbers
  1643. * @param size [IN] roiNum size
  1644. * @param dstBatchPicDescs [IN|OUT] crop output batch picture destruction
  1645. * @param cropAreas [IN] crop area configs
  1646. * @param pasteAreas [IN] paste area configs
  1647. * @param stream [IN] crop batch task stream
  1648. *
  1649. * @retval ACL_SUCCESS The function is successfully executed.
  1650. * @retval OtherValues Failure
  1651. *
  1652. * @see acldvppCreateChannel | acldvppCreateBatchPicDesc | acldvppCreateRoiConfig
  1653. */
  1654. ACL_FUNC_VISIBILITY aclError acldvppVpcBatchCropAndPasteAsync(acldvppChannelDesc *channelDesc,
  1655. acldvppBatchPicDesc *srcBatchPicDescs, uint32_t *roiNums,
  1656. uint32_t size, acldvppBatchPicDesc *dstBatchPicDescs,
  1657. acldvppRoiConfig *cropAreas[],
  1658. acldvppRoiConfig *pasteAreas[], aclrtStream stream);
  1659. /**
  1660. * @ingroup AscendCL
  1661. * @brief dvpp vpc jpeg decode.
  1662. *
  1663. * @par Function
  1664. * For different source picture formats, after decoding,
  1665. * output pictures in the following format:
  1666. * @li jpeg(444) -> YUV444SP:V is front U is back,
  1667. * YUV420 SP V is front U is back, YUV420SP U is front V is back;
  1668. * @li jpeg(422) -> YUV422SP:V is in front U is behind,
  1669. * YUV420SP V is in front U is behind, YUV420SP U is in front V is behind;
  1670. * @li jpeg(420) -> YUV420SP:
  1671. * V is front U is back, YUV420SP U is front V is back;
  1672. * @li jpeg(400) -> YUV420SP:UV data is filled with 0 x 80.
  1673. *
  1674. * @param channelDesc [IN] the channel destruction
  1675. * @param data [IN] decode input picture destruction's data
  1676. * @param size [IN] decode input picture destruction's size
  1677. * @param outputDesc [IN|OUT] decode output picture destruction
  1678. * @param stream [IN] decode task stream
  1679. *
  1680. * @retval ACL_SUCCESS The function is successfully executed.
  1681. * @retval OtherValues Failure
  1682. *
  1683. * @see acldvppCreateChannel | acldvppCreatePicDesc
  1684. */
  1685. ACL_FUNC_VISIBILITY aclError acldvppJpegDecodeAsync(acldvppChannelDesc *channelDesc, const void *data, uint32_t size,
  1686. acldvppPicDesc *outputDesc, aclrtStream stream);
  1687. /**
  1688. * @ingroup AscendCL
  1689. * @brief dvpp vpc jpeg encode.
  1690. *
  1691. * @param channelDesc [IN] the channel destruction
  1692. * @param inputDesc [IN] encode input picture destruction
  1693. * @param data [OUT] encode output picture destruction's data
  1694. * @param size [IN|OUT] encode output picture destruction's size
  1695. * @param config [IN] jpeg encode config
  1696. * @param stream [IN] encode task stream
  1697. *
  1698. * @retval ACL_SUCCESS The function is successfully executed.
  1699. * @retval OtherValues Failure
  1700. *
  1701. * @see acldvppCreateChannel | acldvppCreateJpegeConfig
  1702. */
  1703. ACL_FUNC_VISIBILITY aclError acldvppJpegEncodeAsync(acldvppChannelDesc *channelDesc, acldvppPicDesc *inputDesc,
  1704. const void *data, uint32_t *size, acldvppJpegeConfig *config,
  1705. aclrtStream stream);
  1706. /**
  1707. * @ingroup AscendCL
  1708. * @brief dvpp vpc png decode.
  1709. *
  1710. * @param channelDesc [IN] the channel destruction
  1711. * @param data [IN] decode input picture destruction's data
  1712. * @param size [IN] decode input picture destruction's size
  1713. * @param outputDesc [IN|OUT] decode output picture destruction
  1714. * @param stream [IN] decode task stream
  1715. *
  1716. * @retval ACL_SUCCESS The function is successfully executed.
  1717. * @retval OtherValues Failure
  1718. *
  1719. * @see acldvppCreateChannel | acldvppCreatePicDesc
  1720. */
  1721. ACL_FUNC_VISIBILITY aclError acldvppPngDecodeAsync(acldvppChannelDesc *channelDesc, const void *data, uint32_t size,
  1722. acldvppPicDesc *outputDesc, aclrtStream stream);
  1723. /**
  1724. * @ingroup AscendCL
  1725. * @brief Create vdec channel.
  1726. *
  1727. * @par Function
  1728. * Create a channel for video data processing,
  1729. * the same channel can be reused,
  1730. * and is no longer available after destruction
  1731. *
  1732. * @param channelDesc [IN|OUT] the channel destruction
  1733. *
  1734. * @retval ACL_SUCCESS The function is successfully executed.
  1735. * @retval OtherValues Failure
  1736. *
  1737. * @see aclvdecCreateChannelDesc
  1738. */
  1739. ACL_FUNC_VISIBILITY aclError aclvdecCreateChannel(aclvdecChannelDesc *channelDesc);
  1740. /**
  1741. * @ingroup AscendCL
  1742. * @brief Destroy vdec channel.
  1743. *
  1744. * @par Function
  1745. * Can only destroy channels created by the aclvdecCreateChannel interface
  1746. *
  1747. * @param channelDesc [IN] the channel destruction
  1748. *
  1749. * @retval ACL_SUCCESS The function is successfully executed.
  1750. * @retval OtherValues Failure
  1751. *
  1752. * @see aclvdecCreateChannel
  1753. */
  1754. ACL_FUNC_VISIBILITY aclError aclvdecDestroyChannel(aclvdecChannelDesc *channelDesc);
  1755. /**
  1756. * @ingroup AscendCL
  1757. * @brief dvpp vdec send frame.
  1758. *
  1759. * @par Function
  1760. * Pass the input memory to be decoded
  1761. * and the decoded output memory to the decoder for decoding
  1762. *
  1763. * @param channelDesc [IN] vdec channel destruction
  1764. * @param input [IN] input stream destruction
  1765. * @param output [IN|OUT] output picture destruction
  1766. * @param config [IN] vdec frame config
  1767. * @param userData [IN] user data for callback function
  1768. *
  1769. * @retval ACL_SUCCESS The function is successfully executed.
  1770. * @retval OtherValues Failure
  1771. *
  1772. * @see aclvdecCreateChannel | acldvppCreateStreamDesc | acldvppCreatePicDesc
  1773. */
  1774. ACL_FUNC_VISIBILITY aclError aclvdecSendFrame(aclvdecChannelDesc *channelDesc, acldvppStreamDesc *input,
  1775. acldvppPicDesc *output, aclvdecFrameConfig *config, void *userData);
  1776. /**
  1777. * @ingroup AscendCL
  1778. * @brief dvpp vdec send skipped frame.
  1779. *
  1780. * @par Function
  1781. * Pass video frame to decoder
  1782. *
  1783. * @param channelDesc [IN] vdec channel destruction
  1784. * @param input [IN] input stream destruction
  1785. * @param config [IN] vdec frame config
  1786. * @param userData [IN] user data for callback function
  1787. *
  1788. * @retval ACL_SUCCESS The function is successfully executed.
  1789. * @retval OtherValues Failure
  1790. *
  1791. * @see aclvdecCreateChannel | acldvppCreateStreamDesc | acldvppCreatePicDesc | aclvdecSendFrame
  1792. */
  1793. ACL_FUNC_VISIBILITY aclError aclvdecSendSkippedFrame(aclvdecChannelDesc *channelDesc, acldvppStreamDesc *input,
  1794. aclvdecFrameConfig *config, void *userData);
  1795. /**
  1796. * @ingroup AscendCL
  1797. * @brief dvpp vpc convert color.
  1798. *
  1799. * @par Restriction
  1800. * @li outputDesc:Width height stride, No changes are allowed. Just configure 0
  1801. * @par Function
  1802. * Convert color gamut
  1803. *
  1804. * @param channelDesc [IN] the channel destruction
  1805. * @param inputDesc [IN] convert color input picture destruction
  1806. * @param outputDesc [IN|OUT] convert color output picture destruction
  1807. * @param stream [IN] convert color task stream
  1808. *
  1809. * @retval ACL_SUCCESS The function is successfully executed.
  1810. * @retval OtherValues Failure
  1811. *
  1812. * @see acldvppCreateChannel | acldvppCreatePicDesc
  1813. */
  1814. ACL_FUNC_VISIBILITY aclError acldvppVpcConvertColorAsync(acldvppChannelDesc *channelDesc, acldvppPicDesc *inputDesc,
  1815. acldvppPicDesc *outputDesc, aclrtStream stream);
  1816. /**
  1817. * @ingroup AscendCL
  1818. * @brief dvpp vpc pyramid down.
  1819. *
  1820. * @par Restriction
  1821. * @li outputDesc:format only supported YUV400
  1822. * @par Function
  1823. * Image pyramid down
  1824. *
  1825. * @param channelDesc [IN] the channel destruction
  1826. * @param inputDesc [IN] pyr down input picture destruction
  1827. * @param outputDesc [IN|OUT] pyr down output picture destruction
  1828. * @param reserve [IN] reserved param , must be nullptr
  1829. * @param stream [IN] pyr down task stream
  1830. *
  1831. * @retval ACL_SUCCESS The function is successfully executed.
  1832. * @retval OtherValues Failure
  1833. *
  1834. * @see acldvppCreateChannel | acldvppCreatePicDesc
  1835. */
  1836. ACL_FUNC_VISIBILITY aclError acldvppVpcPyrDownAsync(acldvppChannelDesc *channelDesc, acldvppPicDesc *inputDesc,
  1837. acldvppPicDesc *outputDesc, void *reserve, aclrtStream stream);
  1838. /**
  1839. * @ingroup AscendCL
  1840. * @brief Set dvpp channel mode.
  1841. *
  1842. * @param channelDesc [OUT] the channel destruction
  1843. * @param mode [IN] channel mode
  1844. *
  1845. * @retval ACL_SUCCESS The function is successfully executed.
  1846. * @retval OtherValues Failure
  1847. */
  1848. ACL_FUNC_VISIBILITY aclError acldvppSetChannelDescMode(acldvppChannelDesc *channelDesc, uint32_t mode);
  1849. /**
  1850. * @ingroup AscendCL
  1851. * @brief Set resize config interpolation.
  1852. *
  1853. * @param resizeConfig [OUT] the resize config
  1854. * @param interpolation [IN] interpolation
  1855. *
  1856. * @retval ACL_SUCCESS The function is successfully executed.
  1857. * @retval OtherValues Failure
  1858. */
  1859. ACL_FUNC_VISIBILITY aclError acldvppSetResizeConfigInterpolation(acldvppResizeConfig *resizeConfig,
  1860. uint32_t interpolation);
  1861. /**
  1862. * @ingroup AscendCL
  1863. * @brief Get resize config interpolation.
  1864. *
  1865. * @param resizeConfig [IN] the resize config
  1866. *
  1867. * @retval Interpolation of resize config.
  1868. */
  1869. ACL_FUNC_VISIBILITY uint32_t acldvppGetResizeConfigInterpolation(const acldvppResizeConfig *resizeConfig);
  1870. /**
  1871. * @ingroup AscendCL
  1872. * @brief Set vdec channel out mode.
  1873. *
  1874. * @param channelDesc [OUT] the channel destruction
  1875. * @param outMode [IN] channel out mode
  1876. *
  1877. * @retval ACL_SUCCESS The function is successfully executed.
  1878. * @retval OtherValues Failure
  1879. */
  1880. ACL_FUNC_VISIBILITY aclError aclvdecSetChannelDescOutMode(aclvdecChannelDesc *channelDesc, uint32_t outMode);
  1881. /**
  1882. * @ingroup AscendCL
  1883. * @brief Get vdec channel out mode.
  1884. *
  1885. * @param channelDesc [IN] the channel destruction
  1886. *
  1887. * @retval Out mode of channel destruction
  1888. * @retval default 0
  1889. */
  1890. ACL_FUNC_VISIBILITY uint32_t aclvdecGetChannelDescOutMode(const aclvdecChannelDesc *channelDesc);
  1891. /**
  1892. * @ingroup AscendCL
  1893. * @brief Create dvpp batch picture description.
  1894. *
  1895. * @param batchSize [IN] batch size
  1896. *
  1897. * @retval null for failed.
  1898. * @retval OtherValues success.
  1899. */
  1900. ACL_FUNC_VISIBILITY acldvppBatchPicDesc *acldvppCreateBatchPicDesc(uint32_t batchSize);
  1901. /**
  1902. * @ingroup AscendCL
  1903. * @brief Get dvpp picture description.
  1904. *
  1905. * @param batchPicDesc [IN] dvpp batch picture description.
  1906. * @param index [IN] index of batch
  1907. *
  1908. * @retval null for failed.
  1909. * @retval OtherValues Failure
  1910. *
  1911. * @see acldvppCreateBatchPicDesc
  1912. */
  1913. ACL_FUNC_VISIBILITY acldvppPicDesc *acldvppGetPicDesc(acldvppBatchPicDesc *batchPicDesc, uint32_t index);
  1914. /**
  1915. * @ingroup AscendCL
  1916. * @brief Destroy dvpp batch picture description.
  1917. *
  1918. * @par Function
  1919. * Can only destroy batch picture description information created
  1920. * through acldvppCreateBatchPicDesc interface.
  1921. *
  1922. * @param batchPicDesc [IN] dvpp batch picture description.
  1923. *
  1924. * @retval ACL_SUCCESS The function is successfully executed.
  1925. * @retval OtherValues Failure
  1926. *
  1927. * @see acldvppCreateBatchPicDesc
  1928. */
  1929. ACL_FUNC_VISIBILITY aclError acldvppDestroyBatchPicDesc(acldvppBatchPicDesc *batchPicDesc);
  1930. /**
  1931. * @ingroup AscendCL
  1932. * @brief Create dvpp lut map.
  1933. *
  1934. * @retval null for failed.
  1935. * @retval OtherValues success.
  1936. */
  1937. ACL_FUNC_VISIBILITY acldvppLutMap *acldvppCreateLutMap();
  1938. /**
  1939. * @ingroup AscendCL
  1940. * @brief Destroy lut map.
  1941. *
  1942. * @param lutMap [IN] lut map
  1943. *
  1944. * @retval ACL_SUCCESS for success, other for failure
  1945. */
  1946. ACL_FUNC_VISIBILITY aclError acldvppDestroyLutMap(acldvppLutMap *lutMap);
  1947. /**
  1948. * @ingroup AscendCL
  1949. * @brief Get lut map dims.
  1950. *
  1951. * @param lutMap [IN] lut map
  1952. *
  1953. * @retval 0 for failed.
  1954. * @retval OtherValues success.
  1955. */
  1956. ACL_FUNC_VISIBILITY uint32_t acldvppGetLutMapDims(const acldvppLutMap *lutMap);
  1957. /**
  1958. * @ingroup AscendCL
  1959. * @brief Get lut map data.
  1960. *
  1961. * @param lutMap [IN] lut map
  1962. * @param dim [IN] input dim of map
  1963. * @param data [OUT] the dim of lut map's data
  1964. * @param len [OUT] the dim of lut map's length
  1965. *
  1966. * @retval ACL_SUCCESS The function is successfully executed.
  1967. * @retval OtherValues Failure
  1968. */
  1969. ACL_FUNC_VISIBILITY aclError acldvppGetLutMapData(const acldvppLutMap *lutMap, uint32_t dim, uint8_t **data,
  1970. uint32_t *len);
  1971. /**
  1972. * @ingroup AscendCL
  1973. * @brief Vpc equalize hist.
  1974. *
  1975. * @param channelDesc [IN] channel desc
  1976. * @param inputDesc [IN] input desc
  1977. * @param outputDesc [IN|OUT] output desc
  1978. * @param lutMap [IN] lut map param
  1979. * @param stream [IN] runtime stream
  1980. *
  1981. * @retval ACL_SUCCESS The function is successfully executed.
  1982. * @retval OtherValues Failure
  1983. *
  1984. * @see acldvppCreateChannel|acldvppCreatePicDesc|acldvppCreateLutMap
  1985. */
  1986. ACL_FUNC_VISIBILITY aclError acldvppVpcEqualizeHistAsync(const acldvppChannelDesc *channelDesc,
  1987. const acldvppPicDesc *inputDesc, acldvppPicDesc *outputDesc,
  1988. const acldvppLutMap *lutMap, aclrtStream stream);
  1989. /**
  1990. * @ingroup AscendCL
  1991. * @brief Create dvpp border config.
  1992. *
  1993. * @retval null for failed.
  1994. * @retval OtherValues success.
  1995. */
  1996. ACL_FUNC_VISIBILITY acldvppBorderConfig *acldvppCreateBorderConfig();
  1997. /**
  1998. * @ingroup AscendCL
  1999. * @brief Set value of border config.
  2000. *
  2001. * @param borderConfig [OUT] border config
  2002. * @param index [IN] index of value array
  2003. * @param value [IN] value
  2004. *
  2005. * @retval ACL_SUCCESS for success, other for failure
  2006. */
  2007. ACL_FUNC_VISIBILITY aclError acldvppSetBorderConfigValue(acldvppBorderConfig *borderConfig, uint32_t index,
  2008. double value);
  2009. /**
  2010. * @ingroup AscendCL
  2011. * @brief Set border type of border config.
  2012. *
  2013. * @param borderConfig [OUT] border config
  2014. * @param borderType [IN] border type
  2015. *
  2016. * @retval ACL_SUCCESS for success, other for failure
  2017. */
  2018. ACL_FUNC_VISIBILITY aclError acldvppSetBorderConfigBorderType(acldvppBorderConfig *borderConfig,
  2019. acldvppBorderType borderType);
  2020. /**
  2021. * @ingroup AscendCL
  2022. * @brief Set top of border config.
  2023. *
  2024. * @param borderConfig [OUT] border config
  2025. * @param top [IN] top of border
  2026. *
  2027. * @retval ACL_SUCCESS for success, other for failure
  2028. */
  2029. ACL_FUNC_VISIBILITY aclError acldvppSetBorderConfigTop(acldvppBorderConfig *borderConfig, uint32_t top);
  2030. /**
  2031. * @ingroup AscendCL
  2032. * @brief Set bottom of border config.
  2033. *
  2034. * @param borderConfig [OUT] border config
  2035. * @param bottom [IN] bottom of border
  2036. *
  2037. * @retval ACL_SUCCESS for success, other for failure
  2038. */
  2039. ACL_FUNC_VISIBILITY aclError acldvppSetBorderConfigBottom(acldvppBorderConfig *borderConfig, uint32_t bottom);
  2040. /**
  2041. * @ingroup AscendCL
  2042. * @brief Set left of border config.
  2043. *
  2044. * @param borderConfig [OUT] border config
  2045. * @param left [IN] left of border
  2046. *
  2047. * @retval ACL_SUCCESS for success, other for failure
  2048. */
  2049. ACL_FUNC_VISIBILITY aclError acldvppSetBorderConfigLeft(acldvppBorderConfig *borderConfig, uint32_t left);
  2050. /**
  2051. * @ingroup AscendCL
  2052. * @brief Set right of border config.
  2053. *
  2054. * @param borderConfig [OUT] border config
  2055. * @param right [IN] right of border
  2056. *
  2057. * @retval ACL_SUCCESS for success, other for failure
  2058. */
  2059. ACL_FUNC_VISIBILITY aclError acldvppSetBorderConfigRight(acldvppBorderConfig *borderConfig, uint32_t right);
  2060. /**
  2061. * @ingroup AscendCL
  2062. * @brief Get value of border config.
  2063. *
  2064. * @param borderConfig [IN] border config
  2065. * @param index[IN] index of value array
  2066. *
  2067. * @retval invalid value is < 0, normal Value is >= 0
  2068. */
  2069. ACL_FUNC_VISIBILITY double acldvppGetBorderConfigValue(const acldvppBorderConfig *borderConfig, uint32_t index);
  2070. /**
  2071. * @ingroup AscendCL
  2072. * @brief Get border type of border config.
  2073. *
  2074. * @param borderConfig [IN] border config
  2075. * @retval border type of border config
  2076. */
  2077. ACL_FUNC_VISIBILITY acldvppBorderType acldvppGetBorderConfigBorderType(const acldvppBorderConfig *borderConfig);
  2078. /**
  2079. * @ingroup AscendCL
  2080. * @brief Get right of border config.
  2081. *
  2082. * @param borderConfig [IN] border config
  2083. *
  2084. * @retval default 0, top value of border config
  2085. */
  2086. ACL_FUNC_VISIBILITY uint32_t acldvppGetBorderConfigTop(const acldvppBorderConfig *borderConfig);
  2087. /**
  2088. * @ingroup AscendCL
  2089. * @brief Get Bottom of border config.
  2090. *
  2091. * @param borderConfig [IN] border config
  2092. *
  2093. * @retval default 0, top value of border config
  2094. */
  2095. ACL_FUNC_VISIBILITY uint32_t acldvppGetBorderConfigBottom(const acldvppBorderConfig *borderConfig);
  2096. /**
  2097. * @ingroup AscendCL
  2098. * @brief Get left of border config.
  2099. *
  2100. * @param borderConfig [IN] border config
  2101. *
  2102. * @retval default 0, top value of border config
  2103. */
  2104. ACL_FUNC_VISIBILITY uint32_t acldvppGetBorderConfigLeft(const acldvppBorderConfig *borderConfig);
  2105. /**
  2106. * @ingroup AscendCL
  2107. * @brief Get right of border config.
  2108. *
  2109. * @param borderConfig [IN] border config
  2110. *
  2111. * @retval default 0, right value of border config
  2112. */
  2113. ACL_FUNC_VISIBILITY uint32_t acldvppGetBorderConfigRight(const acldvppBorderConfig *borderConfig);
  2114. /**
  2115. * @ingroup AscendCL
  2116. * @brief Destroy border config.
  2117. *
  2118. * @param borderConfig [IN] border config
  2119. *
  2120. * @retval ACL_SUCCESS for success, other for failure
  2121. */
  2122. ACL_FUNC_VISIBILITY aclError acldvppDestroyBorderConfig(acldvppBorderConfig *borderConfig);
  2123. /**
  2124. * @ingroup AscendCL
  2125. * @brief Vpc make border.
  2126. *
  2127. * @param channelDesc [IN] channel desc
  2128. * @param inputDesc [IN] input desc
  2129. * @param outputDesc [IN|OUT] output desc
  2130. * @param borderConfig [IN] border config param
  2131. * @param stream [IN] runtime stream
  2132. *
  2133. * @retval ACL_SUCCESS The function is successfully executed.
  2134. * @retval OtherValues Failure
  2135. *
  2136. * @see acldvppCreateChannel|acldvppCreatePicDesc|acldvppCreateBorderConfig
  2137. */
  2138. ACL_FUNC_VISIBILITY aclError acldvppVpcMakeBorderAsync(const acldvppChannelDesc *channelDesc,
  2139. const acldvppPicDesc *inputDesc, acldvppPicDesc *outputDesc,
  2140. const acldvppBorderConfig *borderConfig, aclrtStream stream);
  2141. /**
  2142. * @ingroup AscendCL
  2143. * @brief Dvpp vpc calc hist.
  2144. *
  2145. * @param channelDesc [IN] the channel destruction
  2146. * @param srcPicDesc [IN] pyr down input picture destruction
  2147. * @param hist [IN|OUT] pyr down output picture destruction
  2148. * @param reserve [IN] reserved param, must be nullptr
  2149. * @param stream [IN] task stream
  2150. *
  2151. * @retval ACL_SUCCESS The function is successfully executed.
  2152. * @retval OtherValues Failure
  2153. *
  2154. * @see acldvppCreateChannel | acldvppCreatePicDesc | acldvppCreateHist
  2155. */
  2156. ACL_FUNC_VISIBILITY aclError acldvppVpcCalcHistAsync(acldvppChannelDesc *channelDesc, acldvppPicDesc *srcPicDesc,
  2157. acldvppHist *hist, void *reserve, aclrtStream stream);
  2158. /**
  2159. * @ingroup AscendCL
  2160. * @brief Create vpc hist description.
  2161. *
  2162. * @retval null for failed.
  2163. * @retval OtherValues success.
  2164. */
  2165. ACL_FUNC_VISIBILITY acldvppHist *acldvppCreateHist();
  2166. /**
  2167. * @ingroup AscendCL
  2168. * @brief Destroy vpc hist description.
  2169. *
  2170. * @par Function
  2171. * Can only destroy hist description information created
  2172. * through acldvppCreateHist interface.
  2173. *
  2174. * @param hist [IN] vpc hist description.
  2175. *
  2176. * @retval ACL_SUCCESS The function is successfully executed.
  2177. * @retval OtherValues Failure
  2178. *
  2179. * @see acldvppCreateHist
  2180. */
  2181. ACL_FUNC_VISIBILITY aclError acldvppDestroyHist(acldvppHist *hist);
  2182. /**
  2183. * @ingroup AscendCL
  2184. * @brief Get dims of vpc hist description.
  2185. *
  2186. * @param hist [IN] vpc hist description.
  2187. *
  2188. * @retval dims of vpc hist description.
  2189. *
  2190. * @see acldvppCreateHist | acldvppVpcCalcHistAsync
  2191. */
  2192. ACL_FUNC_VISIBILITY uint32_t acldvppGetHistDims(acldvppHist *hist);
  2193. /**
  2194. * @ingroup AscendCL
  2195. * @brief Get data from vpc hist description by dim.
  2196. *
  2197. * @param hist [IN] vpc hist description.
  2198. * @param dim [IN] which dim to get data.
  2199. * @param data [OUT] address of output hist data.
  2200. * @param len [OUT] len of output hist data.
  2201. *
  2202. * @retval ACL_SUCCESS The function is successfully executed.
  2203. * @retval OtherValues Failure
  2204. *
  2205. * @see acldvppCreateHist | acldvppVpcCalcHistAsync
  2206. */
  2207. ACL_FUNC_VISIBILITY aclError acldvppGetHistData(acldvppHist *hist, uint32_t dim, uint32_t **data, uint16_t *len);
  2208. /**
  2209. * @ingroup AscendCL
  2210. * @brief Get dvpp calc hist process return code.
  2211. *
  2212. * @param hist [IN] vpc hist description.
  2213. *
  2214. * @retval Dvpp calc hist process return code.
  2215. *
  2216. * @see acldvppCreateHist | acldvppVpcCalcHistAsync
  2217. */
  2218. ACL_FUNC_VISIBILITY uint32_t acldvppGetHistRetCode(acldvppHist *hist);
  2219. /**
  2220. * @ingroup AscendCL
  2221. * @brief Set vpc hist description to 0.
  2222. *
  2223. * @par Function
  2224. * Can only clear hist description information created
  2225. * through acldvppCreateHist interface.
  2226. *
  2227. * @param hist [IN] vpc hist description.
  2228. *
  2229. * @retval ACL_SUCCESS The function is successfully executed.
  2230. * @retval OtherValues Failure
  2231. *
  2232. * @see acldvppCreateHist
  2233. */
  2234. ACL_FUNC_VISIBILITY aclError acldvppClearHist(acldvppHist *hist);
  2235. #ifdef __cplusplus
  2236. }
  2237. #endif
  2238. #endif // INC_EXTERNAL_ACL_OPS_ACL_DVPP_H_

图引擎模块(GE)是MindSpore的一个子模块,其代码由C++实现,位于前端模块ME和底层硬件之间,起到承接作用。图引擎模块以ME下发的图作为输入,然后进行一系列的深度图优化操作,最后输出一张可以在底层硬件上高效运行的图。GE针对昇腾AI处理器的硬件结构特点,做了特定的优化工作,以此来充分发挥出昇腾AI处理器的强大算力。在进行模型训练/推理时,GE会被自动调用而用户并不感知。GE主要由GE API和GE Core两部分组成,详细的架构图如下所示