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
e2b86974
Commit
e2b86974
authored
Jul 03, 2014
by
Ilya Lavrenov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SSE2 optimization of cv::patchNaNs
parent
964b2609
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
2 deletions
+23
-2
mathfuncs.cpp
modules/core/src/mathfuncs.cpp
+23
-2
No files found.
modules/core/src/mathfuncs.cpp
View file @
e2b86974
...
@@ -2543,12 +2543,33 @@ void patchNaNs( InputOutputArray _a, double _val )
...
@@ -2543,12 +2543,33 @@ void patchNaNs( InputOutputArray _a, double _val )
NAryMatIterator
it
(
arrays
,
(
uchar
**
)
ptrs
);
NAryMatIterator
it
(
arrays
,
(
uchar
**
)
ptrs
);
size_t
len
=
it
.
size
*
a
.
channels
();
size_t
len
=
it
.
size
*
a
.
channels
();
Cv32suf
val
;
Cv32suf
val
;
val
.
f
=
(
float
)
_val
;
float
fval
=
(
float
)
_val
;
val
.
f
=
fval
;
#if CV_SSE2
__m128i
v_mask1
=
_mm_set1_epi32
(
0x7fffffff
),
v_mask2
=
_mm_set1_epi32
(
0x7f800000
);
__m128i
v_val
=
_mm_set1_epi32
(
val
.
i
);
#endif
for
(
size_t
i
=
0
;
i
<
it
.
nplanes
;
i
++
,
++
it
)
for
(
size_t
i
=
0
;
i
<
it
.
nplanes
;
i
++
,
++
it
)
{
{
int
*
tptr
=
ptrs
[
0
];
int
*
tptr
=
ptrs
[
0
];
for
(
size_t
j
=
0
;
j
<
len
;
j
++
)
size_t
j
=
0
;
#if CV_SSE2
if
(
USE_SSE2
)
{
for
(
;
j
<
len
;
j
+=
4
)
{
__m128i
v_src
=
_mm_loadu_si128
((
__m128i
const
*
)(
tptr
+
j
));
__m128i
v_cmp_mask
=
_mm_cmplt_epi32
(
v_mask2
,
_mm_and_si128
(
v_src
,
v_mask1
));
__m128i
v_res
=
_mm_or_si128
(
_mm_andnot_si128
(
v_cmp_mask
,
v_src
),
_mm_and_si128
(
v_cmp_mask
,
v_val
));
_mm_storeu_si128
((
__m128i
*
)(
tptr
+
j
),
v_res
);
}
}
#endif
for
(
;
j
<
len
;
j
++
)
if
(
(
tptr
[
j
]
&
0x7fffffff
)
>
0x7f800000
)
if
(
(
tptr
[
j
]
&
0x7fffffff
)
>
0x7f800000
)
tptr
[
j
]
=
val
.
i
;
tptr
[
j
]
=
val
.
i
;
}
}
...
...
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