libosmocore 1.13.1.1-afb4 Osmocom core library

Files | Data Structures | Macros | Enumerations | Functions
Convolutional encoding and decoding routines

Osmocom convolutional encoder and decoder. More...

## Files
file | conv.h
| Osmocom convolutional encoder and decoder.
file | conv.c
| Generic convolutional encoding / decoding.

## Data Structures
struct | osmo_conv_code
| structure describing a given convolutional code More...
struct | osmo_conv_encoder
| convolutional encoder state More...
struct | osmo_conv_decoder
| convolutional decoder state More...

## Macros
#define | MAX_AE 0x00ffffff

## Enumerations
enum | osmo_conv_term { CONV_TERM_FLUSH = 0 , CONV_TERM_TRUNCATION , CONV_TERM_TAIL_BITING }
| possibe termination types More...

## Functions
int | osmo_conv_get_input_length (const struct osmo_conv_code *code, int len)
int | osmo_conv_get_output_length (const struct osmo_conv_code *code, int len)
void | osmo_conv_encode_init (struct osmo_conv_encoder *encoder, const struct osmo_conv_code *code)
| Initialize a convolutional encoder. More...
void | osmo_conv_encode_load_state (struct osmo_conv_encoder *encoder, const ubit_t *input)
int | osmo_conv_encode_raw (struct osmo_conv_encoder *encoder, const ubit_t *input, ubit_t *output, int n)
int | osmo_conv_encode_flush (struct osmo_conv_encoder *encoder, ubit_t *output)
int | osmo_conv_encode (const struct osmo_conv_code *code, const ubit_t *input, ubit_t *output)
| All-in-one convolutional encoding function. More...
void | osmo_conv_decode_init (struct osmo_conv_decoder *decoder, const struct osmo_conv_code *code, int len, int start_state)
void | osmo_conv_decode_reset (struct osmo_conv_decoder *decoder, int start_state)
void | osmo_conv_decode_rewind (struct osmo_conv_decoder *decoder)
void | osmo_conv_decode_deinit (struct osmo_conv_decoder *decoder)
int | osmo_conv_decode_scan (struct osmo_conv_decoder *decoder, const sbit_t *input, int n)
int | osmo_conv_decode_flush (struct osmo_conv_decoder *decoder, const sbit_t *input)
int | osmo_conv_decode_get_best_end_state (struct osmo_conv_decoder *decoder)
int | osmo_conv_decode_get_output (struct osmo_conv_decoder *decoder, ubit_t *output, int has_flush, int end_state)
int | osmo_conv_decode (const struct osmo_conv_code *code, const sbit_t *input, ubit_t *output)
| All-in-one convolutional decoding function. More...
static int | _conv_encode_do_output (struct osmo_conv_encoder *encoder, uint8_t out, ubit_t *output)
int | osmo_conv_decode_acc (const struct osmo_conv_code *code, const sbit_t *input, ubit_t *output)

## Detailed Description

Osmocom convolutional encoder and decoder.

## Macro Definition Documentation

## ◆ MAX_AE

#define MAX_AE 0x00ffffff

## Enumeration Type Documentation

## ◆ osmo_conv_term

enum osmo_conv_term

possibe termination types

The termination type will determine which state the encoder/decoder can start/end with. This is mostly taken care of in the high level API call. So if you use the low level API, you must take care of making the proper calls yourself.

Enumerator
CONV_TERM_FLUSH | Flush encoder state.
CONV_TERM_TRUNCATION | Direct truncation.
CONV_TERM_TAIL_BITING | Tail biting.

## Function Documentation

## ◆ _conv_encode_do_output()

static int _conv_encode_do_output | ( | struct osmo_conv_encoder * | encoder,
|  | uint8_t | out,
|  | ubit_t * | output
| ) |  |
| inline static

References osmo_conv_encoder::code, osmo_conv_encoder::i_idx, osmo_conv_code::N, osmo_conv_encoder::p_idx, and osmo_conv_code::puncture.

Referenced by osmo_conv_encode_flush(), and osmo_conv_encode_raw().

## ◆ osmo_conv_decode()

int osmo_conv_decode | ( | const struct osmo_conv_code * | code,
|  | const sbit_t * | input,
|  | ubit_t * | output
| ) |  |

All-in-one convolutional decoding function.

Parameters

  [in] | code | description of convolutional code to be used
  [in] | input | array of soft bits (coded)
  [out] | output | array of unpacked bits (decoded)

This is an all-in-one function, taking care of osmo_conv_decode_init, osmo_conv_decode_scan, osmo_conv_decode_flush, osmo_conv_decode_get_best_end_state, osmo_conv_decode_get_output and osmo_conv_decode_deinit.

References osmo_conv_decoder::code, CONV_TERM_FLUSH, CONV_TERM_TAIL_BITING, osmo_conv_code::K, l, osmo_conv_code::len, osmo_conv_code::N, osmo_conv_decode_acc(), osmo_conv_decode_deinit(), osmo_conv_decode_flush(), osmo_conv_decode_get_output(), osmo_conv_decode_init(), osmo_conv_decode_rewind(), osmo_conv_decode_scan(), and osmo_conv_code::term.

## ◆ osmo_conv_decode_acc()

int osmo_conv_decode_acc | ( | const struct osmo_conv_code * | code,
|  | const sbit_t * | input,
|  | ubit_t * | output
| ) |  |

References conv_decode(), init_complete, osmo_conv_code::K, osmo_conv_code::len, osmo_conv_code::N, osmo_conv_init(), osmo_conv_code::puncture, osmo_conv_code::term, vdec_deinit(), and vdec_init().

Referenced by osmo_conv_decode().

## ◆ osmo_conv_decode_deinit()

void osmo_conv_decode_deinit | ( | struct osmo_conv_decoder * | decoder | ) |

References osmo_conv_decoder::ae, osmo_conv_decoder::ae_next, and osmo_conv_decoder::state_history.

Referenced by osmo_conv_decode().

## ◆ osmo_conv_decode_flush()

int osmo_conv_decode_flush | ( | struct osmo_conv_decoder * | decoder,
|  | const sbit_t * | input
| ) |  |

References osmo_conv_decoder::ae, osmo_conv_decoder::ae_next, osmo_conv_decoder::code, osmo_conv_code::K, MAX_AE, osmo_conv_code::N, osmo_conv_decoder::n_states, osmo_conv_code::next_output, osmo_conv_code::next_state, osmo_conv_code::next_term_output, osmo_conv_code::next_term_state, osmo_conv_decoder::o_idx, osmo_conv_decoder::p_idx, osmo_conv_code::puncture, and osmo_conv_decoder::state_history.

Referenced by osmo_conv_decode().

## ◆ osmo_conv_decode_get_best_end_state()

int osmo_conv_decode_get_best_end_state | ( | struct osmo_conv_decoder * | decoder | ) |

References osmo_conv_decoder::ae, osmo_conv_decoder::code, CONV_TERM_FLUSH, CONV_TERM_TAIL_BITING, MAX_AE, n, osmo_conv_decoder::n_states, osmo_conv_decoder::o_idx, osmo_conv_decoder::state_history, and osmo_conv_code::term.

Referenced by osmo_conv_decode_get_output().

## ◆ osmo_conv_decode_get_output()

int osmo_conv_decode_get_output | ( | struct osmo_conv_decoder * | decoder,
|  | ubit_t * | output,
|  | int | has_flush,
|  | int | end_state
| ) |  |

References osmo_conv_decoder::ae, osmo_conv_decoder::code, osmo_conv_code::K, n, osmo_conv_decoder::n_states, osmo_conv_code::next_state, osmo_conv_decoder::o_idx, osmo_conv_decode_get_best_end_state(), and osmo_conv_decoder::state_history.

Referenced by osmo_conv_decode().

## ◆ osmo_conv_decode_init()

void osmo_conv_decode_init | ( | struct osmo_conv_decoder * | decoder,
|  | const struct osmo_conv_code * | code,
|  | int | len,
|  | int | start_state
| ) |  |

References osmo_conv_decoder::ae, osmo_conv_decoder::ae_next, osmo_conv_encoder::code, osmo_conv_decoder::code, osmo_conv_code::K, len(), osmo_conv_code::len, osmo_conv_decoder::len, osmo_conv_decoder::n_states, osmo_conv_decode_reset(), and osmo_conv_decoder::state_history.

Referenced by osmo_conv_decode().

## ◆ osmo_conv_decode_reset()

void osmo_conv_decode_reset | ( | struct osmo_conv_decoder * | decoder,
|  | int | start_state
| ) |  |

References osmo_conv_decoder::ae, MAX_AE, osmo_conv_decoder::n_states, osmo_conv_decoder::o_idx, and osmo_conv_decoder::p_idx.

Referenced by osmo_conv_decode_init().

## ◆ osmo_conv_decode_rewind()

void osmo_conv_decode_rewind | ( | struct osmo_conv_decoder * | decoder | ) |

References osmo_conv_decoder::ae, MAX_AE, osmo_conv_decoder::n_states, osmo_conv_decoder::o_idx, and osmo_conv_decoder::p_idx.

Referenced by osmo_conv_decode().

## ◆ osmo_conv_decode_scan()

int osmo_conv_decode_scan | ( | struct osmo_conv_decoder * | decoder,
|  | const sbit_t * | input,
|  | int | n
| ) |  |

References osmo_conv_decoder::ae, osmo_conv_decoder::ae_next, osmo_conv_decoder::code, MAX_AE, n, osmo_conv_code::N, osmo_conv_decoder::n_states, osmo_conv_code::next_output, osmo_conv_code::next_state, osmo_conv_decoder::o_idx, osmo_conv_decoder::p_idx, osmo_conv_code::puncture, and osmo_conv_decoder::state_history.

Referenced by osmo_conv_decode().

## ◆ osmo_conv_encode()

int osmo_conv_encode | ( | const struct osmo_conv_code * | code,
|  | const ubit_t * | input,
|  | ubit_t * | output
| ) |  |

All-in-one convolutional encoding function.

Parameters

  [in] | code | description of convolutional code to be used
  [in] | input | array of unpacked bits (uncoded)
  [out] | output | array of unpacked bits (encoded)

Returns
  Number of produced output bits

This is an all-in-one function, taking care of osmo_conv_init, osmo_conv_encode_load_state, osmo_conv_encode_raw and osmo_conv_encode_flush as needed.

References osmo_conv_encoder::code, CONV_TERM_FLUSH, CONV_TERM_TAIL_BITING, osmo_conv_code::K, l, osmo_conv_code::len, osmo_conv_encode_flush(), osmo_conv_encode_init(), osmo_conv_encode_load_state(), osmo_conv_encode_raw(), and osmo_conv_code::term.

## ◆ osmo_conv_encode_flush()

int osmo_conv_encode_flush | ( | struct osmo_conv_encoder * | encoder,
|  | ubit_t * | output
| ) |  |

References _conv_encode_do_output(), osmo_conv_encoder::code, osmo_conv_encoder::i_idx, osmo_conv_code::K, n, osmo_conv_code::next_output, osmo_conv_code::next_state, osmo_conv_code::next_term_output, osmo_conv_code::next_term_state, and osmo_conv_encoder::state.

Referenced by osmo_conv_encode().

## ◆ osmo_conv_encode_init()

void osmo_conv_encode_init | ( | struct osmo_conv_encoder * | encoder,
|  | const struct osmo_conv_code * | code
| ) |  |

Initialize a convolutional encoder.

Parameters

  [in,out] | encoder | Encoder state to initialize
  [in] | code | Description of convolutional code

References osmo_conv_encoder::code, and OSMO_ASSERT.

Referenced by osmo_conv_encode().

## ◆ osmo_conv_encode_load_state()

void osmo_conv_encode_load_state | ( | struct osmo_conv_encoder * | encoder,
|  | const ubit_t * | input
| ) |  |

References osmo_conv_encoder::code, osmo_conv_code::K, and osmo_conv_encoder::state.

Referenced by osmo_conv_encode().

## ◆ osmo_conv_encode_raw()

int osmo_conv_encode_raw | ( | struct osmo_conv_encoder * | encoder,
|  | const ubit_t * | input,
|  | ubit_t * | output,
|  | int | n
| ) |  |

References _conv_encode_do_output(), osmo_conv_encoder::code, osmo_conv_encoder::i_idx, n, osmo_conv_code::next_output, osmo_conv_code::next_state, and osmo_conv_encoder::state.

Referenced by osmo_conv_encode().

## ◆ osmo_conv_get_input_length()

int osmo_conv_get_input_length | ( | const struct osmo_conv_code * | code,
|  | int | len
| ) |  |

References len(), and osmo_conv_code::len.

Referenced by osmo_conv_get_output_length().

## ◆ osmo_conv_get_output_length()

int osmo_conv_get_output_length | ( | const struct osmo_conv_code * | code,
|  | int | len
| ) |  |

References CONV_TERM_FLUSH, osmo_conv_code::K, len(), osmo_conv_code::N, osmo_conv_get_input_length(), osmo_conv_code::puncture, and osmo_conv_code::term.