Hide navigation sidebar
Hide table of contents sidebar
Back to top
Toggle table of contents sidebar

# AGC API Functions

group agc_func

  Functions

  void agc_init(agc_state_t *agc, agc_config_t *config)

    Initialise the AGC.

    This function initialises the AGC state with the provided configuration. It must be called at startup to initialise the AGC before processing any frames, and can be called at any time after that to reset the AGC instance, returning the internal AGC state to its defaults.

    Example with an unmodified profile

          agc_state_t agc;
          agc_init(&agc, &AGC_PROFILE_ASR);

    Example with modification to the profile

          agc_config_t conf = AGC_PROFILE_FIXED_GAIN;
          conf.gain = f32_to_float_s32(100);
          agc_state_t agc;
          agc_init(&agc, &conf);

    Parameters:

      - agc – [out] AGC state structure

      - config – [in] Initial configuration values

  void agc_process_frame(agc_state_t *agc, int32_t output[AGC_FRAME_ADVANCE], const int32_t input[AGC_FRAME_ADVANCE], agc_meta_data_t *meta_data)

    Perform AGC processing on a frame of input data.

    This function updates the AGC’s internal state based on the input frame and meta-data, and returns an output containing the result of the AGC algorithm applied to the input.

    The `input` and `output` pointers can be equal to perform the processing in-place.

    Example

          int32_t input[AGC_FRAME_ADVANCE];
          int32_t output[AGC_FRAME_ADVANCE];
          agc_meta_data md;
          md.vnr_flag = AGC_META_DATA_NO_VNR;
          md.aec_ref_power = AGC_META_DATA_NO_AEC;
          md.aec_corr_factor = AGC_META_DATA_NO_AEC;
          agc_process_frame(&agc, output, input, &md);

    Parameters:

      - agc – [inout] AGC state structure

      - output – [out] Array to return the resulting frame of data

      - input – [in] Array of frame data on which to perform the AGC

      - meta_data – [in] Meta-data structure with VNR/AEC data