CloudDelta (cloud_delta v0.2.0)
View SourcePoint-set compression for 2D and 3D coordinates.
CloudDelta treats a cloud as an unordered set of points. It reorders them for spatial locality (Morton order), optionally quantizes, delta-encodes, and entropy-codes residuals with zlib.
Usage
compressed = CloudDelta.compress({x, y}, mode: :quantized, bits: 16)
{x2, y2} = CloudDelta.uncompress(compressed)
compressed3 = CloudDelta.compress(xyz_tuples, mode: :quantized, bits: 12)
points = CloudDelta.uncompress_points(compressed3)
Summary
Functions
Bit-exact round-trip using lossless mode.
Compress a 2D or 3D point cloud.
Honest size statistics against packed float32 and zlib-on-raw-float32.
Decompress to coordinate tensors: {x, y} or {x, y, z}.
Decompress to a list of {x, y} or {x, y, z} floats.
Types
@type compress_opt() :: {:mode, :quantized | :lossless} | {:bits, pos_integer()} | {:preserve_order, boolean()}
@type point_list() :: [point()]
@type points_tensor() :: {Nx.Tensor.t(), Nx.Tensor.t()} | {Nx.Tensor.t(), Nx.Tensor.t(), Nx.Tensor.t()}
Functions
@spec check_compression(points_tensor() | point_list()) :: boolean()
Bit-exact round-trip using lossless mode.
@spec compress(points_tensor() | point_list(), [compress_opt()]) :: binary()
Compress a 2D or 3D point cloud.
Accepts {x, y} or {x, y, z} Nx tensors, or a list of {x, y} / {x, y, z} tuples.
Options:
:mode—:quantized(default) or:lossless:bits— quantization bits per axis,4..24(default16):preserve_order— restore input order (defaultfalse)
@spec stats(points_tensor() | point_list(), [compress_opt()]) :: map()
Honest size statistics against packed float32 and zlib-on-raw-float32.
@spec uncompress(binary()) :: points_tensor()
Decompress to coordinate tensors: {x, y} or {x, y, z}.
@spec uncompress_points(binary()) :: point_list()
Decompress to a list of {x, y} or {x, y, z} floats.