背景:
原有的自定义点云结构在读取、传输、解码整个时间段耗时非常巨大,因此将点云结构进行升级,提高整体运行时间。
protobuf字段类型介绍
| .proto Type | Notes | C++ Type |
|---|---|---|
| double | double | |
| float | float | |
| int32 | Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint32 instead. | int32 |
| int64 | Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint64 instead. | int64 |
| uint32 | Uses variable-length encoding. | uint32 |
| uint64 | Uses variable-length encoding. | uint64 |
| sint32 | Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int32s. | int32 |
| sint64 | Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int64s. | int64 |
| fixed32 | Always four bytes. More efficient than uint32 if values are often greater than 228. | uint32 |
| fixed64 | Always eight bytes. More efficient than uint64 if values are often greater than 256. | uint64 |
| sfixed32 | Always four bytes. | int32 |
| sfixed64 | Always eight bytes. | int64 |
| bool | bool | |
| string | A string must always contain UTF-8 encoded text. | string |
| bytes | May contain any arbitrary sequence of bytes. | string |
修改前:
message PointXYZI {
optional float x = 1 [default = nan];
optional float y = 2 [default = nan];
optional float z = 3 [default = nan];
optional uint32 intensity = 4 [default = 0];
}
message PointCloud {
repeated PointXYZIT point = 1;
}
修改后:
message PointXYZI2 {
repeate float x_array = 1 [default = nan];
repeate float y_array = 2 [default = nan];
repeate float z_array = 3 [default = nan];
optional bytes intensity_array = 4 [default = 0];
}
message PointCloud {
optional PointXYZI2 point_array = 1;
}
修改点:
意义在于:
protobuf修改字段为bytes需要考虑一些问题:
目前占用时间分析:

经验: