libosmocore UNKNOWN
Osmocom core library
Loading...
Searching...
No Matches
conv_acc.c File Reference

Accelerated Viterbi decoder implementation. More...

#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include "config.h"
#include <osmocom/core/conv.h>

Data Structures

struct  vtrellis
struct  vdecoder

Macros

#define BIT2NRZ(REG, N)
#define NUM_STATES(K)
#define INIT_POINTERS(simd)

Functions

 __attribute__ ((visibility("hidden")))
static int conv_code_recursive (const struct osmo_conv_code *code)
static unsigned vstate_lshift (unsigned reg, int k, int val)
static unsigned bitswap2 (unsigned v)
static unsigned bitswap3 (unsigned v)
static unsigned bitswap4 (unsigned v)
static unsigned bitswap5 (unsigned v)
static unsigned bitswap6 (unsigned v)
static unsigned bitswap (unsigned v, unsigned n)
static unsigned gen_output (struct vstate *state, int val, const struct osmo_conv_code *code)
static int gen_state_info (uint8_t *val, unsigned reg, int16_t *output, const struct osmo_conv_code *code)
static unsigned gen_recursive_output (struct vstate *state, uint8_t *val, unsigned reg, const struct osmo_conv_code *code, int pos)
static int gen_recursive_state_info (uint8_t *val, unsigned reg, int16_t *output, const struct osmo_conv_code *code)
static void free_trellis (struct vtrellis *trellis)
static int generate_trellis (struct vdecoder *dec, const struct osmo_conv_code *code)
static void _traceback (struct vdecoder *dec, unsigned state, uint8_t *out, int len)
static void _traceback_rec (struct vdecoder *dec, unsigned state, uint8_t *out, int len)
static int traceback (struct vdecoder *dec, uint8_t *out, int term, int len)
static void vdec_deinit (struct vdecoder *dec)
static int vdec_init (struct vdecoder *dec, const struct osmo_conv_code *code)
static int depuncture (const int8_t *in, const int *punc, int8_t *out, int len)
static void forward_traverse (struct vdecoder *dec, const int8_t *seq)
static int conv_decode (struct vdecoder *dec, const int8_t *seq, const int *punc, uint8_t *out, int len, int term)
static void osmo_conv_init (void)
int osmo_conv_decode_acc (const struct osmo_conv_code *code, const sbit_t *input, ubit_t *output)

Variables

static int init_complete = 0

Detailed Description

Accelerated Viterbi decoder implementation.

Macro Definition Documentation

◆ BIT2NRZ

#define BIT2NRZ ( REG,
N )
Value:
(((REG >> N) & 0x01) * 2 - 1) * -1

Referenced by gen_recursive_state_info(), and gen_state_info().

◆ INIT_POINTERS

#define INIT_POINTERS ( simd)
Value:
{ \
osmo_conv_metrics_k5_n2 = osmo_conv_##simd##_metrics_k5_n2; \
osmo_conv_metrics_k5_n3 = osmo_conv_##simd##_metrics_k5_n3; \
osmo_conv_metrics_k5_n4 = osmo_conv_##simd##_metrics_k5_n4; \
osmo_conv_metrics_k7_n2 = osmo_conv_##simd##_metrics_k7_n2; \
osmo_conv_metrics_k7_n3 = osmo_conv_##simd##_metrics_k7_n3; \
osmo_conv_metrics_k7_n4 = osmo_conv_##simd##_metrics_k7_n4; \
vdec_malloc = &osmo_conv_##simd##_vdec_malloc; \
vdec_free = &osmo_conv_##simd##_vdec_free; \
}

Referenced by osmo_conv_init().

◆ NUM_STATES

#define NUM_STATES ( K)
Value:
(K == 7 ? 64 : 16)
static const unsigned long K[64]

Referenced by gen_recursive_state_info(), generate_trellis(), and vdec_init().

Function Documentation

◆ __attribute__()

__attribute__ ( (visibility("hidden")) )

References __attribute__, and sse41_supported.

◆ _traceback()

void _traceback ( struct vdecoder * dec,
unsigned state,
uint8_t * out,
int len )
static

◆ _traceback_rec()

void _traceback_rec ( struct vdecoder * dec,
unsigned state,
uint8_t * out,
int len )
static

◆ bitswap()

unsigned bitswap ( unsigned v,
unsigned n )
static

◆ bitswap2()

unsigned bitswap2 ( unsigned v)
inlinestatic

Referenced by bitswap().

◆ bitswap3()

unsigned bitswap3 ( unsigned v)
inlinestatic

Referenced by bitswap().

◆ bitswap4()

unsigned bitswap4 ( unsigned v)
inlinestatic

Referenced by bitswap().

◆ bitswap5()

unsigned bitswap5 ( unsigned v)
inlinestatic

Referenced by bitswap().

◆ bitswap6()

unsigned bitswap6 ( unsigned v)
inlinestatic

Referenced by bitswap().

◆ conv_code_recursive()

int conv_code_recursive ( const struct osmo_conv_code * code)
inlinestatic

References osmo_conv_code::next_term_output.

Referenced by vdec_init().

◆ conv_decode()

int conv_decode ( struct vdecoder * dec,
const int8_t * seq,
const int * punc,
uint8_t * out,
int len,
int term )
static

◆ depuncture()

int depuncture ( const int8_t * in,
const int * punc,
int8_t * out,
int len )
static

Referenced by conv_decode().

◆ forward_traverse()

void forward_traverse ( struct vdecoder * dec,
const int8_t * seq )
static

◆ free_trellis()

void free_trellis ( struct vtrellis * trellis)
static

◆ gen_output()

unsigned gen_output ( struct vstate * state,
int val,
const struct osmo_conv_code * code )
static

◆ gen_recursive_output()

unsigned gen_recursive_output ( struct vstate * state,
uint8_t * val,
unsigned reg,
const struct osmo_conv_code * code,
int pos )
static

◆ gen_recursive_state_info()

int gen_recursive_state_info ( uint8_t * val,
unsigned reg,
int16_t * output,
const struct osmo_conv_code * code )
static

◆ gen_state_info()

int gen_state_info ( uint8_t * val,
unsigned reg,
int16_t * output,
const struct osmo_conv_code * code )
static

◆ generate_trellis()

int generate_trellis ( struct vdecoder * dec,
const struct osmo_conv_code * code )
static

For termination other than tail-biting, initialize the zero state as the encoder starting state. Initialize with the maximum accumulated sum at length equal to the constraint length.

References CONV_TERM_TAIL_BITING, free_trellis(), gen_recursive_state_info(), gen_state_info(), osmo_conv_code::K, osmo_conv_code::N, NUM_STATES, vtrellis::num_states, vtrellis::outputs, vdecoder::recursive, vtrellis::sums, osmo_conv_code::term, vdecoder::trellis, and vtrellis::vals.

Referenced by vdec_init().

◆ osmo_conv_init()

void osmo_conv_init ( void )
static

Usage of curly braces is mandatory, because we use multi-line define.

References init_complete, INIT_POINTERS, and sse41_supported.

Referenced by osmo_conv_decode_acc().

◆ traceback()

◆ vdec_deinit()

void vdec_deinit ( struct vdecoder * dec)
static

◆ vdec_init()

◆ vstate_lshift()

unsigned vstate_lshift ( unsigned reg,
int k,
int val )
static

Variable Documentation

◆ init_complete

int init_complete = 0
static