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
ed38ca51
Commit
ed38ca51
authored
Jun 30, 2015
by
Seon-Wook Park
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
spatialGradient: Remove 4 loads in inner loop
parent
5dddb478
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
5 deletions
+15
-5
spatialgradient.cpp
modules/imgproc/src/spatialgradient.cpp
+15
-5
No files found.
modules/imgproc/src/spatialgradient.cpp
View file @
ed38ca51
...
...
@@ -157,13 +157,18 @@ void spatialGradient( InputArray _src, OutputArray _dx, OutputArray _dy,
n_dx
=
dx
.
ptr
<
short
>
(
i
+
1
);
n_dy
=
dy
.
ptr
<
short
>
(
i
+
1
);
v_uint8x16
v_select_m
=
v_uint8x16
(
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0
,
0xFF
);
// Process rest of columns 16-column chunks at a time
for
(
j
=
1
;
j
<
W
-
16
;
j
+=
16
)
{
// Load top row for 3x3 Sobel filter
v_uint8x16
v_um
=
v_load
(
&
p_src
[
j
-
1
]);
v_uint8x16
v_un
=
v_load
(
&
p_src
[
j
]);
v_uint8x16
v_up
=
v_load
(
&
p_src
[
j
+
1
]);
// TODO: Replace _mm_slli_si128 with hal method
v_uint8x16
v_un
=
v_select
(
v_select_m
,
v_uint8x16
(
_mm_slli_si128
(
v_up
.
val
,
1
)),
v_uint8x16
(
_mm_srli_si128
(
v_um
.
val
,
1
)));
v_uint16x8
v_um1
,
v_um2
,
v_un1
,
v_un2
,
v_up1
,
v_up2
;
v_expand
(
v_um
,
v_um1
,
v_um2
);
v_expand
(
v_un
,
v_un1
,
v_un2
);
...
...
@@ -177,8 +182,10 @@ void spatialGradient( InputArray _src, OutputArray _dx, OutputArray _dy,
// Load second row for 3x3 Sobel filter
v_um
=
v_load
(
&
c_src
[
j
-
1
]);
v_un
=
v_load
(
&
c_src
[
j
]);
v_up
=
v_load
(
&
c_src
[
j
+
1
]);
// TODO: Replace _mm_slli_si128 with hal method
v_un
=
v_select
(
v_select_m
,
v_uint8x16
(
_mm_slli_si128
(
v_up
.
val
,
1
)),
v_uint8x16
(
_mm_srli_si128
(
v_um
.
val
,
1
)));
v_expand
(
v_um
,
v_um1
,
v_um2
);
v_expand
(
v_un
,
v_un1
,
v_un2
);
v_expand
(
v_up
,
v_up1
,
v_up2
);
...
...
@@ -191,8 +198,10 @@ void spatialGradient( InputArray _src, OutputArray _dx, OutputArray _dy,
// Load third row for 3x3 Sobel filter
v_um
=
v_load
(
&
n_src
[
j
-
1
]);
v_un
=
v_load
(
&
n_src
[
j
]);
v_up
=
v_load
(
&
n_src
[
j
+
1
]);
// TODO: Replace _mm_slli_si128 with hal method
v_un
=
v_select
(
v_select_m
,
v_uint8x16
(
_mm_slli_si128
(
v_up
.
val
,
1
)),
v_uint8x16
(
_mm_srli_si128
(
v_um
.
val
,
1
)));
v_expand
(
v_um
,
v_um1
,
v_um2
);
v_expand
(
v_un
,
v_un1
,
v_un2
);
v_expand
(
v_up
,
v_up1
,
v_up2
);
...
...
@@ -224,9 +233,10 @@ void spatialGradient( InputArray _src, OutputArray _dx, OutputArray _dy,
// Load fourth row for 3x3 Sobel filter
v_um
=
v_load
(
&
m_src
[
j
-
1
]);
v_un
=
v_load
(
&
m_src
[
j
]);
v_up
=
v_load
(
&
m_src
[
j
+
1
]);
// TODO: Replace _mm_slli_si128 with hal method
v_un
=
v_select
(
v_select_m
,
v_uint8x16
(
_mm_slli_si128
(
v_up
.
val
,
1
)),
v_uint8x16
(
_mm_srli_si128
(
v_um
.
val
,
1
)));
v_expand
(
v_um
,
v_um1
,
v_um2
);
v_expand
(
v_un
,
v_un1
,
v_un2
);
v_expand
(
v_up
,
v_up1
,
v_up2
);
...
...
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