Skip to content

Read Leica block ranges with opt-in parallel decoding - #75

Open
mahach666 wants to merge 1 commit into
feature/issue-23-zstd-performancefrom
feature/issue-24-leica-parallel
Open

mahach666 wants to merge 1 commit into
feature/issue-23-zstd-performancefrom
feature/issue-24-leica-parallel

Conversation

@mahach666

Copy link
Copy Markdown
Contributor

Closes #24

Based on #74 (the branch feature/issue-23-zstd-performance); merge the earlier pull requests first.

What changed

  • New BlockRange (StartBlock, BlockCount) and PclReadOptions.Blocks select the blocks of a scan in file order; per scan, so a setup scan ranges over its own blocks. A range past the last block yields no points; BlockCount = 0 yields none.
  • New PclReadOptions.MaxDegreeOfParallelism (default 1, sequential streaming). Above 1 the Leica reader decodes the selected blocks in parallel on thread-local FileStreams and yields points in file order with consecutive Index values. MaxPoints/SubsampleStep semantics, warnings and Strict match the sequential read; a truncated read (MaxPoints stops early) reports nothing.
  • LgsxScan refactored to shared helpers: one chain walk, range slicing, per-block decode (DecodeBlock), shared unpack (UnpackBlock), ordered parallel combine with Index renumbering, and AggregateException unwrapping (parallel failure surfaces as the original InvalidDataException).
  • Other readers ignore both options (locked by test on E57).
  • Fixtures: multi-block single-scan containers (blockCount) and single-damaged-block files (damagedBlock).

Files changed

  • src/PclIO/BlockRange.cs: new range option type.
  • src/PclIO/PclReadOptions.cs: Blocks and MaxDegreeOfParallelism (validated).
  • src/PclIO/Formats/Leica/LgsxDocument.cs: refactor (shared chain/range/decode/unpack, ordered parallel combine, Index handling, MaxPoints caps, warning/Strict behavior, AggregateException unwrapping).
  • tests/PclIO.Tests/SyntheticFixtures.cs: blockCount/damagedBlock fixture params.
  • tests/PclIO.Tests/FormatTests.cs: range, past-end, parallel-order, parallel-range, MaxPoints cap, damaged-block (both paths + range around it), truncated-file (both paths), MaxPoints truncation suppresses warnings, Strict on selected damaged block, non-Leica ignore test.
  • tests/PclIO.Tests/OptionsAndPathTests.cs: defaults and validation for the new options.
  • README.md, docs/public-api.md, docs/getting-started.md, CHANGELOG.md: Leica-only range/parallel behavior and limits.

Tests

  • dotnet build — 0 warnings, 0 errors.
  • dotnet test — 706 passed, 0 failed, 10 skipped (tests needing private scan files) on .NET 8 and .NET 10.

Limits

  • Leica-only: only the Leica reader honors Blocks and parallel decoding; the parallel read holds the decoded points of the selected blocks, while sequential decoding holds one block at a time.
  • Parallel decodes the whole selection even when MaxPoints stops early; the cap only limits yielded points.
  • PointCount still counts all stored blocks, not the selected range.

@mahach666
mahach666 force-pushed the feature/issue-23-zstd-performance branch from c03a024 to a0245c9 Compare November 17, 2026 15:02
@mahach666
mahach666 force-pushed the feature/issue-24-leica-parallel branch from 0a78bc6 to 2183329 Compare November 17, 2026 15:02

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant