Skip to content

Commit

Permalink
feat: optimize voxel indexing in preprocess_kernel.cu
Browse files Browse the repository at this point in the history
  • Loading branch information
technolojin committed Dec 11, 2024
1 parent 171787b commit a9b06d2
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ __global__ void generateVoxels_random_kernel(

int voxel_idx = floorf((point.x - min_x_range) / pillar_x_size);
int voxel_idy = floorf((point.y - min_y_range) / pillar_y_size);
unsigned int voxel_index = voxel_idy * grid_x_size + voxel_idx;
unsigned int voxel_index = (grid_x_size - 1 - voxel_idx) * grid_y_size + voxel_idy;

unsigned int point_id = atomicAdd(&(mask[voxel_index]), 1);

Expand Down Expand Up @@ -101,7 +101,7 @@ __global__ void generateBaseFeatures_kernel(
if (voxel_idx_inverted >= grid_x_size || voxel_idy >= grid_y_size) return;
unsigned int voxel_idx = grid_x_size - 1 - voxel_idx_inverted;

unsigned int voxel_index = voxel_idy * grid_x_size + voxel_idx;
unsigned int voxel_index = voxel_idx_inverted * grid_y_size + voxel_idy;
unsigned int count = mask[voxel_index];
if (!(count > 0)) return;
count = count < MAX_POINT_IN_VOXEL_SIZE ? count : MAX_POINT_IN_VOXEL_SIZE;
Expand Down

0 comments on commit a9b06d2

Please sign in to comment.