Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
opencv
Commits
bebd49d9
Commit
bebd49d9
authored
Nov 02, 2016
by
Vadim Pisarevsky
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #7467 from tomoaki0705:featureCheckSimdUniversal
parents
050731c4
cba22349
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
55 additions
and
22 deletions
+55
-22
stereosgbm.cpp
modules/calib3d/src/stereosgbm.cpp
+5
-5
intrin_cpp.hpp
modules/core/include/opencv2/core/hal/intrin_cpp.hpp
+11
-0
intrin_neon.hpp
modules/core/include/opencv2/core/hal/intrin_neon.hpp
+11
-0
intrin_sse.hpp
modules/core/include/opencv2/core/hal/intrin_sse.hpp
+11
-0
arithm_simd.hpp
modules/core/src/arithm_simd.hpp
+14
-14
canny.cpp
modules/imgproc/src/canny.cpp
+3
-3
spatialgradient.cpp
modules/imgproc/src/spatialgradient.cpp
+0
-0
No files found.
modules/calib3d/src/stereosgbm.cpp
View file @
bebd49d9
...
...
@@ -132,7 +132,7 @@ static void calcPixelCostBT( const Mat& img1, const Mat& img2, int y,
const
PixType
*
row1
=
img1
.
ptr
<
PixType
>
(
y
),
*
row2
=
img2
.
ptr
<
PixType
>
(
y
);
PixType
*
prow1
=
buffer
+
width2
*
2
,
*
prow2
=
prow1
+
width
*
cn
*
2
;
#if CV_SIMD128
bool
useSIMD
=
checkHardwareSupport
(
CV_CPU_SSE2
)
||
checkHardwareSupport
(
CV_CPU_NEON
);
bool
useSIMD
=
hasSIMD128
(
);
#endif
tab
+=
tabOfs
;
...
...
@@ -292,7 +292,7 @@ static void computeDisparitySGBM( const Mat& img1, const Mat& img2,
};
static
const
v_uint16x8
v_LSB
=
v_uint16x8
(
0x1
,
0x2
,
0x4
,
0x8
,
0x10
,
0x20
,
0x40
,
0x80
);
bool
useSIMD
=
checkHardwareSupport
(
CV_CPU_SSE2
)
||
checkHardwareSupport
(
CV_CPU_NEON
);
bool
useSIMD
=
hasSIMD128
(
);
#endif
const
int
ALIGN
=
16
;
...
...
@@ -891,7 +891,7 @@ buffers(_buffers), img1(&_img1), img2(&_img2), dst_disp(_dst_disp), clipTab(_cli
ftzero
=
std
::
max
(
params
.
preFilterCap
,
15
)
|
1
;
#if CV_SIMD128
useSIMD
=
checkHardwareSupport
(
CV_CPU_SSE2
)
||
checkHardwareSupport
(
CV_CPU_NEON
);
useSIMD
=
hasSIMD128
(
);
#endif
}
...
...
@@ -1054,7 +1054,7 @@ inline void accumulateCostsLeftTop(CostType* leftBuf, CostType* leftBuf_prev, Co
CostType
&
leftMinCost
,
CostType
&
topMinCost
,
int
D
,
int
P1
,
int
P2
)
{
#if CV_SIMD128
if
(
checkHardwareSupport
(
CV_CPU_SSE2
)
||
checkHardwareSupport
(
CV_CPU_NEON
))
if
(
hasSIMD128
(
))
{
v_int16x8
P1_reg
=
v_setall_s16
(
cv
::
saturate_cast
<
CostType
>
(
P1
));
...
...
@@ -1166,7 +1166,7 @@ inline void accumulateCostsRight(CostType* rightBuf, CostType* topBuf, CostType*
CostType
&
rightMinCost
,
int
D
,
int
P1
,
int
P2
,
int
&
optimal_disp
,
CostType
&
min_cost
)
{
#if CV_SIMD128
if
(
checkHardwareSupport
(
CV_CPU_SSE2
)
||
checkHardwareSupport
(
CV_CPU_NEON
))
if
(
hasSIMD128
(
))
{
v_int16x8
P1_reg
=
v_setall_s16
(
cv
::
saturate_cast
<
CostType
>
(
P1
));
...
...
modules/core/include/opencv2/core/hal/intrin_cpp.hpp
View file @
bebd49d9
...
...
@@ -1772,6 +1772,17 @@ inline v_float32x4 v_matmul(const v_float32x4& v, const v_float32x4& m0,
//! @}
//! @name Check SIMD support
//! @{
//! @brief Check CPU capability of SIMD operation
static
inline
bool
hasSIMD128
()
{
return
false
;
}
//! @}
}
#endif
modules/core/include/opencv2/core/hal/intrin_neon.hpp
View file @
bebd49d9
...
...
@@ -46,6 +46,7 @@
#define OPENCV_HAL_INTRIN_NEON_HPP
#include <algorithm>
#include "opencv2/core/utility.hpp"
namespace
cv
{
...
...
@@ -1216,6 +1217,16 @@ inline v_float16x4 v_cvt_f16(const v_float32x4& a)
}
#endif
//! @name Check SIMD support
//! @{
//! @brief Check CPU capability of SIMD operation
static
inline
bool
hasSIMD128
()
{
return
checkHardwareSupport
(
CV_CPU_NEON
);
}
//! @}
//! @endcond
}
...
...
modules/core/include/opencv2/core/hal/intrin_sse.hpp
View file @
bebd49d9
...
...
@@ -46,6 +46,7 @@
#define OPENCV_HAL_SSE_HPP
#include <algorithm>
#include "opencv2/core/utility.hpp"
#define CV_SIMD128 1
#define CV_SIMD128_64F 1
...
...
@@ -1726,6 +1727,16 @@ inline v_float16x4 v_cvt_f16(const v_float32x4& a)
}
#endif
//! @name Check SIMD support
//! @{
//! @brief Check CPU capability of SIMD operation
static
inline
bool
hasSIMD128
()
{
return
checkHardwareSupport
(
CV_CPU_SSE2
);
}
//! @}
//! @endcond
}
...
...
modules/core/src/arithm_simd.hpp
View file @
bebd49d9
...
...
@@ -1197,7 +1197,7 @@ template <>
struct
Div_SIMD
<
uchar
>
{
bool
haveSIMD
;
Div_SIMD
()
{
haveSIMD
=
checkHardwareSupport
(
CV_CPU_SSE2
)
||
checkHardwareSupport
(
CV_CPU_NEON
);
}
Div_SIMD
()
{
haveSIMD
=
hasSIMD128
(
);
}
int
operator
()
(
const
uchar
*
src1
,
const
uchar
*
src2
,
uchar
*
dst
,
int
width
,
double
scale
)
const
{
...
...
@@ -1243,7 +1243,7 @@ template <>
struct
Div_SIMD
<
schar
>
{
bool
haveSIMD
;
Div_SIMD
()
{
haveSIMD
=
checkHardwareSupport
(
CV_CPU_SSE2
)
||
checkHardwareSupport
(
CV_CPU_NEON
);
}
Div_SIMD
()
{
haveSIMD
=
hasSIMD128
(
);
}
int
operator
()
(
const
schar
*
src1
,
const
schar
*
src2
,
schar
*
dst
,
int
width
,
double
scale
)
const
{
...
...
@@ -1289,7 +1289,7 @@ template <>
struct
Div_SIMD
<
ushort
>
{
bool
haveSIMD
;
Div_SIMD
()
{
haveSIMD
=
checkHardwareSupport
(
CV_CPU_SSE2
)
||
checkHardwareSupport
(
CV_CPU_NEON
);
}
Div_SIMD
()
{
haveSIMD
=
hasSIMD128
(
);
}
int
operator
()
(
const
ushort
*
src1
,
const
ushort
*
src2
,
ushort
*
dst
,
int
width
,
double
scale
)
const
{
...
...
@@ -1334,7 +1334,7 @@ template <>
struct
Div_SIMD
<
short
>
{
bool
haveSIMD
;
Div_SIMD
()
{
haveSIMD
=
checkHardwareSupport
(
CV_CPU_SSE2
)
||
checkHardwareSupport
(
CV_CPU_NEON
);
}
Div_SIMD
()
{
haveSIMD
=
hasSIMD128
(
);
}
int
operator
()
(
const
short
*
src1
,
const
short
*
src2
,
short
*
dst
,
int
width
,
double
scale
)
const
{
...
...
@@ -1379,7 +1379,7 @@ template <>
struct
Div_SIMD
<
int
>
{
bool
haveSIMD
;
Div_SIMD
()
{
haveSIMD
=
checkHardwareSupport
(
CV_CPU_SSE2
)
||
checkHardwareSupport
(
CV_CPU_NEON
);
}
Div_SIMD
()
{
haveSIMD
=
hasSIMD128
(
);
}
int
operator
()
(
const
int
*
src1
,
const
int
*
src2
,
int
*
dst
,
int
width
,
double
scale
)
const
{
...
...
@@ -1423,7 +1423,7 @@ template <>
struct
Div_SIMD
<
float
>
{
bool
haveSIMD
;
Div_SIMD
()
{
haveSIMD
=
checkHardwareSupport
(
CV_CPU_SSE2
)
||
checkHardwareSupport
(
CV_CPU_NEON
);
}
Div_SIMD
()
{
haveSIMD
=
hasSIMD128
(
);
}
int
operator
()
(
const
float
*
src1
,
const
float
*
src2
,
float
*
dst
,
int
width
,
double
scale
)
const
{
...
...
@@ -1463,7 +1463,7 @@ template <>
struct
Recip_SIMD
<
uchar
>
{
bool
haveSIMD
;
Recip_SIMD
()
{
haveSIMD
=
checkHardwareSupport
(
CV_CPU_SSE2
)
||
checkHardwareSupport
(
CV_CPU_NEON
);
}
Recip_SIMD
()
{
haveSIMD
=
hasSIMD128
(
);
}
int
operator
()
(
const
uchar
*
src2
,
uchar
*
dst
,
int
width
,
double
scale
)
const
{
...
...
@@ -1504,7 +1504,7 @@ template <>
struct
Recip_SIMD
<
schar
>
{
bool
haveSIMD
;
Recip_SIMD
()
{
haveSIMD
=
checkHardwareSupport
(
CV_CPU_SSE2
)
||
checkHardwareSupport
(
CV_CPU_NEON
);
}
Recip_SIMD
()
{
haveSIMD
=
hasSIMD128
(
);
}
int
operator
()
(
const
schar
*
src2
,
schar
*
dst
,
int
width
,
double
scale
)
const
{
...
...
@@ -1545,7 +1545,7 @@ template <>
struct
Recip_SIMD
<
ushort
>
{
bool
haveSIMD
;
Recip_SIMD
()
{
haveSIMD
=
checkHardwareSupport
(
CV_CPU_SSE2
)
||
checkHardwareSupport
(
CV_CPU_NEON
);
}
Recip_SIMD
()
{
haveSIMD
=
hasSIMD128
(
);
}
int
operator
()
(
const
ushort
*
src2
,
ushort
*
dst
,
int
width
,
double
scale
)
const
{
...
...
@@ -1585,7 +1585,7 @@ template <>
struct
Recip_SIMD
<
short
>
{
bool
haveSIMD
;
Recip_SIMD
()
{
haveSIMD
=
checkHardwareSupport
(
CV_CPU_SSE2
)
||
checkHardwareSupport
(
CV_CPU_NEON
);
}
Recip_SIMD
()
{
haveSIMD
=
hasSIMD128
(
);
}
int
operator
()
(
const
short
*
src2
,
short
*
dst
,
int
width
,
double
scale
)
const
{
...
...
@@ -1625,7 +1625,7 @@ template <>
struct
Recip_SIMD
<
int
>
{
bool
haveSIMD
;
Recip_SIMD
()
{
haveSIMD
=
checkHardwareSupport
(
CV_CPU_SSE2
)
||
checkHardwareSupport
(
CV_CPU_NEON
);
}
Recip_SIMD
()
{
haveSIMD
=
hasSIMD128
(
);
}
int
operator
()
(
const
int
*
src2
,
int
*
dst
,
int
width
,
double
scale
)
const
{
...
...
@@ -1665,7 +1665,7 @@ template <>
struct
Recip_SIMD
<
float
>
{
bool
haveSIMD
;
Recip_SIMD
()
{
haveSIMD
=
checkHardwareSupport
(
CV_CPU_SSE2
)
||
checkHardwareSupport
(
CV_CPU_NEON
);
}
Recip_SIMD
()
{
haveSIMD
=
hasSIMD128
(
);
}
int
operator
()
(
const
float
*
src2
,
float
*
dst
,
int
width
,
double
scale
)
const
{
...
...
@@ -1702,7 +1702,7 @@ template <>
struct
Div_SIMD
<
double
>
{
bool
haveSIMD
;
Div_SIMD
()
{
haveSIMD
=
checkHardwareSupport
(
CV_CPU_SSE2
)
||
checkHardwareSupport
(
CV_CPU_NEON
);
}
Div_SIMD
()
{
haveSIMD
=
hasSIMD128
(
);
}
int
operator
()
(
const
double
*
src1
,
const
double
*
src2
,
double
*
dst
,
int
width
,
double
scale
)
const
{
...
...
@@ -1739,7 +1739,7 @@ template <>
struct
Recip_SIMD
<
double
>
{
bool
haveSIMD
;
Recip_SIMD
()
{
haveSIMD
=
checkHardwareSupport
(
CV_CPU_SSE2
)
||
checkHardwareSupport
(
CV_CPU_NEON
);
}
Recip_SIMD
()
{
haveSIMD
=
hasSIMD128
(
);
}
int
operator
()
(
const
double
*
src2
,
double
*
dst
,
int
width
,
double
scale
)
const
{
...
...
modules/imgproc/src/canny.cpp
View file @
bebd49d9
...
...
@@ -301,7 +301,7 @@ public:
void
operator
()(
const
Range
&
boundaries
)
const
{
#if CV_SIMD128
bool
haveSIMD
=
checkHardwareSupport
(
CV_CPU_SSE2
)
||
checkHardwareSupport
(
CV_CPU_NEON
);
bool
haveSIMD
=
hasSIMD128
(
);
#endif
const
int
type
=
src
.
type
(),
cn
=
CV_MAT_CN
(
type
);
...
...
@@ -709,7 +709,7 @@ public:
uchar
*
pdst
=
dst
.
ptr
()
+
(
ptrdiff_t
)(
dst
.
step
*
boundaries
.
start
);
#if CV_SIMD128
bool
haveSIMD
=
checkHardwareSupport
(
CV_CPU_SSE2
)
||
checkHardwareSupport
(
CV_CPU_NEON
);
bool
haveSIMD
=
hasSIMD128
(
);
#endif
for
(
int
i
=
boundaries
.
start
;
i
<
boundaries
.
end
;
i
++
,
pmap
+=
mapstep
,
pdst
+=
dst
.
step
)
...
...
@@ -962,7 +962,7 @@ static void CannyImpl(Mat& dx, Mat& dy, Mat& dst,
#define CANNY_POP(d) (d) = *--stack_top
#if CV_SIMD128
bool
haveSIMD
=
checkHardwareSupport
(
CV_CPU_SSE2
)
||
checkHardwareSupport
(
CV_CPU_NEON
);
bool
haveSIMD
=
hasSIMD128
(
);
#endif
// calculate magnitude and angle of gradient, perform non-maxima suppression.
...
...
modules/imgproc/src/spatialgradient.cpp
View file @
bebd49d9
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment