changeset 30:2272ba6f6879

libgsmefr: beginning with API definition
author Mychaela Falconia <falcon@freecalypso.org>
date Wed, 23 Nov 2022 07:54:04 +0000
parents d21c68b8f16c
children 19a90fa1f608
files libgsmefr/gsm_efr.h
diffstat 1 files changed, 46 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libgsmefr/gsm_efr.h	Wed Nov 23 07:54:04 2022 +0000
@@ -0,0 +1,46 @@
+/*
+ * This header file is the external public interface to libgsmefr;
+ * it should be installed in the same system include directory
+ * as <gsm.h> and <gsm_fr_preproc.h> for the older FR codec.
+ */
+
+#ifndef	__GSM_EFR_H
+#define	__GSM_EFR_H
+
+#include <stdint.h>
+
+struct EFR_encoder_state;	/* opaque to external users */
+struct EFR_decoder_state;	/* ditto */
+
+extern struct EFR_encoder_state *EFR_encoder_create(int dtx);
+extern struct EFR_decoder_state *EFR_decoder_create(void);
+/* use standard free() call to free both afterward */
+
+/* reset state to initial */
+extern void EFR_encoder_reset(struct EFR_encoder_state *st, int dtx);
+extern void EFR_decoder_reset(struct EFR_decoder_state *st);
+
+/* encoder public functions */
+
+extern void EFR_encode_params(struct EFR_encoder_state *st, const int16_t *pcm,
+			      int16_t *params, int *sp, int *vad);
+extern void EFR_encode_frame(struct EFR_encoder_state *st, const int16_t *pcm,
+			     uint8_t *frame, int *sp, int *vad);
+
+/* decoder public functions */
+
+extern void EFR_decode_params(struct EFR_decoder_state *st,
+			      const int16_t *params, int bfi, int sid, int taf,
+			      int16_t *pcm);
+extern void EFR_decode_frame(struct EFR_decoder_state *st, const uint8_t *frame,
+			     int bfi, int taf, int16_t *pcm);
+extern void EFR_decode_bfi_nodata(struct EFR_decoder_state *st, int taf,
+				  int16_t *pcm);
+
+/* stateless utility functions */
+
+extern int EFR_sid_classify(const uint8_t *frame);
+extern void EFR_frame2params(const uint8_t *frame, int16_t *params);
+extern void EFR_params2frame(const int16_t *params, int sid, uint8_t *frame);
+
+#endif	/* include guard */