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

Go to the source code of this file.

Functions

esp_err_t dspi_dotprod_f32_ansi (image2d_t *in_image, image2d_t *filter, float *out_value, int count_x, int count_y)
 dot product of two images Dot product calculation for two floating point images: out_value += image[i...] * src2[i*...]); i= [0..count_x*count_y) 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 dspi_dotprod_s16_ansi (image2d_t *in_image, image2d_t *filter, int16_t *out_value, int count_x, int count_y, int shift)
 dot product of two images Dot product calculation for two floating point images: out_value += image[i...] * src2[i*...]); i= [0..count_x*count_y) 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 dspi_dotprod_u16_ansi (image2d_t *in_image, image2d_t *filter, uint16_t *out_value, int count_x, int count_y, int shift)
esp_err_t dspi_dotprod_s8_ansi (image2d_t *in_image, image2d_t *filter, int8_t *out_value, int count_x, int count_y, int shift)
esp_err_t dspi_dotprod_u8_ansi (image2d_t *in_image, image2d_t *filter, uint8_t *out_value, int count_x, int count_y, int shift)
esp_err_t dspi_dotprod_s16_aes3 (image2d_t *in_image, image2d_t *filter, int16_t *out_value, int count_x, int count_y, int shift)
esp_err_t dspi_dotprod_u16_aes3 (image2d_t *in_image, image2d_t *filter, uint16_t *out_value, int count_x, int count_y, int shift)
esp_err_t dspi_dotprod_s8_aes3 (image2d_t *in_image, image2d_t *filter, int8_t *out_value, int count_x, int count_y, int shift)
esp_err_t dspi_dotprod_u8_aes3 (image2d_t *in_image, image2d_t *filter, uint8_t *out_value, int count_x, int count_y, int shift)
esp_err_t dspi_dotprod_s16_arp4 (image2d_t *in_image, image2d_t *filter, int16_t *out_value, int count_x, int count_y, int shift)
esp_err_t dspi_dotprod_s8_arp4 (image2d_t *in_image, image2d_t *filter, int8_t *out_value, int count_x, int count_y, int shift)
esp_err_t dspi_dotprod_u16_arp4 (image2d_t *in_image, image2d_t *filter, uint16_t *out_value, int count_x, int count_y, int shift)
esp_err_t dspi_dotprod_u8_arp4 (image2d_t *in_image, image2d_t *filter, uint8_t *out_value, int count_x, int count_y, int shift)
esp_err_t dspi_dotprod_off_f32_ansi (image2d_t *in_image, image2d_t *filter, float *out_value, int count_x, int count_y, float offset)
 dot product of two images with input offset Dot product calculation for two floating point images: out_value += (image[i...] + offset) * src2[i*...]); i= [0..count_x*count_y) 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 dspi_dotprod_off_s16_ansi (image2d_t *in_image, image2d_t *filter, int16_t *out_value, int count_x, int count_y, int shift, int16_t offset)
 dot product of two images with input offset Dot product calculation for two floating point images: out_value += (image[i...] + offset) * src2[i*...]); i= [0..count_x*count_y) 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 dspi_dotprod_off_u16_ansi (image2d_t *in_image, image2d_t *filter, uint16_t *out_value, int count_x, int count_y, int shift, uint16_t offset)
esp_err_t dspi_dotprod_off_s8_ansi (image2d_t *in_image, image2d_t *filter, int8_t *out_value, int count_x, int count_y, int shift, int8_t offset)
esp_err_t dspi_dotprod_off_u8_ansi (image2d_t *in_image, image2d_t *filter, uint8_t *out_value, int count_x, int count_y, int shift, uint8_t offset)
esp_err_t dspi_dotprod_off_s16_aes3 (image2d_t *in_image, image2d_t *filter, int16_t *out_value, int count_x, int count_y, int shift, int16_t offset)
esp_err_t dspi_dotprod_off_u16_aes3 (image2d_t *in_image, image2d_t *filter, uint16_t *out_value, int count_x, int count_y, int shift, uint16_t offset)
esp_err_t dspi_dotprod_off_s8_aes3 (image2d_t *in_image, image2d_t *filter, int8_t *out_value, int count_x, int count_y, int shift, int8_t offset)
esp_err_t dspi_dotprod_off_u8_aes3 (image2d_t *in_image, image2d_t *filter, uint8_t *out_value, int count_x, int count_y, int shift, uint8_t offset)
esp_err_t dspi_dotprod_off_s16_arp4 (image2d_t *in_image, image2d_t *filter, int16_t *out_value, int count_x, int count_y, int shift, int16_t offset)
esp_err_t dspi_dotprod_off_u16_arp4 (image2d_t *in_image, image2d_t *filter, uint16_t *out_value, int count_x, int count_y, int shift, uint16_t offset)
esp_err_t dspi_dotprod_off_s8_arp4 (image2d_t *in_image, image2d_t *filter, int8_t *out_value, int count_x, int count_y, int shift, int8_t offset)
esp_err_t dspi_dotprod_off_u8_arp4 (image2d_t *in_image, image2d_t *filter, uint8_t *out_value, int count_x, int count_y, int shift, uint8_t offset)

Function Documentation

◆ dspi_dotprod_f32_ansi()

esp_err_t dspi_dotprod_f32_ansi ( image2d_t * in_image,
image2d_t * filter,
float * out_value,
int count_x,
int count_y )

dot product of two images Dot product calculation for two floating point images: out_value += image[i...] * src2[i*...]); i= [0..count_x*count_y) 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]in_imagedescriptor of the image
[in]filterdescriptor of the filter
[out]out_valuepointer to the output value
[in]count_xamount of samples by X axis (count_x*step_X <= widdth)
[in]count_yamount of samples by Y axis (count_y*step_Y <= height)
Returns
  • ESP_OK on success
  • One of the error codes from DSP library

Definition at line 17 of file dspi_dotprod_f32_ansi.c.

18{
19 if (in_image->step_x * count_x > in_image->stride_x) {
21 }
22 if (in_image->step_y * count_y > in_image->stride_y) {
24 }
25 if (filter->step_x * count_x > filter->stride_x) {
27 }
28 if (filter->step_y * count_y > filter->stride_y) {
30 }
31
32 float *i_data = (float *)in_image->data;
33 float *f_data = (float *)filter->data;
34 int i_step = in_image->stride_x * in_image->step_y;
35 int f_step = filter->stride_x * filter->step_y;
36
37 float acc = 0;
38 for (int y = 0; y < count_y; y++) {
39 for (int x = 0; x < count_x; x++) {
40 acc += i_data[in_image->step_x * x] * f_data[filter->step_x * x];
41 }
42 i_data += i_step;
43 f_data += f_step;
44 }
45 *out_value = acc;
46 return ESP_OK;
47}
#define ESP_ERR_DSP_PARAM_OUTOFRANGE
#define ESP_OK
Definition esp_err.h:23
int stride_x
Definition dsp_types.h:28
int stride_y
Definition dsp_types.h:29
void * data
Definition dsp_types.h:25
int step_y
Definition dsp_types.h:27
int step_x
Definition dsp_types.h:26
float y[1024]
Definition test_fir.c:11
float x[1024]
Definition test_fir.c:10

References image2d_s::data, ESP_ERR_DSP_PARAM_OUTOFRANGE, ESP_OK, image2d_s::step_x, image2d_s::step_y, image2d_s::stride_x, image2d_s::stride_y, x, and y.

◆ dspi_dotprod_off_f32_ansi()

esp_err_t dspi_dotprod_off_f32_ansi ( image2d_t * in_image,
image2d_t * filter,
float * out_value,
int count_x,
int count_y,
float offset )

dot product of two images with input offset Dot product calculation for two floating point images: out_value += (image[i...] + offset) * src2[i*...]); i= [0..count_x*count_y) 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]in_imagedescriptor of the image
[in]filterdescriptor of the filter
[out]out_valuepointer to the output value
[in]count_xamount of samples by X axis (count_x*step_X <= widdth)
[in]count_yamount of samples by Y axis (count_y*step_Y <= height)
[in]offset- input offset value.
Returns
  • ESP_OK on success
  • One of the error codes from DSP library

Definition at line 17 of file dspi_dotprod_off_f32_ansi.c.

18{
19 if (in_image->step_x * count_x > in_image->stride_x) {
21 }
22 if (in_image->step_y * count_y > in_image->stride_y) {
24 }
25 if (filter->step_x * count_x > filter->stride_x) {
27 }
28 if (filter->step_y * count_y > filter->stride_y) {
30 }
31
32 float *i_data = (float *)in_image->data;
33 float *f_data = (float *)filter->data;
34 int i_step = in_image->stride_x * in_image->step_y;
35 int f_step = filter->stride_x * filter->step_y;
36
37 float acc = 0;
38 for (int y = 0; y < count_y; y++) {
39 for (int x = 0; x < count_x; x++) {
40 acc += i_data[in_image->step_x * x] * (f_data[filter->step_x * x] + offset);
41 }
42 i_data += i_step;
43 f_data += f_step;
44 }
45 *out_value = acc;
46 return ESP_OK;
47}

References image2d_s::data, ESP_ERR_DSP_PARAM_OUTOFRANGE, ESP_OK, image2d_s::step_x, image2d_s::step_y, image2d_s::stride_x, image2d_s::stride_y, x, and y.

◆ dspi_dotprod_off_s16_aes3()

esp_err_t dspi_dotprod_off_s16_aes3 ( image2d_t * in_image,
image2d_t * filter,
int16_t * out_value,
int count_x,
int count_y,
int shift,
int16_t offset )

◆ dspi_dotprod_off_s16_ansi()

esp_err_t dspi_dotprod_off_s16_ansi ( image2d_t * in_image,
image2d_t * filter,
int16_t * out_value,
int count_x,
int count_y,
int shift,
int16_t offset )

dot product of two images with input offset Dot product calculation for two floating point images: out_value += (image[i...] + offset) * src2[i*...]); i= [0..count_x*count_y) 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]in_imagedescriptor of the image
[in]filterdescriptor of the filter
[out]out_valuepointer to the output value
[in]count_xamount of samples by X axis (count_x*step_X <= widdth)
[in]count_yamount of samples by Y axis (count_y*step_Y <= height)
[in]shift- result shift to right, by default must be 15 for int16_t or 7 for int8_t
[in]offset- input offset value.
Returns
  • ESP_OK on success
  • One of the error codes from DSP library

Definition at line 17 of file dspi_dotprod_off_s16_ansi.c.

18{
19 if (in_image->step_x * count_x > in_image->stride_x) {
21 }
22 if (in_image->step_y * count_y > in_image->stride_y) {
24 }
25 if (filter->step_x * count_x > filter->stride_x) {
27 }
28 if (filter->step_y * count_y > filter->stride_y) {
30 }
31
32 int16_t *i_data = (int16_t *)in_image->data;
33 int16_t *f_data = (int16_t *)filter->data;
34 int i_step = in_image->stride_x * in_image->step_y;
35 int f_step = filter->stride_x * filter->step_y;
36
37 int64_t acc = 0;
38 for (int y = 0; y < count_y; y++) {
39 for (int x = 0; x < count_x; x++) {
40 acc += (int32_t)i_data[in_image->step_x * x] * ((int32_t)f_data[filter->step_x * x] + (int32_t)offset);
41 }
42 i_data += i_step;
43 f_data += f_step;
44 }
45 acc += 1 << (shift - 1); // round operation
46 acc >>= shift;
47 *out_value = acc;
48 return ESP_OK;
49}

References image2d_s::data, ESP_ERR_DSP_PARAM_OUTOFRANGE, ESP_OK, image2d_s::step_x, image2d_s::step_y, image2d_s::stride_x, image2d_s::stride_y, x, and y.

◆ dspi_dotprod_off_s16_arp4()

esp_err_t dspi_dotprod_off_s16_arp4 ( image2d_t * in_image,
image2d_t * filter,
int16_t * out_value,
int count_x,
int count_y,
int shift,
int16_t offset )

◆ dspi_dotprod_off_s8_aes3()

esp_err_t dspi_dotprod_off_s8_aes3 ( image2d_t * in_image,
image2d_t * filter,
int8_t * out_value,
int count_x,
int count_y,
int shift,
int8_t offset )

◆ dspi_dotprod_off_s8_ansi()

esp_err_t dspi_dotprod_off_s8_ansi ( image2d_t * in_image,
image2d_t * filter,
int8_t * out_value,
int count_x,
int count_y,
int shift,
int8_t offset )

Definition at line 17 of file dspi_dotprod_off_s8_ansi.c.

18{
19 if (in_image->step_x * count_x > in_image->stride_x) {
21 }
22 if (in_image->step_y * count_y > in_image->stride_y) {
24 }
25 if (filter->step_x * count_x > filter->stride_x) {
27 }
28 if (filter->step_y * count_y > filter->stride_y) {
30 }
31
32 int8_t *i_data = (int8_t *)in_image->data;
33 int8_t *f_data = (int8_t *)filter->data;
34 int i_step = in_image->stride_x * in_image->step_y;
35 int f_step = filter->stride_x * filter->step_y;
36
37 int32_t acc = 0;
38 for (int y = 0; y < count_y; y++) {
39 for (int x = 0; x < count_x; x++) {
40 acc += (int16_t)i_data[in_image->step_x * x] * ((int16_t)f_data[filter->step_x * x] + (int16_t)offset);
41 }
42 i_data += i_step;
43 f_data += f_step;
44 }
45 acc += 1 << (shift - 1); // round operation
46 acc >>= shift;
47 *out_value = acc;
48 return ESP_OK;
49}

References image2d_s::data, ESP_ERR_DSP_PARAM_OUTOFRANGE, ESP_OK, image2d_s::step_x, image2d_s::step_y, image2d_s::stride_x, image2d_s::stride_y, x, and y.

◆ dspi_dotprod_off_s8_arp4()

esp_err_t dspi_dotprod_off_s8_arp4 ( image2d_t * in_image,
image2d_t * filter,
int8_t * out_value,
int count_x,
int count_y,
int shift,
int8_t offset )

◆ dspi_dotprod_off_u16_aes3()

esp_err_t dspi_dotprod_off_u16_aes3 ( image2d_t * in_image,
image2d_t * filter,
uint16_t * out_value,
int count_x,
int count_y,
int shift,
uint16_t offset )

◆ dspi_dotprod_off_u16_ansi()

esp_err_t dspi_dotprod_off_u16_ansi ( image2d_t * in_image,
image2d_t * filter,
uint16_t * out_value,
int count_x,
int count_y,
int shift,
uint16_t offset )

Definition at line 17 of file dspi_dotprod_off_u16_ansi.c.

18{
19 if (in_image->step_x * count_x > in_image->stride_x) {
21 }
22 if (in_image->step_y * count_y > in_image->stride_y) {
24 }
25 if (filter->step_x * count_x > filter->stride_x) {
27 }
28 if (filter->step_y * count_y > filter->stride_y) {
30 }
31
32 uint16_t *i_data = (uint16_t *)in_image->data;
33 uint16_t *f_data = (uint16_t *)filter->data;
34 int i_step = in_image->stride_x * in_image->step_y;
35 int f_step = filter->stride_x * filter->step_y;
36
37 int64_t acc = 0;
38 for (int y = 0; y < count_y; y++) {
39 for (int x = 0; x < count_x; x++) {
40 acc += (int32_t)i_data[in_image->step_x * x] * ((int32_t)f_data[filter->step_x * x] + (int32_t)offset);
41 }
42 i_data += i_step;
43 f_data += f_step;
44 }
45 acc += 1 << (shift - 1); // round operation
46 acc >>= shift;
47 *out_value = acc;
48 return ESP_OK;
49}

References image2d_s::data, ESP_ERR_DSP_PARAM_OUTOFRANGE, ESP_OK, image2d_s::step_x, image2d_s::step_y, image2d_s::stride_x, image2d_s::stride_y, x, and y.

◆ dspi_dotprod_off_u16_arp4()

esp_err_t dspi_dotprod_off_u16_arp4 ( image2d_t * in_image,
image2d_t * filter,
uint16_t * out_value,
int count_x,
int count_y,
int shift,
uint16_t offset )

◆ dspi_dotprod_off_u8_aes3()

esp_err_t dspi_dotprod_off_u8_aes3 ( image2d_t * in_image,
image2d_t * filter,
uint8_t * out_value,
int count_x,
int count_y,
int shift,
uint8_t offset )

◆ dspi_dotprod_off_u8_ansi()

esp_err_t dspi_dotprod_off_u8_ansi ( image2d_t * in_image,
image2d_t * filter,
uint8_t * out_value,
int count_x,
int count_y,
int shift,
uint8_t offset )

Definition at line 17 of file dspi_dotprod_off_u8_ansi.c.

18{
19 if (in_image->step_x * count_x > in_image->stride_x) {
21 }
22 if (in_image->step_y * count_y > in_image->stride_y) {
24 }
25 if (filter->step_x * count_x > filter->stride_x) {
27 }
28 if (filter->step_y * count_y > filter->stride_y) {
30 }
31
32 uint8_t *i_data = (uint8_t *)in_image->data;
33 uint8_t *f_data = (uint8_t *)filter->data;
34 int i_step = in_image->stride_x * in_image->step_y;
35 int f_step = filter->stride_x * filter->step_y;
36
37 int32_t acc = 0;
38 for (int y = 0; y < count_y; y++) {
39 for (int x = 0; x < count_x; x++) {
40 acc += (int16_t)i_data[in_image->step_x * x] * ((int16_t)f_data[filter->step_x * x] + (int16_t)offset);
41 }
42 i_data += i_step;
43 f_data += f_step;
44 }
45 acc += 1 << (shift - 1); // round operation
46 acc >>= shift;
47 *out_value = acc;
48 return ESP_OK;
49}

References image2d_s::data, ESP_ERR_DSP_PARAM_OUTOFRANGE, ESP_OK, image2d_s::step_x, image2d_s::step_y, image2d_s::stride_x, image2d_s::stride_y, x, and y.

◆ dspi_dotprod_off_u8_arp4()

esp_err_t dspi_dotprod_off_u8_arp4 ( image2d_t * in_image,
image2d_t * filter,
uint8_t * out_value,
int count_x,
int count_y,
int shift,
uint8_t offset )

◆ dspi_dotprod_s16_aes3()

esp_err_t dspi_dotprod_s16_aes3 ( image2d_t * in_image,
image2d_t * filter,
int16_t * out_value,
int count_x,
int count_y,
int shift )

◆ dspi_dotprod_s16_ansi()

esp_err_t dspi_dotprod_s16_ansi ( image2d_t * in_image,
image2d_t * filter,
int16_t * out_value,
int count_x,
int count_y,
int shift )

dot product of two images Dot product calculation for two floating point images: out_value += image[i...] * src2[i*...]); i= [0..count_x*count_y) 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]in_imagedescriptor of the image
[in]filterdescriptor of the filter
[out]out_valuepointer to the output value
[in]count_xamount of samples by X axis (count_x*step_X <= widdth)
[in]count_yamount of samples by Y axis (count_y*step_Y <= height)
[in]shift- result shift to right, by default must be 15 for int16_t or 7 for int8_t
Returns
  • ESP_OK on success
  • One of the error codes from DSP library

Definition at line 17 of file dspi_dotprod_s16_ansi.c.

18{
19 if (in_image->step_x * count_x > in_image->stride_x) {
21 }
22 if (in_image->step_y * count_y > in_image->stride_y) {
24 }
25 if (filter->step_x * count_x > filter->stride_x) {
27 }
28 if (filter->step_y * count_y > filter->stride_y) {
30 }
31
32 int16_t *i_data = (int16_t *)in_image->data;
33 int16_t *f_data = (int16_t *)filter->data;
34 int i_step = in_image->stride_x * in_image->step_y;
35 int f_step = filter->stride_x * filter->step_y;
36
37 int64_t acc = 0;
38 for (int y = 0; y < count_y; y++) {
39 for (int x = 0; x < count_x; x++) {
40 acc += (int32_t)i_data[in_image->step_x * x] * (int32_t)f_data[filter->step_x * x];
41 }
42 i_data += i_step;
43 f_data += f_step;
44 }
45 acc += 1 << (shift - 1); // round operation
46 acc >>= shift;
47 *out_value = acc;
48 return ESP_OK;
49}

References image2d_s::data, ESP_ERR_DSP_PARAM_OUTOFRANGE, ESP_OK, image2d_s::step_x, image2d_s::step_y, image2d_s::stride_x, image2d_s::stride_y, x, and y.

◆ dspi_dotprod_s16_arp4()

esp_err_t dspi_dotprod_s16_arp4 ( image2d_t * in_image,
image2d_t * filter,
int16_t * out_value,
int count_x,
int count_y,
int shift )

◆ dspi_dotprod_s8_aes3()

esp_err_t dspi_dotprod_s8_aes3 ( image2d_t * in_image,
image2d_t * filter,
int8_t * out_value,
int count_x,
int count_y,
int shift )

◆ dspi_dotprod_s8_ansi()

esp_err_t dspi_dotprod_s8_ansi ( image2d_t * in_image,
image2d_t * filter,
int8_t * out_value,
int count_x,
int count_y,
int shift )

Definition at line 17 of file dspi_dotprod_s8_ansi.c.

18{
19 if (in_image->step_x * count_x > in_image->stride_x) {
21 }
22 if (in_image->step_y * count_y > in_image->stride_y) {
24 }
25 if (filter->step_x * count_x > filter->stride_x) {
27 }
28 if (filter->step_y * count_y > filter->stride_y) {
30 }
31
32 int8_t *i_data = (int8_t *)in_image->data;
33 int8_t *f_data = (int8_t *)filter->data;
34 int i_step = in_image->stride_x * in_image->step_y;
35 int f_step = filter->stride_x * filter->step_y;
36
37 int32_t acc = 0;
38 for (int y = 0; y < count_y; y++) {
39 for (int x = 0; x < count_x; x++) {
40 acc += (int16_t)i_data[in_image->step_x * x] * (int16_t)f_data[filter->step_x * x];
41 }
42 i_data += i_step;
43 f_data += f_step;
44 }
45 acc += 1 << (shift - 1); // round operation
46 acc >>= shift;
47 *out_value = acc;
48 return ESP_OK;
49}

References image2d_s::data, ESP_ERR_DSP_PARAM_OUTOFRANGE, ESP_OK, image2d_s::step_x, image2d_s::step_y, image2d_s::stride_x, image2d_s::stride_y, x, and y.

◆ dspi_dotprod_s8_arp4()

esp_err_t dspi_dotprod_s8_arp4 ( image2d_t * in_image,
image2d_t * filter,
int8_t * out_value,
int count_x,
int count_y,
int shift )

◆ dspi_dotprod_u16_aes3()

esp_err_t dspi_dotprod_u16_aes3 ( image2d_t * in_image,
image2d_t * filter,
uint16_t * out_value,
int count_x,
int count_y,
int shift )

◆ dspi_dotprod_u16_ansi()

esp_err_t dspi_dotprod_u16_ansi ( image2d_t * in_image,
image2d_t * filter,
uint16_t * out_value,
int count_x,
int count_y,
int shift )

Definition at line 17 of file dspi_dotprod_u16_ansi.c.

18{
19 if (in_image->step_x * count_x > in_image->stride_x) {
21 }
22 if (in_image->step_y * count_y > in_image->stride_y) {
24 }
25 if (filter->step_x * count_x > filter->stride_x) {
27 }
28 if (filter->step_y * count_y > filter->stride_y) {
30 }
31
32 uint16_t *i_data = (uint16_t *)in_image->data;
33 uint16_t *f_data = (uint16_t *)filter->data;
34 int i_step = in_image->stride_x * in_image->step_y;
35 int f_step = filter->stride_x * filter->step_y;
36
37 int64_t acc = 0;
38 for (int y = 0; y < count_y; y++) {
39 for (int x = 0; x < count_x; x++) {
40 acc += (int32_t)i_data[in_image->step_x * x] * (int32_t)f_data[filter->step_x * x];
41 }
42 i_data += i_step;
43 f_data += f_step;
44 }
45 acc += 1 << (shift - 1); // round operation
46 acc >>= shift;
47 *out_value = acc;
48 return ESP_OK;
49}

References image2d_s::data, ESP_ERR_DSP_PARAM_OUTOFRANGE, ESP_OK, image2d_s::step_x, image2d_s::step_y, image2d_s::stride_x, image2d_s::stride_y, x, and y.

◆ dspi_dotprod_u16_arp4()

esp_err_t dspi_dotprod_u16_arp4 ( image2d_t * in_image,
image2d_t * filter,
uint16_t * out_value,
int count_x,
int count_y,
int shift )

◆ dspi_dotprod_u8_aes3()

esp_err_t dspi_dotprod_u8_aes3 ( image2d_t * in_image,
image2d_t * filter,
uint8_t * out_value,
int count_x,
int count_y,
int shift )

◆ dspi_dotprod_u8_ansi()

esp_err_t dspi_dotprod_u8_ansi ( image2d_t * in_image,
image2d_t * filter,
uint8_t * out_value,
int count_x,
int count_y,
int shift )

Definition at line 17 of file dspi_dotprod_u8_ansi.c.

18{
19 if (in_image->step_x * count_x > in_image->stride_x) {
21 }
22 if (in_image->step_y * count_y > in_image->stride_y) {
24 }
25 if (filter->step_x * count_x > filter->stride_x) {
27 }
28 if (filter->step_y * count_y > filter->stride_y) {
30 }
31
32 uint8_t *i_data = (uint8_t *)in_image->data;
33 uint8_t *f_data = (uint8_t *)filter->data;
34 int i_step = in_image->stride_x * in_image->step_y;
35 int f_step = filter->stride_x * filter->step_y;
36
37 int32_t acc = 0;
38 for (int y = 0; y < count_y; y++) {
39 for (int x = 0; x < count_x; x++) {
40 acc += (int16_t)i_data[in_image->step_x * x] * (int16_t)f_data[filter->step_x * x];
41 }
42 i_data += i_step;
43 f_data += f_step;
44 }
45 acc += 1 << (shift - 1); // round operation
46 acc >>= shift;
47 *out_value = acc;
48 return ESP_OK;
49}

References image2d_s::data, ESP_ERR_DSP_PARAM_OUTOFRANGE, ESP_OK, image2d_s::step_x, image2d_s::step_y, image2d_s::stride_x, image2d_s::stride_y, x, and y.

◆ dspi_dotprod_u8_arp4()

esp_err_t dspi_dotprod_u8_arp4 ( image2d_t * in_image,
image2d_t * filter,
uint8_t * out_value,
int count_x,
int count_y,
int shift )