Documentation ¶
Index ¶
- Constants
- Variables
- func BitsToBytes(bits string) []byte
- func BitsToInts(bits string) []int
- func BytesToBits(bytes []byte) string
- func HammingDistance(x string, y string) int
- func IntsToBits(ints []int) string
- func ParseInt(s string) int
- func ReverseBits(num_bits int, input int) int
- type Input
- type Trellis
- type ViterbiCodec
- func (v *ViterbiCodec) BranchMetric(bits string, source_state int, target_state int) int
- func (v *ViterbiCodec) Decode(bits string) string
- func (v *ViterbiCodec) DecodeBytes(bits string) []byte
- func (v *ViterbiCodec) Encode(bits string) string
- func (v *ViterbiCodec) EncodeBytes(bytes []byte) string
- func (v *ViterbiCodec) InitializeOutputs()
- func (v *ViterbiCodec) NextState(current_state int, input int) int
- func (v *ViterbiCodec) Output(current_state int, input int) string
- func (v *ViterbiCodec) PathMetric(bits string, prev_path_metrics []int, state int) [2]int
- func (v *ViterbiCodec) UpdatePathMetrics(bits string, path_metrics []int, trellis Trellis) ([]int, []int)
Constants ¶
View Source
const MaxInt = 1<<(32-1) - 1
Variables ¶
View Source
var FLAGS_encode bool
View Source
var FLAGS_reverse_polynomials bool
Functions ¶
func BitsToBytes ¶
Function that takes in a string of bits and converts it to a []byte.
func BitsToInts ¶
Function that converts a string of bits to []int
func BytesToBits ¶
Function that takes in []byte and converts it to a string of bits.
func HammingDistance ¶
func IntsToBits ¶
Function that converts a []int to a string of bits.
func ReverseBits ¶
Types ¶
type ViterbiCodec ¶
type ViterbiCodec struct {
// contains filtered or unexported fields
}
func Init ¶
func Init(input Input) (*ViterbiCodec, error)
func (*ViterbiCodec) BranchMetric ¶
func (v *ViterbiCodec) BranchMetric(bits string, source_state int, target_state int) int
Return the branch metric for the given source and target states.
func (*ViterbiCodec) Decode ¶
func (v *ViterbiCodec) Decode(bits string) string
Decode a string of bits using the Viterbi algorithm.
func (*ViterbiCodec) DecodeBytes ¶
func (v *ViterbiCodec) DecodeBytes(bits string) []byte
Decode bytes using BitsToBytes and run codec.Decode.
func (*ViterbiCodec) Encode ¶
func (v *ViterbiCodec) Encode(bits string) string
Encode the given message bits.
func (*ViterbiCodec) EncodeBytes ¶
func (v *ViterbiCodec) EncodeBytes(bytes []byte) string
Encode bytes using BytesToBits and run codec.Encode.
func (*ViterbiCodec) InitializeOutputs ¶
func (v *ViterbiCodec) InitializeOutputs()
func (*ViterbiCodec) PathMetric ¶
func (v *ViterbiCodec) PathMetric(bits string, prev_path_metrics []int, state int) [2]int
Return the path metric and the source state for the given target state.
func (*ViterbiCodec) UpdatePathMetrics ¶
func (v *ViterbiCodec) UpdatePathMetrics(bits string, path_metrics []int, trellis Trellis) ([]int, []int)
Update the path metrics and trellis for the next bit.
Click to show internal directories.
Click to hide internal directories.