lzfse

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2023 License: MIT Imports: 7 Imported by: 0

README

lzfse

Documentation

Index

Constants

View Source
const (

	//  Number of bits for hash function to produce. Should be in the range
	//  [10, 16]. Larger values reduce the number of false-positive found during
	//  the match search, and expand the history table, which may allow additional
	//  matches to be found, generally improving the achieved compression ratio.
	//  Larger values also increase the workspace size, and make it less likely
	//  that the history table will be present in cache, which reduces performance.
	LZFSE_ENCODE_HASH_BITS = 14

	//  Number of positions to store for each line in the history table. May
	//  be either 4 or 8. Using 8 doubles the size of the history table, which
	//  increases the chance of finding matches (thus improving compression ratio),
	//  but also increases the workspace size.
	LZFSE_ENCODE_HASH_WIDTH = 4

	//  Match length in bytes to cause immediate emission. Generally speaking,
	//  LZFSE maintains multiple candidate matches and waits to decide which match
	//  to emit until more information is available. When a match exceeds this
	//  threshold, it is emitted immediately. Thus, smaller values may give
	//  somewhat better performance, and larger values may give somewhat better
	//  compression ratios.
	LZFSE_ENCODE_GOOD_MATCH = 40

	//  When the source buffer is very small, LZFSE doesn't compress as well as
	//  some simpler algorithms. To maintain reasonable compression for these
	//  cases, we transition to use LZVN instead if the size of the source buffer
	//  is below this threshold.
	LZFSE_ENCODE_LZVN_THRESHOLD = 4096
)
View Source
const (
	LZFSE_ENCODE_HASH_VALUES     = (1 << LZFSE_ENCODE_HASH_BITS)
	LZFSE_ENCODE_L_SYMBOLS       = 20
	LZFSE_ENCODE_M_SYMBOLS       = 20
	LZFSE_ENCODE_D_SYMBOLS       = 64
	LZFSE_ENCODE_LITERAL_SYMBOLS = 256

	LZFSE_ENCODE_L_SYMBOLS_MAX       = 20
	LZFSE_ENCODE_M_SYMBOLS_MAX       = LZFSE_ENCODE_L_SYMBOLS + LZFSE_ENCODE_M_SYMBOLS
	LZFSE_ENCODE_D_SYMBOLS_MAX       = LZFSE_ENCODE_L_SYMBOLS + LZFSE_ENCODE_M_SYMBOLS + LZFSE_ENCODE_D_SYMBOLS
	LZFSE_ENCODE_LITERAL_SYMBOLS_MAX = LZFSE_ENCODE_L_SYMBOLS + LZFSE_ENCODE_M_SYMBOLS + LZFSE_ENCODE_D_SYMBOLS + LZFSE_ENCODE_LITERAL_SYMBOLS

	LZFSE_ENCODE_L_STATES       = 64
	LZFSE_ENCODE_M_STATES       = 64
	LZFSE_ENCODE_D_STATES       = 256
	LZFSE_ENCODE_LITERAL_STATES = 1024
	LZFSE_MATCHES_PER_BLOCK     = 10000
	LZFSE_LITERALS_PER_BLOCK    = (4 * LZFSE_MATCHES_PER_BLOCK)
)
View Source
const (
	// Block header objects
	LZFSE_NO_BLOCK_MAGIC             magic = 0x00000000 // 0    (invalid)
	LZFSE_ENDOFSTREAM_BLOCK_MAGIC    magic = 0x24787662 // bvx$ (end of stream)
	LZFSE_UNCOMPRESSED_BLOCK_MAGIC   magic = 0x2d787662 // bvx- (raw data)
	LZFSE_COMPRESSEDV1_BLOCK_MAGIC   magic = 0x31787662 // bvx1 (lzfse compressed, uncompressed tables)
	LZFSE_COMPRESSEDV2_BLOCK_MAGIC   magic = 0x32787662 // bvx2 (lzfse compressed, compressed tables)
	LZFSE_COMPRESSEDLZVN_BLOCK_MAGIC magic = 0x6e787662 // bvxn (lzvn compressed)
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Decoder

type Decoder struct {
	CompressedLzfseBlockState lzfseCompressedBlockDecoderState
	CompressedLzvnBlockState  lzvnCompressedBlockDecoderState
	UncompressedBlockState    uncompressedBlockDecoderState
	// contains filtered or unexported fields
}

Decoder lzfse_decoder_state object

func NewDecoder

func NewDecoder(data []byte) *Decoder

NewDecoder creates a new lzfse decoder

func (*Decoder) DecodeBuffer

func (s *Decoder) DecodeBuffer() ([]byte, error)

DecodeBuffer decompresses a buffer using LZFSE.

Jump to

Keyboard shortcuts

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