Skip to content

Commit c46162d

Browse files
committed
Update to v1.1.0
1 parent bd0bb8b commit c46162d

32 files changed

+3783
-1880
lines changed

Inc/cascade.h

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,20 @@
1+
/**
2+
******************************************************************************
3+
* @file cascade.h
4+
* @author MDG Application Team
5+
******************************************************************************
6+
* @attention
7+
*
8+
* Copyright (c) 2024 STMicroelectronics.
9+
* All rights reserved.
10+
*
11+
* This software is licensed under terms that can be found in the LICENSE file
12+
* in the root directory of this software component.
13+
* If no LICENSE file comes with this software, it is provided AS-IS.
14+
*
15+
******************************************************************************
16+
*/
17+
118
#ifdef STM32IPL_ENABLE_OBJECT_DETECTION // STM32IPL
219

320
#ifdef STM32IPL_ENABLE_FRONTAL_FACE_CASCADE // STM32IPL

Inc/filter_int.h

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
/**
2+
******************************************************************************
3+
* @file filter_int.h
4+
* @author AIS Team
5+
* @brief Image processing library filter functions
6+
7+
******************************************************************************
8+
* @attention
9+
*
10+
* Copyright (c) 2025 STMicroelectronics.
11+
* All rights reserved.
12+
*
13+
* This software is licensed under terms that can be found in the LICENSE file
14+
* in the root directory of this software component.
15+
* If no LICENSE file comes with this software, it is provided AS-IS.
16+
*
17+
******************************************************************************
18+
*/
19+
20+
#ifndef __FILTER_INT_H__
21+
#define __FILTER_INT_H__
22+
23+
#include "stm32ipl_imlib.h"
24+
#include "stm32ipl_imlib_int.h"
25+
26+
#ifdef IMLIB_ENABLE_MEDIAN
27+
static inline uint8_t hist_median(uint8_t *data, int len, const int cutoff)
28+
{
29+
int i = 0;
30+
#if defined(ARM_MATH_CM7) || defined(ARM_MATH_CM4) || defined(ARM_MATH_MVEI)
31+
uint32_t oldsum=0, sum32 = 0;
32+
33+
#ifdef IPL_FILTER_HAS_MVE
34+
for (i = 0; i < len; i += 16) { /* work 16 at time with MVE */
35+
sum32 += vaddvq_u8(vldrbq_u8(&data[i]));
36+
if ((int32_t)sum32 >= cutoff) { /* within this group */
37+
break;
38+
} /* if we're at the last 16 values */
39+
oldsum = sum32;
40+
} /* for each group of 16 elements */
41+
sum32 = oldsum;
42+
#endif /* IPL_FILTER_HAS_MVE */
43+
44+
for (; i < len; i += 4) { /* work 4 at time with SIMD */
45+
sum32 = __USADA8(*(uint32_t *)&data[i], 0, sum32);
46+
if ((int32_t)sum32 >= cutoff) { /* within this group */
47+
while ((int32_t)oldsum < cutoff && i < len)
48+
oldsum += data[i++];
49+
break;
50+
} /* if we're at the last 4 values */
51+
oldsum = sum32;
52+
} /* for each group of 4 elements */
53+
#else /* generic C version */
54+
int sum = 0;
55+
for (i = 0; i < len && sum < cutoff; i++) {
56+
sum += data[i];
57+
}
58+
#endif
59+
return i-1;
60+
} /* hist_median() */
61+
#endif /* IMLIB_ENABLE_MEDIAN */
62+
63+
#endif /* __FILTER_INT_H__ */

Inc/imlib_config.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,4 +149,10 @@
149149
// Enable STM32 DMA2D
150150
//#define IMLIB_ENABLE_DMA2D
151151

152+
#ifdef IPL_RESIZE_ROUNDING
153+
#define IPL_RESIZE_PEL_IDX_ROUNDING (1 << 15)
154+
#else
155+
#define IPL_RESIZE_PEL_IDX_ROUNDING (0)
156+
#endif
157+
152158
#endif //__IMLIB_CONFIG_H__

Inc/mve_binary.h

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/**
2+
******************************************************************************
3+
* @file mve_binary.h
4+
* @author AIS Team
5+
* @brief MVE Image processing library binary functions
6+
7+
******************************************************************************
8+
* @attention
9+
*
10+
* Copyright (c) 2025 STMicroelectronics.
11+
* All rights reserved.
12+
*
13+
* This software is licensed under terms that can be found in the LICENSE file
14+
* in the root directory of this software component.
15+
* If no LICENSE file comes with this software, it is provided AS-IS.
16+
*
17+
******************************************************************************
18+
*/
19+
20+
#ifndef __MVE_BINARY__
21+
#define __MVE_BINARY__
22+
23+
#include "imlib.h"
24+
25+
void mve_imlib_binary_binary(image_t *out, image_t *img, color_thresholds_list_lnk_data_t *thresholds, bool invert, bool zero, image_t *mask);
26+
void mve_imlib_binary_grayscale(image_t *out, image_t *img, color_thresholds_list_lnk_data_t *thresholds, bool invert, bool zero, image_t *mask);
27+
void mve_imlib_binary_rgb565(image_t *out, image_t *img, color_thresholds_list_lnk_data_t *thresholds, bool invert, bool zero, image_t *mask);
28+
void mve_imlib_binary_rgb888(image_t *out, image_t *img, color_thresholds_list_lnk_data_t *thresholds, bool invert, bool zero, image_t *mask);
29+
30+
int mve_imlib_erode_dilate_grayscale(image_t *img, int ksize, int threshold, int e_or_d, image_t *mask);
31+
32+
#endif /* __MVE_BINARY__ */

Inc/mve_draw.h

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/**
2+
******************************************************************************
3+
* @file mve_draw.h
4+
* @author AIS Team
5+
* @brief MVE Image processing library drawing functions with 8-bits
6+
* inputs/outputs
7+
8+
******************************************************************************
9+
* @attention
10+
*
11+
* Copyright (c) 2025 STMicroelectronics.
12+
* All rights reserved.
13+
*
14+
* This software is licensed under terms that can be found in the LICENSE file
15+
* in the root directory of this software component.
16+
* If no LICENSE file comes with this software, it is provided AS-IS.
17+
*
18+
******************************************************************************
19+
*/
20+
21+
#ifndef __MVE_DRAW__
22+
#define __MVE_DRAW__
23+
24+
#include "arm_math.h"
25+
#include "imlib.h"
26+
27+
void point_fill_mve(image_t *img, int cx, int cy, int r0, int r1, int c);
28+
29+
void point_fill_mve_binary(image_t *img, int cx, int cy, int r0, int r1, int c);
30+
void point_fill_mve_grayscale(image_t *img, int cx, int cy, int r0, int r1, int c);
31+
void point_fill_mve_rgb888(image_t *img, int cx, int cy, int r0, int r1, int c);
32+
void point_fill_mve_rgb565(image_t *img, int cx, int cy, int r0, int r1, int c);
33+
34+
#endif /* __MVE_DRAW__ */

Inc/mve_filter.h

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/**
2+
******************************************************************************
3+
* @file mve_filter.h
4+
* @author AIS Team
5+
* @brief MVE Image processing library filter functions with 8-bits
6+
* inputs/outputs
7+
8+
******************************************************************************
9+
* @attention
10+
*
11+
* Copyright (c) 2024 STMicroelectronics.
12+
* All rights reserved.
13+
*
14+
* This software is licensed under terms that can be found in the LICENSE file
15+
* in the root directory of this software component.
16+
* If no LICENSE file comes with this software, it is provided AS-IS.
17+
*
18+
******************************************************************************
19+
*/
20+
21+
#ifndef __MVE_FILTER__
22+
#define __MVE_FILTER__
23+
24+
#include "arm_math.h"
25+
#include "imlib.h"
26+
27+
int mve_imlib_median_filter_grayscale(image_t *img, const int ksize, float percentile, bool threshold, int offset, bool invert, image_t *mask);
28+
int mve_imlib_morph_u8(image_t *img, const int ksize, const uint8_t *krn, const float m, const int b, bool threshold, int offset, bool invert, image_t *mask);
29+
30+
#endif /* __MVE_FILTER__ */

Inc/mve_imlib.h

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
/**
2+
******************************************************************************
3+
* @file mve_imlib.h
4+
* @author AIS Team
5+
* @brief MVE Image processing library generic optimized functions
6+
7+
******************************************************************************
8+
* @attention
9+
*
10+
* Copyright (c) 2025 STMicroelectronics.
11+
* All rights reserved.
12+
*
13+
* This software is licensed under terms that can be found in the LICENSE file
14+
* in the root directory of this software component.
15+
* If no LICENSE file comes with this software, it is provided AS-IS.
16+
*
17+
******************************************************************************
18+
*/
19+
20+
#ifndef __MVE_IMLIB_H__
21+
#define __MVE_IMLIB_H__
22+
23+
#include "stm32ipl_imlib.h"
24+
#include "stm32ipl_imlib_int.h"
25+
26+
mve_pred16_t mve_image_get_mask_pixel(image_t *ptr, int x, int y);
27+
28+
#endif /* __MVE_IMLIB_H__ */

Inc/mve_matop.h

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
/**
2+
******************************************************************************
3+
* @file mve_matop.h
4+
* @author AIS Team
5+
* @brief MVE Image processing library mathematic operation optimized functions
6+
7+
******************************************************************************
8+
* @attention
9+
*
10+
* Copyright (c) 2025 STMicroelectronics.
11+
* All rights reserved.
12+
*
13+
* This software is licensed under terms that can be found in the LICENSE file
14+
* in the root directory of this software component.
15+
* If no LICENSE file comes with this software, it is provided AS-IS.
16+
*
17+
******************************************************************************
18+
*/
19+
20+
#ifndef __MVE_MATOP_H__
21+
#define __MVE_MATOP_H__
22+
23+
#include "stm32ipl_imlib.h"
24+
#include "stm32ipl_imlib_int.h"
25+
26+
#include "mve_imlib.h"
27+
28+
static inline void mve_imlib_difference_line_op_grayscale(image_t *img, int line, void *other, image_t *mask)
29+
{
30+
uint8_t *p_data_0 = IMAGE_COMPUTE_GRAYSCALE_PIXEL_ROW_PTR(img, line);
31+
uint8_t *p_data_1 = (uint8_t *)other;
32+
if (NULL == mask) {
33+
for (int i = 0; i < img->w; i+=16) {
34+
mve_pred16_t p = vctp8q(img->w-i);
35+
uint8x16_t u8x16_data_0 = vldrbq_z_u8(p_data_0, p);
36+
uint8x16_t u8x16_data_1 = vldrbq_z_u8(p_data_1, p);
37+
uint8x16_t u8x16_data_out = vabdq_u8(u8x16_data_0, u8x16_data_1);
38+
vstrbq_p_u8(p_data_0, u8x16_data_out, p);
39+
p_data_0 += 16;
40+
p_data_1 += 16;
41+
}
42+
}
43+
else
44+
{
45+
for (int i = 0; i < img->w; i+=16) {
46+
mve_pred16_t p_mask = mve_image_get_mask_pixel(mask, i, line);
47+
uint8x16_t u8x16_data_0 = vldrbq_z_u8(p_data_0, p_mask);
48+
uint8x16_t u8x16_data_1 = vldrbq_z_u8(p_data_1, p_mask);
49+
uint8x16_t u8x16_data_out = vabdq_u8(u8x16_data_0, u8x16_data_1);
50+
vstrbq_p_u8(p_data_0, u8x16_data_out, p_mask);
51+
p_data_0 += 16;
52+
p_data_1 += 16;
53+
}
54+
}
55+
}
56+
57+
static inline void mve_imlib_difference_line_op_rgb888(image_t *img, int line, void *other, image_t *mask)
58+
{
59+
rgb888_t *ptr_rgb888_0 = IMAGE_COMPUTE_RGB888_PIXEL_ROW_PTR(img, line);
60+
rgb888_t *ptr_rgb888_1 = (rgb888_t *)other;
61+
uint8x16_t u8x16_incr = vidupq_n_u8(0, 1) * 3;
62+
if (NULL == mask) {
63+
for (int i = 0; i < img->w; i+=16) {
64+
mve_pred16_t pred = vctp8q(img->w-i);
65+
uint8x16_t u8x16_r_0 = vldrbq_gather_offset_z_u8(&(ptr_rgb888_0->r), u8x16_incr, pred);
66+
uint8x16_t u8x16_g_0 = vldrbq_gather_offset_z_u8(&(ptr_rgb888_0->g), u8x16_incr, pred);
67+
uint8x16_t u8x16_b_0 = vldrbq_gather_offset_z_u8(&(ptr_rgb888_0->b), u8x16_incr, pred);
68+
uint8x16_t u8x16_r_1 = vldrbq_gather_offset_z_u8(&(ptr_rgb888_1->r), u8x16_incr, pred);
69+
uint8x16_t u8x16_g_1 = vldrbq_gather_offset_z_u8(&(ptr_rgb888_1->g), u8x16_incr, pred);
70+
uint8x16_t u8x16_b_1 = vldrbq_gather_offset_z_u8(&(ptr_rgb888_1->b), u8x16_incr, pred);
71+
uint8x16_t u8x16_data_out;
72+
u8x16_data_out = vabdq_u8(u8x16_r_0, u8x16_r_1);
73+
vstrbq_scatter_offset_p_u8(&(ptr_rgb888_0->r), u8x16_incr, u8x16_data_out, pred);
74+
u8x16_data_out = vabdq_u8(u8x16_g_0, u8x16_g_1);
75+
vstrbq_scatter_offset_p_u8(&(ptr_rgb888_0->g), u8x16_incr, u8x16_data_out, pred);
76+
u8x16_data_out = vabdq_u8(u8x16_b_0, u8x16_b_1);
77+
vstrbq_scatter_offset_p_u8(&(ptr_rgb888_0->b), u8x16_incr, u8x16_data_out, pred);
78+
ptr_rgb888_0 += 16;
79+
ptr_rgb888_1 += 16;
80+
}
81+
}
82+
else
83+
{
84+
for (int i = 0; i < img->w; i+=16) {
85+
mve_pred16_t pred = mve_image_get_mask_pixel(mask, i, line);
86+
uint8x16_t u8x16_r_0 = vldrbq_gather_offset_z_u8(&(ptr_rgb888_0->r), u8x16_incr, pred);
87+
uint8x16_t u8x16_g_0 = vldrbq_gather_offset_z_u8(&(ptr_rgb888_0->g), u8x16_incr, pred);
88+
uint8x16_t u8x16_b_0 = vldrbq_gather_offset_z_u8(&(ptr_rgb888_0->b), u8x16_incr, pred);
89+
uint8x16_t u8x16_r_1 = vldrbq_gather_offset_z_u8(&(ptr_rgb888_1->r), u8x16_incr, pred);
90+
uint8x16_t u8x16_g_1 = vldrbq_gather_offset_z_u8(&(ptr_rgb888_1->g), u8x16_incr, pred);
91+
uint8x16_t u8x16_b_1 = vldrbq_gather_offset_z_u8(&(ptr_rgb888_1->b), u8x16_incr, pred);
92+
uint8x16_t u8x16_data_out;
93+
u8x16_data_out = vabdq_u8(u8x16_r_0, u8x16_r_1);
94+
vstrbq_scatter_offset_p_u8(&(ptr_rgb888_0->r), u8x16_incr, u8x16_data_out, pred);
95+
u8x16_data_out = vabdq_u8(u8x16_g_0, u8x16_g_1);
96+
vstrbq_scatter_offset_p_u8(&(ptr_rgb888_0->g), u8x16_incr, u8x16_data_out, pred);
97+
u8x16_data_out = vabdq_u8(u8x16_b_0, u8x16_b_1);
98+
vstrbq_scatter_offset_p_u8(&(ptr_rgb888_0->b), u8x16_incr, u8x16_data_out, pred);
99+
ptr_rgb888_0 += 16;
100+
ptr_rgb888_1 += 16;
101+
}
102+
}
103+
}
104+
#endif /* __MVE_MATOP_H__ */

0 commit comments

Comments
 (0)