iguana

package
v0.0.0-...-86e9f11 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2024 License: Apache-2.0 Imports: 9 Imported by: 1

Documentation

Overview

Package iguana implements a Lizard-derived compression/decompression pipeline

Package iguana implements a Lizard-derived compression/decompression pipeline

Index

Constants

View Source
const (
	DefaultEntropyRejectionThreshold = 1.0
)

Variables

This section is empty.

Functions

func ANS1Decode

func ANS1Decode(src []byte, dstLen int) ([]byte, error)

func ANS1DecodeExplicit

func ANS1DecodeExplicit(src []byte, tab *ANSDenseTable, dstLen int, dst []byte) ([]byte, error)

func ANS32Decode

func ANS32Decode(src []byte, dstLen int) ([]byte, error)

func ANS32DecodeExplicit

func ANS32DecodeExplicit(src []byte, tab *ANSDenseTable, dstLen int, dst []byte) ([]byte, error)

func ANSNibbleDecode

func ANSNibbleDecode(src []byte, dstLen int) ([]byte, error)

func ANSNibbleDecodeExplicit

func ANSNibbleDecodeExplicit(src []byte, tab *ANSNibbleDenseTable, dstLen int, dst []byte) ([]byte, error)

Types

type ANS1Encoder

type ANS1Encoder struct {
	// contains filtered or unexported fields
}

func (*ANS1Encoder) Encode

func (e *ANS1Encoder) Encode(src []byte) ([]byte, error)

func (*ANS1Encoder) EncodeExplicit

func (e *ANS1Encoder) EncodeExplicit(src []byte, stats *ANSStatistics) ([]byte, error)

type ANS32Encoder

type ANS32Encoder struct {
	// contains filtered or unexported fields
}

func (*ANS32Encoder) Encode

func (e *ANS32Encoder) Encode(src []byte) ([]byte, error)

func (*ANS32Encoder) EncodeExplicit

func (e *ANS32Encoder) EncodeExplicit(src []byte, stats *ANSStatistics) ([]byte, error)

type ANSDenseTable

type ANSDenseTable [ansWordM]uint32

func (*ANSDenseTable) Decode

func (tab *ANSDenseTable) Decode(src []byte) ([]byte, error)

Decode deserializes the probability distribution table into *tab and returns the prefix that precedes the serialized data.

type ANSNibbleDenseTable

type ANSNibbleDenseTable [ansNibbleWordM]uint32

func (*ANSNibbleDenseTable) Decode

func (tab *ANSNibbleDenseTable) Decode(src []byte) ([]byte, error)

Decode deserializes the probability distribution table into *tab and returns the prefix that precedes the serialized data.

type ANSNibbleEncoder

type ANSNibbleEncoder struct {
	// contains filtered or unexported fields
}

func (*ANSNibbleEncoder) Encode

func (e *ANSNibbleEncoder) Encode(src []byte) ([]byte, error)

func (*ANSNibbleEncoder) EncodeExplicit

func (e *ANSNibbleEncoder) EncodeExplicit(src []byte, stats *ANSNibbleStatistics) ([]byte, error)

type ANSNibbleStatistics

type ANSNibbleStatistics struct {
	// contains filtered or unexported fields
}

func NewANSNibbleStatistics

func NewANSNibbleStatistics(src []byte) *ANSNibbleStatistics

NewANSNibbleStatistics computes an ANS frequency table on the buffer src.

func (*ANSNibbleStatistics) Encode

func (s *ANSNibbleStatistics) Encode(dst []byte) []byte

Encode appends the serialized representation of the statistics s to the buffer dst and returns the extended buffer.

type ANSStatistics

type ANSStatistics struct {
	// contains filtered or unexported fields
}

func NewANSStatistics

func NewANSStatistics(src []byte) *ANSStatistics

NewANSStatistics computes an ANS frequency table on the buffer src.

func (*ANSStatistics) Encode

func (s *ANSStatistics) Encode(dst []byte) []byte

func (*ANSStatistics) EncodeFull

func (s *ANSStatistics) EncodeFull(dst []byte) []byte

EncodeFull appends the full serialized representation of the statistics s to the buffer dst and returns the extended buffer.

func (*ANSStatistics) EncodePartial

func (s *ANSStatistics) EncodePartial(dst []byte) []byte

EncodePartial appends a partial serialized representation of the statistics s to the buffer dst and returns the extended buffer.

type Decoder

type Decoder struct {
	// contains filtered or unexported fields
}

Decoder is a stateless decoder for iguana-compressed data. The zero value of Decoder is ready to use via Decompress or DecompressTo.

It is not safe to use a Decoder from multiple goroutines simultaneously.

func (*Decoder) Decompress

func (d *Decoder) Decompress(src []byte) ([]byte, error)

Decompress returns the decompressed result of src as a new slice.

func (*Decoder) DecompressTo

func (d *Decoder) DecompressTo(dst []byte, src []byte) ([]byte, error)

DecompressTo decompresses the data in src and appends it to dst, returning the enlarged slice or the first encountered error.

type Encoder

type Encoder struct {
	// contains filtered or unexported fields
}

func (*Encoder) Compress

func (e *Encoder) Compress(src []byte, dst []byte, entropyRejectionThreshold float32) ([]byte, error)

func (*Encoder) CompressComposite

func (e *Encoder) CompressComposite(dst []byte, reqs []EncodingRequest) ([]byte, error)

type EncodingMode

type EncodingMode byte

EncodingMode specifies what structural compression should be applied to the compressor's input.

const (
	EncodingRaw    EncodingMode = iota   // No structural compression is applied
	EncodingIguana              = 1 << 0 // Iguana structural compression is applied
)

type EncodingRequest

type EncodingRequest struct {
	Src                       []byte
	EncMode                   EncodingMode
	EntMode                   EntropyMode
	EntropyRejectionThreshold float32
	EnableSecondaryResolver   bool
}

type EntropyMode

type EntropyMode byte

EntropyMode specifies what entropy compression should be applied to the results of the selected structural compressor.

const (
	EntropyNone      EntropyMode = iota // No entropy compression is applied
	EntropyANS32                        // Vectorized, 32-way interleaved 8-bit rANS entropy compression should be applied
	EntropyANS1                         // Scalar, one-way 8-bit rANS entropy compression should be applied
	EntropyANSNibble                    // Scalar, one-way 4-bit rANS entropy compression should be applied
)

Jump to

Keyboard shortcuts

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