internal

package
v0.0.0-...-8b3d7ad Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 16, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const HeaderSize = 24

Variables

This section is empty.

Functions

func ALPDecode

func ALPDecode(input []int64, exponent int) []float64

func ALPEncode

func ALPEncode(input []float64, exponent int) ([]int64, int, error)

func AutoRiceParam

func AutoRiceParam(deltas []int64) int

AutoRiceParam calculates the optimal Rice parameter for given data. Uses the median of absolute values as a heuristic, rounded to nearest power of 2. This provides good compression without requiring manual tuning.

func DeltaDecode

func DeltaDecode(deltas []int64, first int64, second int64) ([]int64, error)

func DeltaEncode

func DeltaEncode(input []int64) (deltas []int64, first int64, second int64, err error)

func GolombRiceDecode

func GolombRiceDecode(data []byte, bitCount int, valueCount int, m int) ([]uint64, error)

func SimpleDeltaDecode

func SimpleDeltaDecode(deltas []int64, first int64) ([]int64, error)

func SimpleDeltaEncode

func SimpleDeltaEncode(input []int64) (deltas []int64, first int64, err error)

Returns deltas starting from idx 1. Faster than predictive delta but less effective for linear data.

func ZigZagDecode

func ZigZagDecode(input []uint64) ([]int64, error)

func ZigZagEncode

func ZigZagEncode(input []int64) ([]uint64, error)

Types

type Header struct {
	Mode       Mode
	RiceParam  int
	ALPExp     int
	First      int64
	Second     int64
	ValueCount int
}

func Unmarshal

func Unmarshal(data []byte) (*Header, error)

func (*Header) Marshal

func (h *Header) Marshal() []byte

func (*Header) Validate

func (h *Header) Validate() error

Validate checks if the header is valid

type Mode

type Mode int

Mode represents the encoding strategy used

const (
	// ModeFloat uses ALP + Predictive Delta for float64 data
	ModeFloat Mode = iota

	// ModeInt uses simple delta: value[i] - value[i-1]
	// Best for: Monotonically increasing/decreasing integers
	ModeInt
)

func ModeFromByte

func ModeFromByte(b byte) Mode

ModeFromByte converts a byte to Mode

func (Mode) Byte

func (m Mode) Byte() byte

Byte returns the byte representation of Mode

type PackedData

type PackedData struct {
	Data       []byte
	BitCount   int
	ValueCount int
}

PackedData holds the encoded byte data along with metadata needed for decoding

func GolombRiceEncode

func GolombRiceEncode(input []uint64, m int) (PackedData, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL