mirror of
https://github.com/openmv/openmv.git
synced 2025-11-04 14:49:50 +08:00
Merge pull request #2097 from openmv/kwagyeman-kwabena/fix_compile_issues
imlib: Fix gcc13.2 compile issues.
This commit is contained in:
commit
01316c0194
@ -121,4 +121,6 @@ $(BUILD)/%.o : %.s
|
||||
$(ECHO) "AS $<"
|
||||
$(AS) $(AFLAGS) $< -o $@
|
||||
|
||||
$(BUILD)/imlib/fmath.o: override CFLAGS += -fno-strict-aliasing
|
||||
|
||||
-include $(OBJS:%.o=%.d)
|
||||
|
||||
@ -1239,7 +1239,7 @@ void imlib_morph(image_t *img,
|
||||
const int ksize,
|
||||
const int *krn,
|
||||
const float m,
|
||||
const int b,
|
||||
const float b,
|
||||
bool threshold,
|
||||
int offset,
|
||||
bool invert,
|
||||
@ -1250,7 +1250,7 @@ void imlib_morph(image_t *img,
|
||||
buf.h = brows;
|
||||
buf.pixfmt = img->pixfmt;
|
||||
const int32_t m_int = fast_roundf(65536 * m);
|
||||
const int32_t b_int = b << 16;
|
||||
const int32_t b_int = fast_roundf(65536 * b);
|
||||
invert = invert ? 1 : 0; // ensure binary
|
||||
|
||||
switch (img->pixfmt) {
|
||||
|
||||
@ -69,11 +69,8 @@ int OMV_ATTR_ALWAYS_INLINE fast_ceilf(float x) {
|
||||
asm volatile (
|
||||
"vcvtp.S32.f32 %[r], %[x]\n"
|
||||
#else
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wstrict-aliasing"
|
||||
uint32_t max = 0x3f7fffff;
|
||||
x += *((float *) &max);
|
||||
#pragma GCC diagnostic pop
|
||||
asm volatile (
|
||||
"vcvt.S32.f32 %[r], %[x]\n"
|
||||
#endif
|
||||
@ -100,8 +97,6 @@ float OMV_ATTR_ALWAYS_INLINE fast_fabsf(float x) {
|
||||
}
|
||||
#endif
|
||||
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wstrict-aliasing"
|
||||
typedef union {
|
||||
uint32_t l;
|
||||
struct {
|
||||
@ -120,7 +115,6 @@ float fast_expf(float x) {
|
||||
uint32_t packed = (e.s << 31) | (e.e << 23) | e.m << 3;
|
||||
return *((float *) &packed);
|
||||
}
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
/*
|
||||
* From Hackers Delight:
|
||||
|
||||
@ -1402,7 +1402,7 @@ void imlib_morph(image_t *img,
|
||||
const int ksize,
|
||||
const int *krn,
|
||||
const float m,
|
||||
const int b,
|
||||
const float b,
|
||||
bool threshold,
|
||||
int offset,
|
||||
bool invert,
|
||||
|
||||
@ -840,26 +840,16 @@ typedef struct xylf
|
||||
}
|
||||
xylf_t;
|
||||
|
||||
static void lifo_enqueue_fast(lifo_t *ptr, void *data)
|
||||
static void lifo_enqueue_fast(lifo_t *ptr, xylf_t *data)
|
||||
{
|
||||
// we know the structure size is 8 bytes, so don't waste time calling memcpy
|
||||
uint32_t *d = (uint32_t *)(ptr->data + (ptr->len * ptr->data_len));
|
||||
uint32_t *s = (uint32_t *)data;
|
||||
// memcpy(ptr->data + (ptr->len * ptr->data_len), data, ptr->data_len);
|
||||
d[0] = s[0]; d[1] = s[1]; // copy 8 bytes
|
||||
*((xylf_t *)(ptr->data + (ptr->len * ptr->data_len))) = *data;
|
||||
ptr->len += 1;
|
||||
}
|
||||
|
||||
static void lifo_dequeue_fast(lifo_t *ptr, void *data)
|
||||
static void lifo_dequeue_fast(lifo_t *ptr, xylf_t *data)
|
||||
{
|
||||
// we know the structure size is 8 bytes, so don't waste time calling memcpy
|
||||
uint32_t *s = (uint32_t *)(ptr->data + ((ptr->len-1) * ptr->data_len));
|
||||
uint32_t *d = (uint32_t *)data;
|
||||
// if (data) {
|
||||
// memcpy(data, ptr->data + ((ptr->len - 1) * ptr->data_len), ptr->data_len);
|
||||
// }
|
||||
d[0] = s[0]; d[1] = s[1]; // copy 8 bytes
|
||||
ptr->len -= 1;
|
||||
*data = *((xylf_t *)(ptr->data + (ptr->len * ptr->data_len)));
|
||||
}
|
||||
|
||||
static void flood_fill_seed(struct quirc *q, int x, int y, int from, int to,
|
||||
|
||||
@ -178,6 +178,11 @@ target_sources(${MICROPY_TARGET} PRIVATE
|
||||
|
||||
${OMV_USER_MODULES}
|
||||
)
|
||||
set_source_files_properties(
|
||||
${TOP_DIR}/${OMV_DIR}/imlib/fmath.c
|
||||
PROPERTIES
|
||||
COMPILE_OPTIONS "-fno-strict-aliasing"
|
||||
)
|
||||
|
||||
if(MICROPY_PY_SENSOR)
|
||||
target_compile_definitions(${MICROPY_TARGET} PRIVATE
|
||||
|
||||
Loading…
Reference in New Issue
Block a user