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
e320d7dd
Commit
e320d7dd
authored
Oct 31, 2016
by
MambaWong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Accelerating convolution by changing the way of memory access.
parent
483d523c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
14 deletions
+24
-14
dpm_convolution.cpp
modules/dpm/src/dpm_convolution.cpp
+24
-14
No files found.
modules/dpm/src/dpm_convolution.cpp
View file @
e320d7dd
...
@@ -49,11 +49,15 @@ double ConvolutionEngine::convolve(const Mat &feat, const Mat &filter,
...
@@ -49,11 +49,15 @@ double ConvolutionEngine::convolve(const Mat &feat, const Mat &filter,
int
dimHOG
,
int
x
,
int
y
)
int
dimHOG
,
int
x
,
int
y
)
{
{
double
val
=
0
;
double
val
=
0
;
for
(
int
xp
=
0
;
xp
<
filter
.
cols
;
x
p
++
)
for
(
int
yp
=
0
;
yp
<
filter
.
rows
;
y
p
++
)
{
{
for
(
int
yp
=
0
;
yp
<
filter
.
rows
;
yp
++
)
const
double
*
pfeat
=
(
double
*
)
feat
.
ptr
(
y
+
yp
)
+
x
*
dimHOG
;
val
+=
filter
.
at
<
double
>
(
yp
,
xp
)
const
double
*
pfilter
=
(
double
*
)
filter
.
ptr
(
yp
);
*
feat
.
at
<
double
>
(
y
+
yp
,
x
*
dimHOG
+
xp
);
for
(
int
xp
=
0
;
xp
<
filter
.
cols
;
xp
++
)
{
val
+=
pfeat
[
xp
]
*
pfilter
[
xp
];
}
}
}
return
val
;
return
val
;
...
@@ -62,20 +66,26 @@ double ConvolutionEngine::convolve(const Mat &feat, const Mat &filter,
...
@@ -62,20 +66,26 @@ double ConvolutionEngine::convolve(const Mat &feat, const Mat &filter,
void
ConvolutionEngine
::
convolve
(
const
Mat
&
feat
,
const
Mat
&
filter
,
void
ConvolutionEngine
::
convolve
(
const
Mat
&
feat
,
const
Mat
&
filter
,
int
dimHOG
,
Mat
&
result
)
int
dimHOG
,
Mat
&
result
)
{
{
for
(
int
x
=
0
;
x
<
result
.
cols
;
x
++
)
for
(
int
y
=
0
;
y
<
result
.
rows
;
y
++
)
{
{
for
(
int
y
=
0
;
y
<
result
.
rows
;
y
++
)
double
*
presult
=
(
double
*
)
result
.
ptr
(
y
);
for
(
int
x
=
0
;
x
<
result
.
cols
;
x
++
)
{
{
double
val
=
0
;
double
val
=
0
;
for
(
int
xp
=
0
;
xp
<
filter
.
cols
;
x
p
++
)
for
(
int
yp
=
0
;
yp
<
filter
.
rows
;
y
p
++
)
{
{
for
(
int
yp
=
0
;
yp
<
filter
.
rows
;
yp
++
)
const
double
*
pfeat
=
(
double
*
)
feat
.
ptr
(
y
+
yp
)
+
x
*
dimHOG
;
val
+=
feat
.
at
<
double
>
(
y
+
yp
,
x
*
dimHOG
+
xp
)
const
double
*
pfilter
=
(
double
*
)
filter
.
ptr
(
yp
);
*
filter
.
at
<
double
>
(
yp
,
xp
);
}
// xp
for
(
int
xp
=
0
;
xp
<
filter
.
cols
;
xp
++
)
result
.
at
<
double
>
(
y
,
x
)
=
val
;
{
}
// y
val
+=
pfeat
[
xp
]
*
pfilter
[
xp
];
}
// x
}
}
// yp
presult
[
x
]
=
val
;
}
// x
}
// y
}
}
}
// namespace cv
}
// namespace cv
}
// namespace dpm
}
// namespace dpm
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