Feature Extraction API

Module: AI libraries

Structures

Name

struct

feature_extraction
Feature extraction context structure.

Types

Name

typedef float

model_input_t
Model Input.

typedef float

model_output_t
Model Output.

typedef feature_extraction *

feature_extraction_handle
Feature extraction handle, pointer to feature_extraction.

Functions

Name

void

FE_allocFeatureExtract(feature_extraction_handle fe)
Calculates required memory allocation for feature extraction.

void

FE_initFeatureExtract(feature_extraction_handle fe)
Initializes feature extraction state and buffers.

void

FE_runFeatureExtract(feature_extraction_handle fe)
Main feature extraction processing function.

int

FE_compareModelInput(model_input_t * expected_array, model_input_t * obtained_array)
Compares feature extraction buffers.

int

FE_compareModelOutput(model_output_t * expected_array, model_output_t * obtained_array)
Compares nn model buffers.

Types Documentation

typedef model_input_t

typedef float model_input_t;

Model Input.

Model Input type

typedef model_output_t

typedef float model_output_t;

Model Output.

Model Output type

typedef feature_extraction_handle

typedef feature_extraction* feature_extraction_handle;

Feature extraction handle, pointer to feature_extraction.

Functions Documentation

function FE_allocFeatureExtract

void FE_allocFeatureExtract(
    feature_extraction_handle fe
)

Calculates required memory allocation for feature extraction.

Parameters:

  • fe Feature extraction handle

Sets the required memory size for feature extraction operations Size is calculated as 2x frame size in float precision

function FE_initFeatureExtract

void FE_initFeatureExtract(
    feature_extraction_handle fe
)

Initializes feature extraction state and buffers.

Parameters:

  • fe Feature extraction handle

Initializes history buffer and output buffer for feature extraction Handles both normalized and quantized output modes Processes each channel separately for multi-channel data

function FE_runFeatureExtract

void FE_runFeatureExtract(
    feature_extraction_handle fe
)

Main feature extraction processing function.

Parameters:

  • fe Feature extraction handle containing all buffers and state

Performs complete feature extraction pipeline including:

  • Raw signal processing (optional mean removal)

  • Windowing (optional)

  • FFT computation (optional)

  • FFT normalization (optional)

  • DC removal (optional)

  • Frequency binning (optional)

  • Log scaling (optional)

  • Frame concatenation (optional)

  • Batch normalization or direct copy (based on configuration)

Processes each channel independently and supports both normalized float output and quantized int8_t output modes

function FE_compareModelInput

int FE_compareModelInput(
    model_input_t * expected_array,
    model_input_t * obtained_array
)

Compares feature extraction buffers.

Parameters:

  • expected_array Expected output from feature extraction

  • obtained_array Obtained output from feature extraction

Return: number of mismatches in two array

Takes the difference of the two arrays and returns the number of elements that were not matched.

function FE_compareModelOutput

int FE_compareModelOutput(
    model_output_t * expected_array,
    model_output_t * obtained_array
)

Compares nn model buffers.

Parameters:

  • expected_array Expected output from nn model

  • obtained_array Obtained output from nn model

Return: number of mismatches in two array

Takes the difference of the two arrays and returns the number of elements that were not matched.