EDGEAI API
feature_extract.h
Go to the documentation of this file.
1 /*
2  * Created on: Nov 20, 2025
3  */
4 // #############################################################################
5 //
6 // FILE: feature_extract.h
7 //
11 //
12 // #############################################################################
13 //
14 /*
15  * Copyright (c) 2024-2026, Texas Instruments Incorporated
16  *
17  * All rights reserved not granted herein.
18  * Limited License.
19  *
20  * Texas Instruments Incorporated grants a world-wide, royalty-free,
21  * non-exclusive license under copyrights and patents it now or hereafter
22  * owns or controls to make, have made, use, import, offer to sell and sell
23  * ("Utilize") this software subject to the terms herein. With respect to the
24  * foregoing patent license, such license is granted solely to the extent that
25  * any such patent is necessary to Utilize the software alone. The patent
26  * license shall not apply to any combinations which include this software,
27  * other than combinations with devices manufactured by or for TI ("TI
28  * Devices"). No hardware patent is licensed hereunder.
29  *
30  * Redistributions must preserve existing copyright notices and reproduce
31  * this license (including the above copyright notice and the disclaimer and
32  * (if applicable) source code license limitations below) in the documentation
33  * and/or other materials provided with the distribution.
34  *
35  * Redistribution and use in binary form, without modification, are permitted
36  * provided that the following conditions are met:
37  *
38  * * No reverse engineering, decompilation, or disassembly of this software
39  * is permitted with respect to any software provided in binary form.
40  * * Any redistribution and use are licensed by TI for use only with TI Devices.
41  * * Nothing shall obligate TI to provide you with source code for the software
42  * licensed and provided to you in object code.
43  *
44  * If software source code is provided to you, modification and redistribution
45  * of the source code are permitted provided that the following conditions are
46  * met:
47  *
48  * * Any redistribution and use of the source code, including any resulting
49  * derivative works, are licensed by TI for use only with TI Devices.
50  * * Any redistribution and use of any object code compiled from the source
51  * code and any resulting derivative works, are licensed by TI for use
52  * only with TI Devices.
53  *
54  * Neither the name of Texas Instruments Incorporated nor the names of its
55  * suppliers may be used to endorse or promote products derived from this
56  * software without specific prior written permission.
57  *
58  * DISCLAIMER.
59  *
60  * THIS SOFTWARE IS PROVIDED BY TI AND TI'S LICENSORS "AS IS" AND ANY EXPRESS
61  * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
62  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
63  * IN NO EVENT SHALL TI AND TI'S LICENSORS BE LIABLE FOR ANY DIRECT, INDIRECT,
64  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
65  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
66  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
67  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
68  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
69  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
70  */
71 // #############################################################################
72 
87 #ifndef FEATURE_EXTRACT_H_
88 #define FEATURE_EXTRACT_H_
89 
90 // Peripheral includes
91 #include "math.h"
92 #if defined(__TMS320C2000__) || defined(__C29__)
93 #include "driverlib.h"
94 #else
95 #include "stdint.h"
96 #include "stdbool.h"
97 #endif
98 
99 #include "user_input_config.h"
100 
101 #if defined(FE_FFT_COL) && !defined(FE_MODEL_SC)
102 #define FE_MODEL_SC (FE_VARIABLES / 2)
103 #endif
104 
105 #ifdef __cplusplus
106 extern "C" {
107 #endif
108 
114 #if defined(SKIP_NORMALIZE)
115 typedef int8_t model_input_t;
116 #else
117 typedef float model_input_t;
118 #endif
119 
125 #if defined(OUTPUT_INT)
126 typedef int8_t model_output_t;
127 #else
128 typedef float model_output_t;
129 #endif
130 
137 typedef struct {
138  void* input_buffer;
145 
147 
158 void FE_allocFeatureExtract(feature_extraction_handle fe);
159 
171 void FE_initFeatureExtract(feature_extraction_handle fe);
172 
194 void FE_runFeatureExtract(feature_extraction_handle fe);
195 
207 int FE_compareModelInput(model_input_t* expected_array, model_input_t* obtained_array);
208 
220 int FE_compareModelOutput(model_output_t* expected_array, model_output_t* obtained_array);
221 
223 #ifdef __cplusplus
224 }
225 #endif /* extern "C" */
226 
227 #endif /* FEATURE_EXTRACT_H_ */
feature_extraction * feature_extraction_handle
Definition: feature_extract.h:146
bool test_feature_extraction
Definition: feature_extract.h:142
void * scratch_buffer
Definition: feature_extract.h:141
float model_input_t
Model Input.
Definition: feature_extract.h:117
int FE_compareModelInput(model_input_t *expected_array, model_input_t *obtained_array)
Compares feature extraction buffers.
void FE_runFeatureExtract(feature_extraction_handle fe)
Main feature extraction processing function.
int32_t size_required_by_library
Definition: feature_extract.h:143
void * history_buffer
Definition: feature_extract.h:140
Feature extraction context structure.
Definition: feature_extract.h:137
void FE_allocFeatureExtract(feature_extraction_handle fe)
Calculates required memory allocation for feature extraction.
float model_output_t
Model Output.
Definition: feature_extract.h:128
void * output_buffer
Definition: feature_extract.h:139
int FE_compareModelOutput(model_output_t *expected_array, model_output_t *obtained_array)
Compares nn model buffers.
void * input_buffer
Definition: feature_extract.h:138
void FE_initFeatureExtract(feature_extraction_handle fe)
Initializes feature extraction state and buffers.
© Copyright 1995-2026, Texas Instruments Incorporated. All rights reserved.
Trademarks | Privacy policy | Terms of use | Terms of sale