Browse Source
fix compiling for 32-bit machines / machine without SSE2
master
Pandora
7 years ago
No known key found for this signature in database
GPG Key ID: 55DB77C2A03E1EF5
3 changed files with
8 additions and
7 deletions
-
blur.c
-
blur.h
-
blur_simd.c
|
|
@ -121,8 +121,8 @@ void blur_impl_horizontal_pass_generic(uint32_t *src, uint32_t *dst, int width, |
|
|
|
rgbaIn[i] = *(src - k); |
|
|
|
} else { |
|
|
|
for (; i < KERNEL_SIZE; i++) { |
|
|
|
if ((long long) ((src + 4*i - HALF_KERNEL) + 1) |
|
|
|
> (long long) (o_src + (height * width))) |
|
|
|
if ((uintptr_t) ((src + 4*i - HALF_KERNEL) + 1) |
|
|
|
> (uintptr_t) (o_src + (height * width))) |
|
|
|
break; |
|
|
|
rgbaIn[i] = *(src + i - HALF_KERNEL); |
|
|
|
} |
|
|
|
|
|
@ -9,9 +9,10 @@ |
|
|
|
#define HALF_KERNEL KERNEL_SIZE / 2 |
|
|
|
|
|
|
|
void blur_image_surface(cairo_surface_t *surface, int sigma); |
|
|
|
#ifdef __SSE2__ |
|
|
|
void blur_impl_horizontal_pass_sse2(uint32_t *src, uint32_t *dst, int width, int height); |
|
|
|
#endif |
|
|
|
void blur_impl_horizontal_pass_generic(uint32_t *src, uint32_t *dst, int width, int height); |
|
|
|
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -12,7 +12,7 @@ |
|
|
|
|
|
|
|
// number of xmm registers needed to store input pixels for given kernel size
|
|
|
|
#define REGISTERS_CNT (KERNEL_SIZE + 4/2) / 4 |
|
|
|
|
|
|
|
#ifdef __SSE2__ |
|
|
|
void blur_impl_horizontal_pass_sse2(uint32_t *src, uint32_t *dst, int width, int height) { |
|
|
|
uint32_t* o_src = src; |
|
|
|
for (int row = 0; row < height; row++) { |
|
|
@ -46,8 +46,8 @@ void blur_impl_horizontal_pass_sse2(uint32_t *src, uint32_t *dst, int width, int |
|
|
|
rgbaIn[k] = _mm_load_si128((__m128i*)(_rgbaIn + 4*k)); |
|
|
|
} else { |
|
|
|
for (int k = 0; k < REGISTERS_CNT; k++) { |
|
|
|
if ((long long) (((__m128i*) src + 4*k - HALF_KERNEL) + 1) |
|
|
|
> (long long) (o_src + (height * width))) |
|
|
|
if ((uintptr_t) (((__m128i*) src + 4*k - HALF_KERNEL) + 1) |
|
|
|
> (uintptr_t) (o_src + (height * width))) |
|
|
|
break; |
|
|
|
rgbaIn[k] = _mm_loadu_si128((__m128i*)(src + 4*k - HALF_KERNEL)); |
|
|
|
} |
|
|
@ -76,4 +76,4 @@ void blur_impl_horizontal_pass_sse2(uint32_t *src, uint32_t *dst, int width, int |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
#endif |
|
|
|