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

Go to the source code of this file.

Functions

esp_err_t dspm_addc_f32_ansi (const float *input, float *output, float C, int rows, int cols, int padd_in, int padd_out, int step_in, int step_out)
 add a constant and an array with padding (add a constant and a sub-matrix)

Function Documentation

◆ dspm_addc_f32_ansi()

esp_err_t dspm_addc_f32_ansi ( const float * input,
float * output,
float C,
int rows,
int cols,
int padd_in,
int padd_out,
int step_in,
int step_out )

add a constant and an array with padding (add a constant and a sub-matrix)

The function adds a constant and an array defined as a sub-matrix with padding out[row * ptr_step_out + col * step_out] = input[row * ptr_step_in + col * step_in] + C; The implementation uses ANSI C and could be compiled and run on any platform

Parameters
[in]inputinput array
[out]outputoutput array
[in]Cconstant value
[in]rowsmatrix rows
[in]colsmatrix cols
[in]padd_ininput array padding
[in]padd_outoutput array padding
[in]step_instep over input array (by default should be 1)
[in]step_outstep over output array (by default should be 1)
Returns
  • ESP_OK on success
  • One of the error codes from DSP library

Definition at line 9 of file dspm_addc_f32_ansi.c.

10{
11 if (NULL == input) {
13 }
14 if (NULL == output) {
16 }
17
18 if (rows <= 0) {
20 }
21 if (cols <= 0) {
23 }
24
25 if (padd_in < 0) {
27 }
28 if (padd_out < 0) {
30 }
31
32 if (step_in <= 0) {
34 }
35 if (step_out <= 0) {
37 }
38
39 const int ptr_step_in = cols + padd_in;
40 const int ptr_step_out = cols + padd_out;
41 float *ptr_input = (float *)input;
42
43 for (int row = 0; row < rows; row++) {
44 for (int col = 0; col < cols; col++) {
45 output[col * step_out] = ptr_input[col * step_in] + C;
46 }
47 output += ptr_step_out;
48 ptr_input += ptr_step_in;
49 }
50 return ESP_OK;
51}
#define ESP_ERR_DSP_PARAM_OUTOFRANGE
#define ESP_OK
Definition esp_err.h:23
float C[4][16]
Definition test_mmult.c:22

References C, ESP_ERR_DSP_PARAM_OUTOFRANGE, and ESP_OK.