Skip to content

Read PCD files with ASCII, binary and LZF-compressed data - #77

Open
mahach666 wants to merge 2 commits into
feature/issue-25-las-readerfrom
feature/issue-28-pcd
Open

mahach666 wants to merge 2 commits into
feature/issue-25-las-readerfrom
feature/issue-28-pcd

Conversation

@mahach666

Copy link
Copy Markdown
Contributor

Closes #28

Based on #76 (the branch feature/issue-25-las-reader); merge the earlier pull requests first.

What changed

  • New PCD reader (PclFileKind.Pcd, PcdDocument/PcdScan): the 0.7 header (entries in the documented order,
    COUNT optional), ASCII, binary and binary compressed (LZF, decoded by a decoder of its own) point data, the
    declared fields, organised (row after row) and unorganised clouds, and the viewpoint kept as metadata (not
    applied). Positions come from x, y and z; colour from packed rgb/rgba; intensity; normals from
    normal_x/normal_y/normal_z. Channel availability follows the file; points with non-finite coordinates are not
    returned. PointCount is WIDTH times HEIGHT, validated against POINTS at open.
  • PclFile.Open and DetectKind handle .pcd: PCD has no signature, so a strict header structure
    (all entries in order) in any extension decides; an extension alone never suffices.

Files changed

  • src/PclIO/Formats/Pcd/PcdDocument.cs: new reader (header parser, three storage modes, SoA gather for
    compressed data, chunked streaming reads).
  • src/PclIO/Internal/LzfDecoder.cs: new exact-size LZF decoder (literal runs, overlapping matches).
  • src/PclIO/PclFileKind.cs, src/PclIO/PclFile.cs, src/PclIO/Internal/KindDetector.cs: the Pcd kind,
    structure detection (256 KiB probe, position restored) and opening.
  • src/PclIO.Cli/Program.cs: the help text lists PCD as a detected input format.
  • tests/PclIO.Tests/SyntheticFixtures.cs: PcdSamplePoint, CreateSyntheticPcd (fields, storage modes,
    organised grids, count overrides), CreatePcdFile for malformed headers, and a test-only greedy LzfCompress.
  • tests/PclIO.Tests/LzfDecoderTests.cs: hand-built token vectors (independent of the test encoder) plus
    encoder round-trips and truncated/overrun/trailing rejections.
  • tests/PclIO.Tests/FormatTests.cs: PCD section (open metadata, all three storage round trips, organised
    order, NaN skipping, limit/step, Blocks/parallelism ignored, missing positions, unusable colour, unknown
    data type, bad order, grid/count mismatch, ascii/binary/compressed truncation, corrupt LZF, size mismatch).
  • tests/PclIO.Tests/KindDetectionTests.cs, tests/PclIO.Tests/RealFileTests.cs: structure detection and the
    skipped-unless-present .pcd invariant test.
  • README.md, docs/public-api.md, docs/getting-started.md, CHANGELOG.md: the new behaviour and limits.

Tests

  • dotnet build — 0 warnings, 0 errors.
  • dotnet test — 772 passed, 12 skipped (private-scan tests), 1 failed on .NET 8 and .NET 10. The single
    failure is RepositoryHygieneTests.Git_History..., which flags the already-pushed issue API: Streaming and parallel decoding for very large files #24 commit 0a78bc6
    for non-UTC dates — outside this PR; fixing it needs a force-push of feature/issue-24-leica-parallel,
    which I did not do without instruction. Every test covering this PR passes.

Limits

  • x/y/z fields are required; files without them are rejected with NotSupportedException. Colour, intensity
    and normals of an uninterpretable shape stay unread (points without that channel) instead of failing.
  • Multi-count fields transpose per point in compressed payloads (the documented SoA layout only pins the
    field level); count-1 fields — the common case — are exact.
  • Decompressed binary data is capped at 1 GiB; headers at 4096 lines of 1 MiB; 1024 fields of count 65536.
  • Trailing bytes after binary/compressed point data are ignored; Blocks/MaxDegreeOfParallelism are ignored.

@mahach666
mahach666 force-pushed the feature/issue-25-las-reader branch from d08536a to 479c49d Compare November 17, 2026 15:02
@mahach666
mahach666 force-pushed the feature/issue-28-pcd branch from f171a28 to c733b38 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