view libgsmfrp/internal.h @ 288:e0b46ac2c326

gsmfr-encode-r: convert to libgsmfr2
author Mychaela Falconia <falcon@freecalypso.org>
date Sun, 14 Apr 2024 06:20:04 +0000
parents 6ac547f0b903
children
line wrap: on
line source

/*
 * This header file is internal to libgsmfrp;
 * here we define our state structure.
 */

enum rx_state {
	NO_DATA = 0,
	SPEECH,
	SPEECH_MUTING,
	COMFORT_NOISE,
	LOST_SID,
	CN_MUTING,
};

struct gsmfr_preproc_state {
	enum rx_state	rx_state;
	gsm_frame	speech_frame;
	gsm_byte	sid_prefix[5];
	uint8_t		sid_xmaxc;
	uint32_t	cn_random_lfsr;
	unsigned	cn_random_6fold;
};

/* we use the same LFSR PRNG for CN as ETSI EFR implementation */
#define PN_INITIAL_SEED 0x70816958L   /* Pseudo noise generator seed value  */

/* internal functions */
extern void gsmfr_preproc_gen_cn(struct gsmfr_preproc_state *state,
				 gsm_byte *frame);
extern void gsmfr_preproc_sid2cn(struct gsmfr_preproc_state *state,
				 gsm_byte *frame);
extern void gsmfr_preproc_invalid_sid(struct gsmfr_preproc_state *state,
				      gsm_byte *frame);
extern uint16_t gsmfr_preproc_prng(struct gsmfr_preproc_state *state,
				   uint16_t no_bits);
extern uint8_t gsmfr_preproc_xmaxc_mean(const gsm_byte *frame);