wave5.h 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299
  1. /*
  2. * Copyright (c) 2019, Chips&Media
  3. * All rights reserved.
  4. *
  5. * Redistribution and use in source and binary forms, with or without
  6. * modification, are permitted provided that the following conditions are met:
  7. *
  8. * 1. Redistributions of source code must retain the above copyright notice, this
  9. * list of conditions and the following disclaimer.
  10. * 2. Redistributions in binary form must reproduce the above copyright notice,
  11. * this list of conditions and the following disclaimer in the documentation
  12. * and/or other materials provided with the distribution.
  13. *
  14. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
  15. * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  16. * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  17. * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
  18. * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  19. * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  20. * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  21. * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  22. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  23. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  24. */
  25. #ifndef __WAVE5_FUNCTION_H__
  26. #define __WAVE5_FUNCTION_H__
  27. #ifdef USE_FEEDING_METHOD_BUFFER
  28. #include "wave511/vpuapi/vpuapi.h"
  29. #include "wave511/vpuapi/product.h"
  30. #else
  31. #include "vpuapi.h"
  32. #include "product.h"
  33. #endif
  34. #define WAVE5_TEMPBUF_OFFSET (1024*1024)
  35. #define WAVE5_TEMPBUF_SIZE (1024*1024)
  36. #define WAVE5_TASK_BUF_OFFSET (2*1024*1024) // common mem = | codebuf(1M) | tempBuf(1M) | taskbuf0x0 ~ 0xF |
  37. #ifdef __cplusplus
  38. extern "C" {
  39. #endif /* __cplusplus */
  40. #define WAVE5_SUBSAMPLED_ONE_SIZE(_w, _h) ((((_w/4)+15)&~15)*(((_h/4)+7)&~7))
  41. #define WAVE5_AVC_SUBSAMPLED_ONE_SIZE(_w, _h) ((((_w/4)+31)&~31)*(((_h/4)+3)&~3))
  42. #define BSOPTION_ENABLE_EXPLICIT_END (1<<0)
  43. #define WTL_RIGHT_JUSTIFIED 0
  44. #define WTL_LEFT_JUSTIFIED 1
  45. #define WTL_PIXEL_8BIT 0
  46. #define WTL_PIXEL_16BIT 1
  47. #define WTL_PIXEL_32BIT 2
  48. extern Uint32 Wave5VpuIsInit(
  49. Uint32 coreIdx
  50. );
  51. extern Int32 Wave5VpuIsBusy(
  52. Uint32 coreIdx
  53. );
  54. extern Int32 WaveVpuGetProductId(
  55. Uint32 coreIdx
  56. );
  57. extern RetCode Wave5VpuEncGiveCommand(
  58. CodecInst *pCodecInst,
  59. CodecCommand cmd,
  60. void *param
  61. );
  62. extern void Wave5BitIssueCommand(
  63. CodecInst* instance,
  64. Uint32 cmd
  65. );
  66. extern RetCode Wave5VpuGetVersion(
  67. Uint32 coreIdx,
  68. Uint32* versionInfo,
  69. Uint32* revision
  70. );
  71. extern RetCode Wave5VpuInit(
  72. Uint32 coreIdx,
  73. void* firmware,
  74. Uint32 size
  75. );
  76. extern RetCode Wave5VpuSleepWake(
  77. Uint32 coreIdx,
  78. int iSleepWake,
  79. const Uint16* code,
  80. Uint32 size,
  81. BOOL reset
  82. );
  83. extern RetCode Wave5VpuReset(
  84. Uint32 coreIdx,
  85. SWResetMode resetMode
  86. );
  87. extern RetCode Wave5VpuBuildUpDecParam(
  88. CodecInst* instance,
  89. DecOpenParam* param
  90. );
  91. extern RetCode Wave5VpuDecSetBitstreamFlag(
  92. CodecInst* instance,
  93. BOOL running,
  94. BOOL eos,
  95. BOOL explictEnd
  96. );
  97. extern RetCode Wave5VpuDecRegisterFramebuffer(
  98. CodecInst* inst,
  99. FrameBuffer* fbArr,
  100. TiledMapType mapType,
  101. Uint32 count
  102. );
  103. extern RetCode Wave5VpuDecUpdateFramebuffer(
  104. CodecInst* inst,
  105. FrameBuffer* fbcFb,
  106. FrameBuffer* linearFb,
  107. Int32 mvIndex,
  108. Int32 picWidth,
  109. Int32 picHeight
  110. );
  111. extern RetCode Wave5VpuDecFlush(
  112. CodecInst* instance,
  113. FramebufferIndex* framebufferIndexes,
  114. Uint32 size
  115. );
  116. extern RetCode Wave5VpuReInit(
  117. Uint32 coreIdx,
  118. void* firmware,
  119. Uint32 size
  120. );
  121. extern RetCode Wave5VpuDecInitSeq(
  122. CodecInst* instance
  123. );
  124. extern RetCode Wave5VpuDecGetSeqInfo(
  125. CodecInst* instance,
  126. DecInitialInfo* info
  127. );
  128. extern RetCode Wave5VpuDecode(
  129. CodecInst* instance,
  130. DecParam* option
  131. );
  132. extern RetCode Wave5VpuDecGetResult(
  133. CodecInst* instance,
  134. DecOutputInfo* result
  135. );
  136. extern RetCode Wave5VpuDecFiniSeq(
  137. CodecInst* instance
  138. );
  139. extern RetCode Wave5DecWriteProtect(
  140. CodecInst* instance
  141. );
  142. extern RetCode Wave5DecClrDispFlag(
  143. CodecInst* instance,
  144. Uint32 index
  145. );
  146. extern RetCode Wave5DecSetDispFlag(
  147. CodecInst* instance,
  148. Uint32 index
  149. );
  150. extern Int32 Wave5VpuWaitInterrupt(
  151. CodecInst* instance,
  152. Int32 timeout,
  153. BOOL pending
  154. );
  155. extern RetCode Wave5VpuClearInterrupt(
  156. Uint32 coreIdx,
  157. Uint32 flags
  158. );
  159. extern RetCode Wave5VpuDecGetRdPtr(
  160. CodecInst* instance,
  161. PhysicalAddress *rdPtr
  162. );
  163. extern RetCode Wave5VpuGetBwReport(
  164. CodecInst* instance,
  165. VPUBWData* bwMon
  166. );
  167. extern RetCode Wave5VpuGetDebugInfo(
  168. CodecInst* instance,
  169. VPUDebugInfo* info
  170. );
  171. /***< WAVE5 Encoder >******/
  172. RetCode Wave5VpuEncUpdateBS(
  173. CodecInst* instance,
  174. BOOL updateNewBsbuf
  175. );
  176. RetCode Wave5VpuEncGetRdWrPtr(CodecInst* instance,
  177. PhysicalAddress *rdPtr,
  178. PhysicalAddress *wrPtr
  179. );
  180. extern RetCode Wave5VpuBuildUpEncParam(
  181. CodecInst* instance,
  182. EncOpenParam* param
  183. );
  184. extern RetCode Wave5VpuEncInitSeq(
  185. CodecInst*instance
  186. );
  187. extern RetCode Wave5VpuEncGetSeqInfo(
  188. CodecInst* instance,
  189. EncInitialInfo* info
  190. );
  191. #ifdef SUPPORT_LOOK_AHEAD_RC
  192. extern RetCode Wave5VpuEncSetLarcData(
  193. CodecInst* instance,
  194. EncLarcInfo larcInfo
  195. );
  196. #endif
  197. extern RetCode Wave5VpuEncRegisterFramebuffer(
  198. CodecInst* inst,
  199. FrameBuffer* fbArr,
  200. TiledMapType mapType,
  201. Uint32 count
  202. );
  203. extern RetCode Wave5EncWriteProtect(
  204. CodecInst* instance
  205. );
  206. extern RetCode Wave5VpuEncode(
  207. CodecInst* instance,
  208. EncParam* option
  209. );
  210. extern RetCode Wave5VpuEncGetResult(
  211. CodecInst* instance,
  212. EncOutputInfo* result
  213. );
  214. extern RetCode Wave5VpuEncGetHeader(
  215. EncHandle instance,
  216. EncHeaderParam * encHeaderParam
  217. );
  218. extern RetCode Wave5VpuEncFiniSeq(
  219. CodecInst* instance
  220. );
  221. extern RetCode Wave5VpuEncParaChange(
  222. EncHandle instance,
  223. EncChangeParam* param
  224. );
  225. extern RetCode CheckEncCommonParamValid(
  226. EncOpenParam* pop
  227. );
  228. extern RetCode CheckEncRcParamValid(
  229. EncOpenParam* pop
  230. );
  231. extern RetCode CheckEncCustomGopParamValid(
  232. EncOpenParam* pop
  233. );
  234. extern RetCode Wave5VpuGetSrcBufFlag(
  235. CodecInst* instance,
  236. Uint32* flag
  237. );
  238. #ifdef __cplusplus
  239. }
  240. #endif /* __cplusplus */
  241. #endif /* __WAVE5_FUNCTION_H__ */