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
Commits
5968aa18
Commit
5968aa18
authored
5 years ago
by
Nicolas Pope
Browse files
Options
Downloads
Patches
Plain Diff
Fix for finding min max in neighbours
parent
65cdf26d
No related branches found
No related tags found
1 merge request
!88
Implements #146 upsampling option
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
applications/reconstruct/src/dibr.cu
+29
-14
29 additions, 14 deletions
applications/reconstruct/src/dibr.cu
with
29 additions
and
14 deletions
applications/reconstruct/src/dibr.cu
+
29
−
14
View file @
5968aa18
...
@@ -383,20 +383,16 @@ __global__ void OLD_dibr_visibility_kernel(TextureObject<int> depth, int cam, Sp
...
@@ -383,20 +383,16 @@ __global__ void OLD_dibr_visibility_kernel(TextureObject<int> depth, int cam, Sp
#define FULL_MASK 0xffffffff
#define FULL_MASK 0xffffffff
__device__
inline
float
warpMax
(
float
energy
)
{
__device__
inline
float
warpMax
(
float
e
)
{
//for (int i = WARP_SIZE/2; i > 0; i /= 2) {
for
(
int
i
=
WARP_SIZE
/
2
;
i
>
0
;
i
/=
2
)
{
float
e
=
energy
;
for
(
int
i
=
1
;
i
<
32
;
i
*=
2
)
{
const
float
other
=
__shfl_xor_sync
(
FULL_MASK
,
e
,
i
,
WARP_SIZE
);
const
float
other
=
__shfl_xor_sync
(
FULL_MASK
,
e
,
i
,
WARP_SIZE
);
e
=
max
(
e
,
other
);
e
=
max
(
e
,
other
);
}
}
return
e
;
return
e
;
}
}
__device__
inline
float
warpMin
(
float
energy
)
{
__device__
inline
float
warpMin
(
float
e
)
{
//for (int i = WARP_SIZE/2; i > 0; i /= 2) {
for
(
int
i
=
WARP_SIZE
/
2
;
i
>
0
;
i
/=
2
)
{
float
e
=
energy
;
for
(
int
i
=
1
;
i
<
32
;
i
*=
2
)
{
const
float
other
=
__shfl_xor_sync
(
FULL_MASK
,
e
,
i
,
WARP_SIZE
);
const
float
other
=
__shfl_xor_sync
(
FULL_MASK
,
e
,
i
,
WARP_SIZE
);
e
=
min
(
e
,
other
);
e
=
min
(
e
,
other
);
}
}
...
@@ -431,9 +427,7 @@ __device__ inline float warpMin(float energy) {
...
@@ -431,9 +427,7 @@ __device__ inline float warpMin(float energy) {
__syncwarp
();
__syncwarp
();
// Preload valid neighbour points from within a window
// Search for a valid minimum neighbour
// TODO: Should be nearest neighbours, which it currently isn't if there are
// more than MAX_NEIGHBOUR_2 points.
for
(
int
i
=
lane
;
i
<
NEIGHBOR_WINDOW
;
i
+=
WARP_SIZE
)
{
for
(
int
i
=
lane
;
i
<
NEIGHBOR_WINDOW
;
i
+=
WARP_SIZE
)
{
const
int
u
=
(
i
%
(
2
*
NEIGHBOR_RADIUS_2
+
1
))
-
NEIGHBOR_RADIUS_2
;
const
int
u
=
(
i
%
(
2
*
NEIGHBOR_RADIUS_2
+
1
))
-
NEIGHBOR_RADIUS_2
;
const
int
v
=
(
i
/
(
2
*
NEIGHBOR_RADIUS_2
+
1
))
-
NEIGHBOR_RADIUS_2
;
const
int
v
=
(
i
/
(
2
*
NEIGHBOR_RADIUS_2
+
1
))
-
NEIGHBOR_RADIUS_2
;
...
@@ -442,17 +436,38 @@ __device__ inline float warpMin(float energy) {
...
@@ -442,17 +436,38 @@ __device__ inline float warpMin(float energy) {
// If it is close enough...
// If it is close enough...
if
(
point
.
z
>
params
.
camera
.
m_sensorDepthWorldMin
&&
point
.
z
<
params
.
camera
.
m_sensorDepthWorldMax
&&
length
(
point
-
camPos
)
<=
0.02
f
)
{
if
(
point
.
z
>
params
.
camera
.
m_sensorDepthWorldMin
&&
point
.
z
<
params
.
camera
.
m_sensorDepthWorldMax
&&
length
(
point
-
camPos
)
<=
0.02
f
)
{
atomicMin
(
&
minimum
[
warp
],
point
.
z
*
1000.0
f
);
}
}
__syncwarp
();
const
float
minDepth
=
float
(
minimum
[
warp
])
/
1000.0
f
;
// Preload valid neighbour points from within a window. A point is valid
// if it is within a specific distance of the minimum.
// Also calculate the maximum at the same time.
const
float3
minPos
=
params
.
camera
.
kinectDepthToSkeleton
(
x
,
y
,
minDepth
);
for
(
int
i
=
lane
;
i
<
NEIGHBOR_WINDOW
;
i
+=
WARP_SIZE
)
{
const
int
u
=
(
i
%
(
2
*
NEIGHBOR_RADIUS_2
+
1
))
-
NEIGHBOR_RADIUS_2
;
const
int
v
=
(
i
/
(
2
*
NEIGHBOR_RADIUS_2
+
1
))
-
NEIGHBOR_RADIUS_2
;
const
float3
point
=
params
.
camera
.
kinectDepthToSkeleton
(
x
+
u
,
y
+
v
,
float
(
point_in
.
tex2D
(
x
+
u
,
y
+
v
))
/
1000.0
f
);
// If it is close enough...
if
(
point
.
z
>
params
.
camera
.
m_sensorDepthWorldMin
&&
point
.
z
<
params
.
camera
.
m_sensorDepthWorldMax
&&
length
(
point
-
minPos
)
<=
0.02
f
)
{
// Append to neighbour list
// Append to neighbour list
unsigned
int
idx
=
atomicInc
(
&
nidx
[
warp
],
MAX_NEIGHBORS_2
-
1
);
unsigned
int
idx
=
atomicInc
(
&
nidx
[
warp
],
MAX_NEIGHBORS_2
-
1
);
neighborhood_cache
[
warp
][
idx
]
=
point
;
neighborhood_cache
[
warp
][
idx
]
=
point
;
atomicMin
(
&
minimum
[
warp
],
point
.
z
*
1000.0
f
);
atomicMax
(
&
maximum
[
warp
],
point
.
z
*
1000.0
f
);
atomicMax
(
&
maximum
[
warp
],
point
.
z
*
1000.0
f
);
}
}
}
}
__syncwarp
();
__syncwarp
();
const
float
minDepth
=
float
(
minimum
[
warp
])
/
1000.0
f
;
// FIXME: What if minDepth fails energy test, an alternate min is needed.
// Perhaps a second pass can be used?
const
float
maxDepth
=
float
(
maximum
[
warp
])
/
1000.0
f
;
const
float
maxDepth
=
float
(
maximum
[
warp
])
/
1000.0
f
;
const
float
interval
=
(
maxDepth
-
minDepth
)
/
float
(
MAX_ITERATIONS
);
const
float
interval
=
(
maxDepth
-
minDepth
)
/
float
(
MAX_ITERATIONS
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment