openvx_hal.hpp 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. #ifndef OPENCV_OPENVX_HAL_HPP_INCLUDED
  2. #define OPENCV_OPENVX_HAL_HPP_INCLUDED
  3. #include "opencv2/core/hal/interface.h"
  4. #include "VX/vx.h"
  5. template <typename T>
  6. int ovx_hal_add(const T *a, size_t astep, const T *b, size_t bstep, T *c, size_t cstep, int w, int h);
  7. template <typename T>
  8. int ovx_hal_sub(const T *a, size_t astep, const T *b, size_t bstep, T *c, size_t cstep, int w, int h);
  9. template <typename T>
  10. int ovx_hal_absdiff(const T *a, size_t astep, const T *b, size_t bstep, T *c, size_t cstep, int w, int h);
  11. template <typename T>
  12. int ovx_hal_and(const T *a, size_t astep, const T *b, size_t bstep, T *c, size_t cstep, int w, int h);
  13. template <typename T>
  14. int ovx_hal_or(const T *a, size_t astep, const T *b, size_t bstep, T *c, size_t cstep, int w, int h);
  15. template <typename T>
  16. int ovx_hal_xor(const T *a, size_t astep, const T *b, size_t bstep, T *c, size_t cstep, int w, int h);
  17. int ovx_hal_not(const uchar *a, size_t astep, uchar *c, size_t cstep, int w, int h);
  18. template <typename T>
  19. int ovx_hal_mul(const T *a, size_t astep, const T *b, size_t bstep, T *c, size_t cstep, int w, int h, double scale);
  20. int ovx_hal_merge8u(const uchar **src_data, uchar *dst_data, int len, int cn);
  21. int ovx_hal_resize(int atype, const uchar *a, size_t astep, int aw, int ah, uchar *b, size_t bstep, int bw, int bh, double inv_scale_x, double inv_scale_y, int interpolation);
  22. int ovx_hal_warpAffine(int atype, const uchar *a, size_t astep, int aw, int ah, uchar *b, size_t bstep, int bw, int bh, const double M[6], int interpolation, int borderType, const double borderValue[4]);
  23. int ovx_hal_warpPerspective(int atype, const uchar *a, size_t astep, int aw, int ah, uchar *b, size_t bstep, int bw, int bh, const double M[9], int interpolation, int borderType, const double borderValue[4]);
  24. struct cvhalFilter2D;
  25. int ovx_hal_filterInit(cvhalFilter2D **filter_context, uchar *kernel_data, size_t kernel_step, int kernel_type, int kernel_width, int kernel_height,
  26. int, int, int src_type, int dst_type, int borderType, double delta, int anchor_x, int anchor_y, bool allowSubmatrix, bool allowInplace);
  27. int ovx_hal_filterFree(cvhalFilter2D *filter_context);
  28. int ovx_hal_filter(cvhalFilter2D *filter_context, uchar *a, size_t astep, uchar *b, size_t bstep, int w, int h, int, int, int, int);
  29. int ovx_hal_sepFilterInit(cvhalFilter2D **filter_context, int src_type, int dst_type,
  30. int kernel_type, uchar *kernelx_data, int kernelx_length, uchar *kernely_data, int kernely_length,
  31. int anchor_x, int anchor_y, double delta, int borderType);
  32. #if VX_VERSION > VX_VERSION_1_0
  33. int ovx_hal_morphInit(cvhalFilter2D **filter_context, int operation, int src_type, int dst_type, int , int ,
  34. int kernel_type, uchar *kernel_data, size_t kernel_step, int kernel_width, int kernel_height, int anchor_x, int anchor_y,
  35. int borderType, const double borderValue[4], int iterations, bool allowSubmatrix, bool allowInplace);
  36. int ovx_hal_morphFree(cvhalFilter2D *filter_context);
  37. int ovx_hal_morph(cvhalFilter2D *filter_context, uchar *a, size_t astep, uchar *b, size_t bstep, int w, int h, int , int , int , int , int , int , int , int );
  38. #endif // 1.0 guard
  39. int ovx_hal_cvtBGRtoBGR(const uchar * a, size_t astep, uchar * b, size_t bstep, int w, int h, int depth, int acn, int bcn, bool swapBlue);
  40. int ovx_hal_cvtGraytoBGR(const uchar * a, size_t astep, uchar * b, size_t bstep, int w, int h, int depth, int bcn);
  41. int ovx_hal_cvtTwoPlaneYUVtoBGR(const uchar * a, size_t astep, uchar * b, size_t bstep, int w, int h, int bcn, bool swapBlue, int uIdx);
  42. int ovx_hal_cvtTwoPlaneYUVtoBGREx(const uchar * a, size_t astep, const uchar * b, size_t bstep, uchar * c, size_t cstep, int w, int h, int bcn, bool swapBlue, int uIdx);
  43. int ovx_hal_cvtThreePlaneYUVtoBGR(const uchar * a, size_t astep, uchar * b, size_t bstep, int w, int h, int bcn, bool swapBlue, int uIdx);
  44. int ovx_hal_cvtBGRtoThreePlaneYUV(const uchar * a, size_t astep, uchar * b, size_t bstep, int w, int h, int acn, bool swapBlue, int uIdx);
  45. int ovx_hal_cvtOnePlaneYUVtoBGR(const uchar * a, size_t astep, uchar * b, size_t bstep, int w, int h, int bcn, bool swapBlue, int uIdx, int ycn);
  46. int ovx_hal_integral(int depth, int sdepth, int, const uchar * a, size_t astep, uchar * b, size_t bstep, uchar * c, size_t, uchar * d, size_t, int w, int h, int cn);
  47. //==================================================================================================
  48. // functions redefinition
  49. // ...
  50. #undef cv_hal_add8u
  51. #define cv_hal_add8u ovx_hal_add<uchar>
  52. #undef cv_hal_add16s
  53. #define cv_hal_add16s ovx_hal_add<short>
  54. #undef cv_hal_sub8u
  55. #define cv_hal_sub8u ovx_hal_sub<uchar>
  56. #undef cv_hal_sub16s
  57. #define cv_hal_sub16s ovx_hal_sub<short>
  58. #undef cv_hal_absdiff8u
  59. #define cv_hal_absdiff8u ovx_hal_absdiff<uchar>
  60. #undef cv_hal_absdiff16s
  61. #define cv_hal_absdiff16s ovx_hal_absdiff<short>
  62. #undef cv_hal_and8u
  63. #define cv_hal_and8u ovx_hal_and<uchar>
  64. #undef cv_hal_or8u
  65. #define cv_hal_or8u ovx_hal_or<uchar>
  66. #undef cv_hal_xor8u
  67. #define cv_hal_xor8u ovx_hal_xor<uchar>
  68. #undef cv_hal_not8u
  69. #define cv_hal_not8u ovx_hal_not
  70. #undef cv_hal_mul8u
  71. #define cv_hal_mul8u ovx_hal_mul<uchar>
  72. #undef cv_hal_mul16s
  73. #define cv_hal_mul16s ovx_hal_mul<short>
  74. #undef cv_hal_merge8u
  75. #define cv_hal_merge8u ovx_hal_merge8u
  76. //#undef cv_hal_resize
  77. //#define cv_hal_resize ovx_hal_resize
  78. //OpenVX warps use round to zero policy at least in sample implementation
  79. //while OpenCV require round to nearest
  80. //#undef cv_hal_warpAffine
  81. //#define cv_hal_warpAffine ovx_hal_warpAffine
  82. //#undef cv_hal_warpPerspective
  83. //#define cv_hal_warpPerspective ovx_hal_warpPerspective
  84. #undef cv_hal_filterInit
  85. #define cv_hal_filterInit ovx_hal_filterInit
  86. #undef cv_hal_filter
  87. #define cv_hal_filter ovx_hal_filter
  88. #undef cv_hal_filterFree
  89. #define cv_hal_filterFree ovx_hal_filterFree
  90. //#undef cv_hal_sepFilterInit
  91. //#define cv_hal_sepFilterInit ovx_hal_sepFilterInit
  92. //#undef cv_hal_sepFilter
  93. //#define cv_hal_sepFilter ovx_hal_filter
  94. //#undef cv_hal_sepFilterFree
  95. //#define cv_hal_sepFilterFree ovx_hal_filterFree
  96. #if VX_VERSION > VX_VERSION_1_0
  97. #undef cv_hal_morphInit
  98. #define cv_hal_morphInit ovx_hal_morphInit
  99. #undef cv_hal_morph
  100. #define cv_hal_morph ovx_hal_morph
  101. #undef cv_hal_morphFree
  102. #define cv_hal_morphFree ovx_hal_morphFree
  103. #endif // 1.0 guard
  104. #undef cv_hal_cvtBGRtoBGR
  105. #define cv_hal_cvtBGRtoBGR ovx_hal_cvtBGRtoBGR
  106. #undef cv_hal_cvtGraytoBGR
  107. #define cv_hal_cvtGraytoBGR ovx_hal_cvtGraytoBGR
  108. #undef cv_hal_cvtTwoPlaneYUVtoBGR
  109. #define cv_hal_cvtTwoPlaneYUVtoBGR ovx_hal_cvtTwoPlaneYUVtoBGR
  110. #undef cv_hal_cvtTwoPlaneYUVtoBGREx
  111. #define cv_hal_cvtTwoPlaneYUVtoBGREx ovx_hal_cvtTwoPlaneYUVtoBGREx
  112. #undef cv_hal_cvtThreePlaneYUVtoBGR
  113. #define cv_hal_cvtThreePlaneYUVtoBGR ovx_hal_cvtThreePlaneYUVtoBGR
  114. #undef cv_hal_cvtBGRtoThreePlaneYUV
  115. #define cv_hal_cvtBGRtoThreePlaneYUV ovx_hal_cvtBGRtoThreePlaneYUV
  116. #undef cv_hal_cvtOnePlaneYUVtoBGR
  117. #define cv_hal_cvtOnePlaneYUVtoBGR ovx_hal_cvtOnePlaneYUVtoBGR
  118. #undef cv_hal_integral
  119. #define cv_hal_integral ovx_hal_integral
  120. #endif