summaryrefslogtreecommitdiff
path: root/gr-error-correcting-codes/src/lib/libecc/decoder.h
diff options
context:
space:
mode:
Diffstat (limited to 'gr-error-correcting-codes/src/lib/libecc/decoder.h')
-rw-r--r--gr-error-correcting-codes/src/lib/libecc/decoder.h70
1 files changed, 51 insertions, 19 deletions
diff --git a/gr-error-correcting-codes/src/lib/libecc/decoder.h b/gr-error-correcting-codes/src/lib/libecc/decoder.h
index 76a24b20a6..8608001103 100644
--- a/gr-error-correcting-codes/src/lib/libecc/decoder.h
+++ b/gr-error-correcting-codes/src/lib/libecc/decoder.h
@@ -23,37 +23,69 @@
#ifndef INCLUDED_DECODER_H
#define INCLUDED_DECODER_H
-#include "code_types.h"
-
-// the 'decoder' class is a virtual class upon which all decoder types
-// can be built.
+#include "code_io.h"
class decoder
{
+ /*
+ * class decoder
+ * A virtual class upon which all decoder types can be built.
+ * This class provides the basic methods and variables
+ * generic for all decoders.
+ */
public:
decoder () {};
virtual ~decoder () {};
- virtual size_t compute_n_input_metrics (size_t n_output_bits) = 0;
- virtual size_t compute_n_output_bits (size_t n_input_metrics) = 0;
- virtual size_t decode (const char** in_buf,
- char** out_buf,
+ /*
+ * compute_n_...: to be defined by inheriting classes, in order to
+ * allow for user-functions to figure out how many inputs are
+ * required to generate a given number of outputs, and vice versa.
+ * Can't define them without knowing the decoder type.
+ *
+ * Compute the number of input items (metrics, floats, whatevers)
+ * needed to produce 'n_output' bits, and the number of output bits
+ * which will be produced by 'n_input' items ... for a single stream
+ * only.
+ */
+
+ virtual size_t compute_n_input_items (size_t n_output_bits) = 0;
+ virtual size_t compute_n_output_bits (size_t n_input_items) = 0;
+
+ /*
+ * decode: given the input and output buffers, either decode up to
+ * the number of output bits or decode the number of input items
+ * ... if the buffers support either decoding amounts.
+ */
+
+ virtual size_t decode (const code_input_ptr in_buf,
+ code_output_ptr out_buf,
size_t n_bits_to_output);
- virtual size_t decode (const char** in_buf,
- size_t n_metrics_to_input,
- char** out_buf);
+ virtual size_t decode (const code_input_ptr in_buf,
+ size_t n_items_to_input,
+ code_output_ptr out_buf);
+
+/* for remote access to internal info */
+
+ inline const size_t block_size_bits () {return (d_block_size_bits);};
+ inline const size_t n_code_inputs () {return (d_n_code_inputs);};
+ inline const size_t n_code_outputs () {return (d_n_code_outputs);};
+ inline const size_t total_n_dec_bits () {return (d_total_n_dec_bits);};
protected:
- virtual void decode_private (const char** in_buf, char** out_buf) = 0;
- virtual char get_next_input (const char** in_buf, size_t code_input_n) = 0;
- virtual void output_bit (char t_out_bit, char** out_buf,
- size_t t_output_stream) = 0;
+ /*
+ * decode_private: decode the given in_buf and write the output bits
+ * to the out_buf, using internal class variables. This function is
+ * called from the publically available "encode()" methods, which
+ * first set the internal class variables before executing.
+ */
+
+ virtual void decode_private () = 0;
size_t d_block_size_bits, d_n_code_inputs, d_n_code_outputs;
- size_t d_n_dec_bits;
- size_t d_in_buf_ndx, d_out_buf_ndx;
- size_t d_in_bit_shift, d_out_bit_shift;
- size_t d_n_input_metrics_left, d_n_output_bits_left;
+ size_t d_total_n_dec_bits;
+ code_input_ptr d_in_buf;
+ code_output_ptr d_out_buf;
};
#endif /* INCLUDED_DECODER_H */