mirror of
https://github.com/opencv/opencv.git
synced 2024-11-24 03:00:14 +08:00
Merge pull request #25936 from savuor:rv/hal_dot
HAL for dot product added #25936 ### Pull Request Readiness Checklist See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request - [x] I agree to contribute to the project under Apache 2 License. - [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV - [x] The PR is proposed to the proper branch - [ ] There is a reference to the original bug report and related work - [ ] There is accuracy test, performance test and test data in opencv_extra repository, if applicable Patch to opencv_extra has the same branch name. - [x] The feature is well documented and sample code can be built with the project CMake
This commit is contained in:
parent
c9b57819b1
commit
44c814e334
@ -899,6 +899,27 @@ inline int hal_ni_meanStdDev(const uchar* src_data, size_t src_step, int width,
|
||||
#define cv_hal_meanStdDev hal_ni_meanStdDev
|
||||
//! @endcond
|
||||
|
||||
/**
|
||||
* @brief calculates dot product of two vectors (represented as 2d images)
|
||||
*
|
||||
* @param a_data Pointer to 1st 2nd image data
|
||||
* @param a_step Stride of 1st 2nd image
|
||||
* @param b_data Pointer to 1st 2nd image data
|
||||
* @param b_step Stride of 1st 2nd image
|
||||
* @param width Width of both images
|
||||
* @param height Height of both images
|
||||
* @param type Data type of both images, for example CV_8U or CV_32F
|
||||
* @param dot_val Pointer to resulting dot product value
|
||||
* @return int
|
||||
*/
|
||||
inline int hal_ni_dotProduct(const uchar* a_data, size_t a_step, const uchar* b_data, size_t b_step, int width, int height,
|
||||
int type, double *dot_val)
|
||||
{ return CV_HAL_ERROR_NOT_IMPLEMENTED; }
|
||||
|
||||
//! @cond IGNORED
|
||||
#define cv_hal_dotProduct hal_ni_dotProduct
|
||||
//! @endcond
|
||||
|
||||
/**
|
||||
@brief hal_flip
|
||||
@param src_type source and destination image type
|
||||
|
@ -995,9 +995,18 @@ double Mat::dot(InputArray _mat) const
|
||||
CV_INSTRUMENT_REGION();
|
||||
|
||||
Mat mat = _mat.getMat();
|
||||
CV_Assert_N( mat.type() == type(), mat.size == size);
|
||||
|
||||
int cn = channels();
|
||||
if (this->dims <= 2)
|
||||
{
|
||||
double product = 0;
|
||||
CALL_HAL_RET(dotProduct, cv_hal_dotProduct, product, this->data, this->step, mat.data, mat.step,
|
||||
this->cols * cn, this->rows, this->depth());
|
||||
}
|
||||
|
||||
DotProdFunc func = getDotProdFunc(depth());
|
||||
CV_Assert_N( mat.type() == type(), mat.size == size, func != 0 );
|
||||
CV_Assert(func != 0 );
|
||||
|
||||
if( isContinuous() && mat.isContinuous() )
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user