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

Go to the source code of this file.

Macros

#define dsps_mul_f32   dsps_mul_f32_ansi
#define dsps_mul_s16   dsps_mul_s16_ansi
#define dsps_mul_s8   dsps_mul_s8_ansi

Functions

esp_err_t dsps_mul_f32_ansi (const float *input1, const float *input2, float *output, int len, int step1, int step2, int step_out)
 Multiply two arrays.
esp_err_t dsps_mul_f32_ae32 (const float *input1, const float *input2, float *output, int len, int step1, int step2, int step_out)
esp_err_t dsps_mul_s16_ansi (const int16_t *input1, const int16_t *input2, int16_t *output, int len, int step1, int step2, int step_out, int shift)
 Multiply two arrays.
esp_err_t dsps_mul_s16_ae32 (const int16_t *input1, const int16_t *input2, int16_t *output, int len, int step1, int step2, int step_out, int shift)
esp_err_t dsps_mul_s16_aes3 (const int16_t *input1, const int16_t *input2, int16_t *output, int len, int step1, int step2, int step_out, int shift)
esp_err_t dsps_mul_s8_ansi (const int8_t *input1, const int8_t *input2, int8_t *output, int len, int step1, int step2, int step_out, int shift)
esp_err_t dsps_mul_s8_aes3 (const int8_t *input1, const int8_t *input2, int8_t *output, int len, int step1, int step2, int step_out, int shift)

Macro Definition Documentation

◆ dsps_mul_f32

#define dsps_mul_f32   dsps_mul_f32_ansi

Definition at line 106 of file dsps_mul.h.

◆ dsps_mul_s16

#define dsps_mul_s16   dsps_mul_s16_ansi

Definition at line 107 of file dsps_mul.h.

◆ dsps_mul_s8

#define dsps_mul_s8   dsps_mul_s8_ansi

Definition at line 108 of file dsps_mul.h.

Function Documentation

◆ dsps_mul_f32_ae32()

esp_err_t dsps_mul_f32_ae32 ( const float * input1,
const float * input2,
float * output,
int len,
int step1,
int step2,
int step_out )

◆ dsps_mul_f32_ansi()

esp_err_t dsps_mul_f32_ansi ( const float * input1,
const float * input2,
float * output,
int len,
int step1,
int step2,
int step_out )

Multiply two arrays.

The function multiply one input array to another and store result to other array out[i*step_out] = input1[i*step1] * input2[i*step2]; i=[0..len) The implementation use ANSI C and could be compiled and run on any platform

Parameters
[in]input1input array 1
[in]input2input array 2
outputoutput array
lenamount of operations for arrays
step1step over input array 1 (by default should be 1)
step2step over input array 2 (by default should be 1)
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 17 of file dsps_mul_f32_ansi.c.

18{
19 if (NULL == input1) {
21 }
22 if (NULL == input2) {
24 }
25 if (NULL == output) {
27 }
28
29 for (int i = 0 ; i < len ; i++) {
30 output[i * step_out] = input1[i * step1] * input2[i * step2];
31 }
32 return ESP_OK;
33}
#define ESP_ERR_DSP_PARAM_OUTOFRANGE
#define ESP_OK
Definition esp_err.h:23

References ESP_ERR_DSP_PARAM_OUTOFRANGE, and ESP_OK.

◆ dsps_mul_s16_ae32()

esp_err_t dsps_mul_s16_ae32 ( const int16_t * input1,
const int16_t * input2,
int16_t * output,
int len,
int step1,
int step2,
int step_out,
int shift )

◆ dsps_mul_s16_aes3()

esp_err_t dsps_mul_s16_aes3 ( const int16_t * input1,
const int16_t * input2,
int16_t * output,
int len,
int step1,
int step2,
int step_out,
int shift )

◆ dsps_mul_s16_ansi()

esp_err_t dsps_mul_s16_ansi ( const int16_t * input1,
const int16_t * input2,
int16_t * output,
int len,
int step1,
int step2,
int step_out,
int shift )

Multiply two arrays.

The function multiply one input array to another and store result to other array out[i*step_out] = input1[i*step1] * input2[i*step2]; i=[0..len) The implementation use ANSI C and could be compiled and run on any platform

Parameters
[in]input1input array 1
[in]input2input array 2
outputoutput array
lenamount of operations for arrays
step1step over input array 1 (by default should be 1)
step2step over input array 2 (by default should be 1)
step_outstep over output array (by default should be 1)
shiftoutput shift after multiplication (by default should be 15)
Returns
  • ESP_OK on success
  • One of the error codes from DSP library

Definition at line 17 of file dsps_mul_s16_ansi.c.

18{
19 if (NULL == input1) {
21 }
22 if (NULL == input2) {
24 }
25 if (NULL == output) {
27 }
28
29 for (int i = 0 ; i < len ; i++) {
30 int ttt = (int)input1[i * step1] * (int)input2[i * step2];
31 output[i * step_out] = ttt >> shift;
32 }
33 return ESP_OK;
34}

References ESP_ERR_DSP_PARAM_OUTOFRANGE, and ESP_OK.

Referenced by microphone_read_task(), and microphone_read_task().

Here is the caller graph for this function:

◆ dsps_mul_s8_aes3()

esp_err_t dsps_mul_s8_aes3 ( const int8_t * input1,
const int8_t * input2,
int8_t * output,
int len,
int step1,
int step2,
int step_out,
int shift )

◆ dsps_mul_s8_ansi()

esp_err_t dsps_mul_s8_ansi ( const int8_t * input1,
const int8_t * input2,
int8_t * output,
int len,
int step1,
int step2,
int step_out,
int shift )

Definition at line 9 of file dsps_mul_s8_ansi.c.

10{
11 if (NULL == input1) {
13 }
14 if (NULL == input2) {
16 }
17 if (NULL == output) {
19 }
20
21 for (int i = 0 ; i < len ; i++) {
22 int32_t acc = (int32_t)input1[i * step1] * (int32_t)input2[i * step2];
23 output[i * step_out] = acc >> shift;
24 }
25 return ESP_OK;
26}

References ESP_ERR_DSP_PARAM_OUTOFRANGE, and ESP_OK.