decode

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2021 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package decode provides an x86_64 implementation of two Stream VByte decoding algorithms, a normal decoding approach and one that incorporates differential coding.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Get4uint32DeltaScalar added in v0.3.0

func Get4uint32DeltaScalar(in []byte, out []uint32, ctrl uint8, prev uint32)

Get4uint32DeltaScalar will decode 4 uint32 values from in into out and reconstruct the original values via differential coding. Prev provides a way for you to indicate the base value for this batch of 4. For example, when decoding the second batch of 4 integers out of, e.g. 8, you would provide a prev value of the last value in the first batch of 4 you decoded. This is done to ensure that the integers are correctly resolved to the correct diff. An example below.

Input: [ 10, 10, 10, 10 ] [ 10, 10, 10, 10 ] Output: [ 10, 20, 30, 40 ] [ 50, 60, 70, 80 ] Prev: 40

func Get4uint32Scalar

func Get4uint32Scalar(in []byte, out []uint32, ctrl uint8)

Get4uint32Scalar will decode 4 uint32 values from in into out using the Stream VByte format. Returns the number of bytes read from the input buffer.

Note: It is your responsibility to ensure that the incoming slices have the appropriate sizes and data otherwise this func will panic.

func Get8uint32

func Get8uint32(in []byte, out []uint32, ctrl uint16)

Get8uint32 is a general func you can use to decode 8 uint32's at a time. It will use the fastest implementation available determined during package initialization. If your CPU supports special hardware instructions then it will use an accelerated version of Stream VByte. Otherwise, the scalar implementation will be used as the fallback.

func Get8uint32Delta added in v0.3.0

func Get8uint32Delta(in []byte, out []uint32, ctrl uint16, prev uint32)

Get8uint32Delta is a general func you can use to decode 8 differentially coded uint32's at a time. It will use the fastest implementation available determined during package initialization. If your CPU supports special hardware instructions then it will use an accelerated version of Stream VByte. Otherwise, the scalar implementation will be used as the fallback.

func Get8uint32DeltaFast added in v0.3.0

func Get8uint32DeltaFast(in []byte, out []uint32, ctrl uint16, prev uint32)

Get8uint32DeltaFast binds to get8uint32DeltaFast which is implemented in assembly.

func Get8uint32DeltaFastAsm added in v0.3.0

func Get8uint32DeltaFastAsm(
	in []byte, out []uint32, ctrl uint16, prev uint32,
	shuffle *[256][16]uint8, lenTable *[256]uint8,
)

Get8uint32DeltaFastAsm works similarly to get8uint32Fast with the exception that prior to writing the uncompressed integers out to the output slice, the original values are reconstructed from the diffs. The basic reconstruction algorithm is as follows:

Input: [A B C D] Input Shifted: [- A B C] Add above two: [A AB BC CD] Add Prev: [PA PAB PBC PCD] Input Shifted: [- - A AB] Add Shifted: [PA PAB PABC PABCD]

func Get8uint32DeltaScalar added in v0.3.0

func Get8uint32DeltaScalar(in []byte, out []uint32, ctrl uint16, prev uint32)

Get8uint32DeltaScalar will decode 8 uint32 values from in into out and reconstruct the original values via differential coding. Prev provides a way for you to indicate the base value for this batch of 8. For example, when decoding the second batch of 8 integers out of, e.g. 16, you would provide a prev value of the last value in the first batch of 8 you decoded. This is done to ensure that the integers are correctly resolved to the correct diff. An example below.

Input: [ 10, 10, 10, 10, 10, 10, 10, 10 ] [ 10, 10, 10, 10, 10, 10, 10, 10 ] Output: [ 10, 20, 30, 40, 50, 60, 70, 80 ] [ 90, 100, 110, 120, 130, 140, 150, 160 ] Prev: 80

func Get8uint32Fast added in v0.3.0

func Get8uint32Fast(in []byte, out []uint32, ctrl uint16)

Get8uint32Fast binds to get8uint32Fast which is implemented in assembly.

func Get8uint32FastAsm added in v0.3.0

func Get8uint32FastAsm(
	in []byte, out []uint32, ctrl uint16,
	shuffle *[256][16]uint8, lenTable *[256]uint8,
)

Get8uint32FastAsm uses the provided 16-bit control to load the appropriate decoding shuffle masks and performs a shuffle operation on the provided input bytes. This in effect decompresses the input byte stream to uint32s. The result is written to the provided output slice.

func Get8uint32Scalar

func Get8uint32Scalar(in []byte, out []uint32, ctrl uint16)

Get8uint32Scalar will decode 8 uint32 values from in into out using the Stream VByte format. Returns the number of bytes read from the input buffer.

Note: It is your responsibility to ensure that the incoming slices have the appropriate sizes and data otherwise this func will panic.

func GetMode

func GetMode() shared.PerformanceMode

GetMode performs a check to see if the current ISA supports the below decoding funcs.

func GetUint32DeltaScalar added in v0.4.0

func GetUint32DeltaScalar(in []byte, out []uint32, ctrl uint8, count int, prev uint32) int

GetUint32DeltaScalar decodes up to 4 integers from in into out using the Stream VByte format. It will reconstruct the original non differentially encoded values.

Note: It is your responsibility to ensure that the incoming slices have the appropriate sizes and data otherwise this func will panic.

func GetUint32Scalar added in v0.3.0

func GetUint32Scalar(in []byte, out []uint32, ctrl uint8, count int) int

GetUint32Scalar decodes up to 4 integers from in into out using the Stream VByte format.

Note: It is your responsibility to ensure that the incoming slices have the appropriate sizes and data otherwise this func will panic.

Types

type Get8DeltaImpl added in v0.3.0

type Get8DeltaImpl func(in []byte, out []uint32, ctrl uint16, prev uint32)

type Get8Impl

type Get8Impl func(in []byte, out []uint32, ctrl uint16)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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