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
1c9f4e7c
Commit
1c9f4e7c
authored
May 10, 2011
by
Vladislav Vinogradov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed gpu::meanStdDev and gpu::norm under CUDA 4.0
fixed compilation under Win64
parent
7ec77593
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
42 additions
and
5 deletions
+42
-5
matrix_operations.cpp
modules/gpu/src/matrix_operations.cpp
+5
-5
matrix_reductions.cpp
modules/gpu/src/matrix_reductions.cpp
+37
-0
No files found.
modules/gpu/src/matrix_operations.cpp
View file @
1c9f4e7c
...
...
@@ -596,11 +596,11 @@ bool cv::gpu::CudaMem::canMapHostMemory()
namespace
{
int
alignUp
(
int
what
,
in
t
alignment
)
size_t
alignUpStep
(
size_t
what
,
size_
t
alignment
)
{
in
t
alignMask
=
alignment
-
1
;
in
t
inverseAlignMask
=
~
alignMask
;
in
t
res
=
(
what
+
alignMask
)
&
inverseAlignMask
;
size_
t
alignMask
=
alignment
-
1
;
size_
t
inverseAlignMask
=
~
alignMask
;
size_
t
res
=
(
what
+
alignMask
)
&
inverseAlignMask
;
return
res
;
}
}
...
...
@@ -626,7 +626,7 @@ void cv::gpu::CudaMem::create(int _rows, int _cols, int _type, int _alloc_type)
{
cudaDeviceProp
prop
;
cudaSafeCall
(
cudaGetDeviceProperties
(
&
prop
,
getDevice
())
);
step
=
alignUp
(
step
,
prop
.
textureAlignment
);
step
=
alignUp
Step
(
step
,
prop
.
textureAlignment
);
}
int64
_nettosize
=
(
int64
)
step
*
rows
;
size_t
nettosize
=
(
size_t
)
_nettosize
;
...
...
modules/gpu/src/matrix_reductions.cpp
View file @
1c9f4e7c
...
...
@@ -78,9 +78,28 @@ void cv::gpu::meanStdDev(const GpuMat& src, Scalar& mean, Scalar& stddev)
sz
.
width
=
src
.
cols
;
sz
.
height
=
src
.
rows
;
#if NPP_VERSION_MAJOR >= 4
GpuMat
d_buf
(
1
,
2
,
CV_64F
);
nppSafeCall
(
nppiMean_StdDev_8u_C1R
(
src
.
ptr
<
Npp8u
>
(),
src
.
step
,
sz
,
d_buf
.
ptr
<
double
>
(),
d_buf
.
ptr
<
double
>
()
+
1
)
);
cudaSafeCall
(
cudaThreadSynchronize
()
);
double
buf
[
2
];
Mat
_buf
(
1
,
2
,
CV_64F
,
buf
);
d_buf
.
download
(
_buf
);
mean
[
0
]
=
buf
[
0
];
stddev
[
0
]
=
buf
[
1
];
#else
nppSafeCall
(
nppiMean_StdDev_8u_C1R
(
src
.
ptr
<
Npp8u
>
(),
src
.
step
,
sz
,
mean
.
val
,
stddev
.
val
)
);
cudaSafeCall
(
cudaThreadSynchronize
()
);
#endif
}
...
...
@@ -131,14 +150,32 @@ double cv::gpu::norm(const GpuMat& src1, const GpuMat& src2, int normType)
sz
.
height
=
src1
.
rows
;
int
funcIdx
=
normType
>>
1
;
#if NPP_VERSION_MAJOR >= 4
GpuMat
d_buf
(
1
,
1
,
CV_64F
);
nppSafeCall
(
npp_norm_diff_func
[
funcIdx
](
src1
.
ptr
<
Npp8u
>
(),
src1
.
step
,
src2
.
ptr
<
Npp8u
>
(),
src2
.
step
,
sz
,
d_buf
.
ptr
<
double
>
())
);
cudaSafeCall
(
cudaThreadSynchronize
()
);
double
retVal
;
Mat
_buf
(
1
,
1
,
CV_64F
,
&
retVal
);
d_buf
.
download
(
_buf
);
#else
double
retVal
;
nppSafeCall
(
npp_norm_diff_func
[
funcIdx
](
src1
.
ptr
<
Npp8u
>
(),
src1
.
step
,
src2
.
ptr
<
Npp8u
>
(),
src2
.
step
,
sz
,
&
retVal
)
);
cudaSafeCall
(
cudaThreadSynchronize
()
);
#endif
return
retVal
;
}
...
...
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