process_linker_types.h 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. /*
  2. * Copyright (c) 2021 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. /* When set PlinkMsg.msg to this exit code, it means to close the connection */
  22. #define PLINK_EXIT_CODE -1
  23. /* image/video color format */
  24. typedef enum _PlinkColorFormat
  25. {
  26. PLINK_COLOR_FormatUnused,
  27. PLINK_COLOR_FormatMonochrome,
  28. PLINK_COLOR_FormatYUV420Planar,
  29. PLINK_COLOR_FormatYUV420SemiPlanar,
  30. PLINK_COLOR_FormatYUV420SemiPlanarP010,
  31. PLINK_COLOR_FormatYUV422Planar,
  32. PLINK_COLOR_FormatYUV422SemiPlanar,
  33. PLINK_COLOR_Format32bitBGRA8888,
  34. PLINK_COLOR_Format32bitARGB8888,
  35. PLINK_COLOR_Format24BitRGB888,
  36. PLINK_COLOR_Format24BitRGB888Planar,
  37. PLINK_COLOR_Format24BitBGR888,
  38. PLINK_COLOR_Format24BitBGR888Planar,
  39. PLINK_COLOR_FormatRawBayer8bit,
  40. PLINK_COLOR_FormatRawBayer10bit,
  41. PLINK_COLOR_FormatMax
  42. } PlinkColorFormat;
  43. /* Data descriptor type */
  44. typedef enum _PlinkDescType
  45. {
  46. PLINK_TYPE_1D_BUFFER = 0, /* PlinkBufferInfo */
  47. PLINK_TYPE_2D_YUV, /* PlinkYuvInfo */
  48. PLINK_TYPE_2D_RGB, /* PlinkRGBInfo */
  49. PLINK_TYPE_OBJECT, /* PlinkObjectInfo */
  50. PLINK_TYPE_MESSAGE, /* PlinkMsg */
  51. PLINK_TYPE_TIME, /* PlinkTimeInfo */
  52. PLINK_TYPE_MAX
  53. } PlinkDescType;
  54. /* time type */
  55. typedef enum _PlinkTimeType
  56. {
  57. PLINK_TIME_START = 0, /* start time */
  58. PLINK_TIME_CALIBRATION, /* time delta for calibration */
  59. PLINK_TIME_MAX
  60. } PlinkTimeType;
  61. /* 1D buffer */
  62. typedef struct _PlinkBufferInfo
  63. {
  64. PlinkDescHdr header;
  65. unsigned long long bus_address;
  66. unsigned int offset;
  67. unsigned int size;
  68. } PlinkBufferInfo;
  69. /* 2D YUV surface */
  70. typedef struct _PlinkYuvInfo
  71. {
  72. PlinkDescHdr header;
  73. PlinkColorFormat format;
  74. unsigned long long bus_address_y;
  75. unsigned long long bus_address_u;
  76. unsigned long long bus_address_v;
  77. unsigned int offset_y;
  78. unsigned int offset_u;
  79. unsigned int offset_v;
  80. unsigned int pic_width;
  81. unsigned int pic_height;
  82. unsigned int stride_y;
  83. unsigned int stride_u;
  84. unsigned int stride_v;
  85. } PlinkYuvInfo;
  86. /* 2D RGB surface */
  87. typedef struct _PlinkRGBInfo
  88. {
  89. PlinkDescHdr header;
  90. PlinkColorFormat format;
  91. unsigned long long bus_address_r;
  92. unsigned long long bus_address_g;
  93. unsigned long long bus_address_b;
  94. unsigned long long bus_address_a;
  95. unsigned int offset_r;
  96. unsigned int offset_g;
  97. unsigned int offset_b;
  98. unsigned int offset_a;
  99. unsigned int img_width;
  100. unsigned int img_height;
  101. unsigned int stride_r;
  102. unsigned int stride_g;
  103. unsigned int stride_b;
  104. unsigned int stride_a;
  105. } PlinkRGBInfo;
  106. /* Feature map buffer after NPU inference */
  107. typedef struct _PlinkBox
  108. {
  109. float x1;
  110. float y1;
  111. float x2;
  112. float y2;
  113. } PlinkBox;
  114. typedef struct _PlinkLandmark
  115. {
  116. float x[5];
  117. float y[5];
  118. } PlinkLandmark;
  119. typedef struct _PlinkObjectDetect
  120. {
  121. float score;
  122. PlinkBox box;
  123. PlinkLandmark landmark;
  124. } PlinkObjectDetect;
  125. typedef struct _PlinkObjectInfo
  126. {
  127. PlinkDescHdr header;
  128. unsigned long long bus_address;
  129. unsigned int object_cnt;
  130. } PlinkObjectInfo;
  131. /* Used to send message */
  132. typedef struct _PlinkMsg
  133. {
  134. PlinkDescHdr header;
  135. int msg; /* When greater than 0, it means the id of buffer which can be released */
  136. /* When set to 0, it means a buffer can be released, but id is unknown */
  137. /* When set to PLINK_EXIT_CODE, it means to close connection */
  138. /* Other values are reserved */
  139. } PlinkMsg;
  140. /* time information */
  141. typedef struct _PlinkTimeInfo
  142. {
  143. PlinkDescHdr header;
  144. PlinkTimeType type;
  145. long long seconds;
  146. long long useconds;
  147. } PlinkTimeInfo;
  148. #endif /* !_PROCESS_LINKER_TYPES_H_ */