summaryrefslogtreecommitdiffstats
path: root/include/osmocom
diff options
context:
space:
mode:
authorSylvain Munaut <tnt@246tNt.com>2011-11-24 17:46:58 +0100
committerSylvain Munaut <tnt@246tNt.com>2011-11-24 17:46:58 +0100
commit297d13f4604c330efac19c03c12d590730076ed5 (patch)
tree55b8c9c05ba9aa42e32900a3166c10b8c9f89b74 /include/osmocom
parentd4440d4cfab0e8ca855b3120ab92535f5df96330 (diff)
core/conv: Add support for other termination types (trunc & tail biting)
Note that this breaks the ABI and the low level API. But it shouldn't break the high level API, nor the conv code definitions (because fields default to 0, and for new fields '0' is the previous behavior) Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
Diffstat (limited to 'include/osmocom')
-rw-r--r--include/osmocom/core/conv.h31
1 files changed, 25 insertions, 6 deletions
diff --git a/include/osmocom/core/conv.h b/include/osmocom/core/conv.h
index ba490b45..159a055b 100644
--- a/include/osmocom/core/conv.h
+++ b/include/osmocom/core/conv.h
@@ -35,6 +35,19 @@
#include <osmocom/core/bits.h>
+/*! \brief 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.
+ */
+enum osmo_conv_term {
+ CONV_TERM_FLUSH = 0, /*!< \brief Flush encoder state */
+ CONV_TERM_TRUNCATION, /*!< \brief Direct truncation */
+ CONV_TERM_TAIL_BITING, /*!< \brief Tail biting */
+};
+
/*! \brief structure describing a given convolutional code
*
* The only required fields are N,K and the next_output/next_state arrays. The
@@ -46,6 +59,8 @@ struct osmo_conv_code {
int K; /*!< \brief Constraint length */
int len; /*!< \brief # of data bits */
+ enum osmo_conv_term term; /*!< \brief Termination type */
+
const uint8_t (*next_output)[2];/*!< \brief Next output array */
const uint8_t (*next_state)[2]; /*!< \brief Next state array */
@@ -70,9 +85,11 @@ struct osmo_conv_encoder {
void osmo_conv_encode_init(struct osmo_conv_encoder *encoder,
const struct osmo_conv_code *code);
+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_finish(struct osmo_conv_encoder *encoder, ubit_t *output);
+int osmo_conv_encode_flush(struct osmo_conv_encoder *encoder, ubit_t *output);
/* All-in-one */
int osmo_conv_encode(const struct osmo_conv_code *code,
@@ -100,16 +117,18 @@ struct osmo_conv_decoder {
};
void osmo_conv_decode_init(struct osmo_conv_decoder *decoder,
- const struct osmo_conv_code *code, int len);
-void osmo_conv_decode_reset(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_finish(struct osmo_conv_decoder *decoder,
- const sbit_t *input);
+int osmo_conv_decode_flush(struct osmo_conv_decoder *decoder,
+ const sbit_t *input);
int osmo_conv_decode_get_output(struct osmo_conv_decoder *decoder,
- ubit_t *output, int has_finish);
+ ubit_t *output, int has_flush, int end_state);
/* All-in-one */
int osmo_conv_decode(const struct osmo_conv_code *code,