GorillaStream.Compression.Decoder.ValueDecompression (gorilla_stream v3.0.3)

Copy Markdown View Source

XOR-based value decompression for floating-point values in the Gorilla algorithm.

This module reverses the XOR-based compression process to reconstruct the original floating-point values from the compressed bitstream.

The decoding process:

  1. Read the first value (64 bits)
  2. For subsequent values:
    • '0' bit: value is identical to previous
    • '10' + meaningful bits: use previous window for meaningful bits
    • '11' + 5 bits leading + 6 bits length + meaningful bits: use new window

This decoding efficiently reconstructs slowly changing floating-point time series data.

Summary

Functions

Decompresses value bitstream back into a list of float values.

Decompresses values and validates they match expected characteristics.

Gets information about a value bitstream without full decompression.

Validates that a value bitstream can be properly decompressed.

Functions

decompress(value_bits, metadata)

Decompresses value bitstream back into a list of float values.

Parameters

  • value_bits: Bitstream containing encoded values
  • metadata: Metadata containing count and first value info

Returns

  • {:ok, values}: List of decoded float values
  • {:error, reason}: If decompression fails

decompress_and_validate(value_bits, metadata, validation_opts \\ [])

Decompresses values and validates they match expected characteristics.

Parameters

  • value_bits: Bitstream containing encoded values
  • metadata: Metadata with expected characteristics
  • validation_opts: Optional validation parameters

Returns

  • {:ok, {values, stats}}: Decompressed values and statistics
  • {:error, reason}: If decompression or validation fails

get_bitstream_info(value_bits, metadata)

Gets information about a value bitstream without full decompression.

Parameters

  • value_bits: Bitstream to analyze
  • metadata: Metadata with count and first value information

Returns

  • {:ok, info} with basic information, or {:error, reason}

validate_bitstream(value_bits, expected_count)

Validates that a value bitstream can be properly decompressed.

Parameters

  • value_bits: Bitstream to validate
  • expected_count: Expected number of values

Returns

  • :ok if valid, {:error, reason} if invalid