hi_comm_svp.h 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. /******************************************************************************
  2. Copyright (C), 2001-2017, Hisilicon Tech. Co., Ltd.
  3. ******************************************************************************
  4. File Name : hi_comm_svp.h
  5. Version : Initial Draft
  6. Author : Hisilicon multimedia software (SVP) group
  7. Created : 2017/09/19
  8. Description :
  9. History :
  10. 1.Date : 2017/09/19
  11. Author :
  12. Modification: Created file
  13. ******************************************************************************/
  14. #ifndef __HI_COMM_SVP_H__
  15. #define __HI_COMM_SVP_H__
  16. #ifdef __cplusplus
  17. #if __cplusplus
  18. extern "C"{
  19. #endif
  20. #endif /* __cplusplus */
  21. #include "hi_type.h"
  22. #include "hi_errno.h"
  23. /*Blob type*/
  24. typedef enum hiSVP_BLOB_TYPE_E
  25. {
  26. SVP_BLOB_TYPE_S32 = 0x0,
  27. SVP_BLOB_TYPE_U8 = 0x1,
  28. /*channel = 3*/
  29. SVP_BLOB_TYPE_YVU420SP = 0x2,
  30. /*channel = 3*/
  31. SVP_BLOB_TYPE_YVU422SP = 0x3,
  32. SVP_BLOB_TYPE_VEC_S32 = 0x4,
  33. SVP_BLOB_TYPE_SEQ_S32 = 0x5,
  34. SVP_BLOB_TYPE_BUTT
  35. }SVP_BLOB_TYPE_E;
  36. /****************************** Blob struct ******************************
  37. In Caffe, the blob contain shape info as the following order:
  38. Image\FeatureMap: N C H W
  39. FC(normal vector): N C
  40. RNN\LSTM(Recurrent) vector: T N D
  41. The relationship of the following blob struct with Caffe blob is as follows:
  42. Image\FeatureMap: Num Chn Height With
  43. FC(VEC_S32): Num Width
  44. RNN\LSTM(SEQ_S32) vector: Step Num Dim
  45. The stride, which measuring unit is byte, is always algined by the width or
  46. dim direction.
  47. **************************************************************************/
  48. typedef struct hiSVP_BLOB_S
  49. {
  50. SVP_BLOB_TYPE_E enType; /*Blob type*/
  51. HI_U32 u32Stride; /*Stride, a line bytes num*/
  52. HI_U64 u64VirAddr; /*virtual addr*/
  53. HI_U64 u64PhyAddr; /*physical addr*/
  54. HI_U32 u32Num; /*N: frame num or sequence num,correspond to caffe blob's n*/
  55. union
  56. {
  57. struct
  58. {
  59. HI_U32 u32Width; /*W: frame width, correspond to caffe blob's w*/
  60. HI_U32 u32Height; /*H: frame height, correspond to caffe blob's h*/
  61. HI_U32 u32Chn; /*C: frame channel,correspond to caffe blob's c*/
  62. }stWhc;
  63. struct
  64. {
  65. HI_U32 u32Dim; /*D: vecotr dimension*/
  66. HI_U64 u64VirAddrStep; /*T: virtual adress of time steps array in each sequence*/
  67. }stSeq;
  68. }unShape;
  69. }SVP_BLOB_S;
  70. typedef SVP_BLOB_S SVP_SRC_BLOB_S;
  71. typedef SVP_BLOB_S SVP_DST_BLOB_S;
  72. /*Mem information*/
  73. typedef struct hiSVP_MEM_INFO_S
  74. {
  75. HI_U64 u64PhyAddr; /* RW;The physical address of the memory */
  76. HI_U64 u64VirAddr; /* RW;The virtual address of the memory */
  77. HI_U32 u32Size; /* RW;The size of memory */
  78. }SVP_MEM_INFO_S;
  79. typedef SVP_MEM_INFO_S SVP_SRC_MEM_INFO_S;
  80. typedef SVP_MEM_INFO_S SVP_DST_MEM_INFO_S;
  81. /*Image type*/
  82. typedef enum hiSVP_IMAGE_TYPE_E
  83. {
  84. SVP_IMAGE_TYPE_U8C1 = 0x0,
  85. SVP_IMAGE_TYPE_S8C1 = 0x1,
  86. SVP_IMAGE_TYPE_YUV420SP = 0x2, /*YUV420 SemiPlanar*/
  87. SVP_IMAGE_TYPE_YUV422SP = 0x3, /*YUV422 SemiPlanar*/
  88. SVP_IMAGE_TYPE_YUV420P = 0x4, /*YUV420 Planar */
  89. SVP_IMAGE_TYPE_YUV422P = 0x5, /*YUV422 planar */
  90. SVP_IMAGE_TYPE_S8C2_PACKAGE = 0x6,
  91. SVP_IMAGE_TYPE_S8C2_PLANAR = 0x7,
  92. SVP_IMAGE_TYPE_S16C1 = 0x8,
  93. SVP_IMAGE_TYPE_U16C1 = 0x9,
  94. SVP_IMAGE_TYPE_U8C3_PACKAGE = 0xa,
  95. SVP_IMAGE_TYPE_U8C3_PLANAR = 0xb,
  96. SVP_IMAGE_TYPE_S32C1 = 0xc,
  97. SVP_IMAGE_TYPE_U32C1 = 0xd,
  98. SVP_IMAGE_TYPE_S64C1 = 0xe,
  99. SVP_IMAGE_TYPE_U64C1 = 0xf,
  100. SVP_IMAGE_TYPE_BUTT
  101. }SVP_IMAGE_TYPE_E;
  102. /*Image*/
  103. typedef struct hiSVP_IMAGE_S
  104. {
  105. HI_U64 au64PhyAddr[3]; /* RW;The physical address of the image */
  106. HI_U64 au64VirAddr[3]; /* RW;The virtual address of the image */
  107. HI_U32 au32Stride[3]; /* RW;The stride of the image */
  108. HI_U32 u32Width; /* RW;The width of the image */
  109. HI_U32 u32Height; /* RW;The height of the image */
  110. SVP_IMAGE_TYPE_E enType; /* RW;The type of the image */
  111. }SVP_IMAGE_S;
  112. typedef SVP_IMAGE_S SVP_SRC_IMAGE_S;
  113. typedef SVP_IMAGE_S SVP_DST_IMAGE_S;
  114. #ifdef __cplusplus
  115. #if __cplusplus
  116. }
  117. #endif
  118. #endif /* __cplusplus */
  119. #endif /* __HI_COMM_SVP_H__ */