Skip to content
Snippets Groups Projects

Implements #379 Min Disparity in SGM

Merged Nicolas Pope requested to merge feature/379/mindisp into master
1 file
+ 5
5
Compare changes
  • Side-by-side
  • Inline
@@ -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;
}
Loading