ESP-IDF Firmware
Firmware architecture and call graph
Loading...
Searching...
No Matches
dspm_addc_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_addc.h
"
8
9
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)
10
{
11
if
(NULL == input) {
12
return
ESP_ERR_DSP_PARAM_OUTOFRANGE
;
13
}
14
if
(NULL == output) {
15
return
ESP_ERR_DSP_PARAM_OUTOFRANGE
;
16
}
17
18
if
(rows <= 0) {
19
return
ESP_ERR_DSP_PARAM_OUTOFRANGE
;
20
}
21
if
(cols <= 0) {
22
return
ESP_ERR_DSP_PARAM_OUTOFRANGE
;
23
}
24
25
if
(padd_in < 0) {
26
return
ESP_ERR_DSP_PARAM_OUTOFRANGE
;
27
}
28
if
(padd_out < 0) {
29
return
ESP_ERR_DSP_PARAM_OUTOFRANGE
;
30
}
31
32
if
(step_in <= 0) {
33
return
ESP_ERR_DSP_PARAM_OUTOFRANGE
;
34
}
35
if
(step_out <= 0) {
36
return
ESP_ERR_DSP_PARAM_OUTOFRANGE
;
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
}
ESP_ERR_DSP_PARAM_OUTOFRANGE
#define ESP_ERR_DSP_PARAM_OUTOFRANGE
Definition
dsp_err_codes.h:22
dspm_addc.h
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)
Definition
dspm_addc_f32_ansi.c:9
esp_err_t
int esp_err_t
Definition
esp_err.h:21
ESP_OK
#define ESP_OK
Definition
esp_err.h:23
C
float C[4][16]
Definition
test_mmult.c:22
components
espressif__esp-dsp
modules
matrix
addc
float
dspm_addc_f32_ansi.c
Generated by
1.16.1