Houston, we have a trunk.
[debian/gnuradio] / gr-error-correcting-codes / src / lib / libecc / encoder_convolutional_ic8_ic8.h
1 /* -*- c++ -*- */
2 /*
3  * Copyright 2006 Free Software Foundation, Inc.
4  * 
5  * This file is part of GNU Radio
6  * 
7  * GNU Radio is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2, or (at your option)
10  * any later version.
11  * 
12  * GNU Radio is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  * GNU General Public License for more details.
16  * 
17  * You should have received a copy of the GNU General Public License
18  * along with GNU Radio; see the file COPYING.  If not, write to
19  * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20  * Boston, MA 02111-1307, USA.
21  */
22
23 #ifndef INCLUDED_ENCODER_CONVOLUTIONAL_IC8_IC8_H
24 #define INCLUDED_ENCODER_CONVOLUTIONAL_IC8_IC8_H
25
26 #include "encoder_convolutional.h"
27
28 /*!
29  * class encoder_convolutional_ic8_ic8 : public encoder_convolutional
30  *
31  * Encode the incoming streams using a convolutional encoder,
32  *     "feedforward" or feedback.  Optional termination, data
33  *     streaming, and starting and ending memory states.
34  *
35  * input is "ic8": streams of char, one stream per input as defined by the
36  *     instantiated code, using all 8 bits in the char.
37  *
38  * FIXME: need to have inputs for MSB or LSB first input and output.
39  *
40  * output is "ic8": streams of char, one stream per output as defined by the
41  *     instantiated code, using all 8 bits in the char.
42  */
43
44 class encoder_convolutional_ic8_ic8 : public encoder_convolutional
45 {
46 public:
47   encoder_convolutional_ic8_ic8
48   (int frame_size_bits,
49    int n_code_inputs,
50    int n_code_outputs,
51    const std::vector<int> &code_generators,
52    bool do_termination = true,
53    int start_memory_state = 0,
54    int end_memory_state = 0)
55     : encoder_convolutional (frame_size_bits,
56                              n_code_inputs,
57                              n_code_outputs,
58                              code_generators,
59                              do_termination,
60                              start_memory_state,
61                              end_memory_state) {};
62
63   encoder_convolutional_ic8_ic8
64   (int frame_size_bits,
65    int n_code_inputs,
66    int n_code_outputs,
67    const std::vector<int> &code_generators,
68    const std::vector<int> &code_feedback,
69    bool do_termination = true,
70    int start_memory_state = 0,
71    int end_memory_state = 0)
72     : encoder_convolutional (frame_size_bits,
73                              n_code_inputs,
74                              n_code_outputs,
75                              code_generators,
76                              code_feedback,
77                              do_termination,
78                              start_memory_state,
79                              end_memory_state) {};
80
81   virtual ~encoder_convolutional_ic8_ic8 () {};
82
83   virtual size_t compute_n_input_bits (size_t n_output_bits);
84   virtual size_t compute_n_output_bits (size_t n_input_bits);
85
86 protected:
87   virtual char get_next_bit__input (const char** in_buf,
88                                     size_t code_input_n);
89   virtual char get_next_bit__term (size_t code_input_n);
90   virtual void output_bit (char t_out_bit, char** out_buf,
91                            size_t t_output_stream);
92   virtual void increment_io_indices (bool while_encoding);
93   virtual void update_memory_post_encode ();
94 };
95
96 #endif /* INCLUDED_ENCODER_CONVOLUTIONAL_IC8_IC8_H */