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 85 kB

3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568
  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 crop and resize config.
  1585. *
  1586. * @par Function
  1587. * crop the input picture with resize config according to the specified area,
  1588. * and then store the picture in the output memory as the output picture
  1589. *
  1590. * @par Restriction
  1591. * Width alignment requirements:
  1592. * @li The minimum stride is 32 and the maximum is 4096 * 4
  1593. * (that is, an image in argb format with a width of 4096);
  1594. * @li For 8K scaling, widthStride is required to be aligned to 2;
  1595. * @li For non 8K scaling, the calculation formula for widthStride
  1596. * is different for different image formats:
  1597. * @li yuv400sp, yuv420sp, yuv422sp, yuv444sp: input image width aligned to 16
  1598. * @li yuv422packed: input image width * 2 and then align to 16
  1599. * @li yuv444packed, rgb888: input image width alignment * 3, alignment to 16
  1600. * @li xrgb8888: input image width * 4, align to 16
  1601. * @li HFBC:input image width
  1602. * Height alignment requirements:
  1603. * @li The height of the input image is aligned to 2.
  1604. * High stride minimum 6 and maximum 4096.
  1605. *
  1606. * @param channelDesc [IN] the channel destruction
  1607. * @param inputDesc [IN] crop input picture destruction
  1608. * @param outputDesc [IN|OUT] crop output picture destruction
  1609. * @param cropArea [IN] crop area config
  1610. * @param resizeConfig [IN] resize config
  1611. * @param stream [IN] crop and resize config task stream
  1612. *
  1613. * @retval ACL_SUCCESS The function is successfully executed.
  1614. * @retval OtherValues Failure
  1615. */
  1616. ACL_FUNC_VISIBILITY aclError acldvppVpcCropResizeAsync(acldvppChannelDesc *channelDesc, acldvppPicDesc *inputDesc,
  1617. acldvppPicDesc *outputDesc, acldvppRoiConfig *cropArea,
  1618. acldvppResizeConfig *resizeConfig, aclrtStream stream);
  1619. /**
  1620. * @ingroup AscendCL
  1621. * @brief dvpp vpc batch crop.
  1622. *
  1623. * @par Function
  1624. * crop the input batch picture according to the specified area
  1625. * as the output batch pictures
  1626. *
  1627. * @param channelDesc [IN] the channel destruction
  1628. * @param srcBatchPicDescs [IN] crop input batch picture destruction
  1629. * @param roiNums [IN] roi config numbers
  1630. * @param size [IN] roiNum size
  1631. * @param dstBatchPicDescs [IN|OUT] crop output batch picture destruction
  1632. * @param cropAreas [IN] crop area configs
  1633. * @param stream [IN] crop batch task stream
  1634. *
  1635. * @retval ACL_SUCCESS The function is successfully executed.
  1636. * @retval OtherValues Failure
  1637. *
  1638. * @see acldvppCreateChannel | acldvppCreateBatchPicDesc | acldvppCreateRoiConfig
  1639. */
  1640. ACL_FUNC_VISIBILITY aclError acldvppVpcBatchCropAsync(acldvppChannelDesc *channelDesc,
  1641. acldvppBatchPicDesc *srcBatchPicDescs, uint32_t *roiNums,
  1642. uint32_t size, acldvppBatchPicDesc *dstBatchPicDescs,
  1643. acldvppRoiConfig *cropAreas[], aclrtStream stream);
  1644. /**
  1645. * @ingroup AscendCL
  1646. * @brief dvpp vpc batch crop and resize config.
  1647. *
  1648. * @par Function
  1649. * crop the input batch picture with resize config according to the specified area
  1650. * as the output batch pictures
  1651. *
  1652. * @param channelDesc [IN] the channel destruction
  1653. * @param srcBatchPicDescs [IN] crop input batch picture destruction
  1654. * @param roiNums [IN] roi config numbers
  1655. * @param size [IN] roiNum size
  1656. * @param dstBatchPicDescs [IN|OUT] crop output batch picture destruction
  1657. * @param cropAreas [IN] crop area configs
  1658. * @param resizeConfig [IN] resize config
  1659. * @param stream [IN] crop batch and resize config task stream
  1660. *
  1661. * @retval ACL_SUCCESS The function is successfully executed.
  1662. * @retval OtherValues Failure
  1663. *
  1664. * @see acldvppCreateChannel | acldvppCreateBatchPicDesc | acldvppCreateRoiConfig | acldvppCreateDvppConfig
  1665. */
  1666. ACL_FUNC_VISIBILITY aclError acldvppVpcBatchCropResizeAsync(acldvppChannelDesc *channelDesc,
  1667. acldvppBatchPicDesc *srcBatchPicDescs, uint32_t *roiNums,
  1668. uint32_t size, acldvppBatchPicDesc *dstBatchPicDescs,
  1669. acldvppRoiConfig *cropAreas[],
  1670. acldvppResizeConfig *resizeConfig, aclrtStream stream);
  1671. /**
  1672. * @ingroup AscendCL
  1673. * @brief dvpp vpc crop and paste.
  1674. *
  1675. * @par Function
  1676. * crop the input picture according to the specified area,
  1677. * and paste the picture to the specified position of the target picture
  1678. * as the output picture
  1679. *
  1680. * @param channelDesc [IN] thechannel destruction
  1681. * @param inputDesc [IN] crop and paste input picture destruction
  1682. * @param outputDesc [IN|OUT] crop and paste output picture destruction
  1683. * @param cropArea [IN] crop area config
  1684. * @param pasteArea [IN] paste area config
  1685. * @param stream [IN] crop and paste task stream
  1686. *
  1687. * @retval ACL_SUCCESS The function is successfully executed.
  1688. * @retval OtherValues Failure
  1689. *
  1690. * @see acldvppCreateChannel | acldvppCreatePicDesc | acldvppCreateRoiConfig
  1691. */
  1692. ACL_FUNC_VISIBILITY aclError acldvppVpcCropAndPasteAsync(acldvppChannelDesc *channelDesc, acldvppPicDesc *inputDesc,
  1693. acldvppPicDesc *outputDesc, acldvppRoiConfig *cropArea,
  1694. acldvppRoiConfig *pasteArea, aclrtStream stream);
  1695. /**
  1696. * @ingroup AscendCL
  1697. * @brief dvpp vpc crop, resize config and paste.
  1698. *
  1699. * @par Function
  1700. * crop the input picture with resize config according to the specified area,
  1701. * and paste the picture to the specified position of the target picture
  1702. * as the output picture
  1703. *
  1704. * @param channelDesc [IN] thechannel destruction
  1705. * @param inputDesc [IN] crop and paste input picture destruction
  1706. * @param outputDesc [IN|OUT] crop and paste output picture destruction
  1707. * @param cropArea [IN] crop area config
  1708. * @param pasteArea [IN] paste area config
  1709. * @param resizeConfig [IN] resize config
  1710. * @param stream [IN] crop, paste and resize task stream
  1711. *
  1712. * @retval ACL_SUCCESS The function is successfully executed.
  1713. * @retval OtherValues Failure
  1714. *
  1715. * @see acldvppCreateChannel | acldvppCreatePicDesc | acldvppCreateRoiConfig | acldvppCreateResizeConfig
  1716. */
  1717. ACL_FUNC_VISIBILITY aclError acldvppVpcCropResizePasteAsync(acldvppChannelDesc *channelDesc, acldvppPicDesc *inputDesc,
  1718. acldvppPicDesc *outputDesc, acldvppRoiConfig *cropArea,
  1719. acldvppRoiConfig *pasteArea,
  1720. acldvppResizeConfig *resizeConfig, aclrtStream stream);
  1721. /**
  1722. * @ingroup AscendCL
  1723. * @brief dvpp vpc batch crop and paste.
  1724. *
  1725. * @par Function
  1726. * crop the input batch picture according to the specified area,
  1727. * and paste the pictures to the specified position of the target pictures
  1728. * as the output batch pictures
  1729. *
  1730. * @param channelDesc [IN] the channel destruction
  1731. * @param srcBatchPicDescs [IN] crop input batch picture destruction
  1732. * @param roiNums [IN] roi config numbers
  1733. * @param size [IN] roiNum size
  1734. * @param dstBatchPicDescs [IN|OUT] crop output batch picture destruction
  1735. * @param cropAreas [IN] crop area configs
  1736. * @param pasteAreas [IN] paste area configs
  1737. * @param stream [IN] crop batch task stream
  1738. *
  1739. * @retval ACL_SUCCESS The function is successfully executed.
  1740. * @retval OtherValues Failure
  1741. *
  1742. * @see acldvppCreateChannel | acldvppCreateBatchPicDesc | acldvppCreateRoiConfig
  1743. */
  1744. ACL_FUNC_VISIBILITY aclError acldvppVpcBatchCropAndPasteAsync(acldvppChannelDesc *channelDesc,
  1745. acldvppBatchPicDesc *srcBatchPicDescs, uint32_t *roiNums,
  1746. uint32_t size, acldvppBatchPicDesc *dstBatchPicDescs,
  1747. acldvppRoiConfig *cropAreas[],
  1748. acldvppRoiConfig *pasteAreas[], aclrtStream stream);
  1749. /**
  1750. * @ingroup AscendCL
  1751. * @brief dvpp vpc batch crop, resize config and paste.
  1752. *
  1753. * @par Function
  1754. * crop the input batch picture with resize config according to the specified area,
  1755. * and paste the pictures to the specified position of the target pictures
  1756. * as the output batch pictures
  1757. *
  1758. * @param channelDesc [IN] the channel destruction
  1759. * @param srcBatchPicDescs [IN] crop input batch picture destruction
  1760. * @param roiNums [IN] roi config numbers
  1761. * @param size [IN] roiNum size
  1762. * @param dstBatchPicDescs [IN|OUT] crop output batch picture destruction
  1763. * @param cropAreas [IN] crop area configs
  1764. * @param pasteAreas [IN] paste area configs
  1765. * @param resizeConfig [IN] resize config
  1766. * @param stream [IN] crop batch and resize config task stream
  1767. *
  1768. * @retval ACL_SUCCESS The function is successfully executed.
  1769. * @retval OtherValues Failure
  1770. *
  1771. * @see acldvppCreateChannel | acldvppCreateBatchPicDesc | acldvppCreateRoiConfig | acldvppCreateResizeConfig
  1772. */
  1773. ACL_FUNC_VISIBILITY aclError acldvppVpcBatchCropResizePasteAsync(
  1774. acldvppChannelDesc *channelDesc, acldvppBatchPicDesc *srcBatchPicDescs, uint32_t *roiNums, uint32_t size,
  1775. acldvppBatchPicDesc *dstBatchPicDescs, acldvppRoiConfig *cropAreas[], acldvppRoiConfig *pasteAreas[],
  1776. acldvppResizeConfig *resizeConfig, aclrtStream stream);
  1777. /**
  1778. * @ingroup AscendCL
  1779. * @brief dvpp vpc jpeg decode.
  1780. *
  1781. * @par Function
  1782. * For different source picture formats, after decoding,
  1783. * output pictures in the following format:
  1784. * @li jpeg(444) -> YUV444SP:V is front U is back,
  1785. * YUV420 SP V is front U is back, YUV420SP U is front V is back;
  1786. * @li jpeg(422) -> YUV422SP:V is in front U is behind,
  1787. * YUV420SP V is in front U is behind, YUV420SP U is in front V is behind;
  1788. * @li jpeg(420) -> YUV420SP:
  1789. * V is front U is back, YUV420SP U is front V is back;
  1790. * @li jpeg(400) -> YUV420SP:UV data is filled with 0 x 80.
  1791. *
  1792. * @param channelDesc [IN] the channel destruction
  1793. * @param data [IN] decode input picture destruction's data
  1794. * @param size [IN] decode input picture destruction's size
  1795. * @param outputDesc [IN|OUT] decode output picture destruction
  1796. * @param stream [IN] decode task stream
  1797. *
  1798. * @retval ACL_SUCCESS The function is successfully executed.
  1799. * @retval OtherValues Failure
  1800. *
  1801. * @see acldvppCreateChannel | acldvppCreatePicDesc
  1802. */
  1803. ACL_FUNC_VISIBILITY aclError acldvppJpegDecodeAsync(acldvppChannelDesc *channelDesc, const void *data, uint32_t size,
  1804. acldvppPicDesc *outputDesc, aclrtStream stream);
  1805. /**
  1806. * @ingroup AscendCL
  1807. * @brief dvpp vpc jpeg encode.
  1808. *
  1809. * @param channelDesc [IN] the channel destruction
  1810. * @param inputDesc [IN] encode input picture destruction
  1811. * @param data [OUT] encode output picture destruction's data
  1812. * @param size [IN|OUT] encode output picture destruction's size
  1813. * @param config [IN] jpeg encode config
  1814. * @param stream [IN] encode task stream
  1815. *
  1816. * @retval ACL_SUCCESS The function is successfully executed.
  1817. * @retval OtherValues Failure
  1818. *
  1819. * @see acldvppCreateChannel | acldvppCreateJpegeConfig
  1820. */
  1821. ACL_FUNC_VISIBILITY aclError acldvppJpegEncodeAsync(acldvppChannelDesc *channelDesc, acldvppPicDesc *inputDesc,
  1822. const void *data, uint32_t *size, acldvppJpegeConfig *config,
  1823. aclrtStream stream);
  1824. /**
  1825. * @ingroup AscendCL
  1826. * @brief dvpp vpc png decode.
  1827. *
  1828. * @param channelDesc [IN] the channel destruction
  1829. * @param data [IN] decode input picture destruction's data
  1830. * @param size [IN] decode input picture destruction's size
  1831. * @param outputDesc [IN|OUT] decode output picture destruction
  1832. * @param stream [IN] decode task stream
  1833. *
  1834. * @retval ACL_SUCCESS The function is successfully executed.
  1835. * @retval OtherValues Failure
  1836. *
  1837. * @see acldvppCreateChannel | acldvppCreatePicDesc
  1838. */
  1839. ACL_FUNC_VISIBILITY aclError acldvppPngDecodeAsync(acldvppChannelDesc *channelDesc, const void *data, uint32_t size,
  1840. acldvppPicDesc *outputDesc, aclrtStream stream);
  1841. /**
  1842. * @ingroup AscendCL
  1843. * @brief Create vdec channel.
  1844. *
  1845. * @par Function
  1846. * Create a channel for video data processing,
  1847. * the same channel can be reused,
  1848. * and is no longer available after destruction
  1849. *
  1850. * @param channelDesc [IN|OUT] the channel destruction
  1851. *
  1852. * @retval ACL_SUCCESS The function is successfully executed.
  1853. * @retval OtherValues Failure
  1854. *
  1855. * @see aclvdecCreateChannelDesc
  1856. */
  1857. ACL_FUNC_VISIBILITY aclError aclvdecCreateChannel(aclvdecChannelDesc *channelDesc);
  1858. /**
  1859. * @ingroup AscendCL
  1860. * @brief Destroy vdec channel.
  1861. *
  1862. * @par Function
  1863. * Can only destroy channels created by the aclvdecCreateChannel interface
  1864. *
  1865. * @param channelDesc [IN] the channel destruction
  1866. *
  1867. * @retval ACL_SUCCESS The function is successfully executed.
  1868. * @retval OtherValues Failure
  1869. *
  1870. * @see aclvdecCreateChannel
  1871. */
  1872. ACL_FUNC_VISIBILITY aclError aclvdecDestroyChannel(aclvdecChannelDesc *channelDesc);
  1873. /**
  1874. * @ingroup AscendCL
  1875. * @brief dvpp vdec send frame.
  1876. *
  1877. * @par Function
  1878. * Pass the input memory to be decoded
  1879. * and the decoded output memory to the decoder for decoding
  1880. *
  1881. * @param channelDesc [IN] vdec channel destruction
  1882. * @param input [IN] input stream destruction
  1883. * @param output [IN|OUT] output picture destruction
  1884. * @param config [IN] vdec frame config
  1885. * @param userData [IN] user data for callback function
  1886. *
  1887. * @retval ACL_SUCCESS The function is successfully executed.
  1888. * @retval OtherValues Failure
  1889. *
  1890. * @see aclvdecCreateChannel | acldvppCreateStreamDesc | acldvppCreatePicDesc
  1891. */
  1892. ACL_FUNC_VISIBILITY aclError aclvdecSendFrame(aclvdecChannelDesc *channelDesc, acldvppStreamDesc *input,
  1893. acldvppPicDesc *output, aclvdecFrameConfig *config, void *userData);
  1894. /**
  1895. * @ingroup AscendCL
  1896. * @brief dvpp vdec send skipped frame.
  1897. *
  1898. * @par Function
  1899. * Pass video frame to decoder
  1900. *
  1901. * @param channelDesc [IN] vdec channel destruction
  1902. * @param input [IN] input stream destruction
  1903. * @param config [IN] vdec frame config
  1904. * @param userData [IN] user data for callback function
  1905. *
  1906. * @retval ACL_SUCCESS The function is successfully executed.
  1907. * @retval OtherValues Failure
  1908. *
  1909. * @see aclvdecCreateChannel | acldvppCreateStreamDesc | acldvppCreatePicDesc | aclvdecSendFrame
  1910. */
  1911. ACL_FUNC_VISIBILITY aclError aclvdecSendSkippedFrame(aclvdecChannelDesc *channelDesc, acldvppStreamDesc *input,
  1912. aclvdecFrameConfig *config, void *userData);
  1913. /**
  1914. * @ingroup AscendCL
  1915. * @brief dvpp vpc convert color.
  1916. *
  1917. * @par Restriction
  1918. * @li outputDesc:Width height stride, No changes are allowed. Just configure 0
  1919. * @par Function
  1920. * Convert color gamut
  1921. *
  1922. * @param channelDesc [IN] the channel destruction
  1923. * @param inputDesc [IN] convert color input picture destruction
  1924. * @param outputDesc [IN|OUT] convert color output picture destruction
  1925. * @param stream [IN] convert color task stream
  1926. *
  1927. * @retval ACL_SUCCESS The function is successfully executed.
  1928. * @retval OtherValues Failure
  1929. *
  1930. * @see acldvppCreateChannel | acldvppCreatePicDesc
  1931. */
  1932. ACL_FUNC_VISIBILITY aclError acldvppVpcConvertColorAsync(acldvppChannelDesc *channelDesc, acldvppPicDesc *inputDesc,
  1933. acldvppPicDesc *outputDesc, aclrtStream stream);
  1934. /**
  1935. * @ingroup AscendCL
  1936. * @brief dvpp vpc pyramid down.
  1937. *
  1938. * @par Restriction
  1939. * @li outputDesc:format only supported YUV400
  1940. * @par Function
  1941. * Image pyramid down
  1942. *
  1943. * @param channelDesc [IN] the channel destruction
  1944. * @param inputDesc [IN] pyr down input picture destruction
  1945. * @param outputDesc [IN|OUT] pyr down output picture destruction
  1946. * @param reserve [IN] reserved param , must be nullptr
  1947. * @param stream [IN] pyr down task stream
  1948. *
  1949. * @retval ACL_SUCCESS The function is successfully executed.
  1950. * @retval OtherValues Failure
  1951. *
  1952. * @see acldvppCreateChannel | acldvppCreatePicDesc
  1953. */
  1954. ACL_FUNC_VISIBILITY aclError acldvppVpcPyrDownAsync(acldvppChannelDesc *channelDesc, acldvppPicDesc *inputDesc,
  1955. acldvppPicDesc *outputDesc, void *reserve, aclrtStream stream);
  1956. /**
  1957. * @ingroup AscendCL
  1958. * @brief Set dvpp channel mode.
  1959. *
  1960. * @param channelDesc [OUT] the channel destruction
  1961. * @param mode [IN] channel mode
  1962. *
  1963. * @retval ACL_SUCCESS The function is successfully executed.
  1964. * @retval OtherValues Failure
  1965. */
  1966. ACL_FUNC_VISIBILITY aclError acldvppSetChannelDescMode(acldvppChannelDesc *channelDesc, uint32_t mode);
  1967. /**
  1968. * @ingroup AscendCL
  1969. * @brief Set resize config interpolation.
  1970. *
  1971. * @param resizeConfig [OUT] the resize config
  1972. * @param interpolation [IN] interpolation
  1973. *
  1974. * @retval ACL_SUCCESS The function is successfully executed.
  1975. * @retval OtherValues Failure
  1976. */
  1977. ACL_FUNC_VISIBILITY aclError acldvppSetResizeConfigInterpolation(acldvppResizeConfig *resizeConfig,
  1978. uint32_t interpolation);
  1979. /**
  1980. * @ingroup AscendCL
  1981. * @brief Get resize config interpolation.
  1982. *
  1983. * @param resizeConfig [IN] the resize config
  1984. *
  1985. * @retval Interpolation of resize config.
  1986. */
  1987. ACL_FUNC_VISIBILITY uint32_t acldvppGetResizeConfigInterpolation(const acldvppResizeConfig *resizeConfig);
  1988. /**
  1989. * @ingroup AscendCL
  1990. * @brief Set vdec channel out mode.
  1991. *
  1992. * @param channelDesc [OUT] the channel destruction
  1993. * @param outMode [IN] channel out mode
  1994. *
  1995. * @retval ACL_SUCCESS The function is successfully executed.
  1996. * @retval OtherValues Failure
  1997. */
  1998. ACL_FUNC_VISIBILITY aclError aclvdecSetChannelDescOutMode(aclvdecChannelDesc *channelDesc, uint32_t outMode);
  1999. /**
  2000. * @ingroup AscendCL
  2001. * @brief Get vdec channel out mode.
  2002. *
  2003. * @param channelDesc [IN] the channel destruction
  2004. *
  2005. * @retval Out mode of channel destruction
  2006. * @retval default 0
  2007. */
  2008. ACL_FUNC_VISIBILITY uint32_t aclvdecGetChannelDescOutMode(const aclvdecChannelDesc *channelDesc);
  2009. /**
  2010. * @ingroup AscendCL
  2011. * @brief Create dvpp batch picture description.
  2012. *
  2013. * @param batchSize [IN] batch size
  2014. *
  2015. * @retval null for failed.
  2016. * @retval OtherValues success.
  2017. */
  2018. ACL_FUNC_VISIBILITY acldvppBatchPicDesc *acldvppCreateBatchPicDesc(uint32_t batchSize);
  2019. /**
  2020. * @ingroup AscendCL
  2021. * @brief Get dvpp picture description.
  2022. *
  2023. * @param batchPicDesc [IN] dvpp batch picture description.
  2024. * @param index [IN] index of batch
  2025. *
  2026. * @retval null for failed.
  2027. * @retval OtherValues Failure
  2028. *
  2029. * @see acldvppCreateBatchPicDesc
  2030. */
  2031. ACL_FUNC_VISIBILITY acldvppPicDesc *acldvppGetPicDesc(acldvppBatchPicDesc *batchPicDesc, uint32_t index);
  2032. /**
  2033. * @ingroup AscendCL
  2034. * @brief Destroy dvpp batch picture description.
  2035. *
  2036. * @par Function
  2037. * Can only destroy batch picture description information created
  2038. * through acldvppCreateBatchPicDesc interface.
  2039. *
  2040. * @param batchPicDesc [IN] dvpp batch picture description.
  2041. *
  2042. * @retval ACL_SUCCESS The function is successfully executed.
  2043. * @retval OtherValues Failure
  2044. *
  2045. * @see acldvppCreateBatchPicDesc
  2046. */
  2047. ACL_FUNC_VISIBILITY aclError acldvppDestroyBatchPicDesc(acldvppBatchPicDesc *batchPicDesc);
  2048. /**
  2049. * @ingroup AscendCL
  2050. * @brief Create dvpp lut map.
  2051. *
  2052. * @retval null for failed.
  2053. * @retval OtherValues success.
  2054. */
  2055. ACL_FUNC_VISIBILITY acldvppLutMap *acldvppCreateLutMap();
  2056. /**
  2057. * @ingroup AscendCL
  2058. * @brief Destroy lut map.
  2059. *
  2060. * @param lutMap [IN] lut map
  2061. *
  2062. * @retval ACL_SUCCESS for success, other for failure
  2063. */
  2064. ACL_FUNC_VISIBILITY aclError acldvppDestroyLutMap(acldvppLutMap *lutMap);
  2065. /**
  2066. * @ingroup AscendCL
  2067. * @brief Get lut map dims.
  2068. *
  2069. * @param lutMap [IN] lut map
  2070. *
  2071. * @retval 0 for failed.
  2072. * @retval OtherValues success.
  2073. */
  2074. ACL_FUNC_VISIBILITY uint32_t acldvppGetLutMapDims(const acldvppLutMap *lutMap);
  2075. /**
  2076. * @ingroup AscendCL
  2077. * @brief Get lut map data.
  2078. *
  2079. * @param lutMap [IN] lut map
  2080. * @param dim [IN] input dim of map
  2081. * @param data [OUT] the dim of lut map's data
  2082. * @param len [OUT] the dim of lut map's length
  2083. *
  2084. * @retval ACL_SUCCESS The function is successfully executed.
  2085. * @retval OtherValues Failure
  2086. */
  2087. ACL_FUNC_VISIBILITY aclError acldvppGetLutMapData(const acldvppLutMap *lutMap, uint32_t dim, uint8_t **data,
  2088. uint32_t *len);
  2089. /**
  2090. * @ingroup AscendCL
  2091. * @brief Vpc equalize hist.
  2092. *
  2093. * @param channelDesc [IN] channel desc
  2094. * @param inputDesc [IN] input desc
  2095. * @param outputDesc [IN|OUT] output desc
  2096. * @param lutMap [IN] lut map param
  2097. * @param stream [IN] runtime stream
  2098. *
  2099. * @retval ACL_SUCCESS The function is successfully executed.
  2100. * @retval OtherValues Failure
  2101. *
  2102. * @see acldvppCreateChannel|acldvppCreatePicDesc|acldvppCreateLutMap
  2103. */
  2104. ACL_FUNC_VISIBILITY aclError acldvppVpcEqualizeHistAsync(const acldvppChannelDesc *channelDesc,
  2105. const acldvppPicDesc *inputDesc, acldvppPicDesc *outputDesc,
  2106. const acldvppLutMap *lutMap, aclrtStream stream);
  2107. /**
  2108. * @ingroup AscendCL
  2109. * @brief Create dvpp border config.
  2110. *
  2111. * @retval null for failed.
  2112. * @retval OtherValues success.
  2113. */
  2114. ACL_FUNC_VISIBILITY acldvppBorderConfig *acldvppCreateBorderConfig();
  2115. /**
  2116. * @ingroup AscendCL
  2117. * @brief Set value of border config.
  2118. *
  2119. * @param borderConfig [OUT] border config
  2120. * @param index [IN] index of value array
  2121. * @param value [IN] value
  2122. *
  2123. * @retval ACL_SUCCESS for success, other for failure
  2124. */
  2125. ACL_FUNC_VISIBILITY aclError acldvppSetBorderConfigValue(acldvppBorderConfig *borderConfig, uint32_t index,
  2126. double value);
  2127. /**
  2128. * @ingroup AscendCL
  2129. * @brief Set border type of border config.
  2130. *
  2131. * @param borderConfig [OUT] border config
  2132. * @param borderType [IN] border type
  2133. *
  2134. * @retval ACL_SUCCESS for success, other for failure
  2135. */
  2136. ACL_FUNC_VISIBILITY aclError acldvppSetBorderConfigBorderType(acldvppBorderConfig *borderConfig,
  2137. acldvppBorderType borderType);
  2138. /**
  2139. * @ingroup AscendCL
  2140. * @brief Set top of border config.
  2141. *
  2142. * @param borderConfig [OUT] border config
  2143. * @param top [IN] top of border
  2144. *
  2145. * @retval ACL_SUCCESS for success, other for failure
  2146. */
  2147. ACL_FUNC_VISIBILITY aclError acldvppSetBorderConfigTop(acldvppBorderConfig *borderConfig, uint32_t top);
  2148. /**
  2149. * @ingroup AscendCL
  2150. * @brief Set bottom of border config.
  2151. *
  2152. * @param borderConfig [OUT] border config
  2153. * @param bottom [IN] bottom of border
  2154. *
  2155. * @retval ACL_SUCCESS for success, other for failure
  2156. */
  2157. ACL_FUNC_VISIBILITY aclError acldvppSetBorderConfigBottom(acldvppBorderConfig *borderConfig, uint32_t bottom);
  2158. /**
  2159. * @ingroup AscendCL
  2160. * @brief Set left of border config.
  2161. *
  2162. * @param borderConfig [OUT] border config
  2163. * @param left [IN] left of border
  2164. *
  2165. * @retval ACL_SUCCESS for success, other for failure
  2166. */
  2167. ACL_FUNC_VISIBILITY aclError acldvppSetBorderConfigLeft(acldvppBorderConfig *borderConfig, uint32_t left);
  2168. /**
  2169. * @ingroup AscendCL
  2170. * @brief Set right of border config.
  2171. *
  2172. * @param borderConfig [OUT] border config
  2173. * @param right [IN] right of border
  2174. *
  2175. * @retval ACL_SUCCESS for success, other for failure
  2176. */
  2177. ACL_FUNC_VISIBILITY aclError acldvppSetBorderConfigRight(acldvppBorderConfig *borderConfig, uint32_t right);
  2178. /**
  2179. * @ingroup AscendCL
  2180. * @brief Get value of border config.
  2181. *
  2182. * @param borderConfig [IN] border config
  2183. * @param index[IN] index of value array
  2184. *
  2185. * @retval invalid value is < 0, normal Value is >= 0
  2186. */
  2187. ACL_FUNC_VISIBILITY double acldvppGetBorderConfigValue(const acldvppBorderConfig *borderConfig, uint32_t index);
  2188. /**
  2189. * @ingroup AscendCL
  2190. * @brief Get border type of border config.
  2191. *
  2192. * @param borderConfig [IN] border config
  2193. * @retval border type of border config
  2194. */
  2195. ACL_FUNC_VISIBILITY acldvppBorderType acldvppGetBorderConfigBorderType(const acldvppBorderConfig *borderConfig);
  2196. /**
  2197. * @ingroup AscendCL
  2198. * @brief Get right of border config.
  2199. *
  2200. * @param borderConfig [IN] border config
  2201. *
  2202. * @retval default 0, top value of border config
  2203. */
  2204. ACL_FUNC_VISIBILITY uint32_t acldvppGetBorderConfigTop(const acldvppBorderConfig *borderConfig);
  2205. /**
  2206. * @ingroup AscendCL
  2207. * @brief Get Bottom of border config.
  2208. *
  2209. * @param borderConfig [IN] border config
  2210. *
  2211. * @retval default 0, top value of border config
  2212. */
  2213. ACL_FUNC_VISIBILITY uint32_t acldvppGetBorderConfigBottom(const acldvppBorderConfig *borderConfig);
  2214. /**
  2215. * @ingroup AscendCL
  2216. * @brief Get left of border config.
  2217. *
  2218. * @param borderConfig [IN] border config
  2219. *
  2220. * @retval default 0, top value of border config
  2221. */
  2222. ACL_FUNC_VISIBILITY uint32_t acldvppGetBorderConfigLeft(const acldvppBorderConfig *borderConfig);
  2223. /**
  2224. * @ingroup AscendCL
  2225. * @brief Get right of border config.
  2226. *
  2227. * @param borderConfig [IN] border config
  2228. *
  2229. * @retval default 0, right value of border config
  2230. */
  2231. ACL_FUNC_VISIBILITY uint32_t acldvppGetBorderConfigRight(const acldvppBorderConfig *borderConfig);
  2232. /**
  2233. * @ingroup AscendCL
  2234. * @brief Destroy border config.
  2235. *
  2236. * @param borderConfig [IN] border config
  2237. *
  2238. * @retval ACL_SUCCESS for success, other for failure
  2239. */
  2240. ACL_FUNC_VISIBILITY aclError acldvppDestroyBorderConfig(acldvppBorderConfig *borderConfig);
  2241. /**
  2242. * @ingroup AscendCL
  2243. * @brief Vpc make border.
  2244. *
  2245. * @param channelDesc [IN] channel desc
  2246. * @param inputDesc [IN] input desc
  2247. * @param outputDesc [IN|OUT] output desc
  2248. * @param borderConfig [IN] border config param
  2249. * @param stream [IN] runtime stream
  2250. *
  2251. * @retval ACL_SUCCESS The function is successfully executed.
  2252. * @retval OtherValues Failure
  2253. *
  2254. * @see acldvppCreateChannel|acldvppCreatePicDesc|acldvppCreateBorderConfig
  2255. */
  2256. ACL_FUNC_VISIBILITY aclError acldvppVpcMakeBorderAsync(const acldvppChannelDesc *channelDesc,
  2257. const acldvppPicDesc *inputDesc, acldvppPicDesc *outputDesc,
  2258. const acldvppBorderConfig *borderConfig, aclrtStream stream);
  2259. /**
  2260. * @ingroup AscendCL
  2261. * @brief Dvpp vpc calc hist.
  2262. *
  2263. * @param channelDesc [IN] the channel destruction
  2264. * @param srcPicDesc [IN] pyr down input picture destruction
  2265. * @param hist [IN|OUT] pyr down output picture destruction
  2266. * @param reserve [IN] reserved param, must be nullptr
  2267. * @param stream [IN] task stream
  2268. *
  2269. * @retval ACL_SUCCESS The function is successfully executed.
  2270. * @retval OtherValues Failure
  2271. *
  2272. * @see acldvppCreateChannel | acldvppCreatePicDesc | acldvppCreateHist
  2273. */
  2274. ACL_FUNC_VISIBILITY aclError acldvppVpcCalcHistAsync(acldvppChannelDesc *channelDesc, acldvppPicDesc *srcPicDesc,
  2275. acldvppHist *hist, void *reserve, aclrtStream stream);
  2276. /**
  2277. * @ingroup AscendCL
  2278. * @brief Create vpc hist description.
  2279. *
  2280. * @retval null for failed.
  2281. * @retval OtherValues success.
  2282. */
  2283. ACL_FUNC_VISIBILITY acldvppHist *acldvppCreateHist();
  2284. /**
  2285. * @ingroup AscendCL
  2286. * @brief Destroy vpc hist description.
  2287. *
  2288. * @par Function
  2289. * Can only destroy hist description information created
  2290. * through acldvppCreateHist interface.
  2291. *
  2292. * @param hist [IN] vpc hist description.
  2293. *
  2294. * @retval ACL_SUCCESS The function is successfully executed.
  2295. * @retval OtherValues Failure
  2296. *
  2297. * @see acldvppCreateHist
  2298. */
  2299. ACL_FUNC_VISIBILITY aclError acldvppDestroyHist(acldvppHist *hist);
  2300. /**
  2301. * @ingroup AscendCL
  2302. * @brief Get dims of vpc hist description.
  2303. *
  2304. * @param hist [IN] vpc hist description.
  2305. *
  2306. * @retval dims of vpc hist description.
  2307. *
  2308. * @see acldvppCreateHist | acldvppVpcCalcHistAsync
  2309. */
  2310. ACL_FUNC_VISIBILITY uint32_t acldvppGetHistDims(acldvppHist *hist);
  2311. /**
  2312. * @ingroup AscendCL
  2313. * @brief Get data from vpc hist description by dim.
  2314. *
  2315. * @param hist [IN] vpc hist description.
  2316. * @param dim [IN] which dim to get data.
  2317. * @param data [OUT] address of output hist data.
  2318. * @param len [OUT] len of output hist data.
  2319. *
  2320. * @retval ACL_SUCCESS The function is successfully executed.
  2321. * @retval OtherValues Failure
  2322. *
  2323. * @see acldvppCreateHist | acldvppVpcCalcHistAsync
  2324. */
  2325. ACL_FUNC_VISIBILITY aclError acldvppGetHistData(acldvppHist *hist, uint32_t dim, uint32_t **data, uint16_t *len);
  2326. /**
  2327. * @ingroup AscendCL
  2328. * @brief Get dvpp calc hist process return code.
  2329. *
  2330. * @param hist [IN] vpc hist description.
  2331. *
  2332. * @retval Dvpp calc hist process return code.
  2333. *
  2334. * @see acldvppCreateHist | acldvppVpcCalcHistAsync
  2335. */
  2336. ACL_FUNC_VISIBILITY uint32_t acldvppGetHistRetCode(acldvppHist *hist);
  2337. /**
  2338. * @ingroup AscendCL
  2339. * @brief Set vpc hist description to 0.
  2340. *
  2341. * @par Function
  2342. * Can only clear hist description information created
  2343. * through acldvppCreateHist interface.
  2344. *
  2345. * @param hist [IN] vpc hist description.
  2346. *
  2347. * @retval ACL_SUCCESS The function is successfully executed.
  2348. * @retval OtherValues Failure
  2349. *
  2350. * @see acldvppCreateHist
  2351. */
  2352. ACL_FUNC_VISIBILITY aclError acldvppClearHist(acldvppHist *hist);
  2353. /**
  2354. * @ingroup AscendCL
  2355. * @brief dvpp vpc batch crop, resize config and make border.
  2356. *
  2357. * @par Function
  2358. * crop the input batch picture with resize config and border configs according to the specified area
  2359. * as the output batch pictures
  2360. *
  2361. * @param channelDesc [IN] the channel destruction
  2362. * @param srcBatchPicDescs [IN] crop input batch picture destruction
  2363. * @param roiNums [IN] roi config numbers
  2364. * @param size [IN] roiNum size
  2365. * @param dstBatchPicDescs [IN|OUT] crop output batch picture destruction
  2366. * @param cropAreas [IN] crop area configs
  2367. * @param borderCfgs [IN] border configs
  2368. * @param resizeConfig [IN] resize config
  2369. * @param stream [IN] crop batch, resize config and make border task stream
  2370. *
  2371. * @retval ACL_SUCCESS The function is successfully executed.
  2372. * @retval OtherValues Failure
  2373. *
  2374. * @see acldvppCreateChannel | acldvppCreateBatchPicDesc | acldvppCreateRoiConfig | acldvppCreateResizeConfig
  2375. */
  2376. ACL_FUNC_VISIBILITY aclError acldvppVpcBatchCropResizeMakeBorderAsync(
  2377. acldvppChannelDesc *channelDesc, acldvppBatchPicDesc *srcBatchPicDescs, uint32_t *roiNums, uint32_t size,
  2378. acldvppBatchPicDesc *dstBatchPicDescs, acldvppRoiConfig *cropAreas[], acldvppBorderConfig *borderCfgs[],
  2379. acldvppResizeConfig *resizeConfig, aclrtStream stream);
  2380. #ifdef __cplusplus
  2381. }
  2382. #endif
  2383. #endif // INC_EXTERNAL_ACL_OPS_ACL_DVPP_H_

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