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
2c39f0ee
Commit
2c39f0ee
authored
Oct 26, 2010
by
Vladislav Vinogradov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix unnecessary memory allocation in gpu::magnitude and gpu::phase
parent
d0a4352e
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
16 deletions
+18
-16
gpu.hpp
modules/gpu/include/opencv2/gpu/gpu.hpp
+1
-1
arithm.cpp
modules/gpu/src/arithm.cpp
+15
-13
arithm.cpp
tests/gpu/src/arithm.cpp
+2
-2
No files found.
modules/gpu/include/opencv2/gpu/gpu.hpp
View file @
2c39f0ee
...
...
@@ -557,7 +557,7 @@ namespace cv
//! computes the integral image and integral for the squared image
//! sum will have CV_32S type, sqsum - CV32F type
//! supports only CV_
32F
C1 source type
//! supports only CV_
8U
C1 source type
CV_EXPORTS
void
integral
(
GpuMat
&
src
,
GpuMat
&
sum
,
GpuMat
&
sqsum
);
//! computes the standard deviation of integral images
...
...
modules/gpu/src/arithm.cpp
View file @
2c39f0ee
...
...
@@ -660,18 +660,20 @@ namespace cv { namespace gpu { namespace mathfunc
namespace
{
inline
void
cartToPolar_caller
(
const
GpuMat
&
x
,
const
GpuMat
&
y
,
GpuMat
&
mag
,
bool
magSqr
,
GpuMat
&
angle
,
bool
angleInDegrees
,
cudaStream_t
stream
)
inline
void
cartToPolar_caller
(
const
GpuMat
&
x
,
const
GpuMat
&
y
,
GpuMat
*
mag
,
bool
magSqr
,
GpuMat
*
angle
,
bool
angleInDegrees
,
cudaStream_t
stream
)
{
CV_DbgAssert
(
x
.
size
()
==
y
.
size
()
&&
x
.
type
()
==
y
.
type
());
CV_Assert
(
x
.
depth
()
==
CV_32F
);
mag
.
create
(
x
.
size
(),
x
.
type
());
angle
.
create
(
x
.
size
(),
x
.
type
());
if
(
mag
)
mag
->
create
(
x
.
size
(),
x
.
type
());
if
(
angle
)
angle
->
create
(
x
.
size
(),
x
.
type
());
GpuMat
x1cn
=
x
.
reshape
(
1
);
GpuMat
y1cn
=
y
.
reshape
(
1
);
GpuMat
mag1cn
=
mag
.
reshape
(
1
);
GpuMat
angle1cn
=
angle
.
reshape
(
1
);
GpuMat
mag1cn
=
mag
?
mag
->
reshape
(
1
)
:
GpuMat
(
);
GpuMat
angle1cn
=
angle
?
angle
->
reshape
(
1
)
:
GpuMat
(
);
mathfunc
::
cartToPolar_gpu
(
x1cn
,
y1cn
,
mag1cn
,
magSqr
,
angle1cn
,
angleInDegrees
,
stream
);
}
...
...
@@ -695,42 +697,42 @@ namespace
void
cv
::
gpu
::
magnitude
(
const
GpuMat
&
x
,
const
GpuMat
&
y
,
GpuMat
&
dst
)
{
::
cartToPolar_caller
(
x
,
y
,
dst
,
false
,
GpuMat
()
,
false
,
0
);
::
cartToPolar_caller
(
x
,
y
,
&
dst
,
false
,
0
,
false
,
0
);
}
void
cv
::
gpu
::
magnitude
(
const
GpuMat
&
x
,
const
GpuMat
&
y
,
GpuMat
&
dst
,
const
Stream
&
stream
)
{
::
cartToPolar_caller
(
x
,
y
,
dst
,
false
,
GpuMat
()
,
false
,
StreamAccessor
::
getStream
(
stream
));
::
cartToPolar_caller
(
x
,
y
,
&
dst
,
false
,
0
,
false
,
StreamAccessor
::
getStream
(
stream
));
}
void
cv
::
gpu
::
magnitudeSqr
(
const
GpuMat
&
x
,
const
GpuMat
&
y
,
GpuMat
&
dst
)
{
::
cartToPolar_caller
(
x
,
y
,
dst
,
true
,
GpuMat
()
,
false
,
0
);
::
cartToPolar_caller
(
x
,
y
,
&
dst
,
true
,
0
,
false
,
0
);
}
void
cv
::
gpu
::
magnitudeSqr
(
const
GpuMat
&
x
,
const
GpuMat
&
y
,
GpuMat
&
dst
,
const
Stream
&
stream
)
{
::
cartToPolar_caller
(
x
,
y
,
dst
,
true
,
GpuMat
()
,
false
,
StreamAccessor
::
getStream
(
stream
));
::
cartToPolar_caller
(
x
,
y
,
&
dst
,
true
,
0
,
false
,
StreamAccessor
::
getStream
(
stream
));
}
void
cv
::
gpu
::
phase
(
const
GpuMat
&
x
,
const
GpuMat
&
y
,
GpuMat
&
angle
,
bool
angleInDegrees
)
{
::
cartToPolar_caller
(
x
,
y
,
GpuMat
(),
false
,
angle
,
angleInDegrees
,
0
);
::
cartToPolar_caller
(
x
,
y
,
0
,
false
,
&
angle
,
angleInDegrees
,
0
);
}
void
cv
::
gpu
::
phase
(
const
GpuMat
&
x
,
const
GpuMat
&
y
,
GpuMat
&
angle
,
bool
angleInDegrees
,
const
Stream
&
stream
)
{
::
cartToPolar_caller
(
x
,
y
,
GpuMat
(),
false
,
angle
,
angleInDegrees
,
StreamAccessor
::
getStream
(
stream
));
::
cartToPolar_caller
(
x
,
y
,
0
,
false
,
&
angle
,
angleInDegrees
,
StreamAccessor
::
getStream
(
stream
));
}
void
cv
::
gpu
::
cartToPolar
(
const
GpuMat
&
x
,
const
GpuMat
&
y
,
GpuMat
&
mag
,
GpuMat
&
angle
,
bool
angleInDegrees
)
{
::
cartToPolar_caller
(
x
,
y
,
mag
,
false
,
angle
,
angleInDegrees
,
0
);
::
cartToPolar_caller
(
x
,
y
,
&
mag
,
false
,
&
angle
,
angleInDegrees
,
0
);
}
void
cv
::
gpu
::
cartToPolar
(
const
GpuMat
&
x
,
const
GpuMat
&
y
,
GpuMat
&
mag
,
GpuMat
&
angle
,
bool
angleInDegrees
,
const
Stream
&
stream
)
{
::
cartToPolar_caller
(
x
,
y
,
mag
,
false
,
angle
,
angleInDegrees
,
StreamAccessor
::
getStream
(
stream
));
::
cartToPolar_caller
(
x
,
y
,
&
mag
,
false
,
&
angle
,
angleInDegrees
,
StreamAccessor
::
getStream
(
stream
));
}
void
cv
::
gpu
::
polarToCart
(
const
GpuMat
&
magnitude
,
const
GpuMat
&
angle
,
GpuMat
&
x
,
GpuMat
&
y
,
bool
angleInDegrees
)
...
...
tests/gpu/src/arithm.cpp
View file @
2c39f0ee
...
...
@@ -620,12 +620,12 @@ struct CV_GpuNppImagePhaseTest : public CV_GpuArithmTest
}
cv
::
Mat
cpuRes
;
cv
::
phase
(
mat1
,
mat2
,
cpuRes
);
cv
::
phase
(
mat1
,
mat2
,
cpuRes
,
true
);
GpuMat
gpu1
(
mat1
);
GpuMat
gpu2
(
mat2
);
GpuMat
gpuRes
;
cv
::
gpu
::
phase
(
gpu1
,
gpu2
,
gpuRes
);
cv
::
gpu
::
phase
(
gpu1
,
gpu2
,
gpuRes
,
true
);
return
CheckNorm
(
cpuRes
,
gpuRes
);
}
...
...
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