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

Go to the source code of this file.

Macros

#define dspm_sub_f32   dspm_sub_f32_ansi

Functions

esp_err_t dspm_sub_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)
 subtracts two arrays with paddings (subtracts two sub-matrices)
esp_err_t dspm_sub_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_sub_f32

#define dspm_sub_f32   dspm_sub_f32_ansi

Definition at line 58 of file dspm_sub.h.

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

Function Documentation

◆ dspm_sub_f32_ae32()

esp_err_t dspm_sub_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_sub_f32_ansi()

esp_err_t dspm_sub_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 )

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

The function subtracts 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 9 of file dspm_sub_f32_ansi.c.

10{
11 if (NULL == input1) {
13 }
14 if (NULL == input2) {
16 }
17 if (NULL == output) {
19 }
20
21 if (rows <= 0) {
23 }
24 if (cols <= 0) {
26 }
27
28 if (padd1 < 0) {
30 }
31 if (padd2 < 0) {
33 }
34 if (padd_out < 0) {
36 }
37
38 if (step1 <= 0) {
40 }
41 if (step2 <= 0) {
43 }
44 if (step_out <= 0) {
46 }
47
48 const int ptr_input1_step = cols + padd1;
49 const int ptr_input2_step = cols + padd2;
50 const int ptr_out_step = cols + padd_out;
51 float *ptr_input1 = (float *)input1;
52 float *ptr_input2 = (float *)input2;
53
54 for (int row = 0; row < rows; row++) {
55 for (int col = 0; col < cols; col++) {
56 output[col * step_out] = ptr_input1[col * step1] - ptr_input2[col * step2];
57 }
58 ptr_input1 += ptr_input1_step;
59 ptr_input2 += ptr_input2_step;
60 output += ptr_out_step;
61 }
62 return ESP_OK;
63}
#define ESP_ERR_DSP_PARAM_OUTOFRANGE
#define ESP_OK
Definition esp_err.h:23

References ESP_ERR_DSP_PARAM_OUTOFRANGE, and ESP_OK.