/* ------------------------------------------------------------------------------ FUNCTION NAME: lsp_reset ------------------------------------------------------------------------------ INPUT AND OUTPUT DEFINITIONS Inputs: st = Pointer to type lspState Outputs: st = Pointer to type lspState -- values are reset. Returns: None Global Variables Used: None Local Variables Needed: None ------------------------------------------------------------------------------ FUNCTION DESCRIPTION resets lsp_state data ------------------------------------------------------------------------------ REQUIREMENTS None ------------------------------------------------------------------------------ REFERENCES lsp.c, UMTS GSM AMR speech codec, R99 - Version 3.2.0, March 2, 2001 ------------------------------------------------------------------------------ PSEUDO-CODE ------------------------------------------------------------------------------ RESOURCES USED [optional] When the code is written for a specific target processor the the resources used should be documented below. HEAP MEMORY USED: x bytes STACK MEMORY USED: x bytes CLOCK CYCLES: (cycle count equation for this function) + (variable used to represent cycle count for each subroutine called) where: (cycle count variable) = cycle count for [subroutine name] ------------------------------------------------------------------------------ CAUTION [optional] [State any special notes, constraints or cautions for users of this function] ------------------------------------------------------------------------------ */ Word16 lsp_reset(lspState *st) { if (st == (lspState *) NULL) { /* fprintf(stderr, "lsp_reset: invalid parameter\n"); */ return -1; } /* Init lsp_old[] */ memcpy(st->lsp_old, lsp_init_data, M*sizeof(Word16)); /* Initialize lsp_old_q[] */ memcpy(st->lsp_old_q, st->lsp_old, M*sizeof(Word16)); /* Reset quantization state */ Q_plsf_reset(st->qSt); return 0; }
/* ************************************************************************** * * Function : Q_plsf_init * Purpose : Allocates memory and initializes state variables * ************************************************************************** */ int Q_plsf_init (Q_plsfState **state) { Q_plsfState* s; if (state == (Q_plsfState **) NULL){ fprintf(stderr, "Q_plsf_init: invalid parameter\n"); return -1; } *state = NULL; /* allocate memory */ if ((s= (Q_plsfState *) malloc(sizeof(Q_plsfState))) == NULL){ fprintf(stderr, "Q_plsf_init: can not malloc state structure\n"); return -1; } Q_plsf_reset(s); *state = s; return 0; }