view libgsmhr1/dec_state.c @ 602:72cdae602d6e

libgsmhr1/dec_func.c: rm unused static functions In the original code, sp_dec.c held two kinds of functions: those needed only as part of the decoder, and those used by both decoder and encoder engines. In this library, we have moved the latter class of functions to dec_func.c module. Almost all static functions from the original sp_dec.c, with the exception of aToRc(), are needed only on sp_dec.c side of the new divide - remove them from dec_func.c, where they became dead code.
author Mychaela Falconia <falcon@freecalypso.org>
date Thu, 04 Dec 2025 18:58:22 +0000
parents 8e4ecdfadf5a
children
line wrap: on
line source

/*
 * Here we implement gsmhr_decoder_create() and gsmhr_decoder_reset()
 * functions: allocation and initialization of full speech decoder state.
 */

#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include "tw_gsmhr.h"
#include "typedefs.h"
#include "namespace.h"
#include "dec_state.h"
#include "dtx_const.h"

struct gsmhr_decoder_state *gsmhr_decoder_create(void)
{
	struct gsmhr_decoder_state *st;

	st = malloc(sizeof(struct gsmhr_decoder_state));
	if (st)
		gsmhr_decoder_reset(st);
	return st;
}

void gsmhr_decoder_reset(struct gsmhr_decoder_state *st)
{
	int i;

	memset(st, 0, sizeof(struct gsmhr_decoder_state));
	gsmhr_rxfe_reset(&st->rxfe);
	for (i = 0; i < 4; i++) {
		st->plSubfrEnergyMem[i] = 80;
		st->swLevelMem[i] = -72;
	}
	st->swRxDTXState = CNINTPER - 1;
	st->is_homed = 1;
}