Skip to content

Commit 547a2d2

Browse files
committed
Merge pull request opencv#6535 from sovrasov:lapack-hal
2 parents 4142e73 + 055f5c7 commit 547a2d2

File tree

13 files changed

+1027
-75
lines changed

13 files changed

+1027
-75
lines changed

CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,7 @@ OCV_OPTION(WITH_VA "Include VA support" OFF
221221
OCV_OPTION(WITH_VA_INTEL "Include Intel VA-API/OpenCL support" OFF IF (UNIX AND NOT ANDROID) )
222222
OCV_OPTION(WITH_GDAL "Include GDAL Support" OFF IF (NOT ANDROID AND NOT IOS AND NOT WINRT) )
223223
OCV_OPTION(WITH_GPHOTO2 "Include gPhoto2 library support" ON IF (UNIX AND NOT ANDROID) )
224+
OCV_OPTION(WITH_LAPACK "Include Lapack library support" ON IF (UNIX AND NOT ANDROID) )
224225

225226
# OpenCV build components
226227
# ===================================================
@@ -1173,6 +1174,10 @@ if(DEFINED WITH_VA_INTEL)
11731174
status(" Use Intel VA-API/OpenCL:" HAVE_VA_INTEL THEN "YES (MSDK: ${VA_INTEL_MSDK_ROOT} OpenCL: ${VA_INTEL_IOCL_ROOT})" ELSE NO)
11741175
endif(DEFINED WITH_VA_INTEL)
11751176

1177+
if(DEFINED WITH_LAPACK)
1178+
status(" Use Lapack:" HAVE_LAPACK THEN "YES" ELSE NO)
1179+
endif(DEFINED WITH_LAPACK)
1180+
11761181
status(" Use Eigen:" HAVE_EIGEN THEN "YES (ver ${EIGEN_WORLD_VERSION}.${EIGEN_MAJOR_VERSION}.${EIGEN_MINOR_VERSION})" ELSE NO)
11771182
status(" Use Cuda:" HAVE_CUDA THEN "YES (ver ${CUDA_VERSION_STRING})" ELSE NO)
11781183
status(" Use OpenCL:" HAVE_OPENCL THEN YES ELSE NO)

cmake/OpenCVFindLibsPerf.cmake

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,19 @@
22
# Detect other 3rd-party performance and math libraries
33
# ----------------------------------------------------------------------------
44

5+
# --- Lapack ---
6+
if(WITH_LAPACK)
7+
find_package(LAPACK)
8+
if(LAPACK_FOUND)
9+
find_path(LAPACK_INCLUDE_DIR "lapacke.h")
10+
if(LAPACK_INCLUDE_DIR)
11+
set(HAVE_LAPACK 1)
12+
ocv_include_directories(${LAPACK_INCLUDE_DIR})
13+
list(APPEND OPENCV_LINKER_LIBS ${LAPACK_LIBRARIES})
14+
endif()
15+
endif(LAPACK_FOUND)
16+
endif(WITH_LAPACK)
17+
518
# --- TBB ---
619
if(WITH_TBB)
720
include("${OpenCV_SOURCE_DIR}/cmake/OpenCVDetectTBB.cmake")

cmake/templates/cvconfig.h.in

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,3 +197,6 @@
197197

198198
/* Intel VA-API/OpenCL */
199199
#cmakedefine HAVE_VA_INTEL
200+
201+
/* Lapack */
202+
#cmakedefine HAVE_LAPACK

modules/core/include/opencv2/core/hal/hal.hpp

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -49,17 +49,6 @@
4949
#include "opencv2/core/cvstd.hpp"
5050
#include "opencv2/core/hal/interface.h"
5151

52-
//! @cond IGNORED
53-
#define CALL_HAL(name, fun, ...) \
54-
int res = fun(__VA_ARGS__); \
55-
if (res == CV_HAL_ERROR_OK) \
56-
return; \
57-
else if (res != CV_HAL_ERROR_NOT_IMPLEMENTED) \
58-
CV_Error_(cv::Error::StsInternal, \
59-
("HAL implementation " CVAUX_STR(name) " ==> " CVAUX_STR(fun) " returned %d (0x%08x)", res, res));
60-
//! @endcond
61-
62-
6352
namespace cv { namespace hal {
6453

6554
//! @addtogroup core_hal_functions
@@ -75,6 +64,21 @@ CV_EXPORTS int LU32f(float* A, size_t astep, int m, float* b, size_t bstep, int
7564
CV_EXPORTS int LU64f(double* A, size_t astep, int m, double* b, size_t bstep, int n);
7665
CV_EXPORTS bool Cholesky32f(float* A, size_t astep, int m, float* b, size_t bstep, int n);
7766
CV_EXPORTS bool Cholesky64f(double* A, size_t astep, int m, double* b, size_t bstep, int n);
67+
CV_EXPORTS void SVD32f(float* At, size_t astep, float* W, float* U, size_t ustep, float* Vt, size_t vstep, int m, int n, int flags);
68+
CV_EXPORTS void SVD64f(double* At, size_t astep, double* W, double* U, size_t ustep, double* Vt, size_t vstep, int m, int n, int flags);
69+
70+
CV_EXPORTS void gemm32f(const float* src1, size_t src1_step, const float* src2, size_t src2_step,
71+
float alpha, const float* src3, size_t src3_step, float beta, float* dst, size_t dst_step,
72+
int m_a, int n_a, int n_d, int flags);
73+
CV_EXPORTS void gemm64f(const double* src1, size_t src1_step, const double* src2, size_t src2_step,
74+
double alpha, const double* src3, size_t src3_step, double beta, double* dst, size_t dst_step,
75+
int m_a, int n_a, int n_d, int flags);
76+
CV_EXPORTS void gemm32fc(const float* src1, size_t src1_step, const float* src2, size_t src2_step,
77+
float alpha, const float* src3, size_t src3_step, float beta, float* dst, size_t dst_step,
78+
int m_a, int n_a, int n_d, int flags);
79+
CV_EXPORTS void gemm64fc(const double* src1, size_t src1_step, const double* src2, size_t src2_step,
80+
double alpha, const double* src3, size_t src3_step, double beta, double* dst, size_t dst_step,
81+
int m_a, int n_a, int n_d, int flags);
7882

7983
CV_EXPORTS int normL1_(const uchar* a, const uchar* b, int n);
8084
CV_EXPORTS float normL1_(const float* a, const float* b, int n);

modules/core/include/opencv2/core/hal/interface.h

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,21 @@ typedef signed char schar;
158158
#define CV_HAL_DFT_IS_INPLACE 1024
159159
//! @}
160160

161+
//! @name SVD flags
162+
//! @{
163+
#define CV_HAL_SVD_NO_UV 1
164+
#define CV_HAL_SVD_SHORT_UV 2
165+
#define CV_HAL_SVD_MODIFY_A 4
166+
#define CV_HAL_SVD_FULL_UV 8
167+
//! @}
168+
169+
//! @name Gemm flags
170+
//! @{
171+
#define CV_HAL_GEMM_1_T 1
172+
#define CV_HAL_GEMM_2_T 2
173+
#define CV_HAL_GEMM_3_T 4
174+
//! @}
175+
161176
//! @}
162177

163178
#endif

modules/core/include/opencv2/core/matx.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -438,7 +438,7 @@ template<typename _Tp, int m> struct Matx_DetOp
438438
return p;
439439
for( int i = 0; i < m; i++ )
440440
p *= temp(i, i);
441-
return 1./p;
441+
return p;
442442
}
443443
};
444444

0 commit comments

Comments
 (0)