Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv_contrib
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_contrib
Commits
ee3ef107
Commit
ee3ef107
authored
Dec 25, 2019
by
Alexander Alekhin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
core(SIMD): allow to build modules with SIMD emulator
parent
91b39aa0
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
14 deletions
+19
-14
sparse_matching_gpc.cpp
modules/optflow/src/sparse_matching_gpc.cpp
+1
-0
learning_based_color_balance.cpp
modules/xphoto/src/learning_based_color_balance.cpp
+18
-14
No files found.
modules/optflow/src/sparse_matching_gpc.cpp
View file @
ee3ef107
...
...
@@ -41,6 +41,7 @@
//M*/
#include "precomp.hpp"
#undef CV_FORCE_SIMD128_CPP // mixed HAL SIMD/SSE code
#include "opencv2/core/core_c.h"
#include "opencv2/core/private.hpp"
#include "opencv2/flann/miniflann.hpp"
...
...
modules/xphoto/src/learning_based_color_balance.cpp
View file @
ee3ef107
...
...
@@ -262,26 +262,26 @@ void LearningBasedWBImpl::getAverageAndBrightestColorChromaticity(Vec2f &average
uint
sumB
=
0
,
sumG
=
0
,
sumR
=
0
;
uchar
*
src_ptr
=
src
.
ptr
<
uchar
>
();
#if CV_SIMD128
v_uint8x16
v_inB
,
v_inG
,
v_inR
,
v_mask
;
v_uint16x8
v_sR1
,
v_sR2
,
v_sG1
,
v_sG2
,
v_sB1
,
v_sB2
,
v_sum
;
v_uint16x8
v_max_sum
=
v_setall_u16
(
0
),
v_max_mask
,
v_brightestR
,
v_brightestG
,
v_brightestB
;
v_uint32x4
v_uint1
,
v_uint2
,
v_SB
=
v_setzero_u32
(),
v_SG
=
v_setzero_u32
(),
v_SR
=
v_setzero_u32
();
v_uint16x8
v_max_sum
=
v_setall_u16
(
0
),
v_brightestR
=
v_setall_u16
(
0
),
v_brightestG
=
v_setall_u16
(
0
),
v_brightestB
=
v_setall_u16
(
0
);
v_uint32x4
v_SB
=
v_setzero_u32
(),
v_SG
=
v_setzero_u32
(),
v_SR
=
v_setzero_u32
();
for
(;
i
<
src_len
-
15
;
i
+=
16
)
{
v_uint8x16
v_inB
,
v_inG
,
v_inR
;
v_load_deinterleave
(
src_ptr
+
3
*
i
,
v_inB
,
v_inG
,
v_inR
);
v_mask
=
v_load
(
mask_ptr
+
i
);
v_
uint8x16
v_
mask
=
v_load
(
mask_ptr
+
i
);
v_inB
&=
v_mask
;
v_inG
&=
v_mask
;
v_inR
&=
v_mask
;
v_uint16x8
v_sR1
,
v_sR2
,
v_sG1
,
v_sG2
,
v_sB1
,
v_sB2
;
v_expand
(
v_inB
,
v_sB1
,
v_sB2
);
v_expand
(
v_inG
,
v_sG1
,
v_sG2
);
v_expand
(
v_inR
,
v_sR1
,
v_sR2
);
// update the brightest (R,G,B) tuple (process left half):
v_sum
=
v_sB1
+
v_sG1
+
v_sR1
;
v_max_mask
=
(
v_sum
>
v_max_sum
);
v_
uint16x8
v_
sum
=
v_sB1
+
v_sG1
+
v_sR1
;
v_
uint16x8
v_
max_mask
=
(
v_sum
>
v_max_sum
);
v_max_sum
=
v_max
(
v_sum
,
v_max_sum
);
v_brightestB
=
(
v_sB1
&
v_max_mask
)
+
(
v_brightestB
&
(
~
v_max_mask
));
v_brightestG
=
(
v_sG1
&
v_max_mask
)
+
(
v_brightestG
&
(
~
v_max_mask
));
...
...
@@ -299,6 +299,8 @@ void LearningBasedWBImpl::getAverageAndBrightestColorChromaticity(Vec2f &average
v_sB1
=
v_sB1
+
v_sB2
;
v_sG1
=
v_sG1
+
v_sG2
;
v_sR1
=
v_sR1
+
v_sR2
;
v_uint32x4
v_uint1
,
v_uint2
;
v_expand
(
v_sB1
,
v_uint1
,
v_uint2
);
v_SB
+=
v_uint1
+
v_uint2
;
v_expand
(
v_sG1
,
v_uint1
,
v_uint2
);
...
...
@@ -351,27 +353,28 @@ void LearningBasedWBImpl::getAverageAndBrightestColorChromaticity(Vec2f &average
uint64
sumB
=
0
,
sumG
=
0
,
sumR
=
0
;
ushort
*
src_ptr
=
src
.
ptr
<
ushort
>
();
#if CV_SIMD128
v_uint16x8
v_inB
,
v_inG
,
v_inR
,
v_mask
,
v_mask_lower
=
v_setall_u16
(
255
);
v_uint32x4
v_iR1
,
v_iR2
,
v_iG1
,
v_iG2
,
v_iB1
,
v_iB2
,
v_sum
;
v_uint32x4
v_max_sum
=
v_setall_u32
(
0
),
v_max_mask
,
v_brightestR
,
v_brightestG
,
v_brightestB
;
v_uint64x2
v_uint64_1
,
v_uint64_2
,
v_SB
=
v_setzero_u64
(),
v_SG
=
v_setzero_u64
(),
v_SR
=
v_setzero_u64
();
const
v_uint16x8
v_mask_lower
=
v_setall_u16
(
255
);
v_uint32x4
v_max_sum
=
v_setall_u32
(
0
),
v_brightestR
=
v_setall_u32
(
0
),
v_brightestG
=
v_setall_u32
(
0
),
v_brightestB
=
v_setall_u32
(
0
);
v_uint64x2
v_SB
=
v_setzero_u64
(),
v_SG
=
v_setzero_u64
(),
v_SR
=
v_setzero_u64
();
for
(;
i
<
src_len
-
7
;
i
+=
8
)
{
v_uint16x8
v_inB
,
v_inG
,
v_inR
;
v_load_deinterleave
(
src_ptr
+
3
*
i
,
v_inB
,
v_inG
,
v_inR
);
v_mask
=
v_load_expand
(
mask_ptr
+
i
);
v_
uint16x8
v_
mask
=
v_load_expand
(
mask_ptr
+
i
);
v_mask
=
v_mask
|
((
v_mask
&
v_mask_lower
)
<<
8
);
v_inB
&=
v_mask
;
v_inG
&=
v_mask
;
v_inR
&=
v_mask
;
v_uint32x4
v_iR1
,
v_iR2
,
v_iG1
,
v_iG2
,
v_iB1
,
v_iB2
;
v_expand
(
v_inB
,
v_iB1
,
v_iB2
);
v_expand
(
v_inG
,
v_iG1
,
v_iG2
);
v_expand
(
v_inR
,
v_iR1
,
v_iR2
);
// update the brightest (R,G,B) tuple (process left half):
v_sum
=
v_iB1
+
v_iG1
+
v_iR1
;
v_max_mask
=
(
v_sum
>
v_max_sum
);
v_
uint32x4
v_
sum
=
v_iB1
+
v_iG1
+
v_iR1
;
v_
uint32x4
v_
max_mask
=
(
v_sum
>
v_max_sum
);
v_max_sum
=
v_max
(
v_sum
,
v_max_sum
);
v_brightestB
=
(
v_iB1
&
v_max_mask
)
+
(
v_brightestB
&
(
~
v_max_mask
));
v_brightestG
=
(
v_iG1
&
v_max_mask
)
+
(
v_brightestG
&
(
~
v_max_mask
));
...
...
@@ -389,6 +392,7 @@ void LearningBasedWBImpl::getAverageAndBrightestColorChromaticity(Vec2f &average
v_iB1
=
v_iB1
+
v_iB2
;
v_iG1
=
v_iG1
+
v_iG2
;
v_iR1
=
v_iR1
+
v_iR2
;
v_uint64x2
v_uint64_1
,
v_uint64_2
;
v_expand
(
v_iB1
,
v_uint64_1
,
v_uint64_2
);
v_SB
+=
v_uint64_1
+
v_uint64_2
;
v_expand
(
v_iG1
,
v_uint64_1
,
v_uint64_2
);
...
...
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