29 #ifndef PUNCT_CONVCODE_H 30 #define PUNCT_CONVCODE_H 36 #include <itpp/itexports.h> 109 void set_puncture_matrix(
const bmat &pmatrix);
119 void encode(
const bvec &input, bvec &output);
121 bvec
encode(
const bvec &input) { bvec output;
encode(input, output);
return output; }
124 void encode_trunc(
const bvec &input, bvec &output);
135 void encode_tail(
const bvec &input, bvec &output);
146 void encode_tailbite(
const bvec &input, bvec &output);
149 { bvec output; encode_tailbite(input, output);
return output; }
153 virtual void decode(
const vec &received_signal, bvec &output);
155 virtual bvec
decode(
const vec &received_signal) { bvec output;
decode(received_signal, output);
return output; }
158 virtual void decode(
const bvec &coded_bits, bvec &decoded_bits);
159 virtual bvec decode(
const bvec &coded_bits);
162 void decode_trunc(
const vec &received_signal, bvec &output);
172 void decode_tail(
const vec &received_signal, bvec &output);
182 void decode_tailbite(
const vec &received_signal, bvec &output);
185 { bvec output; decode_tailbite(received_signal, output);
return output; }
193 bool inverse_tail(
const bvec coded_sequence, bvec &input);
196 bool catastrophic(
void);
199 void distance_profile(ivec &dist_prof,
int time,
int dmax = 100000,
bool reverse =
false);
229 void calculate_spectrum(
Array<ivec> &spectrum,
int time,
int dmax,
int no_terms,
int block_length = 0);
247 int fast(
Array<ivec> &spectrum,
int time,
int dfree,
int no_terms,
int d_best_so_far = 0,
bool test_catastrophic =
false);
251 int weight(
const int state,
const int input,
int time);
253 void weight(
const int state,
int &w0,
int &w1,
int time);
255 int weight_reverse(
const int state,
const int input,
int time);
257 void weight_reverse(
const int state,
int &w0,
int &w1,
int time);
269 #endif // #ifndef PUNCT_CONVCODE_H Definition of a binary convolutional encoder class.
void set_method(const CONVOLUTIONAL_CODE_METHOD method)
Set encoding and decoding method (Trunc, Tail, or Tailbite)
void set_code(const CONVOLUTIONAL_CODE_TYPE type_of_code, int inverse_rate, int constraint_length)
Set the code according to built-in tables.
virtual bvec decode(const vec &received_signal)
Viterbi decoding using specified method.
Binary Convolutional rate 1/n class.
Vec< T > reverse(const Vec< T > &in)
Reverse the input vector.
ivec get_generator_polynomials() const
Get generator polynomials.
int total
The number of "1" in the puncture matrix.
bvec decode_trunc(const vec &received_signal)
Viterbi decoding using truncation of memory (default = 5*K)
bvec encode_tail(const bvec &input)
Encoding that begins and ends in the zero state.
void set_generator_polynomials(const ivec &gen, int constraint_length)
Set generator polynomials. Given in Proakis integer form.
bvec decode_tailbite(const vec &received_signal)
Decode a block of encoded data where encode_tailbite has been used. Tries all start states...
virtual ~Punctured_Convolutional_Code(void)
Destructor.
int weight(const bvec &a)
Calculate the Hamming weight of a.
Definition of Array class (container)
CONVOLUTIONAL_CODE_TYPE
Type of Convolutional Code.
bmat puncture_matrix
The puncture matrix (n rows and Period columns)
Matrix Class Definitions.
int get_puncture_period() const
Get puncturing period.
bvec decode_tail(const vec &received_signal)
Decode a block of encoded data where encode_tail has been used.
virtual double get_rate() const
Return rate of code.
vec spectrum(const vec &v, int nfft, int noverlap)
Power spectrum calculation.
bvec encode_tailbite(const bvec &input)
Encode a binary vector of inputs using tailbiting.
int Period
The puncture period (i.e. the number of columns in the puncture matrix)
void init_encoder()
Set the encoder internal state in start_state (set by set_start_state()).
CONVOLUTIONAL_CODE_METHOD
Encoding and decoding methods for Convolutional codes.
void set_code(const CONVOLUTIONAL_CODE_TYPE type_of_code, int inverse_rate, int constraint_length)
Set the code according to built-in tables.
Punctured_Convolutional_Code(void)
Constructor.
bvec encode(const bvec &input)
Encode a binary vector of inputs using specified method.
void set_generator_polynomials(const ivec &gen, int constraint_length)
Set generator polynomials. Given in Proakis integer form.
void set_method(const CONVOLUTIONAL_CODE_METHOD method)
Set encoding and decoding method (Trunc, Tail, or Tailbite)
bvec encode_trunc(const bvec &input)
Encode a binary vector of inputs starting from state set by the set_state function.
Binary Punctured Convolutional Code Class.
bmat get_puncture_matrix() const
Get puncture matrix.
Mat< bin > bmat
bin matrix
Templated Vector Class Definitions.