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

Go to the source code of this file.

Macros

#define dsps_dotprod_s16   dsps_dotprod_s16_ansi
#define dsps_dotprod_f32   dsps_dotprod_f32_ansi
#define dsps_dotprode_f32   dsps_dotprode_f32_ansi

Functions

esp_err_t dsps_dotprod_s16_ansi (const int16_t *src1, const int16_t *src2, int16_t *dest, int len, int8_t shift)
 dot product of two 16 bit vectors Dot product calculation for two signed 16 bit arrays: *dest += (src1[i] * src2[i]) >> (15-shift); i= [0..N) The extension (_ansi) use ANSI C and could be compiled and run on any platform. The extension (_ae32) is optimized for ESP32 chip.
esp_err_t dsps_dotprod_s16_ae32 (const int16_t *src1, const int16_t *src2, int16_t *dest, int len, int8_t shift)
esp_err_t dsps_dotprod_s16_arp4 (const int16_t *src1, const int16_t *src2, int16_t *dest, int len, int8_t shift)
esp_err_t dsps_dotprod_f32_ansi (const float *src1, const float *src2, float *dest, int len)
 dot product of two float vectors Dot product calculation for two floating point arrays: *dest += (src1[i] * src2[i]); i= [0..N) The extension (_ansi) use ANSI C and could be compiled and run on any platform. The extension (_ae32) is optimized for ESP32 chip.
esp_err_t dsps_dotprod_f32_ae32 (const float *src1, const float *src2, float *dest, int len)
esp_err_t dsps_dotprod_f32_aes3 (const float *src1, const float *src2, float *dest, int len)
esp_err_t dsps_dotprod_f32_arp4 (const float *src1, const float *src2, float *dest, int len)
esp_err_t dsps_dotprode_f32_ansi (const float *src1, const float *src2, float *dest, int len, int step1, int step2)
 dot product of two float vectors with step Dot product calculation for two floating point arrays: *dest += (src1[i*step1] * src2[i*step2]); i= [0..N) The extension (_ansi) use ANSI C and could be compiled and run on any platform. The extension (_ae32) is optimized for ESP32 chip.
esp_err_t dsps_dotprode_f32_ae32 (const float *src1, const float *src2, float *dest, int len, int step1, int step2)
esp_err_t dsps_dotprode_f32_arp4 (const float *src1, const float *src2, float *dest, int len, int step1, int step2)

Macro Definition Documentation

◆ dsps_dotprod_f32

#define dsps_dotprod_f32   dsps_dotprod_f32_ansi

Definition at line 124 of file dsps_dotprod.h.

◆ dsps_dotprod_s16

#define dsps_dotprod_s16   dsps_dotprod_s16_ansi

Definition at line 123 of file dsps_dotprod.h.

◆ dsps_dotprode_f32

#define dsps_dotprode_f32   dsps_dotprode_f32_ansi

Definition at line 125 of file dsps_dotprod.h.

Function Documentation

◆ dsps_dotprod_f32_ae32()

esp_err_t dsps_dotprod_f32_ae32 ( const float * src1,
const float * src2,
float * dest,
int len )

◆ dsps_dotprod_f32_aes3()

esp_err_t dsps_dotprod_f32_aes3 ( const float * src1,
const float * src2,
float * dest,
int len )

◆ dsps_dotprod_f32_ansi()

esp_err_t dsps_dotprod_f32_ansi ( const float * src1,
const float * src2,
float * dest,
int len )

dot product of two float vectors Dot product calculation for two floating point arrays: *dest += (src1[i] * src2[i]); i= [0..N) The extension (_ansi) use ANSI C and could be compiled and run on any platform. The extension (_ae32) is optimized for ESP32 chip.

Parameters
[in]src1source array 1
[in]src2source array 2
destdestination pointer
[in]lenlength of input arrays
Returns
  • ESP_OK on success
  • One of the error codes from DSP library

Definition at line 17 of file dsps_dotprod_f32_ansi.c.

18{
19 float acc = 0;
20 for (int i = 0 ; i < len ; i++) {
21 acc += src1[i] * src2[i];
22 }
23 *dest = acc;
24 return ESP_OK;
25}
#define ESP_OK
Definition esp_err.h:23

References ESP_OK.

◆ dsps_dotprod_f32_arp4()

esp_err_t dsps_dotprod_f32_arp4 ( const float * src1,
const float * src2,
float * dest,
int len )

◆ dsps_dotprod_s16_ae32()

esp_err_t dsps_dotprod_s16_ae32 ( const int16_t * src1,
const int16_t * src2,
int16_t * dest,
int len,
int8_t shift )

◆ dsps_dotprod_s16_ansi()

esp_err_t dsps_dotprod_s16_ansi ( const int16_t * src1,
const int16_t * src2,
int16_t * dest,
int len,
int8_t shift )

dot product of two 16 bit vectors Dot product calculation for two signed 16 bit arrays: *dest += (src1[i] * src2[i]) >> (15-shift); i= [0..N) The extension (_ansi) use ANSI C and could be compiled and run on any platform. The extension (_ae32) is optimized for ESP32 chip.

Parameters
[in]src1source array 1
[in]src2source array 2
destdestination pointer
[in]lenlength of input arrays
[in]shiftshift of the result.
Returns
  • ESP_OK on success
  • One of the error codes from DSP library

Definition at line 17 of file dsps_dotprod_s16_ansi.c.

18{
19 // To make correct round operation we have to shift round value
20 long long acc = 0x7fff >> shift;
21
22 for (int i = 0 ; i < len ; i++) {
23 acc += (int32_t)src1[i] * (int32_t)src2[i];
24 }
25
26 int final_shift = shift - 15;
27 if (final_shift > 0) {
28 *dest = (acc << final_shift);
29 } else {
30 *dest = (acc >> (-final_shift));
31 }
32 return ESP_OK;
33}

References ESP_OK.

◆ dsps_dotprod_s16_arp4()

esp_err_t dsps_dotprod_s16_arp4 ( const int16_t * src1,
const int16_t * src2,
int16_t * dest,
int len,
int8_t shift )

◆ dsps_dotprode_f32_ae32()

esp_err_t dsps_dotprode_f32_ae32 ( const float * src1,
const float * src2,
float * dest,
int len,
int step1,
int step2 )

◆ dsps_dotprode_f32_ansi()

esp_err_t dsps_dotprode_f32_ansi ( const float * src1,
const float * src2,
float * dest,
int len,
int step1,
int step2 )

dot product of two float vectors with step Dot product calculation for two floating point arrays: *dest += (src1[i*step1] * src2[i*step2]); i= [0..N) The extension (_ansi) use ANSI C and could be compiled and run on any platform. The extension (_ae32) is optimized for ESP32 chip.

Parameters
[in]src1source array 1
[in]src2source array 2
destdestination pointer
[in]lenlength of input arrays
[in]step1step over elements in first array
[in]step2step over elements in second array
Returns
  • ESP_OK on success
  • One of the error codes from DSP library

Definition at line 17 of file dsps_dotprode_f32_ansi.c.

18{
19 float acc = 0;
20 for (int i = 0 ; i < len ; i++) {
21 acc += src1[i * step1] * src2[i * step2];
22 }
23 *dest = acc;
24 return ESP_OK;
25}

References ESP_OK.

◆ dsps_dotprode_f32_arp4()

esp_err_t dsps_dotprode_f32_arp4 ( const float * src1,
const float * src2,
float * dest,
int len,
int step1,
int step2 )