ESP-IDF Firmware
Firmware architecture and call graph
Loading...
Searching...
No Matches
dspm_sub_f32_ansi.c
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2023 Espressif Systems (Shanghai) CO LTD
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7#include "dspm_sub.h"
8
9esp_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)
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
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)
int esp_err_t
Definition esp_err.h:21
#define ESP_OK
Definition esp_err.h:23