/************************************************************************* * * Function: Post_Filter_init * Purpose: Allocates memory for filter structure and initializes * state memory * ************************************************************************** */ int Post_Filter_init (Post_FilterState **state) { Post_FilterState* s; if (state == (Post_FilterState **) NULL) { fprintf(stderr, "Post_Filter_init: invalid parameter\n"); return -1; } *state = NULL; /* allocate memory */ if ((s= (Post_FilterState *) malloc(sizeof(Post_FilterState))) == NULL) { fprintf(stderr, "Post_Filter_init: can not malloc state structure\n"); return -1; } s->preemph_state = NULL; s->agc_state = NULL; if (preemphasis_init(&s->preemph_state) || agc_init(&s->agc_state)) { Post_Filter_exit(&s); return -1; } Post_Filter_reset(s); *state = s; return 0; }
/************************************************************************* * * Function: Speech_Decode_Frame_reset * Purpose: Resetses state memory * ************************************************************************** */ int Speech_Decode_Frame_reset (Speech_Decode_FrameState *state) { Decoder_amr_reset(state->decoder_amrState, (enum Mode)0); Post_Filter_reset(state->post_state); Post_Process_reset(state->postHP_state); state->prev_mode = (enum Mode)0; return 0; }