ESP-IDF Firmware
Firmware architecture and call graph
Loading...
Searching...
No Matches
dspm_add.h File Reference
#include "dsp_err.h"
#include "dspm_add_platform.h"
Include dependency graph for dspm_add.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define dspm_add_f32   dspm_add_f32_ansi

Functions

esp_err_t dspm_add_f32_ansi (const float *input1, const float *input2, float *output, int rows, int cols, int padd1, int padd2, int padd_out, int step1, int step2, int step_out)
 add two arrays with paddings (add two sub-matrices)
esp_err_t dspm_add_f32_ae32 (const float *input1, const float *input2, float *output, int rows, int cols, int padd1, int padd2, int padd_out, int step1, int step2, int step_out)

Macro Definition Documentation

◆ dspm_add_f32

#define dspm_add_f32   dspm_add_f32_ansi

Definition at line 62 of file dspm_add.h.

Referenced by dspm::operator+(), and dspm::Mat::operator+=().

Function Documentation

◆ dspm_add_f32_ae32()

esp_err_t dspm_add_f32_ae32 ( const float * input1,
const float * input2,
float * output,
int rows,
int cols,
int padd1,
int padd2,
int padd_out,
int step1,
int step2,
int step_out )

◆ dspm_add_f32_ansi()

esp_err_t dspm_add_f32_ansi ( const float * input1,
const float * input2,
float * output,
int rows,
int cols,
int padd1,
int padd2,
int padd_out,
int step1,
int step2,
int step_out )

add two arrays with paddings (add two sub-matrices)

The function adds two arrays defined as sub-matrices with paddings out[row * ptr_step_out + col * step_out] = in1[row * ptr_step_in1 + col * step1] + in2[row * ptr_step_in2 + col * step2]; The implementation use ANSI C and could be compiled and run on any platform

Parameters
[in]input1input array 1
[in]input2input array 2
[out]outputoutput array
[in]rowsmatrix rows
[in]colsmatrix cols
[in]padd1input array 1 padding
[in]padd2input array 2 padding
[in]padd_outoutput array padding
[in]step1step over input array 1 (by default should be 1)
[in]step2step over input array 2 (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 10 of file dspm_add_f32_ansi.c.

11{
12 if (NULL == input1) {
14 }
15 if (NULL == input2) {
17 }
18 if (NULL == output) {
20 }
21
22 if (rows <= 0) {
24 }
25 if (cols <= 0) {
27 }
28
29 if (padd1 < 0) {
31 }
32 if (padd2 < 0) {
34 }
35 if (padd_out < 0) {
37 }
38
39 if (step1 <= 0) {
41 }
42 if (step2 <= 0) {
44 }
45 if (step_out <= 0) {
47 }
48
49 const int ptr_input1_step = cols + padd1;
50 const int ptr_input2_step = cols + padd2;
51 const int ptr_output_step = cols + padd_out;
52 float *ptr_input1 = (float *)input1;
53 float *ptr_input2 = (float *)input2;
54
55 for (int row = 0; row < rows; row++) {
56 for (int col = 0; col < cols; col++) {
57 output[col * step_out] = ptr_input1[col * step1] + ptr_input2[col * step2];
58 }
59 ptr_input1 += ptr_input1_step;
60 ptr_input2 += ptr_input2_step;
61 output += ptr_output_step;
62 }
63 return ESP_OK;
64}
#define ESP_ERR_DSP_PARAM_OUTOFRANGE
#define ESP_OK
Definition esp_err.h:23

References ESP_ERR_DSP_PARAM_OUTOFRANGE, and ESP_OK.