process_linker_types.h 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196
  1. /*
  2. * Copyright (c) 2021-2022 Alibaba Group. All rights reserved.
  3. * License-Identifier: Apache-2.0
  4. *
  5. * Licensed under the Apache License, Version 2.0 (the "License"); you may
  6. * not use this file except in compliance with the License.
  7. * You may obtain a copy of the License at
  8. *
  9. * http://www.apache.org/licenses/LICENSE-2.0
  10. *
  11. * Unless required by applicable law or agreed to in writing, software
  12. * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  13. * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. * See the License for the specific language governing permissions and
  15. * limitations under the License.
  16. *
  17. */
  18. #ifndef _PROCESS_LINKER_TYPES_H_
  19. #define _PROCESS_LINKER_TYPES_H_
  20. #include "process_linker.h"
  21. #ifdef __cplusplus
  22. extern "C" {
  23. #endif
  24. /* When set PlinkMsg.msg to this exit code, it means to close the connection */
  25. #define PLINK_EXIT_CODE -1
  26. /* image/video color format */
  27. typedef enum _PlinkColorFormat
  28. {
  29. PLINK_COLOR_FormatUnused,
  30. PLINK_COLOR_FormatMonochrome,
  31. PLINK_COLOR_FormatYUV420Planar,
  32. PLINK_COLOR_FormatYUV420SemiPlanar,
  33. PLINK_COLOR_FormatYUV420SemiPlanarP010,
  34. PLINK_COLOR_FormatYUV422Planar,
  35. PLINK_COLOR_FormatYUV422SemiPlanar,
  36. PLINK_COLOR_Format32bitBGRA8888,
  37. PLINK_COLOR_Format32bitARGB8888,
  38. PLINK_COLOR_Format24BitRGB888,
  39. PLINK_COLOR_Format24BitRGB888Planar,
  40. PLINK_COLOR_Format24BitBGR888,
  41. PLINK_COLOR_Format24BitBGR888Planar,
  42. PLINK_COLOR_FormatRawBayer8bit,
  43. PLINK_COLOR_FormatRawBayer10bit,
  44. PLINK_COLOR_FormatRawBayer12bit,
  45. PLINK_COLOR_FormatMax
  46. } PlinkColorFormat;
  47. typedef enum _PlinkBayerPattern
  48. {
  49. PLINK_BAYER_PATTERN_RGGB,
  50. PLINK_BAYER_PATTERN_BGGR,
  51. PLINK_BAYER_PATTERN_GRBG,
  52. PLINK_BAYER_PATTERN_GBRG,
  53. PLINK_BAYER_PATTERN_MAX
  54. } PlinkBayerPattern;
  55. /* Data descriptor type */
  56. typedef enum _PlinkDescType
  57. {
  58. PLINK_TYPE_1D_BUFFER = 0, /* PlinkBufferInfo */
  59. PLINK_TYPE_2D_YUV, /* PlinkYuvInfo */
  60. PLINK_TYPE_2D_RGB, /* PlinkRGBInfo */
  61. PLINK_TYPE_OBJECT, /* PlinkObjectInfo */
  62. PLINK_TYPE_MESSAGE, /* PlinkMsg */
  63. PLINK_TYPE_TIME, /* PlinkTimeInfo */
  64. PLINK_TYPE_2D_RAW, /* PlinkRawInfo */
  65. PLINK_TYPE_MAX
  66. } PlinkDescType;
  67. /* time type */
  68. typedef enum _PlinkTimeType
  69. {
  70. PLINK_TIME_START = 0, /* start time */
  71. PLINK_TIME_CALIBRATION, /* time delta for calibration */
  72. PLINK_TIME_MAX
  73. } PlinkTimeType;
  74. /* 1D buffer */
  75. typedef struct _PlinkBufferInfo
  76. {
  77. PlinkDescHdr header;
  78. unsigned long long bus_address;
  79. unsigned int offset;
  80. unsigned int size;
  81. } PlinkBufferInfo;
  82. /* 2D YUV surface */
  83. typedef struct _PlinkYuvInfo
  84. {
  85. PlinkDescHdr header;
  86. PlinkColorFormat format;
  87. unsigned long long bus_address_y;
  88. unsigned long long bus_address_u;
  89. unsigned long long bus_address_v;
  90. unsigned int offset_y;
  91. unsigned int offset_u;
  92. unsigned int offset_v;
  93. unsigned int pic_width;
  94. unsigned int pic_height;
  95. unsigned int stride_y;
  96. unsigned int stride_u;
  97. unsigned int stride_v;
  98. } PlinkYuvInfo;
  99. /* 2D RGB surface */
  100. typedef struct _PlinkRGBInfo
  101. {
  102. PlinkDescHdr header;
  103. PlinkColorFormat format;
  104. unsigned long long bus_address_r;
  105. unsigned long long bus_address_g;
  106. unsigned long long bus_address_b;
  107. unsigned long long bus_address_a;
  108. unsigned int offset_r;
  109. unsigned int offset_g;
  110. unsigned int offset_b;
  111. unsigned int offset_a;
  112. unsigned int img_width;
  113. unsigned int img_height;
  114. unsigned int stride_r;
  115. unsigned int stride_g;
  116. unsigned int stride_b;
  117. unsigned int stride_a;
  118. } PlinkRGBInfo;
  119. /* 2D Bayer Raw surface */
  120. typedef struct _PlinkRawInfo
  121. {
  122. PlinkDescHdr header;
  123. PlinkColorFormat format;
  124. PlinkBayerPattern pattern;
  125. unsigned long long bus_address;
  126. unsigned int offset;
  127. unsigned int img_width;
  128. unsigned int img_height;
  129. unsigned int stride;
  130. } PlinkRawInfo;
  131. /* Feature map buffer after NPU inference */
  132. typedef struct _PlinkBox
  133. {
  134. float x1;
  135. float y1;
  136. float x2;
  137. float y2;
  138. } PlinkBox;
  139. typedef struct _PlinkLandmark
  140. {
  141. float x[5];
  142. float y[5];
  143. } PlinkLandmark;
  144. typedef struct _PlinkObjectDetect
  145. {
  146. float score;
  147. PlinkBox box;
  148. PlinkLandmark landmark;
  149. } PlinkObjectDetect;
  150. typedef struct _PlinkObjectInfo
  151. {
  152. PlinkDescHdr header;
  153. unsigned long long bus_address;
  154. unsigned int object_cnt;
  155. } PlinkObjectInfo;
  156. /* Used to send message */
  157. typedef struct _PlinkMsg
  158. {
  159. PlinkDescHdr header;
  160. int msg; /* When greater than 0, it means the id of buffer which can be released */
  161. /* When set to 0, it means a buffer can be released, but id is unknown */
  162. /* When set to PLINK_EXIT_CODE, it means to close connection */
  163. /* Other values are reserved */
  164. } PlinkMsg;
  165. /* time information */
  166. typedef struct _PlinkTimeInfo
  167. {
  168. PlinkDescHdr header;
  169. PlinkTimeType type;
  170. long long seconds;
  171. long long useconds;
  172. } PlinkTimeInfo;
  173. #ifdef __cplusplus
  174. }
  175. #endif
  176. #endif /* !_PROCESS_LINKER_TYPES_H_ */