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
9esp_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) {
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
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)
int esp_err_t
Definition esp_err.h:21
#define ESP_OK
Definition esp_err.h:23
float C[4][16]
Definition test_mmult.c:22