common.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. /* SPDX-License-Identifier: LGPL-2.1 OR BSD-3-Clause */
  2. //--=========================================================================--
  3. // This file is a part of VPU Reference API project
  4. //-----------------------------------------------------------------------------
  5. //
  6. // This confidential and proprietary software may be used only
  7. // as authorized by a licensing agreement from Chips&Media Inc.
  8. // In the event of publication, the following notice is applicable:
  9. //
  10. // (C) COPYRIGHT 2006 - 2011 CHIPS&MEDIA INC.
  11. // ALL RIGHTS RESERVED
  12. //
  13. // The entire notice above must be reproduced on all authorized
  14. // copies.
  15. //
  16. //--=========================================================================--
  17. #ifndef __COMMON_FUNCTION_H__
  18. #define __COMMON_FUNCTION_H__
  19. #include "vpuapi.h"
  20. #include "product.h"
  21. #define VPU_HANDLE_TO_DECINFO(_handle) (&(((CodecInst*)_handle)->CodecInfo->decInfo))
  22. #define VPU_HANDLE_TO_ENCINFO(_handle) (&(((CodecInst*)_handle)->CodecInfo->encInfo))
  23. #define CODA7Q_MVCOL_BUF_SIZE(_w, _h) ((((VPU_ALIGN32(_w)*VPU_ALIGN32(_h)*3)>>1)+4)/5)
  24. #define CODA7Q_FBC_LUMA_TABLE_SIZE(_w, _h) (((_h+15)/16)*((_w+255)/256)*128)
  25. #define CODA7Q_FBC_CHROMA_TABLE_SIZE(_w, _h) (((_h+15)/16)*((_w/2+255)/256)*128)
  26. #define WAVE4_SUBSAMPLED_ONE_SIZE(_w, _h) ((((_w/4)+15)&~15)*(((_h/4)+7)&~7))
  27. #define WAVE5_SUBSAMPLED_ONE_SIZE(_w, _h) ((((_w/4)+15)&~15)*(((_h/4)+7)&~7))
  28. #define BSOPTION_ENABLE_EXPLICIT_END (1<<0)
  29. #define W4_WTL_RIGHT_JUSTIFIED 0
  30. #define W4_WTL_LEFT_JUSTIFIED 1
  31. #define W4_WTL_PIXEL_8BIT 0
  32. #define W4_WTL_PIXEL_16BIT 1
  33. #define W4_WTL_PIXEL_32BIT 2
  34. typedef struct CodecInstHeader {
  35. Int32 inUse;
  36. Int32 coreIdx;
  37. Int32 productId;
  38. Int32 instIndex;
  39. Int32 codecMode;
  40. Int32 codecModeAux;
  41. Int32 loggingEnable;
  42. Uint32 isDecoder;
  43. } CodecInstHeader;
  44. #ifdef __cplusplus
  45. extern "C" {
  46. #endif /* __cplusplus */
  47. extern Int32 WaveVpuGetProductId(
  48. Uint32 coreIdx
  49. );
  50. extern RetCode Wave4VpuGetVersion(
  51. Uint32 coreIdx,
  52. Uint32* versionInfo,
  53. Uint32* revision
  54. );
  55. extern RetCode Wave4VpuInit(
  56. Uint32 coreIdx,
  57. void* firmware,
  58. Uint32 size
  59. );
  60. extern RetCode Wave4VpuReInit(
  61. Uint32 coreIdx,
  62. void* firmware,
  63. Uint32 size
  64. );
  65. extern RetCode Wave4VpuDeinit(
  66. Uint32 coreIdx
  67. );
  68. extern Uint32 Wave4VpuIsInit(
  69. Uint32 coreIdx
  70. );
  71. extern Int32 Wave4VpuIsBusy(
  72. Uint32 coreIdx
  73. );
  74. extern Int32 Wave4VpuWaitInterrupt(
  75. CodecInst* handle,
  76. Int32 timeout
  77. );
  78. extern RetCode Wave4VpuClearInterrupt(
  79. Uint32 coreIdx,
  80. Uint32 flags
  81. );
  82. extern RetCode Wave4VpuReset(
  83. Uint32 coreIdx,
  84. SWResetMode resetMode
  85. );
  86. extern RetCode Wave4VpuSleepWake(
  87. Uint32 coreIdx,
  88. int iSleepWake,
  89. const Uint16* code,
  90. Uint32 size
  91. );
  92. extern RetCode Wave4VpuBuildUpDecParam(
  93. CodecInst* instance,
  94. DecOpenParam* param
  95. );
  96. extern RetCode Wave4VpuDecFiniSeq(
  97. CodecInst* instance
  98. );
  99. extern RetCode Wave4VpuDecRegisterFramebuffer(
  100. CodecInst* instance,
  101. FrameBuffer* fb,
  102. TiledMapType mapType,
  103. Uint32 count
  104. );
  105. extern RetCode Wave4VpuDecSetBitstreamFlag(
  106. CodecInst* instance,
  107. BOOL running,
  108. BOOL eos,
  109. BOOL explicitEnd
  110. );
  111. extern RetCode Wave4VpuDecFlush(
  112. CodecInst* instance,
  113. FramebufferIndex* framebufferIndexes,
  114. Uint32 size
  115. );
  116. extern RetCode Wave4DecWriteProtect(
  117. CodecInst* instance
  118. );
  119. extern RetCode Wave4EncWriteProtect(
  120. CodecInst* instance
  121. );
  122. extern void Wave4BitIssueCommand(
  123. CodecInst* instance,
  124. Uint32 cmd
  125. );
  126. extern RetCode Wave4VpuEncFiniSeq(
  127. CodecInst* instance
  128. );
  129. extern RetCode Wave4VpuBuildUpEncParam(
  130. CodecInst* pCodec,
  131. EncOpenParam* param
  132. );
  133. #ifdef __cplusplus
  134. }
  135. #endif /* __cplusplus */
  136. #endif /* __COMMON_FUNCTION_H__ */