changeset 113:269d341db403

libgsmefr: implement main encoder wrapper
author Mychaela Falconia <falcon@freecalypso.org>
date Tue, 29 Nov 2022 07:30:39 +0000
parents 035424a6ca83
children ff0372186b59
files libgsmefr/Makefile libgsmefr/enc_wrap.c
diffstat 2 files changed, 24 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/libgsmefr/Makefile	Tue Nov 29 07:05:59 2022 +0000
+++ b/libgsmefr/Makefile	Tue Nov 29 07:30:39 2022 +0000
@@ -3,10 +3,10 @@
 OBJS=	agc.o autocorr.o az_lsp.o basicop2.o bfi_nodata.o c1035pf.o cod_12k2.o \
 	convolve.o d1035pf.o d_gains.o d_homing.o d_plsf_5.o dec_12k2.o \
 	dec_create.o dec_lag6.o dec_main.o dec_wrap.o dtx.o e_homing.o \
-	enc_create.o enc_lag6.o enc_main.o frame2params.o g_code.o g_pitch.o \
-	int_lpc.o inter_6.o inv_sqrt.o lag_wind.o levinson.o log2.o lsp_az.o \
-	lsp_lsf.o oper_32b.o params2frame.o pitch_f6.o pitch_ol.o pow2.o \
-	pre_proc.o pred_lt6.o preemph.o pstfilt2.o q_gains.o q_plsf_5.o \
+	enc_create.o enc_lag6.o enc_main.o enc_wrap.o frame2params.o g_code.o \
+	g_pitch.o int_lpc.o inter_6.o inv_sqrt.o lag_wind.o levinson.o log2.o \
+	lsp_az.o lsp_lsf.o oper_32b.o params2frame.o pitch_f6.o pitch_ol.o \
+	pow2.o pre_proc.o pred_lt6.o preemph.o pstfilt2.o q_gains.o q_plsf_5.o \
 	reorder.o residu.o sid_class.o sid_insert.o syn_filt.o tls_flags.o \
 	vad.o weight_a.o
 HDRS=	basic_op.h cnst.h codec.h d_homing.h dec_state.h dtx.h e_homing.h \
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/libgsmefr/enc_wrap.c	Tue Nov 29 07:30:39 2022 +0000
@@ -0,0 +1,20 @@
+/*
+ * This module contains our EFR_encode_frame() function, which is the primary
+ * (most common, most useful) interface to our EFR encoder.
+ */
+
+#include "gsm_efr.h"
+
+void EFR_encode_frame(struct EFR_encoder_state *st, const int16_t *pcm_in,
+		      uint8_t *frame, int *sp_out, int *vad_out)
+{
+	int16_t params[EFR_NUM_PARAMS];
+	int sp;
+
+	EFR_encode_params(st, pcm_in, params, &sp, vad_out);
+	EFR_params2frame(params, frame);
+	if (!sp)
+		EFR_insert_sid_codeword(frame);
+	if (sp_out)
+		*sp_out = sp;
+}