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
da5aaab2
Commit
da5aaab2
authored
Aug 22, 2012
by
Vladislav Vinogradov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
optimized gpu::integral for Kepler
parent
92795ba4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
76 additions
and
20 deletions
+76
-20
gpumat.hpp
modules/core/include/opencv2/core/gpumat.hpp
+3
-1
integral_image.cu
modules/gpu/src/cuda/integral_image.cu
+0
-0
imgproc.cpp
modules/gpu/src/imgproc.cpp
+73
-19
No files found.
modules/core/include/opencv2/core/gpumat.hpp
View file @
da5aaab2
...
...
@@ -72,9 +72,11 @@ namespace cv { namespace gpu
FEATURE_SET_COMPUTE_13
=
13
,
FEATURE_SET_COMPUTE_20
=
20
,
FEATURE_SET_COMPUTE_21
=
21
,
FEATURE_SET_COMPUTE_30
=
30
,
GLOBAL_ATOMICS
=
FEATURE_SET_COMPUTE_11
,
SHARED_ATOMICS
=
FEATURE_SET_COMPUTE_12
,
NATIVE_DOUBLE
=
FEATURE_SET_COMPUTE_13
NATIVE_DOUBLE
=
FEATURE_SET_COMPUTE_13
,
WARP_SHUFFLE_FUNCTIONS
=
FEATURE_SET_COMPUTE_30
};
// Gives information about what GPU archs this OpenCV GPU module was
...
...
modules/gpu/src/cuda/integral_image.cu
0 → 100644
View file @
da5aaab2
This diff is collapsed.
Click to expand it.
modules/gpu/src/imgproc.cpp
View file @
da5aaab2
...
...
@@ -223,7 +223,7 @@ void cv::gpu::reprojectImageTo3D(const GpuMat& disp, GpuMat& xyz, const Mat& Q,
using
namespace
cv
::
gpu
::
device
::
imgproc
;
typedef
void
(
*
func_t
)(
const
DevMem2Db
disp
,
DevMem2Db
xyz
,
const
float
*
q
,
cudaStream_t
stream
);
static
const
func_t
funcs
[
2
][
4
]
=
static
const
func_t
funcs
[
2
][
4
]
=
{
{
reprojectImageTo3D_gpu
<
uchar
,
float3
>
,
0
,
0
,
reprojectImageTo3D_gpu
<
short
,
float3
>
},
{
reprojectImageTo3D_gpu
<
uchar
,
float4
>
,
0
,
0
,
reprojectImageTo3D_gpu
<
short
,
float4
>
}
...
...
@@ -533,32 +533,86 @@ void cv::gpu::integral(const GpuMat& src, GpuMat& sum, Stream& s)
integralBuffered
(
src
,
sum
,
buffer
,
s
);
}
namespace
cv
{
namespace
gpu
{
namespace
device
{
namespace
imgproc
{
void
shfl_integral_gpu
(
DevMem2Db
img
,
DevMem2D_
<
unsigned
int
>
integral
,
cudaStream_t
stream
);
}
}}}
void
cv
::
gpu
::
integralBuffered
(
const
GpuMat
&
src
,
GpuMat
&
sum
,
GpuMat
&
buffer
,
Stream
&
s
)
{
CV_Assert
(
src
.
type
()
==
CV_8UC1
);
if
(
sum
.
cols
!=
src
.
cols
+
1
&&
sum
.
rows
!=
src
.
rows
+
1
)
sum
.
create
(
src
.
rows
+
1
,
src
.
cols
+
1
,
CV_32S
);
NcvSize32u
roiSize
;
roiSize
.
width
=
src
.
cols
;
roiSize
.
height
=
src
.
rows
;
cudaStream_t
stream
=
StreamAccessor
::
getStream
(
s
);
cudaDeviceProp
prop
;
cudaSafeCall
(
cudaGetDeviceProperties
(
&
prop
,
cv
::
gpu
::
getDevice
())
);
DeviceInfo
info
;
Ncv32u
bufSize
;
ncvSafeCall
(
nppiStIntegralGetSize_8u32u
(
roiSize
,
&
bufSize
,
prop
)
);
ensureSizeIsEnough
(
1
,
bufSize
,
CV_8UC1
,
buffer
)
;
if
(
info
.
supports
(
WARP_SHUFFLE_FUNCTIONS
))
{
GpuMat
src16
;
cudaStream_t
stream
=
StreamAccessor
::
getStream
(
s
);
if
(
src
.
cols
%
16
==
0
)
src16
=
src
;
else
{
ensureSizeIsEnough
(
src
.
rows
,
((
src
.
cols
+
15
)
/
16
)
*
16
,
src
.
type
(),
buffer
);
NppStStreamHandler
h
(
stream
);
GpuMat
inner
=
buffer
(
Rect
(
0
,
0
,
src
.
cols
,
src
.
rows
));
if
(
s
)
{
s
.
enqueueMemSet
(
buffer
,
Scalar
::
all
(
0
));
s
.
enqueueCopy
(
src
,
inner
);
}
else
{
buffer
.
setTo
(
Scalar
::
all
(
0
));
src
.
copyTo
(
inner
);
}
src16
=
buffer
;
}
ncvSafeCall
(
nppiStIntegral_8u32u_C1R
(
const_cast
<
Ncv8u
*>
(
src
.
ptr
<
Ncv8u
>
()),
static_cast
<
int
>
(
src
.
step
),
sum
.
ptr
<
Ncv32u
>
(),
static_cast
<
int
>
(
sum
.
step
),
roiSize
,
buffer
.
ptr
<
Ncv8u
>
(),
bufSize
,
prop
)
);
sum
.
create
(
src16
.
rows
+
1
,
src16
.
cols
+
1
,
CV_32SC1
);
if
(
stream
==
0
)
cudaSafeCall
(
cudaDeviceSynchronize
()
);
if
(
s
)
s
.
enqueueMemSet
(
sum
,
Scalar
::
all
(
0
));
else
sum
.
setTo
(
Scalar
::
all
(
0
));
GpuMat
inner
=
sum
(
Rect
(
1
,
1
,
src16
.
cols
,
src16
.
rows
));
cv
::
gpu
::
device
::
imgproc
::
shfl_integral_gpu
(
src16
,
inner
,
stream
);
if
(
src16
.
cols
!=
src
.
cols
)
sum
=
sum
(
Rect
(
0
,
0
,
src
.
cols
+
1
,
src
.
rows
+
1
));
}
else
{
sum
.
create
(
src
.
rows
+
1
,
src
.
cols
+
1
,
CV_32SC1
);
NcvSize32u
roiSize
;
roiSize
.
width
=
src
.
cols
;
roiSize
.
height
=
src
.
rows
;
cudaDeviceProp
prop
;
cudaSafeCall
(
cudaGetDeviceProperties
(
&
prop
,
cv
::
gpu
::
getDevice
())
);
Ncv32u
bufSize
;
ncvSafeCall
(
nppiStIntegralGetSize_8u32u
(
roiSize
,
&
bufSize
,
prop
)
);
ensureSizeIsEnough
(
1
,
bufSize
,
CV_8UC1
,
buffer
);
NppStStreamHandler
h
(
stream
);
ncvSafeCall
(
nppiStIntegral_8u32u_C1R
(
const_cast
<
Ncv8u
*>
(
src
.
ptr
<
Ncv8u
>
()),
static_cast
<
int
>
(
src
.
step
),
sum
.
ptr
<
Ncv32u
>
(),
static_cast
<
int
>
(
sum
.
step
),
roiSize
,
buffer
.
ptr
<
Ncv8u
>
(),
bufSize
,
prop
)
);
if
(
stream
==
0
)
cudaSafeCall
(
cudaDeviceSynchronize
()
);
}
}
//////////////////////////////////////////////////////////////////////////////
...
...
@@ -1340,7 +1394,7 @@ Size cv::gpu::ConvolveBuf::estimateBlockSize(Size result_size, Size /*templ_size
int
width
=
(
result_size
.
width
+
2
)
/
3
;
int
height
=
(
result_size
.
height
+
2
)
/
3
;
width
=
std
::
min
(
width
,
result_size
.
width
);
height
=
std
::
min
(
height
,
result_size
.
height
);
height
=
std
::
min
(
height
,
result_size
.
height
);
return
Size
(
width
,
height
);
}
...
...
@@ -1380,7 +1434,7 @@ void cv::gpu::convolve(const GpuMat& image, const GpuMat& templ, GpuMat& result,
cufftHandle
planR2C
,
planC2R
;
cufftSafeCall
(
cufftPlan2d
(
&
planC2R
,
dft_size
.
height
,
dft_size
.
width
,
CUFFT_C2R
));
cufftSafeCall
(
cufftPlan2d
(
&
planR2C
,
dft_size
.
height
,
dft_size
.
width
,
CUFFT_R2C
));
cufftSafeCall
(
cufftPlan2d
(
&
planR2C
,
dft_size
.
height
,
dft_size
.
width
,
CUFFT_R2C
));
cufftSafeCall
(
cufftSetStream
(
planR2C
,
StreamAccessor
::
getStream
(
stream
))
);
cufftSafeCall
(
cufftSetStream
(
planC2R
,
StreamAccessor
::
getStream
(
stream
))
);
...
...
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