Skip to content
Snippets Groups Projects
Commit 079433f7 authored by Nicolas Pope's avatar Nicolas Pope
Browse files

Fix some horizontal costs

parent 98af15bd
No related branches found
No related tags found
1 merge request!345Implements #379 Min Disparity in SGM
......@@ -88,7 +88,7 @@ __global__ void aggregate_horizontal_path_kernel(
}else{
for(unsigned int i = 0; i < DP_BLOCKS_PER_THREAD; ++i){
for(unsigned int j = 0; j < DP_BLOCK_SIZE; ++j){
const int x = static_cast<int>(width - min_disp - (j + dp_offset));
const int x = static_cast<int>(width - (j + dp_offset)) - min_disp;
if(0 <= x && x < static_cast<int>(width)){
right_buffer[i][j] = __ldg(&right[i * feature_step + x]);
}else{
......@@ -121,9 +121,9 @@ __global__ void aggregate_horizontal_path_kernel(
#else
right_buffer[j][0] = __shfl_up(t, 1, SUBGROUP_SIZE);
#endif
if(lane_id == 0){
if(lane_id == 0 && x >= min_disp + dp_offset){
right_buffer[j][0] =
__ldg(&right[j * feature_step + x - dp_offset]);
__ldg(&right[j * feature_step + x - min_disp - dp_offset]);
}
}else{
const feature_type t = right_buffer[j][0];
......@@ -137,9 +137,9 @@ __global__ void aggregate_horizontal_path_kernel(
right_buffer[j][DP_BLOCK_SIZE - 1] = __shfl_down(t, 1, SUBGROUP_SIZE);
#endif
if(lane_id + 1 == SUBGROUP_SIZE){
if(x >= dp_offset + DP_BLOCK_SIZE - 1){
if(x >= min_disp + dp_offset + DP_BLOCK_SIZE - 1){
right_buffer[j][DP_BLOCK_SIZE - 1] =
__ldg(&right[j * feature_step + x - (dp_offset + DP_BLOCK_SIZE - 1)]);
__ldg(&right[j * feature_step + x - min_disp - (dp_offset + DP_BLOCK_SIZE - 1)]);
}else{
right_buffer[j][DP_BLOCK_SIZE - 1] = 0;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment