aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-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,