interface.h 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  1. #ifndef OPENCV_CORE_HAL_INTERFACE_H
  2. #define OPENCV_CORE_HAL_INTERFACE_H
  3. //! @addtogroup core_hal_interface
  4. //! @{
  5. //! @name Return codes
  6. //! @{
  7. #define CV_HAL_ERROR_OK 0
  8. #define CV_HAL_ERROR_NOT_IMPLEMENTED 1
  9. #define CV_HAL_ERROR_UNKNOWN -1
  10. //! @}
  11. #ifdef __cplusplus
  12. #include <cstddef>
  13. #else
  14. #include <stddef.h>
  15. #include <stdbool.h>
  16. #endif
  17. //! @name Data types
  18. //! primitive types
  19. //! - schar - signed 1 byte integer
  20. //! - uchar - unsigned 1 byte integer
  21. //! - short - signed 2 byte integer
  22. //! - ushort - unsigned 2 byte integer
  23. //! - int - signed 4 byte integer
  24. //! - uint - unsigned 4 byte integer
  25. //! - int64 - signed 8 byte integer
  26. //! - uint64 - unsigned 8 byte integer
  27. //! @{
  28. #if !defined _MSC_VER && !defined __BORLANDC__
  29. # if defined __cplusplus && __cplusplus >= 201103L && !defined __APPLE__
  30. # include <cstdint>
  31. # ifdef __NEWLIB__
  32. typedef unsigned int uint;
  33. # else
  34. typedef std::uint32_t uint;
  35. # endif
  36. # else
  37. # include <stdint.h>
  38. typedef uint32_t uint;
  39. # endif
  40. #else
  41. typedef unsigned uint;
  42. #endif
  43. typedef signed char schar;
  44. #ifndef __IPL_H__
  45. typedef unsigned char uchar;
  46. typedef unsigned short ushort;
  47. #endif
  48. #if defined _MSC_VER || defined __BORLANDC__
  49. typedef __int64 int64;
  50. typedef unsigned __int64 uint64;
  51. # define CV_BIG_INT(n) n##I64
  52. # define CV_BIG_UINT(n) n##UI64
  53. #else
  54. typedef int64_t int64;
  55. typedef uint64_t uint64;
  56. # define CV_BIG_INT(n) n##LL
  57. # define CV_BIG_UINT(n) n##ULL
  58. #endif
  59. #define CV_USRTYPE1 (void)"CV_USRTYPE1 support has been dropped in OpenCV 4.0"
  60. #define CV_CN_MAX 512
  61. #define CV_CN_SHIFT 3
  62. #define CV_DEPTH_MAX (1 << CV_CN_SHIFT)
  63. #define CV_8U 0
  64. #define CV_8S 1
  65. #define CV_16U 2
  66. #define CV_16S 3
  67. #define CV_32S 4
  68. #define CV_32F 5
  69. #define CV_64F 6
  70. #define CV_16F 7
  71. #define CV_MAT_DEPTH_MASK (CV_DEPTH_MAX - 1)
  72. #define CV_MAT_DEPTH(flags) ((flags) & CV_MAT_DEPTH_MASK)
  73. #define CV_MAKETYPE(depth,cn) (CV_MAT_DEPTH(depth) + (((cn)-1) << CV_CN_SHIFT))
  74. #define CV_MAKE_TYPE CV_MAKETYPE
  75. #define CV_8UC1 CV_MAKETYPE(CV_8U,1)
  76. #define CV_8UC2 CV_MAKETYPE(CV_8U,2)
  77. #define CV_8UC3 CV_MAKETYPE(CV_8U,3)
  78. #define CV_8UC4 CV_MAKETYPE(CV_8U,4)
  79. #define CV_8UC(n) CV_MAKETYPE(CV_8U,(n))
  80. #define CV_8SC1 CV_MAKETYPE(CV_8S,1)
  81. #define CV_8SC2 CV_MAKETYPE(CV_8S,2)
  82. #define CV_8SC3 CV_MAKETYPE(CV_8S,3)
  83. #define CV_8SC4 CV_MAKETYPE(CV_8S,4)
  84. #define CV_8SC(n) CV_MAKETYPE(CV_8S,(n))
  85. #define CV_16UC1 CV_MAKETYPE(CV_16U,1)
  86. #define CV_16UC2 CV_MAKETYPE(CV_16U,2)
  87. #define CV_16UC3 CV_MAKETYPE(CV_16U,3)
  88. #define CV_16UC4 CV_MAKETYPE(CV_16U,4)
  89. #define CV_16UC(n) CV_MAKETYPE(CV_16U,(n))
  90. #define CV_16SC1 CV_MAKETYPE(CV_16S,1)
  91. #define CV_16SC2 CV_MAKETYPE(CV_16S,2)
  92. #define CV_16SC3 CV_MAKETYPE(CV_16S,3)
  93. #define CV_16SC4 CV_MAKETYPE(CV_16S,4)
  94. #define CV_16SC(n) CV_MAKETYPE(CV_16S,(n))
  95. #define CV_32SC1 CV_MAKETYPE(CV_32S,1)
  96. #define CV_32SC2 CV_MAKETYPE(CV_32S,2)
  97. #define CV_32SC3 CV_MAKETYPE(CV_32S,3)
  98. #define CV_32SC4 CV_MAKETYPE(CV_32S,4)
  99. #define CV_32SC(n) CV_MAKETYPE(CV_32S,(n))
  100. #define CV_32FC1 CV_MAKETYPE(CV_32F,1)
  101. #define CV_32FC2 CV_MAKETYPE(CV_32F,2)
  102. #define CV_32FC3 CV_MAKETYPE(CV_32F,3)
  103. #define CV_32FC4 CV_MAKETYPE(CV_32F,4)
  104. #define CV_32FC(n) CV_MAKETYPE(CV_32F,(n))
  105. #define CV_64FC1 CV_MAKETYPE(CV_64F,1)
  106. #define CV_64FC2 CV_MAKETYPE(CV_64F,2)
  107. #define CV_64FC3 CV_MAKETYPE(CV_64F,3)
  108. #define CV_64FC4 CV_MAKETYPE(CV_64F,4)
  109. #define CV_64FC(n) CV_MAKETYPE(CV_64F,(n))
  110. #define CV_16FC1 CV_MAKETYPE(CV_16F,1)
  111. #define CV_16FC2 CV_MAKETYPE(CV_16F,2)
  112. #define CV_16FC3 CV_MAKETYPE(CV_16F,3)
  113. #define CV_16FC4 CV_MAKETYPE(CV_16F,4)
  114. #define CV_16FC(n) CV_MAKETYPE(CV_16F,(n))
  115. //! @}
  116. //! @name Comparison operation
  117. //! @sa cv::CmpTypes
  118. //! @{
  119. #define CV_HAL_CMP_EQ 0
  120. #define CV_HAL_CMP_GT 1
  121. #define CV_HAL_CMP_GE 2
  122. #define CV_HAL_CMP_LT 3
  123. #define CV_HAL_CMP_LE 4
  124. #define CV_HAL_CMP_NE 5
  125. //! @}
  126. //! @name Border processing modes
  127. //! @sa cv::BorderTypes
  128. //! @{
  129. #define CV_HAL_BORDER_CONSTANT 0
  130. #define CV_HAL_BORDER_REPLICATE 1
  131. #define CV_HAL_BORDER_REFLECT 2
  132. #define CV_HAL_BORDER_WRAP 3
  133. #define CV_HAL_BORDER_REFLECT_101 4
  134. #define CV_HAL_BORDER_TRANSPARENT 5
  135. #define CV_HAL_BORDER_ISOLATED 16
  136. //! @}
  137. //! @name DFT flags
  138. //! @{
  139. #define CV_HAL_DFT_INVERSE 1
  140. #define CV_HAL_DFT_SCALE 2
  141. #define CV_HAL_DFT_ROWS 4
  142. #define CV_HAL_DFT_COMPLEX_OUTPUT 16
  143. #define CV_HAL_DFT_REAL_OUTPUT 32
  144. #define CV_HAL_DFT_TWO_STAGE 64
  145. #define CV_HAL_DFT_STAGE_COLS 128
  146. #define CV_HAL_DFT_IS_CONTINUOUS 512
  147. #define CV_HAL_DFT_IS_INPLACE 1024
  148. //! @}
  149. //! @name SVD flags
  150. //! @{
  151. #define CV_HAL_SVD_NO_UV 1
  152. #define CV_HAL_SVD_SHORT_UV 2
  153. #define CV_HAL_SVD_MODIFY_A 4
  154. #define CV_HAL_SVD_FULL_UV 8
  155. //! @}
  156. //! @name Gemm flags
  157. //! @{
  158. #define CV_HAL_GEMM_1_T 1
  159. #define CV_HAL_GEMM_2_T 2
  160. #define CV_HAL_GEMM_3_T 4
  161. //! @}
  162. //! @}
  163. #endif