37#include <itpp/itexports.h>
142 virtual void encode(
const bvec &input, bvec &output);
145 encode(input, output);
157 void encode_trunc(
const bvec &input, bvec &output);
158 bvec encode_trunc(
const bvec &input) {
160 encode_trunc(input, output);
176 void encode_tail(
const bvec &input, bvec &output);
177 bvec encode_tail(
const bvec &input) {
179 encode_tail(input, output);
199 void encode_tailbite(
const bvec &input, bvec &output);
200 bvec encode_tailbite(
const bvec &input) {
202 encode_tailbite(input, output);
213 void encode_bit(
const bin &input, bvec &output);
214 bvec encode_bit(
const bin &input) {
216 encode_bit(input, output);
222 virtual void decode(
const bvec &coded_bits, bvec &decoded_bits);
223 virtual bvec decode(
const bvec &coded_bits);
227 virtual void decode(
const vec &received_signal, bvec &output);
259 virtual void decode_tailbite(
const vec &received_signal, bvec &output);
260 virtual bvec decode_tailbite(
const vec &received_signal) {
262 decode_tailbite(received_signal, output);
269 virtual void decode_trunc(
const vec &received_signal, bvec &output);
270 virtual bvec decode_trunc(
const vec &received_signal) {
272 decode_trunc(received_signal, output);
279 virtual double get_rate(
void)
const {
return rate; }
285 "Convolutional_Code::set_start_state(): Invalid start state");
302 "Truncation length shorter than K");
311 bool catastrophic(
void);
375 return ((
instate >> 1) | (input << (m - 1)));
379 return (((
state << 1) | input) & ((1 << m) - 1));
383 S0 = (
state << 1) & (no_states - 1);
392 int weight_reverse(
const int state,
const int input);
395 void weight_reverse(
const int state,
int &
w0,
int &
w1);
397 bvec output_reverse(
const int state,
const int input);
Definition of Array class (container)
Import/Export definitions for some templates defined in base folder.
Channel Code class virtual interface.
int length() const
Returns the number of data elements in the array object.
Generic Channel Code class.
Binary Convolutional rate 1/n class.
int get_input(const int state)
Returns the input that results in state, that is the MSB of state.
int encoder_state
The current encoder state.
int get_encoder_state(void) const
Get the current encoder state.
double rate
The rate of the code.
void set_method(const CONVOLUTIONAL_CODE_METHOD method)
Set encoding and decoding method (Trunc, Tail, or Tailbite)
vec sum_metric
Metrics accumulator.
imat path_memory
Path memory (trellis)
int get_truncation_length(void) const
Get memory truncation length.
int next_state(const int instate, const int input)
Next state from instate given the input.
virtual double get_rate(void) const
Return rate of code (not including the rate-loss)
int trunc_length
The decoder truncation length.
ivec get_generator_polynomials(void) const
Get generator polynomials.
void set_start_state(int state)
Set encoder default start state.
void previous_state(const int state, int &S0, int &S1)
The previous state from state given the input.
int previous_state(const int state, const int input)
The previous state from state given the input.
int start_state
The encoder start state.
virtual ~Convolutional_Code(void)
Destructor.
imat output_reverse_int
output in int format for a given state and input
Convolutional_Code(void)
Default constructor - sets (0133,0171) code with tail.
int trunc_ptr
Truncated path memory pointer.
int no_states
Number of states.
void init_encoder()
Initialise internal encoder state with start state. Has no effect on Tail and Tailbite methods.
void set_truncation_length(const int length)
Set memory truncation length. Must be at least K.
int n
Number of generators.
int m
Memory of the encoder.
ivec gen_pol_rev
Generator polynomials for the reverse code.
int trunc_state
Truncated memory fill state.
CONVOLUTIONAL_CODE_METHOD cc_method
encoding and decoding method
bvec xor_int_table
Auxilary table used by the codec.
ivec gen_pol
Generator polynomials.
Array< bool > visited_state
Visited states.
virtual bvec decode(const vec &received_signal)
Decode a vec of received data.
virtual bvec encode(const bvec &input)
Encode a bvec of input.
#define it_error_if(t, s)
Abort if t is true.
CONVOLUTIONAL_CODE_METHOD
Encoding and decoding methods for Convolutional codes.
CONVOLUTIONAL_CODE_TYPE
Type of Convolutional Code.
int length(const Vec< T > &v)
Length of vector.
int weight(const bvec &a)
Calculate the Hamming weight of a.
Vec< T > reverse(const Vec< T > &in)
Reverse the input vector.
vec spectrum(const vec &v, int nfft, int noverlap)
Power spectrum calculation.
Matrix Class Definitions.
int weight_int(int length, int in)
int compare_spectra(ivec v1, ivec v2)
int reverse_int(int length, int in)
Templated Vector Class Definitions.