ESP-IDF Firmware
Firmware architecture and call graph
Loading...
Searching...
No Matches
dsps_corr_f32_ansi.c File Reference
#include "dsps_corr.h"
Include dependency graph for dsps_corr_f32_ansi.c:

Go to the source code of this file.

Functions

esp_err_t dsps_corr_f32_ansi (const float *Signal, const int siglen, const float *Pattern, const int patlen, float *dest)
 Correlation with pattern.

Function Documentation

◆ dsps_corr_f32_ansi()

esp_err_t dsps_corr_f32_ansi ( const float * Signal,
const int siglen,
const float * Pattern,
const int patlen,
float * dest )

Correlation with pattern.

The function correlate input sigla array with pattern array. The implementation use ANSI C and could be compiled and run on any platform

Parameters
[in]Signalinput array with signal values
[in]siglenlength of the signal array
[in]Patterninput array with pattern values
[in]patlenlength of the pattern array. The siglen must be bigger then patlen!
destoutput array with result of correlation
Returns
  • ESP_OK on success
  • One of the error codes from DSP library (one of the input array are NULL, or if (siglen < patlen))

Definition at line 17 of file dsps_corr_f32_ansi.c.

18{
19 if (NULL == Signal) {
21 }
22 if (NULL == Pattern) {
24 }
25 if (NULL == dest) {
27 }
28 if (siglen < patlen) {
30 }
31
32 for (size_t n = 0; n <= (siglen - patlen); n++) {
33 float k_corr = 0;
34 for (size_t m = 0; m < patlen; m++) {
35 k_corr += Signal[n + m] * Pattern[m];
36 }
37 dest[n] = k_corr;
38 }
39 return ESP_OK;
40}
#define ESP_ERR_DSP_PARAM_OUTOFRANGE
#define ESP_OK
Definition esp_err.h:23
const int m
Definition test_mmult.c:16
const int n
Definition test_mmult.c:17

References ESP_ERR_DSP_PARAM_OUTOFRANGE, ESP_OK, m, and n.