diff --git a/3rdparty/carotene/hal/tegra_hal.hpp b/3rdparty/carotene/hal/tegra_hal.hpp index 31182a029a..2e07b7f526 100644 --- a/3rdparty/carotene/hal/tegra_hal.hpp +++ b/3rdparty/carotene/hal/tegra_hal.hpp @@ -1962,4 +1962,20 @@ inline int TEGRA_LKOpticalFlowLevel(const uchar *prev_data, size_t prev_data_ste #define cv_hal_LKOpticalFlowLevel TEGRA_LKOpticalFlowLevel #endif // __ARM_ARCH=7 +#if 0 // OpenCV provides fater parallel implementation +inline int TEGRA_ScharrDeriv(const uchar* src_data, size_t src_step, + short* dst_data, size_t dst_step, + int width, int height, int cn) +{ + if (!CAROTENE_NS::isSupportedConfiguration()) + return CV_HAL_ERROR_NOT_IMPLEMENTED; + + CAROTENE_NS::ScharrDeriv(CAROTENE_NS::Size2D(width, height), cn, src_data, src_step, dst_data, dst_step); + return CV_HAL_ERROR_OK; +} + +#undef cv_hal_ScharrDeriv +#define cv_hal_ScharrDeriv TEGRA_ScharrDeriv +#endif + #endif diff --git a/modules/video/src/hal_replacement.hpp b/modules/video/src/hal_replacement.hpp index 8d10ab39d1..b3551d1d3f 100644 --- a/modules/video/src/hal_replacement.hpp +++ b/modules/video/src/hal_replacement.hpp @@ -67,6 +67,27 @@ inline int hal_ni_LKOpticalFlowLevel(const uchar *prev_data, size_t prev_data_st #define cv_hal_LKOpticalFlowLevel hal_ni_LKOpticalFlowLevel //! @endcond +/** +@brief Computes Schaar derivatives with inteleaved layout xyxy... +@param src_data source image data +@param src_step source image step +@param dst_data destination buffer data +@param dst_step destination buffer step +@param width image width +@param height image height +@param cn source image channels +**/ +inline int hal_ni_ScharrDeriv(const uchar* src_data, size_t src_step, + short* dst_data, size_t dst_step, + int width, int height, int cn) +{ + return CV_HAL_ERROR_NOT_IMPLEMENTED; +} + +//! @cond IGNORED +#define cv_hal_ScharrDeriv hal_ni_ScharrDeriv +//! @endcond + //! @} #if defined(__clang__) diff --git a/modules/video/src/lkpyramid.cpp b/modules/video/src/lkpyramid.cpp index a9917595e9..1ed0482447 100644 --- a/modules/video/src/lkpyramid.cpp +++ b/modules/video/src/lkpyramid.cpp @@ -63,6 +63,9 @@ static void calcScharrDeriv(const cv::Mat& src, cv::Mat& dst) int rows = src.rows, cols = src.cols, cn = src.channels(), depth = src.depth(); CV_Assert(depth == CV_8U); dst.create(rows, cols, CV_MAKETYPE(DataType::depth, cn*2)); + + CALL_HAL(ScharrDeriv, cv_hal_ScharrDeriv, src.data, src.step, (short*)dst.data, dst.step, cols, rows, cn); + parallel_for_(Range(0, rows), cv::detail::ScharrDerivInvoker(src, dst), cv::getNumThreads()); }