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
12999416
Commit
12999416
authored
May 31, 2011
by
Leonid Beynenson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Made small optimization: for some processors using float accumulator gives speedup.
parent
6aabf72b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
0 deletions
+23
-0
cascadedetect.cpp
modules/objdetect/src/cascadedetect.cpp
+23
-0
No files found.
modules/objdetect/src/cascadedetect.cpp
View file @
12999416
...
@@ -982,24 +982,47 @@ inline int predictCategoricalStump( CascadeClassifier& cascade, Ptr<FeatureEvalu
...
@@ -982,24 +982,47 @@ inline int predictCategoricalStump( CascadeClassifier& cascade, Ptr<FeatureEvalu
CascadeClassifier
::
Data
::
DTreeNode
*
cascadeNodes
=
&
cascade
.
data
.
nodes
[
0
];
CascadeClassifier
::
Data
::
DTreeNode
*
cascadeNodes
=
&
cascade
.
data
.
nodes
[
0
];
CascadeClassifier
::
Data
::
Stage
*
cascadeStages
=
&
cascade
.
data
.
stages
[
0
];
CascadeClassifier
::
Data
::
Stage
*
cascadeStages
=
&
cascade
.
data
.
stages
[
0
];
#ifdef HAVE_TEGRA_OPTIMIZATION
float
tmp
;
// float accumulator -- float operations are quicker
#endif
for
(
int
si
=
0
;
si
<
nstages
;
si
++
)
for
(
int
si
=
0
;
si
<
nstages
;
si
++
)
{
{
CascadeClassifier
::
Data
::
Stage
&
stage
=
cascadeStages
[
si
];
CascadeClassifier
::
Data
::
Stage
&
stage
=
cascadeStages
[
si
];
int
wi
,
ntrees
=
stage
.
ntrees
;
int
wi
,
ntrees
=
stage
.
ntrees
;
#ifdef HAVE_TEGRA_OPTIMIZATION
tmp
=
0
;
#else
sum
=
0
;
sum
=
0
;
#endif
for
(
wi
=
0
;
wi
<
ntrees
;
wi
++
)
for
(
wi
=
0
;
wi
<
ntrees
;
wi
++
)
{
{
CascadeClassifier
::
Data
::
DTreeNode
&
node
=
cascadeNodes
[
nodeOfs
];
CascadeClassifier
::
Data
::
DTreeNode
&
node
=
cascadeNodes
[
nodeOfs
];
int
c
=
featureEvaluator
(
node
.
featureIdx
);
int
c
=
featureEvaluator
(
node
.
featureIdx
);
const
int
*
subset
=
&
cascadeSubsets
[
nodeOfs
*
subsetSize
];
const
int
*
subset
=
&
cascadeSubsets
[
nodeOfs
*
subsetSize
];
#ifdef HAVE_TEGRA_OPTIMIZATION
tmp
+=
cascadeLeaves
[
subset
[
c
>>
5
]
&
(
1
<<
(
c
&
31
))
?
leafOfs
:
leafOfs
+
1
];
#else
sum
+=
cascadeLeaves
[
subset
[
c
>>
5
]
&
(
1
<<
(
c
&
31
))
?
leafOfs
:
leafOfs
+
1
];
sum
+=
cascadeLeaves
[
subset
[
c
>>
5
]
&
(
1
<<
(
c
&
31
))
?
leafOfs
:
leafOfs
+
1
];
#endif
nodeOfs
++
;
nodeOfs
++
;
leafOfs
+=
2
;
leafOfs
+=
2
;
}
}
#ifdef HAVE_TEGRA_OPTIMIZATION
if
(
tmp
<
stage
.
threshold
)
{
sum
=
(
double
)
tmp
;
return
-
si
;
}
#else
if
(
sum
<
stage
.
threshold
)
if
(
sum
<
stage
.
threshold
)
return
-
si
;
return
-
si
;
#endif
}
}
#ifdef HAVE_TEGRA_OPTIMIZATION
sum
=
(
double
)
tmp
;
#endif
return
1
;
return
1
;
}
}
...
...
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