hobuinc / laz-perf

Alternative LAZ implementation for C++ and JavaScript
Apache License 2.0
74 stars 44 forks source link

laszip_seek_point #111

Closed m-schuetz closed 2 years ago

m-schuetz commented 2 years ago

Is there a way to read subsets of points? For PotreeConverter, I've been using laszip_seek_point to create multiple laszip threads, each decompressing different regions of an laz file in parallel.

m-schuetz commented 2 years ago

I'm following the https://github.com/hobu/laz-perf/blob/master/cpp/examples/readlaz.cpp example btw, so I've got

auto filename = path.c_str();
auto file = ifstream(filename, std::ios::binary);
lazperf::reader::generic_file f(file);

auto buffer = make_shared<Buffer>(256);
f.readPoint(buffer->data_char);

And I'd like to add a f.seekPoint(firstPoint) before the first f.readPoint().

abellgithub commented 2 years ago

The decompressors provide for chunk-level decompression. Decompressing chunks can occur in parallel by seeking to the location of desired chunks. PDAL has code that seeks to an arbitrary point by seeking to the beginning of a chunk and discarding points until the desired point is reached: https://github.com/PDAL/PDAL/blob/master/pdal/compression/LazPerfVlrCompression.cpp#L254-L278