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
f8aba860
Commit
f8aba860
authored
Jan 30, 2012
by
Vladislav Vinogradov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed build under CUDA 4.1
parent
7ddb706b
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
79 additions
and
28 deletions
+79
-28
element_operations.cpp
modules/gpu/src/element_operations.cpp
+35
-28
graphcuts.cpp
modules/gpu/src/graphcuts.cpp
+10
-0
imgproc.cpp
modules/gpu/src/imgproc.cpp
+26
-0
matrix_reductions.cpp
modules/gpu/src/matrix_reductions.cpp
+8
-0
No files found.
modules/gpu/src/element_operations.cpp
View file @
f8aba860
...
...
@@ -680,6 +680,7 @@ void cv::gpu::absdiff(const GpuMat& src1, const GpuMat& src2, GpuMat& dst, Strea
bool
aligned
=
isAligned
(
src1
.
data
,
16
)
&&
isAligned
(
src2
.
data
,
16
)
&&
isAligned
(
dst
.
data
,
16
);
#if CUDART_VERSION == 4000
if
(
aligned
&&
src1
.
depth
()
==
CV_8U
&&
(
src1
.
cols
*
src1
.
channels
())
%
4
==
0
)
{
NppStreamHandler
h
(
stream
);
...
...
@@ -692,42 +693,48 @@ void cv::gpu::absdiff(const GpuMat& src1, const GpuMat& src2, GpuMat& dst, Strea
if
(
stream
==
0
)
cudaSafeCall
(
cudaDeviceSynchronize
()
);
}
else
if
(
aligned
&&
src1
.
depth
()
==
CV_8U
)
else
#endif
{
NppStreamHandler
h
(
stream
);
if
(
aligned
&&
src1
.
depth
()
==
CV_8U
)
{
NppStreamHandler
h
(
stream
);
nppSafeCall
(
nppiAbsDiff_8u_C1R
(
src1
.
ptr
<
Npp8u
>
(),
static_cast
<
int
>
(
src1
.
step
),
src2
.
ptr
<
Npp8u
>
(),
static_cast
<
int
>
(
src2
.
step
),
dst
.
ptr
<
Npp8u
>
(),
static_cast
<
int
>
(
dst
.
step
),
sz
)
);
nppSafeCall
(
nppiAbsDiff_8u_C1R
(
src1
.
ptr
<
Npp8u
>
(),
static_cast
<
int
>
(
src1
.
step
),
src2
.
ptr
<
Npp8u
>
(),
static_cast
<
int
>
(
src2
.
step
),
dst
.
ptr
<
Npp8u
>
(),
static_cast
<
int
>
(
dst
.
step
),
sz
)
);
if
(
stream
==
0
)
cudaSafeCall
(
cudaDeviceSynchronize
()
);
}
else
if
(
aligned
&&
src1
.
depth
()
==
CV_32S
)
{
NppStreamHandler
h
(
stream
);
if
(
stream
==
0
)
cudaSafeCall
(
cudaDeviceSynchronize
()
);
}
#if CUDART_VERSION == 4000
else
if
(
aligned
&&
src1
.
depth
()
==
CV_32S
)
{
NppStreamHandler
h
(
stream
);
nppSafeCall
(
nppiAbsDiff_32s_C1R
(
src1
.
ptr
<
Npp32s
>
(),
static_cast
<
int
>
(
src1
.
step
),
src2
.
ptr
<
Npp32s
>
(),
static_cast
<
int
>
(
src2
.
step
),
dst
.
ptr
<
Npp32s
>
(),
static_cast
<
int
>
(
dst
.
step
),
sz
)
);
nppSafeCall
(
nppiAbsDiff_32s_C1R
(
src1
.
ptr
<
Npp32s
>
(),
static_cast
<
int
>
(
src1
.
step
),
src2
.
ptr
<
Npp32s
>
(),
static_cast
<
int
>
(
src2
.
step
),
dst
.
ptr
<
Npp32s
>
(),
static_cast
<
int
>
(
dst
.
step
),
sz
)
);
if
(
stream
==
0
)
cudaSafeCall
(
cudaDeviceSynchronize
()
);
}
else
if
(
aligned
&&
src1
.
depth
()
==
CV_32F
)
{
NppStreamHandler
h
(
stream
);
if
(
stream
==
0
)
cudaSafeCall
(
cudaDeviceSynchronize
()
);
}
#endif
else
if
(
aligned
&&
src1
.
depth
()
==
CV_32F
)
{
NppStreamHandler
h
(
stream
);
nppSafeCall
(
nppiAbsDiff_32f_C1R
(
src1
.
ptr
<
Npp32f
>
(),
static_cast
<
int
>
(
src1
.
step
),
src2
.
ptr
<
Npp32f
>
(),
static_cast
<
int
>
(
src2
.
step
),
dst
.
ptr
<
Npp32f
>
(),
static_cast
<
int
>
(
dst
.
step
),
sz
)
);
nppSafeCall
(
nppiAbsDiff_32f_C1R
(
src1
.
ptr
<
Npp32f
>
(),
static_cast
<
int
>
(
src1
.
step
),
src2
.
ptr
<
Npp32f
>
(),
static_cast
<
int
>
(
src2
.
step
),
dst
.
ptr
<
Npp32f
>
(),
static_cast
<
int
>
(
dst
.
step
),
sz
)
);
if
(
stream
==
0
)
cudaSafeCall
(
cudaDeviceSynchronize
()
);
}
else
{
const
func_t
func
=
funcs
[
src1
.
depth
()];
CV_Assert
(
func
!=
0
);
if
(
stream
==
0
)
cudaSafeCall
(
cudaDeviceSynchronize
()
);
}
else
{
const
func_t
func
=
funcs
[
src1
.
depth
()];
CV_Assert
(
func
!=
0
);
func
(
src1
.
reshape
(
1
),
src2
.
reshape
(
1
),
dst
.
reshape
(
1
),
stream
);
func
(
src1
.
reshape
(
1
),
src2
.
reshape
(
1
),
dst
.
reshape
(
1
),
stream
);
}
}
}
...
...
modules/gpu/src/graphcuts.cpp
View file @
f8aba860
...
...
@@ -77,8 +77,18 @@ void cv::gpu::graphcut(GpuMat& terminals, GpuMat& leftTransp, GpuMat& rightTrans
NppStreamHandler
h
(
stream
);
#if CUDART_VERSION > 4000
NppiGraphcutState
*
pState
;
nppSafeCall
(
nppiGraphcutInitAlloc
(
sznpp
,
&
pState
,
buf
.
ptr
<
Npp8u
>
())
);
nppSafeCall
(
nppiGraphcut_32s8u
(
terminals
.
ptr
<
Npp32s
>
(),
leftTransp
.
ptr
<
Npp32s
>
(),
rightTransp
.
ptr
<
Npp32s
>
(),
top
.
ptr
<
Npp32s
>
(),
bottom
.
ptr
<
Npp32s
>
(),
static_cast
<
int
>
(
terminals
.
step
),
static_cast
<
int
>
(
leftTransp
.
step
),
sznpp
,
labels
.
ptr
<
Npp8u
>
(),
static_cast
<
int
>
(
labels
.
step
),
pState
)
);
nppSafeCall
(
nppiGraphcutFree
(
pState
)
);
#else
nppSafeCall
(
nppiGraphcut_32s8u
(
terminals
.
ptr
<
Npp32s
>
(),
leftTransp
.
ptr
<
Npp32s
>
(),
rightTransp
.
ptr
<
Npp32s
>
(),
top
.
ptr
<
Npp32s
>
(),
bottom
.
ptr
<
Npp32s
>
(),
static_cast
<
int
>
(
terminals
.
step
),
static_cast
<
int
>
(
leftTransp
.
step
),
sznpp
,
labels
.
ptr
<
Npp8u
>
(),
static_cast
<
int
>
(
labels
.
step
),
buf
.
ptr
<
Npp8u
>
())
);
#endif
if
(
stream
==
0
)
cudaSafeCall
(
cudaDeviceSynchronize
()
);
...
...
modules/gpu/src/imgproc.cpp
View file @
f8aba860
...
...
@@ -935,6 +935,31 @@ void cv::gpu::columnSum(const GpuMat& src, GpuMat& dst)
void
cv
::
gpu
::
rectStdDev
(
const
GpuMat
&
src
,
const
GpuMat
&
sqr
,
GpuMat
&
dst
,
const
Rect
&
rect
,
Stream
&
s
)
{
#if CUDART_VERSION > 4000
CV_Assert
(
src
.
type
()
==
CV_32SC1
&&
sqr
.
type
()
==
CV_64FC1
);
dst
.
create
(
src
.
size
(),
CV_32FC1
);
NppiSize
sz
;
sz
.
width
=
src
.
cols
;
sz
.
height
=
src
.
rows
;
NppiRect
nppRect
;
nppRect
.
height
=
rect
.
height
;
nppRect
.
width
=
rect
.
width
;
nppRect
.
x
=
rect
.
x
;
nppRect
.
y
=
rect
.
y
;
cudaStream_t
stream
=
StreamAccessor
::
getStream
(
s
);
NppStreamHandler
h
(
stream
);
nppSafeCall
(
nppiRectStdDev_32s32f_C1R
(
src
.
ptr
<
Npp32s
>
(),
static_cast
<
int
>
(
src
.
step
),
sqr
.
ptr
<
Npp64f
>
(),
static_cast
<
int
>
(
sqr
.
step
),
dst
.
ptr
<
Npp32f
>
(),
static_cast
<
int
>
(
dst
.
step
),
sz
,
nppRect
)
);
if
(
stream
==
0
)
cudaSafeCall
(
cudaDeviceSynchronize
()
);
#else
CV_Assert
(
src
.
type
()
==
CV_32SC1
&&
sqr
.
type
()
==
CV_32FC1
);
dst
.
create
(
src
.
size
(),
CV_32FC1
);
...
...
@@ -958,6 +983,7 @@ void cv::gpu::rectStdDev(const GpuMat& src, const GpuMat& sqr, GpuMat& dst, cons
if
(
stream
==
0
)
cudaSafeCall
(
cudaDeviceSynchronize
()
);
#endif
}
...
...
modules/gpu/src/matrix_reductions.cpp
View file @
f8aba860
...
...
@@ -117,7 +117,15 @@ void cv::gpu::meanStdDev(const GpuMat& src, Scalar& mean, Scalar& stddev)
DeviceBuffer
dbuf
(
2
);
#if CUDART_VERSION > 4000
int
bufSize
;
nppSafeCall
(
nppiMeanStdDev8uC1RGetBufferHostSize
(
sz
,
&
bufSize
)
);
GpuMat
buf
(
1
,
bufSize
,
CV_8UC1
);
nppSafeCall
(
nppiMean_StdDev_8u_C1R
(
src
.
ptr
<
Npp8u
>
(),
static_cast
<
int
>
(
src
.
step
),
sz
,
buf
.
ptr
<
Npp8u
>
(),
dbuf
,
(
double
*
)
dbuf
+
1
)
);
#else
nppSafeCall
(
nppiMean_StdDev_8u_C1R
(
src
.
ptr
<
Npp8u
>
(),
static_cast
<
int
>
(
src
.
step
),
sz
,
dbuf
,
(
double
*
)
dbuf
+
1
)
);
#endif
cudaSafeCall
(
cudaDeviceSynchronize
()
);
...
...
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