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
5ac4b23b
Commit
5ac4b23b
authored
Oct 22, 2010
by
Anatoly Baksheev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added PtrStep structure to pass in __global__ functions
parent
17412aa5
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
5 deletions
+27
-5
devmem2d.hpp
modules/gpu/include/opencv2/gpu/devmem2d.hpp
+27
-5
No files found.
modules/gpu/include/opencv2/gpu/devmem2d.hpp
View file @
5ac4b23b
...
...
@@ -47,30 +47,52 @@ namespace cv
{
namespace
gpu
{
// Simple lightweight structure
that encapsulates image ptr on device, its pitch and its sizes
.
// Simple lightweight structure
s that encapsulates information about an image on device
.
// It is intended to pass to nvcc-compiled code. GpuMat depends on headers that nvcc can't compile
template
<
typename
T
>
struct
DevMem2D_
template
<
typename
T
>
struct
PtrStep_
{
typedef
T
elem_t
;
enum
{
elem_size
=
sizeof
(
elem_t
)
};
T
*
ptr
;
size_t
step
;
typedef
T
elem_type
;
enum
{
elem_size
=
sizeof
(
elem_type
)
};
#if defined(__CUDACC__)
__host__
__device__
#endif
size_t
elemSize
()
const
{
return
elem_size
;
}
};
template
<
typename
T
>
struct
DevMem2D_
{
int
cols
;
int
rows
;
T
*
ptr
;
size_t
step
;
size_t
elem_step
;
/*__host__*/
DevMem2D_
()
:
cols
(
0
),
rows
(
0
),
ptr
(
0
),
step
(
0
),
elem_step
(
0
)
{}
/*__host__*/
DevMem2D_
(
int
rows_
,
int
cols_
,
T
*
ptr_
,
size_t
step_
)
:
cols
(
cols_
),
rows
(
rows_
),
ptr
(
ptr_
),
step
(
step_
),
elem_step
(
step_
/
sizeof
(
T
))
{}
template
<
typename
U
>
/*__host__*/
explicit
DevMem2D_
(
const
DevMem2D_
<
U
>&
d
)
:
cols
(
d
.
cols
),
rows
(
d
.
rows
),
ptr
((
T
*
)
d
.
ptr
),
step
(
d
.
step
),
elem_step
(
d
.
step
/
sizeof
(
T
))
{}
template
<
typename
U
>
/*__host__*/
operator
PtrStep_
<
U
>
()
const
{
PtrStep_
<
U
>
dt
;
dt
.
ptr
=
ptr
;
dt
.
step
=
step
;
return
dt
;
}
typedef
typename
PtrStep_
<
T
>::
elem_type
elem_type
;
enum
{
elem_size
=
PtrStep_
<
T
>::
elem_size
};
#if defined(__CUDACC__)
__host__
__device__
#endif
size_t
elemSize
()
const
{
return
elem_size
;
}
};
...
...
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