decode

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2014 License: AGPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NextPowerOf2

func NextPowerOf2(v int) int

func Quantize

func Quantize(input []float64, output []byte)

Bit-value is determined by the sign of each sample after filtering.

Types

type AlphaMaxBetaMinLUT

type AlphaMaxBetaMinLUT []float64

Alpha*Max + Beta*Min Magnitude Approximation Lookup Table.

func NewAlphaMaxBetaMinLUT

func NewAlphaMaxBetaMinLUT() (lut AlphaMaxBetaMinLUT)

Pre-computes absolute values with most common DC offset for rtl-sdr dongles.

func (AlphaMaxBetaMinLUT) Execute

func (lut AlphaMaxBetaMinLUT) Execute(input []byte, output []float64)

Calculates complex magnitude on given IQ stream writing result to output.

type Decoder

type Decoder struct {
	Cfg PacketConfig

	IQ        []byte
	Signal    []float64
	Quantized []byte
	// contains filtered or unexported fields
}

Decoder contains buffers and radio configuration.

func NewDecoder

func NewDecoder(cfg PacketConfig, fastMag bool) (d Decoder)

Create a new decoder with the given packet configuration.

func (Decoder) Decode

func (d Decoder) Decode(input []byte) (pkts [][]byte)

Decode accepts a sample block and performs various DSP techniques to extract a packet.

func (Decoder) Filter

func (d Decoder) Filter(input []float64)

Matched filter for Manchester coded signals. Output signal's sign at each sample determines the bit-value since Manchester symbols have odd symmetry.

func (Decoder) Pack

func (d Decoder) Pack(input []byte, slices [][]byte)

Packs quantized signal into slices such that the first rank represents sample offsets and the second represents the value of each symbol from the given offset.

func (Decoder) Search

func (d Decoder) Search(slices [][]byte, preamble []byte) (indexes []int)

For each sample offset look for the preamble. Return a list of indexes the preamble is found at. Indexes are absolute in the unsliced quantized buffer.

type MagLUT

type MagLUT []float64

Default Magnitude Lookup Table

func NewSqrtMagLUT

func NewSqrtMagLUT() (lut MagLUT)

Pre-computes normalized squares with most common DC offset for rtl-sdr dongles.

func (MagLUT) Execute

func (lut MagLUT) Execute(input []byte, output []float64)

Calculates complex magnitude on given IQ stream writing result to output.

type MagnitudeLUT

type MagnitudeLUT interface {
	Execute([]byte, []float64)
}

A MagnitudeLUT knows how to perform complex magnitude on a slice of IQ samples.

type PacketConfig

type PacketConfig struct {
	DataRate                    int
	BlockSize, BlockSize2       int
	SymbolLength, SymbolLength2 int
	SampleRate                  int

	PreambleSymbols, PacketSymbols int
	PreambleLength, PacketLength   int
	BufferLength                   int
	Preamble                       string
}

PacketConfig specifies packet-specific radio configuration.

func (PacketConfig) Log

func (cfg PacketConfig) Log()

Jump to

Keyboard shortcuts

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