TinyModem
Header-only software audio modem library
Loading...
Searching...
No Matches
tinymodem::QPSKCode Class Reference

Rate 1/2 convolutional code with K=5 (polynomials 0x17 and 0x19) of QPSK31 (fldigi) and a soft decision Viterbi decoder. More...

#include <PSK.h>

Public Member Functions

int encode (int bit)
 Encodes one bit: returns the 2 bit symbol.
void reset ()
 Resets the encoder and decoder state.
int decode (const float metric[4])
template<class F>
void flush (F on_bit)
 Provides the bits which are still in the decoder (oldest first).

Static Public Member Functions

static int output (int reg)
 encoder output (2 bits) for the register of the last K input bits

Static Public Attributes

static constexpr int K = 5
static constexpr int STATES = 1 << (K - 1)
static constexpr int DEPTH = 32
 decisions which are kept for the trace back (decoding delay in bits)

Protected Member Functions

int traceBack (int depth)
 Input bit of depth steps ago on the best path.

Static Protected Member Functions

static int parity (int v)

Protected Attributes

int shreg = 0
float metrics [STATES] = {0}
uint16_t history [DEPTH]
int pos = 0
int count = 0

Detailed Description

Rate 1/2 convolutional code with K=5 (polynomials 0x17 and 0x19) of QPSK31 (fldigi) and a soft decision Viterbi decoder.

Member Function Documentation

◆ decode()

int tinymodem::QPSKCode::decode ( const float metric[4])
inline

Adds the metrics of the 4 possible symbols (higher = more likely): returns the decoded bit of DEPTH steps ago or -1

◆ encode()

int tinymodem::QPSKCode::encode ( int bit)
inline

Encodes one bit: returns the 2 bit symbol.

◆ flush()

template<class F>
void tinymodem::QPSKCode::flush ( F on_bit)
inline

Provides the bits which are still in the decoder (oldest first).

◆ output()

int tinymodem::QPSKCode::output ( int reg)
inlinestatic

encoder output (2 bits) for the register of the last K input bits

◆ parity()

int tinymodem::QPSKCode::parity ( int v)
inlinestaticprotected

◆ reset()

void tinymodem::QPSKCode::reset ( )
inline

Resets the encoder and decoder state.

◆ traceBack()

int tinymodem::QPSKCode::traceBack ( int depth)
inlineprotected

Input bit of depth steps ago on the best path.

Member Data Documentation

◆ count

int tinymodem::QPSKCode::count = 0
protected

◆ DEPTH

int tinymodem::QPSKCode::DEPTH = 32
staticconstexpr

decisions which are kept for the trace back (decoding delay in bits)

◆ history

uint16_t tinymodem::QPSKCode::history[DEPTH]
protected

◆ K

int tinymodem::QPSKCode::K = 5
staticconstexpr

◆ metrics

float tinymodem::QPSKCode::metrics[STATES] = {0}
protected

◆ pos

int tinymodem::QPSKCode::pos = 0
protected

◆ shreg

int tinymodem::QPSKCode::shreg = 0
protected

◆ STATES

int tinymodem::QPSKCode::STATES = 1 << (K - 1)
staticconstexpr

The documentation for this class was generated from the following file: