diff libtwamr/agc.c @ 307:6b33f3ba4289

libtwamr: go for single-chunk-state approach
author Mychaela Falconia <falcon@freecalypso.org>
date Tue, 16 Apr 2024 17:18:04 +0000
parents 07f936338de1
children
line wrap: on
line diff
--- a/libtwamr/agc.c	Mon Apr 15 23:47:51 2024 +0000
+++ b/libtwamr/agc.c	Tue Apr 16 17:18:04 2024 +0000
@@ -25,8 +25,6 @@
 *                         INCLUDE FILES
 *****************************************************************************
 */
-#include <stdlib.h>
-#include <stdio.h>
 #include "typedef.h"
 #include "basic_op.h"
 #include "no_count.h"
@@ -104,72 +102,14 @@
 /*
 **************************************************************************
 *
-*  Function    : agc_init
-*  Purpose     : Allocates memory for agc state and initializes
-*                state memory
-*
-**************************************************************************
-*/
-int agc_init (agcState **state)
-{
-  agcState* s;
- 
-  if (state == (agcState **) NULL){
-      fprintf(stderr, "agc_init: invalid parameter\n");
-      return -1;
-  }
-  *state = NULL;
- 
-  /* allocate memory */
-  if ((s= (agcState *) malloc(sizeof(agcState))) == NULL){
-      fprintf(stderr, "agc_init: can not malloc state structure\n");
-      return -1;
-  }
-  
-  agc_reset(s);
-  *state = s;
-  
-  return 0;
-}
- 
-/*
-**************************************************************************
-*
 *  Function    : agc_reset
 *  Purpose     : Reset of agc (i.e. set state memory to 1.0)
 *
 **************************************************************************
 */
-int agc_reset (agcState *state)
+void agc_reset (agcState *state)
 {
-  if (state == (agcState *) NULL){
-      fprintf(stderr, "agc_reset: invalid parameter\n");
-      return -1;
-  }
-  
   state->past_gain = 4096;   /* initial value of past_gain = 1.0  */
-  
-  return 0;
-}
- 
-/*
-**************************************************************************
-*
-*  Function    : agc_exit
-*  Purpose     : The memory used for state memory is freed
-*
-**************************************************************************
-*/
-void agc_exit (agcState **state)
-{
-  if (state == NULL || *state == NULL)
-      return;
- 
-  /* deallocate memory */
-  free(*state);
-  *state = NULL;
-  
-  return;
 }
  
 /*