Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
ftl
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Nicolas Pope
ftl
Merge requests
!105
CUDA optical flow smoothing
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
CUDA optical flow smoothing
feature/off-cuda
into
master
Overview
0
Commits
28
Pipelines
1
Changes
2
Merged
Sebastian Hahta
requested to merge
feature/off-cuda
into
master
5 years ago
Overview
0
Commits
28
Pipelines
1
Changes
2
Expand
Closes
#155 (closed)
0
0
Merge request reports
Viewing commit
185b9d7e
Prev
Next
Show latest version
2 files
+
34
−
35
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
2
Search (e.g. *.vue) (Ctrl+P)
185b9d7e
updated interface with automatic cpu/gpu transfer
· 185b9d7e
Sebastian Hahta
authored
5 years ago
components/rgbd-sources/include/ftl/rgbd/frame.hpp
+
28
−
25
Options
@@ -27,55 +27,57 @@ public:
return
available_
[
_channelIdx
(
channel
)];
}
/* @brief Get reference to the channel data.
* @param Channel type
* @param Output parameter
* @param User of the method sets data. NOTE: Only works on unused
* channels or if reset() was called previously (TODO).
* @returns True, if output parameter contains valid data
/* @brief get reference to the channel contents
* @param channel type
* @returns const reference to channel data
*
* Methods automatically copy between host/gpu if the data is only available
* in the other. Results are cached.
* in the other. Results are cached. Result is valid only if hasChannel() is
* true.
*/
bool
getChannel
(
const
ftl
::
rgbd
::
channel_t
&
channel
,
cv
::
Mat
&
out
,
bool
set
=
false
)
const
cv
::
Mat
&
getChannel
(
const
ftl
::
rgbd
::
channel_t
&
channel
)
{
auto
idx
=
_channelIdx
(
channel
);
bool
retval
=
available_
[
idx
]
&
mask_host
;
if
(
!
retval
)
if
(
!
(
available_
[
idx
]
&
mask_host
))
{
if
(
available_
[
idx
]
&
mask_gpu
)
{
channels_gpu_
[
idx
].
download
(
channels_host_
[
idx
]);
retval
=
true
;
set
=
true
;
available_
[
idx
]
|=
mask_host
;
}
}
if
(
set
)
{
available_
[
idx
]
|=
mask_host
;
}
return
channels_host_
[
idx
];
}
out
=
channels_host_
[
idx
];
return
retval
;
cv
::
Mat
&
setChannel
(
const
ftl
::
rgbd
::
channel_t
&
channel
)
{
auto
idx
=
_channelIdx
(
channel
);
available_
[
idx
]
=
mask_host
;
return
channels_host_
[
idx
];
}
bool
getChannel
(
const
ftl
::
rgbd
::
channel_t
&
channel
,
cv
::
cuda
::
GpuMat
&
out
,
bool
set
=
false
)
const
cv
::
cuda
::
GpuMat
&
getChannel
Gpu
(
const
ftl
::
rgbd
::
channel_t
&
channel
)
{
auto
idx
=
_channelIdx
(
channel
);
bool
retval
=
available_
[
idx
]
&
mask_gpu
;
if
(
!
retval
)
if
(
!
(
available_
[
idx
]
&
mask_gpu
))
{
if
(
available_
[
idx
]
&
mask_host
)
{
channels_gpu_
[
idx
].
upload
(
channels_host_
[
idx
]);
retval
=
true
;
set
=
true
;
available_
[
idx
]
|=
mask_gpu
;
}
}
if
(
set
)
{
available_
[
idx
]
|=
mask_host
;
}
out
=
channels_gpu_
[
idx
];
return
retval
;
return
channels_gpu_
[
idx
];
}
cv
::
cuda
::
GpuMat
&
setChannelGpu
(
const
ftl
::
rgbd
::
channel_t
&
channel
)
{
auto
idx
=
_channelIdx
(
channel
);
available_
[
idx
]
=
mask_gpu
;
return
channels_gpu_
[
idx
];
}
private
:
@@ -94,7 +96,8 @@ private:
case
kChanConfidence
:
return
7
;
case
kChanFlow
:
return
8
;
case
kChanEnergy
:
return
9
;
default:
return
0
;
// should not happen (error)
// should not happen (error); returned index is kChanNone
default:
return
0
;
}
}
Loading