livoxG1:collateDgrams.cl: Clarify collation offsetting

This commit is contained in:
2025-11-09 12:12:08 -04:00
parent 55116b1d41
commit 5f03e4c392
+16 -9
View File
@@ -37,8 +37,10 @@ __kernel void collate(
// Get points array pointer (after 18-byte header)
__global uchar* pointsArray = slotStart + 18;
// Base offset in collation buffer for this slot (in floats, 4 per PointXYZI)
uint collationBaseOffset = slotIndex * nPointsPerSlot * 4;
// Base offset in collation buffer for this slot (in floats)
// Each PointXYZI is 4 floats (x, y, z, intensity)
#define FLOATS_PER_POINT 4
uint collationBaseOffset = slotIndex * nPointsPerSlot * FLOATS_PER_POINT;
// Process based on data type using nested ifs (outer) with loops (inner)
if (dataType == 0)
@@ -62,7 +64,7 @@ __kernel void collate(
float intensity = (float)reflectivity;
// Write to collation buffer
uint offset = collationBaseOffset + (i * 4);
uint offset = collationBaseOffset + (i * FLOATS_PER_POINT);
collation[offset + 0] = x;
collation[offset + 1] = y;
collation[offset + 2] = z;
@@ -91,7 +93,7 @@ __kernel void collate(
float intensity = (float)reflectivity;
// Write to collation buffer
uint offset = collationBaseOffset + (i * 4);
uint offset = collationBaseOffset + (i * FLOATS_PER_POINT);
collation[offset + 0] = x;
collation[offset + 1] = y;
collation[offset + 2] = z;
@@ -122,7 +124,8 @@ __kernel void collate(
float z1 = (float)z1_mm / 1000.0f;
float intensity1 = (float)reflectivity1;
uint offset1 = collationBaseOffset + (pointIndex * 4);
uint offset1 = collationBaseOffset
+ (pointIndex * FLOATS_PER_POINT);
collation[offset1 + 0] = x1;
collation[offset1 + 1] = y1;
collation[offset1 + 2] = z1;
@@ -141,7 +144,8 @@ __kernel void collate(
float z2 = (float)z2_mm / 1000.0f;
float intensity2 = (float)reflectivity2;
uint offset2 = collationBaseOffset + (pointIndex * 4);
uint offset2 = collationBaseOffset
+ (pointIndex * FLOATS_PER_POINT);
collation[offset2 + 0] = x2;
collation[offset2 + 1] = y2;
collation[offset2 + 2] = z2;
@@ -173,7 +177,8 @@ __kernel void collate(
float z1 = (float)z1_mm / 1000.0f;
float intensity1 = (float)reflectivity1;
uint offset1 = collationBaseOffset + (pointIndex * 4);
uint offset1 = collationBaseOffset
+ (pointIndex * FLOATS_PER_POINT);
collation[offset1 + 0] = x1;
collation[offset1 + 1] = y1;
collation[offset1 + 2] = z1;
@@ -192,7 +197,8 @@ __kernel void collate(
float z2 = (float)z2_mm / 1000.0f;
float intensity2 = (float)reflectivity2;
uint offset2 = collationBaseOffset + (pointIndex * 4);
uint offset2 = collationBaseOffset
+ (pointIndex * FLOATS_PER_POINT);
collation[offset2 + 0] = x2;
collation[offset2 + 1] = y2;
collation[offset2 + 2] = z2;
@@ -211,7 +217,8 @@ __kernel void collate(
float z3 = (float)z3_mm / 1000.0f;
float intensity3 = (float)reflectivity3;
uint offset3 = collationBaseOffset + (pointIndex * 4);
uint offset3 = collationBaseOffset
+ (pointIndex * FLOATS_PER_POINT);
collation[offset3 + 0] = x3;
collation[offset3 + 1] = y3;
collation[offset3 + 2] = z3;