Bug Summary

File:ccv_basic.c
Warning:line 472, column 2
The right operand of '*' is a garbage value

Annotated Source Code

Press '?' to see keyboard shortcuts

clang -cc1 -cc1 -triple x86_64-unknown-linux-gnu -analyze -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name ccv_basic.c -analyzer-store=region -analyzer-opt-analyze-nested-blocks -analyzer-checker=core -analyzer-checker=apiModeling -analyzer-checker=unix -analyzer-checker=deadcode -analyzer-checker=security.insecureAPI.UncheckedReturn -analyzer-checker=security.insecureAPI.getpw -analyzer-checker=security.insecureAPI.gets -analyzer-checker=security.insecureAPI.mktemp -analyzer-checker=security.insecureAPI.mkstemp -analyzer-checker=security.insecureAPI.vfork -analyzer-checker=nullability.NullPassedToNonnull -analyzer-checker=nullability.NullReturnedFromNonnull -analyzer-output plist -w -setup-static-analyzer -mrelocation-model static -mframe-pointer=none -menable-no-infs -menable-no-nans -fapprox-func -menable-unsafe-fp-math -fno-signed-zeros -mreassociate -freciprocal-math -fdenormal-fp-math=preserve-sign,preserve-sign -ffp-contract=fast -fno-rounding-math -ffast-math -ffinite-math-only -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -target-feature +sse2 -tune-cpu generic -debugger-tuning=gdb -fcoverage-compilation-dir=/home/liu/buildslave/linux-x64-runtests/build/lib -resource-dir /usr/local/lib/clang/14.0.6 -I . -I /usr/local/cuda/include -D HAVE_CBLAS -D HAVE_LIBPNG -D HAVE_LIBJPEG -D HAVE_FFTW3 -D HAVE_PTHREAD -D HAVE_LIBLINEAR -D HAVE_TESSERACT -D HAVE_AVCODEC -D HAVE_AVFORMAT -D HAVE_AVUTIL -D HAVE_SWSCALE -D USE_DISPATCH -D HAVE_SSE2 -D HAVE_GSL -D HAVE_CUDA -D HAVE_CUDNN -D HAVE_NCCL -D USE_SYSTEM_CUB -I /usr/local/include -internal-isystem /usr/local/lib/clang/14.0.6/include -internal-isystem /usr/local/include -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/9/../../../../x86_64-linux-gnu/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -O3 -fdebug-compilation-dir=/home/liu/buildslave/linux-x64-runtests/build/lib -ferror-limit 19 -fblocks -fgnuc-version=4.2.1 -vectorize-loops -vectorize-slp -analyzer-output=html -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /home/liu/buildslave/public_html/analyze/2022-07-27-230511-338087-1 -x c ccv_basic.c
1#include "ccv.h"
2#include "ccv_internal.h"
3#if defined(HAVE_SSE21)
4#include <xmmintrin.h>
5#elif defined(HAVE_NEON)
6#include <arm_neon.h>
7#endif
8
9/* sobel filter is fundamental to many other high-level algorithms,
10 * here includes 2 special case impl (for 1x3/3x1, 3x3) and one general impl */
11void ccv_sobel(ccv_dense_matrix_t* a, ccv_dense_matrix_t** b, int type, int dx, int dy)
12{
13 ccv_declare_derived_signature(sig, a->sig != 0, ccv_sign_with_format(64, "ccv_sobel(%d,%d)", dx, dy), a->sig, CCV_EOF_SIGN)char _ccv_identifier_13[(64)]; memset(_ccv_identifier_13, 0, (
64)); snprintf(_ccv_identifier_13, (64), ("ccv_sobel(%d,%d)")
, dx, dy); size_t _ccv_string_size_13 = (64);; uint64_t sig =
(a->sig != 0) ? ccv_cache_generate_signature(_ccv_identifier_13
, _ccv_string_size_13, a->sig, ((uint64_t)0)) : 0;
;
14 type = (type == 0) ? CCV_32S | CCV_GET_CHANNEL(a->type)((a->type) & 0xFFF) : CCV_GET_DATA_TYPE(type)((type) & 0xFF000) | CCV_GET_CHANNEL(a->type)((a->type) & 0xFFF);
15 ccv_dense_matrix_t* db = *b = ccv_dense_matrix_renew(*b, a->rows, a->cols, CCV_GET_CHANNEL(a->type)((a->type) & 0xFFF) | CCV_ALL_DATA_TYPE(CCV_8U | CCV_32S | CCV_32F | CCV_64S | CCV_64F), type, sig);
16 ccv_object_return_if_cached(, db){ if ((!(db) || (((int*)(db))[0] & CCV_GARBAGE)) &&
(!(0) || (((int*)(0))[0] & CCV_GARBAGE)) && (!(0
) || (((int*)(0))[0] & CCV_GARBAGE)) && (!(0) || (
((int*)(0))[0] & CCV_GARBAGE)) && (!(0) || (((int
*)(0))[0] & CCV_GARBAGE)) && (!(0) || (((int*)(0)
)[0] & CCV_GARBAGE)) && (!(0) || (((int*)(0))[0] &
CCV_GARBAGE)) && (!(0) || (((int*)(0))[0] & CCV_GARBAGE
)) && (!(0) || (((int*)(0))[0] & CCV_GARBAGE)) &&
(!(0) || (((int*)(0))[0] & CCV_GARBAGE)) && (!(0
) || (((int*)(0))[0] & CCV_GARBAGE)) && (!(0) || (
((int*)(0))[0] & CCV_GARBAGE)) && (!(0) || (((int
*)(0))[0] & CCV_GARBAGE)) && (!(0) || (((int*)(0)
)[0] & CCV_GARBAGE)) && (!(0) || (((int*)(0))[0] &
CCV_GARBAGE)) && (!(0) || (((int*)(0))[0] & CCV_GARBAGE
)) && (!(0) || (((int*)(0))[0] & CCV_GARBAGE)) &&
(!(0) || (((int*)(0))[0] & CCV_GARBAGE)) && (!(0
) || (((int*)(0))[0] & CCV_GARBAGE)) && (!(0) || (
((int*)(0))[0] & CCV_GARBAGE)) && (!(0) || (((int
*)(0))[0] & CCV_GARBAGE)) && (!(0) || (((int*)(0)
)[0] & CCV_GARBAGE)) && (!(0) || (((int*)(0))[0] &
CCV_GARBAGE)) && (!(0) || (((int*)(0))[0] & CCV_GARBAGE
)) && (!(0) || (((int*)(0))[0] & CCV_GARBAGE)) &&
(!(0) || (((int*)(0))[0] & CCV_GARBAGE)) && (!(0
) || (((int*)(0))[0] & CCV_GARBAGE)) && (!(0) || (
((int*)(0))[0] & CCV_GARBAGE)) && (!(0) || (((int
*)(0))[0] & CCV_GARBAGE)) && (!(0) || (((int*)(0)
)[0] & CCV_GARBAGE)) && (!(0) || (((int*)(0))[0] &
CCV_GARBAGE)) && (!(0) || (((int*)(0))[0] & CCV_GARBAGE
)) && (!(0) || (((int*)(0))[0] & CCV_GARBAGE)) &&
(!(0) || (((int*)(0))[0] & CCV_GARBAGE)) && (!(0
) || (((int*)(0))[0] & CCV_GARBAGE)) && (!(0) || (
((int*)(0))[0] & CCV_GARBAGE)) && (!(0) || (((int
*)(0))[0] & CCV_GARBAGE)) && (!(0) || (((int*)(0)
)[0] & CCV_GARBAGE)) && (!(0) || (((int*)(0))[0] &
CCV_GARBAGE)) && (!(0) || (((int*)(0))[0] & CCV_GARBAGE
)) && (!(0) || (((int*)(0))[0] & CCV_GARBAGE)) &&
(!(0) || (((int*)(0))[0] & CCV_GARBAGE)) && (!(0
) || (((int*)(0))[0] & CCV_GARBAGE)) && (!(0) || (
((int*)(0))[0] & CCV_GARBAGE)) && (!(0) || (((int
*)(0))[0] & CCV_GARBAGE)) && (!(0) || (((int*)(0)
)[0] & CCV_GARBAGE)) && (!(0) || (((int*)(0))[0] &
CCV_GARBAGE)) && (!(0) || (((int*)(0))[0] & CCV_GARBAGE
)) && (!(0) || (((int*)(0))[0] & CCV_GARBAGE)) &&
(!(0) || (((int*)(0))[0] & CCV_GARBAGE)) && (!(0
) || (((int*)(0))[0] & CCV_GARBAGE)) && (!(0) || (
((int*)(0))[0] & CCV_GARBAGE)) && (!(0) || (((int
*)(0))[0] & CCV_GARBAGE)) && (!(0) || (((int*)(0)
)[0] & CCV_GARBAGE)) && (!(0) || (((int*)(0))[0] &
CCV_GARBAGE)) && (!(0) || (((int*)(0))[0] & CCV_GARBAGE
)) && (!(0) || (((int*)(0))[0] & CCV_GARBAGE)) &&
(!(0) || (((int*)(0))[0] & CCV_GARBAGE)) && (!(0
) || (((int*)(0))[0] & CCV_GARBAGE)) && (!(0) || (
((int*)(0))[0] & CCV_GARBAGE)) && (!(0) || (((int
*)(0))[0] & CCV_GARBAGE)) && (!(0) || (((int*)(0)
)[0] & CCV_GARBAGE)) && (!(0) || (((int*)(0))[0] &
CCV_GARBAGE))) { (void)((db) && (((int*)(db))[0] &=
~CCV_GARBAGE));(void)((0) && (((int*)(0))[0] &= ~
CCV_GARBAGE));(void)((0) && (((int*)(0))[0] &= ~CCV_GARBAGE
));(void)((0) && (((int*)(0))[0] &= ~CCV_GARBAGE)
);(void)((0) && (((int*)(0))[0] &= ~CCV_GARBAGE))
;(void)((0) && (((int*)(0))[0] &= ~CCV_GARBAGE));
(void)((0) && (((int*)(0))[0] &= ~CCV_GARBAGE));(
void)((0) && (((int*)(0))[0] &= ~CCV_GARBAGE));(void
)((0) && (((int*)(0))[0] &= ~CCV_GARBAGE));(void)
((0) && (((int*)(0))[0] &= ~CCV_GARBAGE));(void)(
(0) && (((int*)(0))[0] &= ~CCV_GARBAGE));(void)((
0) && (((int*)(0))[0] &= ~CCV_GARBAGE));(void)((0
) && (((int*)(0))[0] &= ~CCV_GARBAGE));(void)((0)
&& (((int*)(0))[0] &= ~CCV_GARBAGE));(void)((0) &&
(((int*)(0))[0] &= ~CCV_GARBAGE));(void)((0) && (
((int*)(0))[0] &= ~CCV_GARBAGE));(void)((0) && ((
(int*)(0))[0] &= ~CCV_GARBAGE));(void)((0) && (((
int*)(0))[0] &= ~CCV_GARBAGE));(void)((0) && (((int
*)(0))[0] &= ~CCV_GARBAGE));(void)((0) && (((int*
)(0))[0] &= ~CCV_GARBAGE));(void)((0) && (((int*)
(0))[0] &= ~CCV_GARBAGE));(void)((0) && (((int*)(
0))[0] &= ~CCV_GARBAGE));(void)((0) && (((int*)(0
))[0] &= ~CCV_GARBAGE));(void)((0) && (((int*)(0)
)[0] &= ~CCV_GARBAGE));(void)((0) && (((int*)(0))
[0] &= ~CCV_GARBAGE));(void)((0) && (((int*)(0))[
0] &= ~CCV_GARBAGE));(void)((0) && (((int*)(0))[0
] &= ~CCV_GARBAGE));(void)((0) && (((int*)(0))[0]
&= ~CCV_GARBAGE));(void)((0) && (((int*)(0))[0] &=
~CCV_GARBAGE));(void)((0) && (((int*)(0))[0] &= ~
CCV_GARBAGE));(void)((0) && (((int*)(0))[0] &= ~CCV_GARBAGE
));(void)((0) && (((int*)(0))[0] &= ~CCV_GARBAGE)
);(void)((0) && (((int*)(0))[0] &= ~CCV_GARBAGE))
;(void)((0) && (((int*)(0))[0] &= ~CCV_GARBAGE));
(void)((0) && (((int*)(0))[0] &= ~CCV_GARBAGE));(
void)((0) && (((int*)(0))[0] &= ~CCV_GARBAGE));(void
)((0) && (((int*)(0))[0] &= ~CCV_GARBAGE));(void)
((0) && (((int*)(0))[0] &= ~CCV_GARBAGE));(void)(
(0) && (((int*)(0))[0] &= ~CCV_GARBAGE));(void)((
0) && (((int*)(0))[0] &= ~CCV_GARBAGE));(void)((0
) && (((int*)(0))[0] &= ~CCV_GARBAGE));(void)((0)
&& (((int*)(0))[0] &= ~CCV_GARBAGE));(void)((0) &&
(((int*)(0))[0] &= ~CCV_GARBAGE));(void)((0) && (
((int*)(0))[0] &= ~CCV_GARBAGE));(void)((0) && ((
(int*)(0))[0] &= ~CCV_GARBAGE));(void)((0) && (((
int*)(0))[0] &= ~CCV_GARBAGE));(void)((0) && (((int
*)(0))[0] &= ~CCV_GARBAGE));(void)((0) && (((int*
)(0))[0] &= ~CCV_GARBAGE));(void)((0) && (((int*)
(0))[0] &= ~CCV_GARBAGE));(void)((0) && (((int*)(
0))[0] &= ~CCV_GARBAGE));(void)((0) && (((int*)(0
))[0] &= ~CCV_GARBAGE));(void)((0) && (((int*)(0)
)[0] &= ~CCV_GARBAGE));(void)((0) && (((int*)(0))
[0] &= ~CCV_GARBAGE));(void)((0) && (((int*)(0))[
0] &= ~CCV_GARBAGE));(void)((0) && (((int*)(0))[0
] &= ~CCV_GARBAGE));(void)((0) && (((int*)(0))[0]
&= ~CCV_GARBAGE));(void)((0) && (((int*)(0))[0] &=
~CCV_GARBAGE));(void)((0) && (((int*)(0))[0] &= ~
CCV_GARBAGE));(void)((0) && (((int*)(0))[0] &= ~CCV_GARBAGE
));(void)((0) && (((int*)(0))[0] &= ~CCV_GARBAGE)
);(void)((0) && (((int*)(0))[0] &= ~CCV_GARBAGE))
;(void)((0) && (((int*)(0))[0] &= ~CCV_GARBAGE));
(void)((0) && (((int*)(0))[0] &= ~CCV_GARBAGE));;
; return ; } }
;
17 int i, j, k, c, ch = CCV_GET_CHANNEL(a->type)((a->type) & 0xFFF);
18 unsigned char* a_ptr = a->data.u8;
19 unsigned char* b_ptr = db->data.u8;
20 if (dx == 1 && dy == 0)
21 {
22 assert(a->cols >= 3)((void) sizeof ((a->cols >= 3) ? 1 : 0), __extension__ (
{ if (a->cols >= 3) ; else __assert_fail ("a->cols >= 3"
, "ccv_basic.c", 22, __extension__ __PRETTY_FUNCTION__); }))
;
23 /* special case 1: 1x3 or 3x1 window */
24#define for_block(_for_get, _for_set) \
25 for (i = 0; i < a->rows; i++) \
26 { \
27 for (k = 0; k < ch; k++) \
28 _for_set(b_ptr, k, 2 * (_for_get(a_ptr, ch + k) - _for_get(a_ptr, k))); \
29 for (j = 1; j < a->cols - 1; j++) \
30 for (k = 0; k < ch; k++) \
31 _for_set(b_ptr, j * ch + k, _for_get(a_ptr, (j + 1) * ch + k) - _for_get(a_ptr, (j - 1) * ch + k)); \
32 for (k = 0; k < ch; k++) \
33 _for_set(b_ptr, (a->cols - 1) * ch + k, 2 * (_for_get(a_ptr, (a->cols - 1) * ch + k) - _for_get(a_ptr, (a->cols - 2) * ch + k))); \
34 b_ptr += db->step; \
35 a_ptr += a->step; \
36 }
37 ccv_matrix_getter(a->type, ccv_matrix_setter, db->type, for_block){ switch (((a->type) & 0xFF000)) { case CCV_32S: { { switch
(((db->type) & 0xFF000)) { case CCV_32S: { for_block(
_ccv_get_32s_value, _ccv_set_32s_value); break; } case CCV_32F
: { for_block(_ccv_get_32s_value, _ccv_set_32f_value); break;
} case CCV_64S: { for_block(_ccv_get_32s_value, _ccv_set_64s_value
); break; } case CCV_64F: { for_block(_ccv_get_32s_value, _ccv_set_64f_value
); break; } default: { for_block(_ccv_get_32s_value, _ccv_set_8u_value
); } } }; break; } case CCV_32F: { { switch (((db->type) &
0xFF000)) { case CCV_32S: { for_block(_ccv_get_32f_value, _ccv_set_32s_value
); break; } case CCV_32F: { for_block(_ccv_get_32f_value, _ccv_set_32f_value
); break; } case CCV_64S: { for_block(_ccv_get_32f_value, _ccv_set_64s_value
); break; } case CCV_64F: { for_block(_ccv_get_32f_value, _ccv_set_64f_value
); break; } default: { for_block(_ccv_get_32f_value, _ccv_set_8u_value
); } } }; break; } case CCV_64S: { { switch (((db->type) &
0xFF000)) { case CCV_32S: { for_block(_ccv_get_64s_value, _ccv_set_32s_value
); break; } case CCV_32F: { for_block(_ccv_get_64s_value, _ccv_set_32f_value
); break; } case CCV_64S: { for_block(_ccv_get_64s_value, _ccv_set_64s_value
); break; } case CCV_64F: { for_block(_ccv_get_64s_value, _ccv_set_64f_value
); break; } default: { for_block(_ccv_get_64s_value, _ccv_set_8u_value
); } } }; break; } case CCV_64F: { { switch (((db->type) &
0xFF000)) { case CCV_32S: { for_block(_ccv_get_64f_value, _ccv_set_32s_value
); break; } case CCV_32F: { for_block(_ccv_get_64f_value, _ccv_set_32f_value
); break; } case CCV_64S: { for_block(_ccv_get_64f_value, _ccv_set_64s_value
); break; } case CCV_64F: { for_block(_ccv_get_64f_value, _ccv_set_64f_value
); break; } default: { for_block(_ccv_get_64f_value, _ccv_set_8u_value
); } } }; break; } default: { { switch (((db->type) & 0xFF000
)) { case CCV_32S: { for_block(_ccv_get_8u_value, _ccv_set_32s_value
); break; } case CCV_32F: { for_block(_ccv_get_8u_value, _ccv_set_32f_value
); break; } case CCV_64S: { for_block(_ccv_get_8u_value, _ccv_set_64s_value
); break; } case CCV_64F: { for_block(_ccv_get_8u_value, _ccv_set_64f_value
); break; } default: { for_block(_ccv_get_8u_value, _ccv_set_8u_value
); } } }; } } }
;
38#undef for_block
39 } else if (dx == 0 && dy == 1) {
40 assert(a->rows >= 3)((void) sizeof ((a->rows >= 3) ? 1 : 0), __extension__ (
{ if (a->rows >= 3) ; else __assert_fail ("a->rows >= 3"
, "ccv_basic.c", 40, __extension__ __PRETTY_FUNCTION__); }))
;
41 /* special case 1: 1x3 or 3x1 window */
42#define for_block(_for_get, _for_set) \
43 for (j = 0; j < a->cols; j++) \
44 for (k = 0; k < ch; k++) \
45 _for_set(b_ptr, j * ch + k, 2 * (_for_get(a_ptr + a->step, j * ch + k) - _for_get(a_ptr, j * ch + k))); \
46 a_ptr += a->step; \
47 b_ptr += db->step; \
48 for (i = 1; i < a->rows - 1; i++) \
49 { \
50 for (j = 0; j < a->cols; j++) \
51 for (k = 0; k < ch; k++) \
52 _for_set(b_ptr, j * ch + k, _for_get(a_ptr + a->step, j * ch + k) - _for_get(a_ptr - a->step, j * ch + k)); \
53 a_ptr += a->step; \
54 b_ptr += db->step; \
55 } \
56 for (j = 0; j < a->cols; j++) \
57 for (k = 0; k < ch; k++) \
58 _for_set(b_ptr, j * ch + k, 2 * (_for_get(a_ptr, j * ch + k) - _for_get(a_ptr - a->step, j * ch + k)));
59 ccv_matrix_getter(a->type, ccv_matrix_setter, db->type, for_block){ switch (((a->type) & 0xFF000)) { case CCV_32S: { { switch
(((db->type) & 0xFF000)) { case CCV_32S: { for_block(
_ccv_get_32s_value, _ccv_set_32s_value); break; } case CCV_32F
: { for_block(_ccv_get_32s_value, _ccv_set_32f_value); break;
} case CCV_64S: { for_block(_ccv_get_32s_value, _ccv_set_64s_value
); break; } case CCV_64F: { for_block(_ccv_get_32s_value, _ccv_set_64f_value
); break; } default: { for_block(_ccv_get_32s_value, _ccv_set_8u_value
); } } }; break; } case CCV_32F: { { switch (((db->type) &
0xFF000)) { case CCV_32S: { for_block(_ccv_get_32f_value, _ccv_set_32s_value
); break; } case CCV_32F: { for_block(_ccv_get_32f_value, _ccv_set_32f_value
); break; } case CCV_64S: { for_block(_ccv_get_32f_value, _ccv_set_64s_value
); break; } case CCV_64F: { for_block(_ccv_get_32f_value, _ccv_set_64f_value
); break; } default: { for_block(_ccv_get_32f_value, _ccv_set_8u_value
); } } }; break; } case CCV_64S: { { switch (((db->type) &
0xFF000)) { case CCV_32S: { for_block(_ccv_get_64s_value, _ccv_set_32s_value
); break; } case CCV_32F: { for_block(_ccv_get_64s_value, _ccv_set_32f_value
); break; } case CCV_64S: { for_block(_ccv_get_64s_value, _ccv_set_64s_value
); break; } case CCV_64F: { for_block(_ccv_get_64s_value, _ccv_set_64f_value
); break; } default: { for_block(_ccv_get_64s_value, _ccv_set_8u_value
); } } }; break; } case CCV_64F: { { switch (((db->type) &
0xFF000)) { case CCV_32S: { for_block(_ccv_get_64f_value, _ccv_set_32s_value
); break; } case CCV_32F: { for_block(_ccv_get_64f_value, _ccv_set_32f_value
); break; } case CCV_64S: { for_block(_ccv_get_64f_value, _ccv_set_64s_value
); break; } case CCV_64F: { for_block(_ccv_get_64f_value, _ccv_set_64f_value
); break; } default: { for_block(_ccv_get_64f_value, _ccv_set_8u_value
); } } }; break; } default: { { switch (((db->type) & 0xFF000
)) { case CCV_32S: { for_block(_ccv_get_8u_value, _ccv_set_32s_value
); break; } case CCV_32F: { for_block(_ccv_get_8u_value, _ccv_set_32f_value
); break; } case CCV_64S: { for_block(_ccv_get_8u_value, _ccv_set_64s_value
); break; } case CCV_64F: { for_block(_ccv_get_8u_value, _ccv_set_64f_value
); break; } default: { for_block(_ccv_get_8u_value, _ccv_set_8u_value
); } } }; } } }
;
60#undef for_block
61 } else if ((dx == 1 && dy == 1) || (dx == -1 && dy == -1)) {
62 /* special case 2: 3x3 window with diagonal direction */
63 assert(a->rows >= 3 && a->cols >= 3)((void) sizeof ((a->rows >= 3 && a->cols >=
3) ? 1 : 0), __extension__ ({ if (a->rows >= 3 &&
a->cols >= 3) ; else __assert_fail ("a->rows >= 3 && a->cols >= 3"
, "ccv_basic.c", 63, __extension__ __PRETTY_FUNCTION__); }))
;
64#define for_block(_for_get, _for_set) \
65 for (j = 0; j < a->cols - 1; j++) \
66 for (k = 0; k < ch; k++) \
67 _for_set(b_ptr, j * ch + k, 2 * (_for_get(a_ptr + a->step, (j + 1) * ch + k) - _for_get(a_ptr, j * ch + k))); \
68 for (k = 0; k < ch; k++) \
69 _for_set(b_ptr, (a->cols - 1) * ch + k, 2 * (_for_get(a_ptr + a->step, (a->cols - 1) * ch + k) - _for_get(a_ptr, (a->cols - 1) * ch + k))); \
70 a_ptr += a->step; \
71 b_ptr += db->step; \
72 for (i = 1; i < a->rows - 1; i++) \
73 { \
74 for (k = 0; k < ch; k++) \
75 _for_set(b_ptr, k, 2 * (_for_get(a_ptr + a->step, ch + k) - _for_get(a_ptr, k))); \
76 for (j = 1; j < a->cols - 1; j++) \
77 for (k = 0; k < ch; k++) \
78 _for_set(b_ptr, j * ch + k, _for_get(a_ptr + a->step, (j + 1) * ch + k) - _for_get(a_ptr - a->step, (j - 1) * ch + k)); \
79 for (k = 0; k < ch; k++) \
80 _for_set(b_ptr, (a->cols - 1) * ch + k, 2 * (_for_get(a_ptr, (a->cols - 1) * ch + k) - _for_get(a_ptr - a->step, (a->cols - 2) * ch + k))); \
81 a_ptr += a->step; \
82 b_ptr += db->step; \
83 } \
84 for (k = 0; k < ch; k++) \
85 _for_set(b_ptr, k, 2 * (_for_get(a_ptr, k) - _for_get(a_ptr - a->step, k))); \
86 for (j = 1; j < a->cols; j++) \
87 for (k = 0; k < ch; k++) \
88 _for_set(b_ptr, j * ch + k, 2 * (_for_get(a_ptr, j * ch + k) - _for_get(a_ptr - a->step, (j - 1) * ch + k)));
89 ccv_matrix_getter(a->type, ccv_matrix_setter, db->type, for_block){ switch (((a->type) & 0xFF000)) { case CCV_32S: { { switch
(((db->type) & 0xFF000)) { case CCV_32S: { for_block(
_ccv_get_32s_value, _ccv_set_32s_value); break; } case CCV_32F
: { for_block(_ccv_get_32s_value, _ccv_set_32f_value); break;
} case CCV_64S: { for_block(_ccv_get_32s_value, _ccv_set_64s_value
); break; } case CCV_64F: { for_block(_ccv_get_32s_value, _ccv_set_64f_value
); break; } default: { for_block(_ccv_get_32s_value, _ccv_set_8u_value
); } } }; break; } case CCV_32F: { { switch (((db->type) &
0xFF000)) { case CCV_32S: { for_block(_ccv_get_32f_value, _ccv_set_32s_value
); break; } case CCV_32F: { for_block(_ccv_get_32f_value, _ccv_set_32f_value
); break; } case CCV_64S: { for_block(_ccv_get_32f_value, _ccv_set_64s_value
); break; } case CCV_64F: { for_block(_ccv_get_32f_value, _ccv_set_64f_value
); break; } default: { for_block(_ccv_get_32f_value, _ccv_set_8u_value
); } } }; break; } case CCV_64S: { { switch (((db->type) &
0xFF000)) { case CCV_32S: { for_block(_ccv_get_64s_value, _ccv_set_32s_value
); break; } case CCV_32F: { for_block(_ccv_get_64s_value, _ccv_set_32f_value
); break; } case CCV_64S: { for_block(_ccv_get_64s_value, _ccv_set_64s_value
); break; } case CCV_64F: { for_block(_ccv_get_64s_value, _ccv_set_64f_value
); break; } default: { for_block(_ccv_get_64s_value, _ccv_set_8u_value
); } } }; break; } case CCV_64F: { { switch (((db->type) &
0xFF000)) { case CCV_32S: { for_block(_ccv_get_64f_value, _ccv_set_32s_value
); break; } case CCV_32F: { for_block(_ccv_get_64f_value, _ccv_set_32f_value
); break; } case CCV_64S: { for_block(_ccv_get_64f_value, _ccv_set_64s_value
); break; } case CCV_64F: { for_block(_ccv_get_64f_value, _ccv_set_64f_value
); break; } default: { for_block(_ccv_get_64f_value, _ccv_set_8u_value
); } } }; break; } default: { { switch (((db->type) & 0xFF000
)) { case CCV_32S: { for_block(_ccv_get_8u_value, _ccv_set_32s_value
); break; } case CCV_32F: { for_block(_ccv_get_8u_value, _ccv_set_32f_value
); break; } case CCV_64S: { for_block(_ccv_get_8u_value, _ccv_set_64s_value
); break; } case CCV_64F: { for_block(_ccv_get_8u_value, _ccv_set_64f_value
); break; } default: { for_block(_ccv_get_8u_value, _ccv_set_8u_value
); } } }; } } }
;
90#undef for_block
91 } else if ((dx == 1 && dy == -1) || (dx == -1 && dy == 1)) {
92 /* special case 2: 3x3 window with diagonal direction */
93 assert(a->rows >= 3 && a->cols >= 3)((void) sizeof ((a->rows >= 3 && a->cols >=
3) ? 1 : 0), __extension__ ({ if (a->rows >= 3 &&
a->cols >= 3) ; else __assert_fail ("a->rows >= 3 && a->cols >= 3"
, "ccv_basic.c", 93, __extension__ __PRETTY_FUNCTION__); }))
;
94#define for_block(_for_get, _for_set) \
95 for (k = 0; k < ch; k++) \
96 _for_set(b_ptr, k, 2 * (_for_get(a_ptr + a->step, k) - _for_get(a_ptr, k))); \
97 for (j = 1; j < a->cols; j++) \
98 for (k = 0; k < ch; k++) \
99 _for_set(b_ptr, j * ch + k, 2 * (_for_get(a_ptr + a->step, (j - 1) * ch + k) - _for_get(a_ptr, j * ch + k))); \
100 a_ptr += a->step; \
101 b_ptr += db->step; \
102 for (i = 1; i < a->rows - 1; i++) \
103 { \
104 for (k = 0; k < ch; k++) \
105 _for_set(b_ptr, k, 2 * (_for_get(a_ptr, k) - _for_get(a_ptr - a->step, ch + k))); \
106 for (j = 1; j < a->cols - 1; j++) \
107 for (k = 0; k < ch; k++) \
108 _for_set(b_ptr, j * ch + k, _for_get(a_ptr + a->step, (j - 1) * ch + k) - _for_get(a_ptr - a->step, (j + 1) * ch + k)); \
109 for (k = 0; k < ch; k++) \
110 _for_set(b_ptr, (a->cols - 1) * ch + k, 2 * (_for_get(a_ptr + a->step, (a->cols - 2) * ch + k) - _for_get(a_ptr, (a->cols - 1) * ch + k))); \
111 a_ptr += a->step; \
112 b_ptr += db->step; \
113 } \
114 for (j = 0; j < a->cols - 1; j++) \
115 for (k = 0; k < ch; k++) \
116 _for_set(b_ptr, j * ch + k, 2 * (_for_get(a_ptr, j * ch + k) - _for_get(a_ptr - a->step, (j + 1) * ch + k))); \
117 for (k = 0; k < ch; k++) \
118 _for_set(b_ptr, (a->cols - 1) * ch + k, 2 * (_for_get(a_ptr, (a->cols - 1) * ch + k) - _for_get(a_ptr - a->step, (a->cols - 1) * ch + k)));
119 ccv_matrix_getter(a->type, ccv_matrix_setter, db->type, for_block){ switch (((a->type) & 0xFF000)) { case CCV_32S: { { switch
(((db->type) & 0xFF000)) { case CCV_32S: { for_block(
_ccv_get_32s_value, _ccv_set_32s_value); break; } case CCV_32F
: { for_block(_ccv_get_32s_value, _ccv_set_32f_value); break;
} case CCV_64S: { for_block(_ccv_get_32s_value, _ccv_set_64s_value
); break; } case CCV_64F: { for_block(_ccv_get_32s_value, _ccv_set_64f_value
); break; } default: { for_block(_ccv_get_32s_value, _ccv_set_8u_value
); } } }; break; } case CCV_32F: { { switch (((db->type) &
0xFF000)) { case CCV_32S: { for_block(_ccv_get_32f_value, _ccv_set_32s_value
); break; } case CCV_32F: { for_block(_ccv_get_32f_value, _ccv_set_32f_value
); break; } case CCV_64S: { for_block(_ccv_get_32f_value, _ccv_set_64s_value
); break; } case CCV_64F: { for_block(_ccv_get_32f_value, _ccv_set_64f_value
); break; } default: { for_block(_ccv_get_32f_value, _ccv_set_8u_value
); } } }; break; } case CCV_64S: { { switch (((db->type) &
0xFF000)) { case CCV_32S: { for_block(_ccv_get_64s_value, _ccv_set_32s_value
); break; } case CCV_32F: { for_block(_ccv_get_64s_value, _ccv_set_32f_value
); break; } case CCV_64S: { for_block(_ccv_get_64s_value, _ccv_set_64s_value
); break; } case CCV_64F: { for_block(_ccv_get_64s_value, _ccv_set_64f_value
); break; } default: { for_block(_ccv_get_64s_value, _ccv_set_8u_value
); } } }; break; } case CCV_64F: { { switch (((db->type) &
0xFF000)) { case CCV_32S: { for_block(_ccv_get_64f_value, _ccv_set_32s_value
); break; } case CCV_32F: { for_block(_ccv_get_64f_value, _ccv_set_32f_value
); break; } case CCV_64S: { for_block(_ccv_get_64f_value, _ccv_set_64s_value
); break; } case CCV_64F: { for_block(_ccv_get_64f_value, _ccv_set_64f_value
); break; } default: { for_block(_ccv_get_64f_value, _ccv_set_8u_value
); } } }; break; } default: { { switch (((db->type) & 0xFF000
)) { case CCV_32S: { for_block(_ccv_get_8u_value, _ccv_set_32s_value
); break; } case CCV_32F: { for_block(_ccv_get_8u_value, _ccv_set_32f_value
); break; } case CCV_64S: { for_block(_ccv_get_8u_value, _ccv_set_64s_value
); break; } case CCV_64F: { for_block(_ccv_get_8u_value, _ccv_set_64f_value
); break; } default: { for_block(_ccv_get_8u_value, _ccv_set_8u_value
); } } }; } } }
;
120#undef for_block
121 } else if (dx == 3 && dy == 0) {
122 assert(a->rows >= 3 && a->cols >= 3)((void) sizeof ((a->rows >= 3 && a->cols >=
3) ? 1 : 0), __extension__ ({ if (a->rows >= 3 &&
a->cols >= 3) ; else __assert_fail ("a->rows >= 3 && a->cols >= 3"
, "ccv_basic.c", 122, __extension__ __PRETTY_FUNCTION__); }))
;
123 /* special case 3: 3x3 window, corresponding sigma = 0.85 */
124 unsigned char* buf = (unsigned char*)alloca(db->step)__builtin_alloca (db->step);
125#define for_block(_for_get, _for_set_b, _for_get_b) \
126 for (j = 0; j < a->cols; j++) \
127 for (k = 0; k < ch; k++) \
128 _for_set_b(b_ptr, j * ch + k, _for_get(a_ptr + a->step, j * ch + k) + 3 * _for_get(a_ptr, j * ch + k)); \
129 a_ptr += a->step; \
130 b_ptr += db->step; \
131 for (i = 1; i < a->rows - 1; i++) \
132 { \
133 for (j = 0; j < a->cols; j++) \
134 for (k = 0; k < ch; k++) \
135 _for_set_b(b_ptr, j * ch + k, _for_get(a_ptr + a->step, j * ch + k) + 2 * _for_get(a_ptr, j * ch + k) + _for_get(a_ptr - a->step, j * ch + k)); \
136 a_ptr += a->step; \
137 b_ptr += db->step; \
138 } \
139 for (j = 0; j < a->cols; j++) \
140 for (k = 0; k < ch; k++) \
141 _for_set_b(b_ptr, j * ch + k, 3 * _for_get(a_ptr, j * ch + k) + _for_get(a_ptr - a->step, j * ch + k)); \
142 b_ptr = db->data.u8; \
143 for (i = 0; i < a->rows; i++) \
144 { \
145 for (k = 0; k < ch; k++) \
146 _for_set_b(buf, k, _for_get_b(b_ptr, ch + k) - _for_get_b(b_ptr, k)); \
147 for (j = 1; j < a->cols - 1; j++) \
148 for (k = 0; k < ch; k++) \
149 _for_set_b(buf, j * ch + k, _for_get_b(b_ptr, (j + 1) * ch + k) - _for_get_b(b_ptr, (j - 1) * ch + k)); \
150 for (k = 0; k < ch; k++) \
151 _for_set_b(buf, (a->cols - 1) * ch + k, _for_get_b(b_ptr, (a->cols - 1) * ch + k) - _for_get_b(b_ptr, (a->cols - 2) * ch + k)); \
152 memcpy(b_ptr, buf, db->step); \
153 b_ptr += db->step; \
154 }
155 ccv_matrix_getter(a->type, ccv_matrix_setter_getter, db->type, for_block){ switch (((a->type) & 0xFF000)) { case CCV_32S: { { switch
(((db->type) & 0xFF000)) { case CCV_32S: { for_block(
_ccv_get_32s_value, _ccv_set_32s_value, _ccv_get_32s_value); break
; } case CCV_32F: { for_block(_ccv_get_32s_value, _ccv_set_32f_value
, _ccv_get_32f_value); break; } case CCV_64S: { for_block(_ccv_get_32s_value
, _ccv_set_64s_value, _ccv_get_64s_value); break; } case CCV_64F
: { for_block(_ccv_get_32s_value, _ccv_set_64f_value, _ccv_get_64f_value
); break; } default: { for_block(_ccv_get_32s_value, _ccv_set_8u_value
, _ccv_get_8u_value); } } }; break; } case CCV_32F: { { switch
(((db->type) & 0xFF000)) { case CCV_32S: { for_block(
_ccv_get_32f_value, _ccv_set_32s_value, _ccv_get_32s_value); break
; } case CCV_32F: { for_block(_ccv_get_32f_value, _ccv_set_32f_value
, _ccv_get_32f_value); break; } case CCV_64S: { for_block(_ccv_get_32f_value
, _ccv_set_64s_value, _ccv_get_64s_value); break; } case CCV_64F
: { for_block(_ccv_get_32f_value, _ccv_set_64f_value, _ccv_get_64f_value
); break; } default: { for_block(_ccv_get_32f_value, _ccv_set_8u_value
, _ccv_get_8u_value); } } }; break; } case CCV_64S: { { switch
(((db->type) & 0xFF000)) { case CCV_32S: { for_block(
_ccv_get_64s_value, _ccv_set_32s_value, _ccv_get_32s_value); break
; } case CCV_32F: { for_block(_ccv_get_64s_value, _ccv_set_32f_value
, _ccv_get_32f_value); break; } case CCV_64S: { for_block(_ccv_get_64s_value
, _ccv_set_64s_value, _ccv_get_64s_value); break; } case CCV_64F
: { for_block(_ccv_get_64s_value, _ccv_set_64f_value, _ccv_get_64f_value
); break; } default: { for_block(_ccv_get_64s_value, _ccv_set_8u_value
, _ccv_get_8u_value); } } }; break; } case CCV_64F: { { switch
(((db->type) & 0xFF000)) { case CCV_32S: { for_block(
_ccv_get_64f_value, _ccv_set_32s_value, _ccv_get_32s_value); break
; } case CCV_32F: { for_block(_ccv_get_64f_value, _ccv_set_32f_value
, _ccv_get_32f_value); break; } case CCV_64S: { for_block(_ccv_get_64f_value
, _ccv_set_64s_value, _ccv_get_64s_value); break; } case CCV_64F
: { for_block(_ccv_get_64f_value, _ccv_set_64f_value, _ccv_get_64f_value
); break; } default: { for_block(_ccv_get_64f_value, _ccv_set_8u_value
, _ccv_get_8u_value); } } }; break; } default: { { switch (((
db->type) & 0xFF000)) { case CCV_32S: { for_block(_ccv_get_8u_value
, _ccv_set_32s_value, _ccv_get_32s_value); break; } case CCV_32F
: { for_block(_ccv_get_8u_value, _ccv_set_32f_value, _ccv_get_32f_value
); break; } case CCV_64S: { for_block(_ccv_get_8u_value, _ccv_set_64s_value
, _ccv_get_64s_value); break; } case CCV_64F: { for_block(_ccv_get_8u_value
, _ccv_set_64f_value, _ccv_get_64f_value); break; } default: {
for_block(_ccv_get_8u_value, _ccv_set_8u_value, _ccv_get_8u_value
); } } }; } } }
;
156#undef for_block
157 } else if (dx == 0 && dy == 3) {
158 assert(a->rows >= 3 && a->cols >= 3)((void) sizeof ((a->rows >= 3 && a->cols >=
3) ? 1 : 0), __extension__ ({ if (a->rows >= 3 &&
a->cols >= 3) ; else __assert_fail ("a->rows >= 3 && a->cols >= 3"
, "ccv_basic.c", 158, __extension__ __PRETTY_FUNCTION__); }))
;
159 /* special case 3: 3x3 window, corresponding sigma = 0.85 */
160 unsigned char* buf = (unsigned char*)alloca(db->step)__builtin_alloca (db->step);
161#define for_block(_for_get, _for_set_b, _for_get_b) \
162 for (j = 0; j < a->cols; j++) \
163 for (k = 0; k < ch; k++) \
164 _for_set_b(b_ptr, j * ch + k, _for_get(a_ptr + a->step, j * ch + k) - _for_get(a_ptr, j * ch + k)); \
165 a_ptr += a->step; \
166 b_ptr += db->step; \
167 for (i = 1; i < a->rows - 1; i++) \
168 { \
169 for (j = 0; j < a->cols; j++) \
170 for (k = 0; k < ch; k++) \
171 _for_set_b(b_ptr, j * ch + k, _for_get(a_ptr + a->step, j * ch + k) - _for_get(a_ptr - a->step, j * ch + k)); \
172 a_ptr += a->step; \
173 b_ptr += db->step; \
174 } \
175 for (j = 0; j < a->cols; j++) \
176 for (k = 0; k < ch; k++) \
177 _for_set_b(b_ptr, j * ch + k, _for_get(a_ptr, j * ch + k) - _for_get(a_ptr - a->step, j * ch + k)); \
178 b_ptr = db->data.u8; \
179 for (i = 0; i < a->rows; i++) \
180 { \
181 for (k = 0; k < ch; k++) \
182 _for_set_b(buf, k, _for_get_b(b_ptr, ch + k) + 3 * _for_get_b(b_ptr, k)); \
183 for (j = 1; j < a->cols - 1; j++) \
184 for (k = 0; k < ch; k++) \
185 _for_set_b(buf, j * ch + k, _for_get_b(b_ptr, (j + 1) * ch + k) + 2 * _for_get_b(b_ptr, j * ch + k) + _for_get_b(b_ptr, (j - 1) * ch + k)); \
186 for (k = 0; k < ch; k++) \
187 _for_set_b(buf, (a->cols - 1) * ch + k, _for_get_b(b_ptr, (a->cols - 2) * ch + k) + 3 * _for_get_b(b_ptr, (a->cols - 1) * ch + k)); \
188 memcpy(b_ptr, buf, db->step); \
189 b_ptr += db->step; \
190 }
191 ccv_matrix_getter(a->type, ccv_matrix_setter_getter, db->type, for_block){ switch (((a->type) & 0xFF000)) { case CCV_32S: { { switch
(((db->type) & 0xFF000)) { case CCV_32S: { for_block(
_ccv_get_32s_value, _ccv_set_32s_value, _ccv_get_32s_value); break
; } case CCV_32F: { for_block(_ccv_get_32s_value, _ccv_set_32f_value
, _ccv_get_32f_value); break; } case CCV_64S: { for_block(_ccv_get_32s_value
, _ccv_set_64s_value, _ccv_get_64s_value); break; } case CCV_64F
: { for_block(_ccv_get_32s_value, _ccv_set_64f_value, _ccv_get_64f_value
); break; } default: { for_block(_ccv_get_32s_value, _ccv_set_8u_value
, _ccv_get_8u_value); } } }; break; } case CCV_32F: { { switch
(((db->type) & 0xFF000)) { case CCV_32S: { for_block(
_ccv_get_32f_value, _ccv_set_32s_value, _ccv_get_32s_value); break
; } case CCV_32F: { for_block(_ccv_get_32f_value, _ccv_set_32f_value
, _ccv_get_32f_value); break; } case CCV_64S: { for_block(_ccv_get_32f_value
, _ccv_set_64s_value, _ccv_get_64s_value); break; } case CCV_64F
: { for_block(_ccv_get_32f_value, _ccv_set_64f_value, _ccv_get_64f_value
); break; } default: { for_block(_ccv_get_32f_value, _ccv_set_8u_value
, _ccv_get_8u_value); } } }; break; } case CCV_64S: { { switch
(((db->type) & 0xFF000)) { case CCV_32S: { for_block(
_ccv_get_64s_value, _ccv_set_32s_value, _ccv_get_32s_value); break
; } case CCV_32F: { for_block(_ccv_get_64s_value, _ccv_set_32f_value
, _ccv_get_32f_value); break; } case CCV_64S: { for_block(_ccv_get_64s_value
, _ccv_set_64s_value, _ccv_get_64s_value); break; } case CCV_64F
: { for_block(_ccv_get_64s_value, _ccv_set_64f_value, _ccv_get_64f_value
); break; } default: { for_block(_ccv_get_64s_value, _ccv_set_8u_value
, _ccv_get_8u_value); } } }; break; } case CCV_64F: { { switch
(((db->type) & 0xFF000)) { case CCV_32S: { for_block(
_ccv_get_64f_value, _ccv_set_32s_value, _ccv_get_32s_value); break
; } case CCV_32F: { for_block(_ccv_get_64f_value, _ccv_set_32f_value
, _ccv_get_32f_value); break; } case CCV_64S: { for_block(_ccv_get_64f_value
, _ccv_set_64s_value, _ccv_get_64s_value); break; } case CCV_64F
: { for_block(_ccv_get_64f_value, _ccv_set_64f_value, _ccv_get_64f_value
); break; } default: { for_block(_ccv_get_64f_value, _ccv_set_8u_value
, _ccv_get_8u_value); } } }; break; } default: { { switch (((
db->type) & 0xFF000)) { case CCV_32S: { for_block(_ccv_get_8u_value
, _ccv_set_32s_value, _ccv_get_32s_value); break; } case CCV_32F
: { for_block(_ccv_get_8u_value, _ccv_set_32f_value, _ccv_get_32f_value
); break; } case CCV_64S: { for_block(_ccv_get_8u_value, _ccv_set_64s_value
, _ccv_get_64s_value); break; } case CCV_64F: { for_block(_ccv_get_8u_value
, _ccv_set_64f_value, _ccv_get_64f_value); break; } default: {
for_block(_ccv_get_8u_value, _ccv_set_8u_value, _ccv_get_8u_value
); } } }; } } }
;
192#undef for_block
193 } else {
194 /* general case: in this case, I will generate a separable filter, and do the convolution */
195 int fsz = ccv_max(dx, dy)({ typeof (dx) _a = (dx); typeof (dy) _b = (dy); (_a > _b)
? _a : _b; })
;
196 assert(fsz % 2 == 1)((void) sizeof ((fsz % 2 == 1) ? 1 : 0), __extension__ ({ if (
fsz % 2 == 1) ; else __assert_fail ("fsz % 2 == 1", "ccv_basic.c"
, 196, __extension__ __PRETTY_FUNCTION__); }))
;
197 int hfz = fsz / 2;
198 unsigned char* df = (unsigned char*)alloca(sizeof(double) * fsz)__builtin_alloca (sizeof(double) * fsz);
199 unsigned char* gf = (unsigned char*)alloca(sizeof(double) * fsz)__builtin_alloca (sizeof(double) * fsz);
200 /* the sigma calculation is linear derviation of 3x3 - 0.85, 5x5 - 1.32 */
201 double sigma = ((fsz - 1) / 2) * 0.47 + 0.38;
202 double sigma2 = (2.0 * sigma * sigma);
203 /* 2.5 is the factor to make the kernel "visible" in integer setting */
204 double psigma3 = 2.5 / sqrt(sqrt(2 * CCV_PI(3.141592653589793)) * sigma * sigma * sigma);
205 for (i = 0; i < fsz; i++)
206 {
207 ((double*)df)[i] = (i - hfz) * exp(-((i - hfz) * (i - hfz)) / sigma2) * psigma3;
208 ((double*)gf)[i] = exp(-((i - hfz) * (i - hfz)) / sigma2) * psigma3;
209 }
210 if (db->type & CCV_32S)
211 {
212 for (i = 0; i < fsz; i++)
213 {
214 // df could be negative, thus, (int)(x + 0.5) shortcut will not work
215 ((int*)df)[i] = (int)round(((double*)df)[i] * 256.0);
216 ((int*)gf)[i] = (int)(((double*)gf)[i] * 256.0 + 0.5);
217 }
218 } else {
219 for (i = 0; i < fsz; i++)
220 {
221 ccv_set_value(db->type, df, i, ((double*)df)[i], 0)switch ((((db->type)) & 0xFF000)) { case CCV_32S: ((int
*)(df))[(i)] = (int)(((double*)df)[i]) >> 0; break; case
CCV_32F: ((float*)(df))[(i)] = (float)((double*)df)[i]; break
; case CCV_64S: ((int64_t*)(df))[(i)] = (int64_t)(((double*)df
)[i]) >> 0; break; case CCV_64F: ((double*)(df))[(i)] =
(double)((double*)df)[i]; break; default: ((unsigned char*)(
df))[(i)] = ({ typeof (0) _a = (0); typeof (255) _b = (255); typeof
((int)(((double*)df)[i]) >> 0) _x = ((int)(((double*)df
)[i]) >> 0); (_x < _a) ? _a : ((_x > _b) ? _b : _x
); }); }
;
222 ccv_set_value(db->type, gf, i, ((double*)gf)[i], 0)switch ((((db->type)) & 0xFF000)) { case CCV_32S: ((int
*)(gf))[(i)] = (int)(((double*)gf)[i]) >> 0; break; case
CCV_32F: ((float*)(gf))[(i)] = (float)((double*)gf)[i]; break
; case CCV_64S: ((int64_t*)(gf))[(i)] = (int64_t)(((double*)gf
)[i]) >> 0; break; case CCV_64F: ((double*)(gf))[(i)] =
(double)((double*)gf)[i]; break; default: ((unsigned char*)(
gf))[(i)] = ({ typeof (0) _a = (0); typeof (255) _b = (255); typeof
((int)(((double*)gf)[i]) >> 0) _x = ((int)(((double*)gf
)[i]) >> 0); (_x < _a) ? _a : ((_x > _b) ? _b : _x
); }); }
;
223 }
224 }
225 if (dx < dy)
226 {
227 unsigned char* tf = df;
228 df = gf;
229 gf = tf;
230 }
231 unsigned char* buf = (unsigned char*)alloca(sizeof(double) * ch * (fsz + ccv_max(a->rows, a->cols)))__builtin_alloca (sizeof(double) * ch * (fsz + ({ typeof (a->
rows) _a = (a->rows); typeof (a->cols) _b = (a->cols
); (_a > _b) ? _a : _b; })))
;
232#define for_block(_for_get, _for_type_b, _for_set_b, _for_get_b) \
233 for (i = 0; i < a->rows; i++) \
234 { \
235 for (j = 0; j < hfz; j++) \
236 for (k = 0; k < ch; k++) \
237 _for_set_b(buf, j * ch + k, _for_get(a_ptr, k)); \
238 for (j = 0; j < a->cols; j++) \
239 for (k = 0; k < ch; k++) \
240 _for_set_b(buf, (j + hfz) * ch + k, _for_get(a_ptr, j * ch + k)); \
241 for (j = a->cols; j < a->cols + hfz; j++) \
242 for (k = 0; k < ch; k++) \
243 _for_set_b(buf, (j + hfz) * ch + k, _for_get(a_ptr, (a->cols - 1) * ch + k)); \
244 for (j = 0; j < a->cols; j++) \
245 { \
246 for (c = 0; c < ch; c++) \
247 { \
248 _for_type_b sum = 0; \
249 for (k = 0; k < fsz; k++) \
250 sum += _for_get_b(buf, (j + k) * ch + c) * _for_get_b(df, k); \
251 _for_set_b(b_ptr, j * ch + c, sum, 8); \
252 } \
253 } \
254 a_ptr += a->step; \
255 b_ptr += db->step; \
256 } \
257 b_ptr = db->data.u8; \
258 for (i = 0; i < a->cols; i++) \
259 { \
260 for (j = 0; j < hfz; j++) \
261 for (k = 0; k < ch; k++) \
262 _for_set_b(buf, j * ch + k, _for_get_b(b_ptr, i * ch + k)); \
263 for (j = 0; j < a->rows; j++) \
264 for (k = 0; k < ch; k++) \
265 _for_set_b(buf, (j + hfz) * ch + k, _for_get_b(b_ptr + j * db->step, i * ch + k)); \
266 for (j = a->rows; j < a->rows + hfz; j++) \
267 for (k = 0; k < ch; k++) \
268 _for_set_b(buf, (j + hfz) * ch + k, _for_get_b(b_ptr + (a->rows - 1) * db->step, i * ch + k)); \
269 for (j = 0; j < a->rows; j++) \
270 { \
271 for (c = 0; c < ch; c++) \
272 { \
273 _for_type_b sum = 0; \
274 for (k = 0; k < fsz; k++) \
275 sum += _for_get_b(buf, (j + k) * ch + c) * _for_get_b(gf, k); \
276 _for_set_b(b_ptr + j * db->step, i * ch + c, sum, 8); \
277 } \
278 } \
279 }
280 ccv_matrix_getter(a->type, ccv_matrix_typeof_setter_getter, db->type, for_block){ switch (((a->type) & 0xFF000)) { case CCV_32S: { { switch
(((db->type) & 0xFF000)) { case CCV_32S: { for_block(
_ccv_get_32s_value, int, _ccv_set_32s_value, _ccv_get_32s_value
); break; } case CCV_32F: { for_block(_ccv_get_32s_value, float
, _ccv_set_32f_value, _ccv_get_32f_value); break; } case CCV_64S
: { for_block(_ccv_get_32s_value, int64_t, _ccv_set_64s_value
, _ccv_get_64s_value); break; } case CCV_64F: { for_block(_ccv_get_32s_value
, double, _ccv_set_64f_value, _ccv_get_64f_value); break; } default
: { for_block(_ccv_get_32s_value, unsigned char, _ccv_set_8u_value
, _ccv_get_8u_value); } } }; break; } case CCV_32F: { { switch
(((db->type) & 0xFF000)) { case CCV_32S: { for_block(
_ccv_get_32f_value, int, _ccv_set_32s_value, _ccv_get_32s_value
); break; } case CCV_32F: { for_block(_ccv_get_32f_value, float
, _ccv_set_32f_value, _ccv_get_32f_value); break; } case CCV_64S
: { for_block(_ccv_get_32f_value, int64_t, _ccv_set_64s_value
, _ccv_get_64s_value); break; } case CCV_64F: { for_block(_ccv_get_32f_value
, double, _ccv_set_64f_value, _ccv_get_64f_value); break; } default
: { for_block(_ccv_get_32f_value, unsigned char, _ccv_set_8u_value
, _ccv_get_8u_value); } } }; break; } case CCV_64S: { { switch
(((db->type) & 0xFF000)) { case CCV_32S: { for_block(
_ccv_get_64s_value, int, _ccv_set_32s_value, _ccv_get_32s_value
); break; } case CCV_32F: { for_block(_ccv_get_64s_value, float
, _ccv_set_32f_value, _ccv_get_32f_value); break; } case CCV_64S
: { for_block(_ccv_get_64s_value, int64_t, _ccv_set_64s_value
, _ccv_get_64s_value); break; } case CCV_64F: { for_block(_ccv_get_64s_value
, double, _ccv_set_64f_value, _ccv_get_64f_value); break; } default
: { for_block(_ccv_get_64s_value, unsigned char, _ccv_set_8u_value
, _ccv_get_8u_value); } } }; break; } case CCV_64F: { { switch
(((db->type) & 0xFF000)) { case CCV_32S: { for_block(
_ccv_get_64f_value, int, _ccv_set_32s_value, _ccv_get_32s_value
); break; } case CCV_32F: { for_block(_ccv_get_64f_value, float
, _ccv_set_32f_value, _ccv_get_32f_value); break; } case CCV_64S
: { for_block(_ccv_get_64f_value, int64_t, _ccv_set_64s_value
, _ccv_get_64s_value); break; } case CCV_64F: { for_block(_ccv_get_64f_value
, double, _ccv_set_64f_value, _ccv_get_64f_value); break; } default
: { for_block(_ccv_get_64f_value, unsigned char, _ccv_set_8u_value
, _ccv_get_8u_value); } } }; break; } default: { { switch (((
db->type) & 0xFF000)) { case CCV_32S: { for_block(_ccv_get_8u_value
, int, _ccv_set_32s_value, _ccv_get_32s_value); break; } case
CCV_32F: { for_block(_ccv_get_8u_value, float, _ccv_set_32f_value
, _ccv_get_32f_value); break; } case CCV_64S: { for_block(_ccv_get_8u_value
, int64_t, _ccv_set_64s_value, _ccv_get_64s_value); break; } case
CCV_64F: { for_block(_ccv_get_8u_value, double, _ccv_set_64f_value
, _ccv_get_64f_value); break; } default: { for_block(_ccv_get_8u_value
, unsigned char, _ccv_set_8u_value, _ccv_get_8u_value); } } }
; } } }
;
281#undef for_block
282 }
283}
284
285/* the fast arctan function adopted from OpenCV */
286static void _ccv_atan2(float* x, float* y, float* angle, float* mag, int len)
287{
288 int i = 0;
289 float scale = (float)(180.0 / CCV_PI(3.141592653589793));
290#ifdef HAVE_SSE21
291#ifndef _WIN32
292 union { int i; float fl; } iabsmask; iabsmask.i = 0x7fffffff;
293 __m128 eps = _mm_set1_ps((float)1e-6), absmask = _mm_set1_ps(iabsmask.fl);
294 __m128 _90 = _mm_set1_ps((float)(3.141592654 * 0.5)), _180 = _mm_set1_ps((float)3.141592654), _360 = _mm_set1_ps((float)(3.141592654 * 2));
295 __m128 zero = _mm_setzero_ps(), _0_28 = _mm_set1_ps(0.28f), scale4 = _mm_set1_ps(scale);
296
297 for(; i <= len - 4; i += 4)
298 {
299 __m128 x4 = _mm_loadu_ps(x + i), y4 = _mm_loadu_ps(y + i);
300 __m128 xq4 = _mm_mul_ps(x4, x4), yq4 = _mm_mul_ps(y4, y4);
301 __m128 xly = _mm_cmplt_ps(xq4, yq4);
302 __m128 z4 = _mm_div_ps(_mm_mul_ps(x4, y4), _mm_add_ps(_mm_add_ps(_mm_max_ps(xq4, yq4), _mm_mul_ps(_mm_min_ps(xq4, yq4), _0_28)), eps));
303
304 // a4 <- x < y ? 90 : 0;
305 __m128 a4 = _mm_and_ps(xly, _90);
306 // a4 <- (y < 0 ? 360 - a4 : a4) == ((x < y ? y < 0 ? 270 : 90) : (y < 0 ? 360 : 0))
307 __m128 mask = _mm_cmplt_ps(y4, zero);
308 a4 = _mm_or_ps(_mm_and_ps(_mm_sub_ps(_360, a4), mask), _mm_andnot_ps(mask, a4));
309 // a4 <- (x < 0 && !(x < y) ? 180 : a4)
310 mask = _mm_andnot_ps(xly, _mm_cmplt_ps(x4, zero));
311 a4 = _mm_or_ps(_mm_and_ps(_180, mask), _mm_andnot_ps(mask, a4));
312
313 // a4 <- (x < y ? a4 - z4 : a4 + z4)
314 a4 = _mm_mul_ps(_mm_add_ps(_mm_xor_ps(z4, _mm_andnot_ps(absmask, xly)), a4), scale4);
315 __m128 m4 = _mm_sqrt_ps(_mm_add_ps(xq4, yq4));
316 _mm_storeu_ps(angle + i, a4);
317 _mm_storeu_ps(mag + i, m4);
318 }
319#endif
320#endif
321 for(; i < len; i++)
322 {
323 float xf = x[i], yf = y[i];
324 float a, x2 = xf * xf, y2 = yf * yf;
325 if(y2 <= x2)
326 a = xf * yf / (x2 + 0.28f * y2 + (float)1e-6) + (float)(xf < 0 ? CCV_PI(3.141592653589793) : yf >= 0 ? 0 : CCV_PI(3.141592653589793) * 2);
327 else
328 a = (float)(yf >= 0 ? CCV_PI(3.141592653589793) * 0.5 : CCV_PI(3.141592653589793) * 1.5) - xf * yf / (y2 + 0.28f * x2 + (float)1e-6);
329 angle[i] = a * scale;
330 mag[i] = sqrtf(x2 + y2);
331 }
332}
333
334void ccv_gradient(ccv_dense_matrix_t* a, ccv_dense_matrix_t** theta, int ttype, ccv_dense_matrix_t** m, int mtype, int dx, int dy)
335{
336 ccv_declare_derived_signature(tsig, a->sig != 0, ccv_sign_with_format(64, "ccv_gradient(theta,%d,%d)", dx, dy), a->sig, CCV_EOF_SIGN)char _ccv_identifier_336[(64)]; memset(_ccv_identifier_336, 0
, (64)); snprintf(_ccv_identifier_336, (64), ("ccv_gradient(theta,%d,%d)"
), dx, dy); size_t _ccv_string_size_336 = (64);; uint64_t tsig
= (a->sig != 0) ? ccv_cache_generate_signature(_ccv_identifier_336
, _ccv_string_size_336, a->sig, ((uint64_t)0)) : 0;
;
337 ccv_declare_derived_signature(msig, a->sig != 0, ccv_sign_with_format(64, "ccv_gradient(m,%d,%d)", dx, dy), a->sig, CCV_EOF_SIGN)char _ccv_identifier_337[(64)]; memset(_ccv_identifier_337, 0
, (64)); snprintf(_ccv_identifier_337, (64), ("ccv_gradient(m,%d,%d)"
), dx, dy); size_t _ccv_string_size_337 = (64);; uint64_t msig
= (a->sig != 0) ? ccv_cache_generate_signature(_ccv_identifier_337
, _ccv_string_size_337, a->sig, ((uint64_t)0)) : 0;
;
338 int ch = CCV_GET_CHANNEL(a->type)((a->type) & 0xFFF);
339 ccv_dense_matrix_t* dtheta = *theta = ccv_dense_matrix_renew(*theta, a->rows, a->cols, CCV_32F | ch, CCV_32F | ch, tsig);
340 ccv_dense_matrix_t* dm = *m = ccv_dense_matrix_renew(*m, a->rows, a->cols, CCV_32F | ch, CCV_32F | ch, msig);
341 assert(dtheta && dm)((void) sizeof ((dtheta && dm) ? 1 : 0), __extension__
({ if (dtheta && dm) ; else __assert_fail ("dtheta && dm"
, "ccv_basic.c", 341, __extension__ __PRETTY_FUNCTION__); }))
;
342 ccv_object_return_if_cached(, dtheta, dm){ if ((!(dtheta) || (((int*)(dtheta))[0] & CCV_GARBAGE)) &&
(!(dm) || (((int*)(dm))[0] & CCV_GARBAGE)) && (!
(0) || (((int*)(0))[0] & CCV_GARBAGE)) && (!(0) ||
(((int*)(0))[0] & CCV_GARBAGE)) && (!(0) || (((int
*)(0))[0] & CCV_GARBAGE)) && (!(0) || (((int*)(0)
)[0] & CCV_GARBAGE)) && (!(0) || (((int*)(0))[0] &
CCV_GARBAGE)) && (!(0) || (((int*)(0))[0] & CCV_GARBAGE
)) && (!(0) || (((int*)(0))[0] & CCV_GARBAGE)) &&
(!(0) || (((int*)(0))[0] & CCV_GARBAGE)) && (!(0
) || (((int*)(0))[0] & CCV_GARBAGE)) && (!(0) || (
((int*)(0))[0] & CCV_GARBAGE)) && (!(0) || (((int
*)(0))[0] & CCV_GARBAGE)) && (!(0) || (((int*)(0)
)[0] & CCV_GARBAGE)) && (!(0) || (((int*)(0))[0] &
CCV_GARBAGE)) && (!(0) || (((int*)(0))[0] & CCV_GARBAGE
)) && (!(0) || (((int*)(0))[0] & CCV_GARBAGE)) &&
(!(0) || (((int*)(0))[0] & CCV_GARBAGE)) && (!(0
) || (((int*)(0))[0] & CCV_GARBAGE)) && (!(0) || (
((int*)(0))[0] & CCV_GARBAGE)) && (!(0) || (((int
*)(0))[0] & CCV_GARBAGE)) && (!(0) || (((int*)(0)
)[0] & CCV_GARBAGE)) && (!(0) || (((int*)(0))[0] &
CCV_GARBAGE)) && (!(0) || (((int*)(0))[0] & CCV_GARBAGE
)) && (!(0) || (((int*)(0))[0] & CCV_GARBAGE)) &&
(!(0) || (((int*)(0))[0] & CCV_GARBAGE)) && (!(0
) || (((int*)(0))[0] & CCV_GARBAGE)) && (!(0) || (
((int*)(0))[0] & CCV_GARBAGE)) && (!(0) || (((int
*)(0))[0] & CCV_GARBAGE)) && (!(0) || (((int*)(0)
)[0] & CCV_GARBAGE)) && (!(0) || (((int*)(0))[0] &
CCV_GARBAGE)) && (!(0) || (((int*)(0))[0] & CCV_GARBAGE
)) && (!(0) || (((int*)(0))[0] & CCV_GARBAGE)) &&
(!(0) || (((int*)(0))[0] & CCV_GARBAGE)) && (!(0
) || (((int*)(0))[0] & CCV_GARBAGE)) && (!(0) || (
((int*)(0))[0] & CCV_GARBAGE)) && (!(0) || (((int
*)(0))[0] & CCV_GARBAGE)) && (!(0) || (((int*)(0)
)[0] & CCV_GARBAGE)) && (!(0) || (((int*)(0))[0] &
CCV_GARBAGE)) && (!(0) || (((int*)(0))[0] & CCV_GARBAGE
)) && (!(0) || (((int*)(0))[0] & CCV_GARBAGE)) &&
(!(0) || (((int*)(0))[0] & CCV_GARBAGE)) && (!(0
) || (((int*)(0))[0] & CCV_GARBAGE)) && (!(0) || (
((int*)(0))[0] & CCV_GARBAGE)) && (!(0) || (((int
*)(0))[0] & CCV_GARBAGE)) && (!(0) || (((int*)(0)
)[0] & CCV_GARBAGE)) && (!(0) || (((int*)(0))[0] &
CCV_GARBAGE)) && (!(0) || (((int*)(0))[0] & CCV_GARBAGE
)) && (!(0) || (((int*)(0))[0] & CCV_GARBAGE)) &&
(!(0) || (((int*)(0))[0] & CCV_GARBAGE)) && (!(0
) || (((int*)(0))[0] & CCV_GARBAGE)) && (!(0) || (
((int*)(0))[0] & CCV_GARBAGE)) && (!(0) || (((int
*)(0))[0] & CCV_GARBAGE)) && (!(0) || (((int*)(0)
)[0] & CCV_GARBAGE)) && (!(0) || (((int*)(0))[0] &
CCV_GARBAGE)) && (!(0) || (((int*)(0))[0] & CCV_GARBAGE
)) && (!(0) || (((int*)(0))[0] & CCV_GARBAGE)) &&
(!(0) || (((int*)(0))[0] & CCV_GARBAGE)) && (!(0
) || (((int*)(0))[0] & CCV_GARBAGE)) && (!(0) || (
((int*)(0))[0] & CCV_GARBAGE)) && (!(0) || (((int
*)(0))[0] & CCV_GARBAGE)) && (!(0) || (((int*)(0)
)[0] & CCV_GARBAGE)) && (!(0) || (((int*)(0))[0] &
CCV_GARBAGE))) { (void)((dtheta) && (((int*)(dtheta)
)[0] &= ~CCV_GARBAGE));(void)((dm) && (((int*)(dm
))[0] &= ~CCV_GARBAGE));(void)((0) && (((int*)(0)
)[0] &= ~CCV_GARBAGE));(void)((0) && (((int*)(0))
[0] &= ~CCV_GARBAGE));(void)((0) && (((int*)(0))[
0] &= ~CCV_GARBAGE));(void)((0) && (((int*)(0))[0
] &= ~CCV_GARBAGE));(void)((0) && (((int*)(0))[0]
&= ~CCV_GARBAGE));(void)((0) && (((int*)(0))[0] &=
~CCV_GARBAGE));(void)((0) && (((int*)(0))[0] &= ~
CCV_GARBAGE));(void)((0) && (((int*)(0))[0] &= ~CCV_GARBAGE
));(void)((0) && (((int*)(0))[0] &= ~CCV_GARBAGE)
);(void)((0) && (((int*)(0))[0] &= ~CCV_GARBAGE))
;(void)((0) && (((int*)(0))[0] &= ~CCV_GARBAGE));
(void)((0) && (((int*)(0))[0] &= ~CCV_GARBAGE));(
void)((0) && (((int*)(0))[0] &= ~CCV_GARBAGE));(void
)((0) && (((int*)(0))[0] &= ~CCV_GARBAGE));(void)
((0) && (((int*)(0))[0] &= ~CCV_GARBAGE));(void)(
(0) && (((int*)(0))[0] &= ~CCV_GARBAGE));(void)((
0) && (((int*)(0))[0] &= ~CCV_GARBAGE));(void)((0
) && (((int*)(0))[0] &= ~CCV_GARBAGE));(void)((0)
&& (((int*)(0))[0] &= ~CCV_GARBAGE));(void)((0) &&
(((int*)(0))[0] &= ~CCV_GARBAGE));(void)((0) && (
((int*)(0))[0] &= ~CCV_GARBAGE));(void)((0) && ((
(int*)(0))[0] &= ~CCV_GARBAGE));(void)((0) && (((
int*)(0))[0] &= ~CCV_GARBAGE));(void)((0) && (((int
*)(0))[0] &= ~CCV_GARBAGE));(void)((0) && (((int*
)(0))[0] &= ~CCV_GARBAGE));(void)((0) && (((int*)
(0))[0] &= ~CCV_GARBAGE));(void)((0) && (((int*)(
0))[0] &= ~CCV_GARBAGE));(void)((0) && (((int*)(0
))[0] &= ~CCV_GARBAGE));(void)((0) && (((int*)(0)
)[0] &= ~CCV_GARBAGE));(void)((0) && (((int*)(0))
[0] &= ~CCV_GARBAGE));(void)((0) && (((int*)(0))[
0] &= ~CCV_GARBAGE));(void)((0) && (((int*)(0))[0
] &= ~CCV_GARBAGE));(void)((0) && (((int*)(0))[0]
&= ~CCV_GARBAGE));(void)((0) && (((int*)(0))[0] &=
~CCV_GARBAGE));(void)((0) && (((int*)(0))[0] &= ~
CCV_GARBAGE));(void)((0) && (((int*)(0))[0] &= ~CCV_GARBAGE
));(void)((0) && (((int*)(0))[0] &= ~CCV_GARBAGE)
);(void)((0) && (((int*)(0))[0] &= ~CCV_GARBAGE))
;(void)((0) && (((int*)(0))[0] &= ~CCV_GARBAGE));
(void)((0) && (((int*)(0))[0] &= ~CCV_GARBAGE));(
void)((0) && (((int*)(0))[0] &= ~CCV_GARBAGE));(void
)((0) && (((int*)(0))[0] &= ~CCV_GARBAGE));(void)
((0) && (((int*)(0))[0] &= ~CCV_GARBAGE));(void)(
(0) && (((int*)(0))[0] &= ~CCV_GARBAGE));(void)((
0) && (((int*)(0))[0] &= ~CCV_GARBAGE));(void)((0
) && (((int*)(0))[0] &= ~CCV_GARBAGE));(void)((0)
&& (((int*)(0))[0] &= ~CCV_GARBAGE));(void)((0) &&
(((int*)(0))[0] &= ~CCV_GARBAGE));(void)((0) && (
((int*)(0))[0] &= ~CCV_GARBAGE));(void)((0) && ((
(int*)(0))[0] &= ~CCV_GARBAGE));(void)((0) && (((
int*)(0))[0] &= ~CCV_GARBAGE));(void)((0) && (((int
*)(0))[0] &= ~CCV_GARBAGE));(void)((0) && (((int*
)(0))[0] &= ~CCV_GARBAGE));(void)((0) && (((int*)
(0))[0] &= ~CCV_GARBAGE));(void)((0) && (((int*)(
0))[0] &= ~CCV_GARBAGE));(void)((0) && (((int*)(0
))[0] &= ~CCV_GARBAGE));(void)((0) && (((int*)(0)
)[0] &= ~CCV_GARBAGE));(void)((0) && (((int*)(0))
[0] &= ~CCV_GARBAGE));(void)((0) && (((int*)(0))[
0] &= ~CCV_GARBAGE));(void)((0) && (((int*)(0))[0
] &= ~CCV_GARBAGE));(void)((0) && (((int*)(0))[0]
&= ~CCV_GARBAGE));;; return ; } }
;
343 ccv_revive_object_if_cached(dtheta, dm)(void)((dtheta) && (((int*)(dtheta))[0] &= ~CCV_GARBAGE
));(void)((dm) && (((int*)(dm))[0] &= ~CCV_GARBAGE
));(void)((0) && (((int*)(0))[0] &= ~CCV_GARBAGE)
);(void)((0) && (((int*)(0))[0] &= ~CCV_GARBAGE))
;(void)((0) && (((int*)(0))[0] &= ~CCV_GARBAGE));
(void)((0) && (((int*)(0))[0] &= ~CCV_GARBAGE));(
void)((0) && (((int*)(0))[0] &= ~CCV_GARBAGE));(void
)((0) && (((int*)(0))[0] &= ~CCV_GARBAGE));(void)
((0) && (((int*)(0))[0] &= ~CCV_GARBAGE));(void)(
(0) && (((int*)(0))[0] &= ~CCV_GARBAGE));(void)((
0) && (((int*)(0))[0] &= ~CCV_GARBAGE));(void)((0
) && (((int*)(0))[0] &= ~CCV_GARBAGE));(void)((0)
&& (((int*)(0))[0] &= ~CCV_GARBAGE));(void)((0) &&
(((int*)(0))[0] &= ~CCV_GARBAGE));(void)((0) && (
((int*)(0))[0] &= ~CCV_GARBAGE));(void)((0) && ((
(int*)(0))[0] &= ~CCV_GARBAGE));(void)((0) && (((
int*)(0))[0] &= ~CCV_GARBAGE));(void)((0) && (((int
*)(0))[0] &= ~CCV_GARBAGE));(void)((0) && (((int*
)(0))[0] &= ~CCV_GARBAGE));(void)((0) && (((int*)
(0))[0] &= ~CCV_GARBAGE));(void)((0) && (((int*)(
0))[0] &= ~CCV_GARBAGE));(void)((0) && (((int*)(0
))[0] &= ~CCV_GARBAGE));(void)((0) && (((int*)(0)
)[0] &= ~CCV_GARBAGE));(void)((0) && (((int*)(0))
[0] &= ~CCV_GARBAGE));(void)((0) && (((int*)(0))[
0] &= ~CCV_GARBAGE));(void)((0) && (((int*)(0))[0
] &= ~CCV_GARBAGE));(void)((0) && (((int*)(0))[0]
&= ~CCV_GARBAGE));(void)((0) && (((int*)(0))[0] &=
~CCV_GARBAGE));(void)((0) && (((int*)(0))[0] &= ~
CCV_GARBAGE));(void)((0) && (((int*)(0))[0] &= ~CCV_GARBAGE
));(void)((0) && (((int*)(0))[0] &= ~CCV_GARBAGE)
);(void)((0) && (((int*)(0))[0] &= ~CCV_GARBAGE))
;(void)((0) && (((int*)(0))[0] &= ~CCV_GARBAGE));
(void)((0) && (((int*)(0))[0] &= ~CCV_GARBAGE));(
void)((0) && (((int*)(0))[0] &= ~CCV_GARBAGE));(void
)((0) && (((int*)(0))[0] &= ~CCV_GARBAGE));(void)
((0) && (((int*)(0))[0] &= ~CCV_GARBAGE));(void)(
(0) && (((int*)(0))[0] &= ~CCV_GARBAGE));(void)((
0) && (((int*)(0))[0] &= ~CCV_GARBAGE));(void)((0
) && (((int*)(0))[0] &= ~CCV_GARBAGE));(void)((0)
&& (((int*)(0))[0] &= ~CCV_GARBAGE));(void)((0) &&
(((int*)(0))[0] &= ~CCV_GARBAGE));(void)((0) && (
((int*)(0))[0] &= ~CCV_GARBAGE));(void)((0) && ((
(int*)(0))[0] &= ~CCV_GARBAGE));(void)((0) && (((
int*)(0))[0] &= ~CCV_GARBAGE));(void)((0) && (((int
*)(0))[0] &= ~CCV_GARBAGE));(void)((0) && (((int*
)(0))[0] &= ~CCV_GARBAGE));(void)((0) && (((int*)
(0))[0] &= ~CCV_GARBAGE));(void)((0) && (((int*)(
0))[0] &= ~CCV_GARBAGE));(void)((0) && (((int*)(0
))[0] &= ~CCV_GARBAGE));(void)((0) && (((int*)(0)
)[0] &= ~CCV_GARBAGE));(void)((0) && (((int*)(0))
[0] &= ~CCV_GARBAGE));(void)((0) && (((int*)(0))[
0] &= ~CCV_GARBAGE));(void)((0) && (((int*)(0))[0
] &= ~CCV_GARBAGE));(void)((0) && (((int*)(0))[0]
&= ~CCV_GARBAGE));(void)((0) && (((int*)(0))[0] &=
~CCV_GARBAGE));(void)((0) && (((int*)(0))[0] &= ~
CCV_GARBAGE));(void)((0) && (((int*)(0))[0] &= ~CCV_GARBAGE
));(void)((0) && (((int*)(0))[0] &= ~CCV_GARBAGE)
);(void)((0) && (((int*)(0))[0] &= ~CCV_GARBAGE))
;(void)((0) && (((int*)(0))[0] &= ~CCV_GARBAGE));
(void)((0) && (((int*)(0))[0] &= ~CCV_GARBAGE));(
void)((0) && (((int*)(0))[0] &= ~CCV_GARBAGE));;
;
344 ccv_dense_matrix_t* tx = 0;
345 ccv_dense_matrix_t* ty = 0;
346 ccv_sobel(a, &tx, CCV_32F | ch, dx, 0);
347 ccv_sobel(a, &ty, CCV_32F | ch, 0, dy);
348 _ccv_atan2(tx->data.f32, ty->data.f32, dtheta->data.f32, dm->data.f32, ch * a->rows * a->cols);
349 ccv_matrix_free(tx);
350 ccv_matrix_free(ty);
351}
352
353static void _ccv_flip_y_self(ccv_dense_matrix_t* a)
354{
355 int i;
356 unsigned char* buffer = (unsigned char*)alloca(a->step)__builtin_alloca (a->step);
357 unsigned char* a_ptr = a->data.u8;
358 unsigned char* b_ptr = a->data.u8 + (a->rows - 1) * a->step;
359 for (i = 0; i < a->rows / 2; i++)
360 {
361 memcpy(buffer, a_ptr, a->step);
362 memcpy(a_ptr, b_ptr, a->step);
363 memcpy(b_ptr, buffer, a->step);
364 a_ptr += a->step;
365 b_ptr -= a->step;
366 }
367}
368
369static void _ccv_flip_x_self(ccv_dense_matrix_t* a)
370{
371 int i, j;
372 int len = CCV_GET_DATA_TYPE_SIZE(a->type)_ccv_get_data_type_size[((a->type) & 0xFF000) >>
12]
* CCV_GET_CHANNEL(a->type)((a->type) & 0xFFF);
373 unsigned char* buffer = (unsigned char*)alloca(len)__builtin_alloca (len);
374 unsigned char* a_ptr = a->data.u8;
375 for (i = 0; i < a->rows; i++)
376 {
377 for (j = 0; j < a->cols / 2; j++)
378 {
379 memcpy(buffer, a_ptr + j * len, len);
380 memcpy(a_ptr + j * len, a_ptr + (a->cols - 1 - j) * len, len);
381 memcpy(a_ptr + (a->cols - 1 - j) * len, buffer, len);
382 }
383 a_ptr += a->step;
384 }
385}
386
387void ccv_flip(ccv_dense_matrix_t* a, ccv_dense_matrix_t** b, int btype, int type)
388{
389 /* this is the special case where ccv_declare_derived_signature_* macros cannot handle properly */
390 uint64_t sig = a->sig;
391 if (type & CCV_FLIP_Y)
392 sig = (a->sig == 0) ? 0 : ccv_cache_generate_signature("ccv_flip_y", 10, sig, CCV_EOF_SIGN((uint64_t)0));
393 if (type & CCV_FLIP_X)
394 sig = (a->sig == 0) ? 0 : ccv_cache_generate_signature("ccv_flip_x", 10, sig, CCV_EOF_SIGN((uint64_t)0));
395 ccv_dense_matrix_t* db;
396 if (b == 0)
397 {
398 db = a;
399 if (a->sig != 0)
400 {
401 btype = CCV_GET_DATA_TYPE(a->type)((a->type) & 0xFF000) | CCV_GET_CHANNEL(a->type)((a->type) & 0xFFF);
402 sig = ccv_cache_generate_signature((const char*)&btype, sizeof(int), sig, CCV_EOF_SIGN((uint64_t)0));
403 a->sig = sig;
404 }
405 } else {
406 btype = CCV_GET_DATA_TYPE(a->type)((a->type) & 0xFF000) | CCV_GET_CHANNEL(a->type)((a->type) & 0xFFF);
407 *b = db = ccv_dense_matrix_renew(*b, a->rows, a->cols, btype, btype, sig);
408 ccv_object_return_if_cached(, db){ if ((!(db) || (((int*)(db))[0] & CCV_GARBAGE)) &&
(!(0) || (((int*)(0))[0] & CCV_GARBAGE)) && (!(0
) || (((int*)(0))[0] & CCV_GARBAGE)) && (!(0) || (
((int*)(0))[0] & CCV_GARBAGE)) && (!(0) || (((int
*)(0))[0] & CCV_GARBAGE)) && (!(0) || (((int*)(0)
)[0] & CCV_GARBAGE)) && (!(0) || (((int*)(0))[0] &
CCV_GARBAGE)) && (!(0) || (((int*)(0))[0] & CCV_GARBAGE
)) && (!(0) || (((int*)(0))[0] & CCV_GARBAGE)) &&
(!(0) || (((int*)(0))[0] & CCV_GARBAGE)) && (!(0
) || (((int*)(0))[0] & CCV_GARBAGE)) && (!(0) || (
((int*)(0))[0] & CCV_GARBAGE)) && (!(0) || (((int
*)(0))[0] & CCV_GARBAGE)) && (!(0) || (((int*)(0)
)[0] & CCV_GARBAGE)) && (!(0) || (((int*)(0))[0] &
CCV_GARBAGE)) && (!(0) || (((int*)(0))[0] & CCV_GARBAGE
)) && (!(0) || (((int*)(0))[0] & CCV_GARBAGE)) &&
(!(0) || (((int*)(0))[0] & CCV_GARBAGE)) && (!(0
) || (((int*)(0))[0] & CCV_GARBAGE)) && (!(0) || (
((int*)(0))[0] & CCV_GARBAGE)) && (!(0) || (((int
*)(0))[0] & CCV_GARBAGE)) && (!(0) || (((int*)(0)
)[0] & CCV_GARBAGE)) && (!(0) || (((int*)(0))[0] &
CCV_GARBAGE)) && (!(0) || (((int*)(0))[0] & CCV_GARBAGE
)) && (!(0) || (((int*)(0))[0] & CCV_GARBAGE)) &&
(!(0) || (((int*)(0))[0] & CCV_GARBAGE)) && (!(0
) || (((int*)(0))[0] & CCV_GARBAGE)) && (!(0) || (
((int*)(0))[0] & CCV_GARBAGE)) && (!(0) || (((int
*)(0))[0] & CCV_GARBAGE)) && (!(0) || (((int*)(0)
)[0] & CCV_GARBAGE)) && (!(0) || (((int*)(0))[0] &
CCV_GARBAGE)) && (!(0) || (((int*)(0))[0] & CCV_GARBAGE
)) && (!(0) || (((int*)(0))[0] & CCV_GARBAGE)) &&
(!(0) || (((int*)(0))[0] & CCV_GARBAGE)) && (!(0
) || (((int*)(0))[0] & CCV_GARBAGE)) && (!(0) || (
((int*)(0))[0] & CCV_GARBAGE)) && (!(0) || (((int
*)(0))[0] & CCV_GARBAGE)) && (!(0) || (((int*)(0)
)[0] & CCV_GARBAGE)) && (!(0) || (((int*)(0))[0] &
CCV_GARBAGE)) && (!(0) || (((int*)(0))[0] & CCV_GARBAGE
)) && (!(0) || (((int*)(0))[0] & CCV_GARBAGE)) &&
(!(0) || (((int*)(0))[0] & CCV_GARBAGE)) && (!(0
) || (((int*)(0))[0] & CCV_GARBAGE)) && (!(0) || (
((int*)(0))[0] & CCV_GARBAGE)) && (!(0) || (((int
*)(0))[0] & CCV_GARBAGE)) && (!(0) || (((int*)(0)
)[0] & CCV_GARBAGE)) && (!(0) || (((int*)(0))[0] &
CCV_GARBAGE)) && (!(0) || (((int*)(0))[0] & CCV_GARBAGE
)) && (!(0) || (((int*)(0))[0] & CCV_GARBAGE)) &&
(!(0) || (((int*)(0))[0] & CCV_GARBAGE)) && (!(0
) || (((int*)(0))[0] & CCV_GARBAGE)) && (!(0) || (
((int*)(0))[0] & CCV_GARBAGE)) && (!(0) || (((int
*)(0))[0] & CCV_GARBAGE)) && (!(0) || (((int*)(0)
)[0] & CCV_GARBAGE)) && (!(0) || (((int*)(0))[0] &
CCV_GARBAGE)) && (!(0) || (((int*)(0))[0] & CCV_GARBAGE
)) && (!(0) || (((int*)(0))[0] & CCV_GARBAGE)) &&
(!(0) || (((int*)(0))[0] & CCV_GARBAGE)) && (!(0
) || (((int*)(0))[0] & CCV_GARBAGE)) && (!(0) || (
((int*)(0))[0] & CCV_GARBAGE)) && (!(0) || (((int
*)(0))[0] & CCV_GARBAGE)) && (!(0) || (((int*)(0)
)[0] & CCV_GARBAGE)) && (!(0) || (((int*)(0))[0] &
CCV_GARBAGE))) { (void)((db) && (((int*)(db))[0] &=
~CCV_GARBAGE));(void)((0) && (((int*)(0))[0] &= ~
CCV_GARBAGE));(void)((0) && (((int*)(0))[0] &= ~CCV_GARBAGE
));(void)((0) && (((int*)(0))[0] &= ~CCV_GARBAGE)
);(void)((0) && (((int*)(0))[0] &= ~CCV_GARBAGE))
;(void)((0) && (((int*)(0))[0] &= ~CCV_GARBAGE));
(void)((0) && (((int*)(0))[0] &= ~CCV_GARBAGE));(
void)((0) && (((int*)(0))[0] &= ~CCV_GARBAGE));(void
)((0) && (((int*)(0))[0] &= ~CCV_GARBAGE));(void)
((0) && (((int*)(0))[0] &= ~CCV_GARBAGE));(void)(
(0) && (((int*)(0))[0] &= ~CCV_GARBAGE));(void)((
0) && (((int*)(0))[0] &= ~CCV_GARBAGE));(void)((0
) && (((int*)(0))[0] &= ~CCV_GARBAGE));(void)((0)
&& (((int*)(0))[0] &= ~CCV_GARBAGE));(void)((0) &&
(((int*)(0))[0] &= ~CCV_GARBAGE));(void)((0) && (
((int*)(0))[0] &= ~CCV_GARBAGE));(void)((0) && ((
(int*)(0))[0] &= ~CCV_GARBAGE));(void)((0) && (((
int*)(0))[0] &= ~CCV_GARBAGE));(void)((0) && (((int
*)(0))[0] &= ~CCV_GARBAGE));(void)((0) && (((int*
)(0))[0] &= ~CCV_GARBAGE));(void)((0) && (((int*)
(0))[0] &= ~CCV_GARBAGE));(void)((0) && (((int*)(
0))[0] &= ~CCV_GARBAGE));(void)((0) && (((int*)(0
))[0] &= ~CCV_GARBAGE));(void)((0) && (((int*)(0)
)[0] &= ~CCV_GARBAGE));(void)((0) && (((int*)(0))
[0] &= ~CCV_GARBAGE));(void)((0) && (((int*)(0))[
0] &= ~CCV_GARBAGE));(void)((0) && (((int*)(0))[0
] &= ~CCV_GARBAGE));(void)((0) && (((int*)(0))[0]
&= ~CCV_GARBAGE));(void)((0) && (((int*)(0))[0] &=
~CCV_GARBAGE));(void)((0) && (((int*)(0))[0] &= ~
CCV_GARBAGE));(void)((0) && (((int*)(0))[0] &= ~CCV_GARBAGE
));(void)((0) && (((int*)(0))[0] &= ~CCV_GARBAGE)
);(void)((0) && (((int*)(0))[0] &= ~CCV_GARBAGE))
;(void)((0) && (((int*)(0))[0] &= ~CCV_GARBAGE));
(void)((0) && (((int*)(0))[0] &= ~CCV_GARBAGE));(
void)((0) && (((int*)(0))[0] &= ~CCV_GARBAGE));(void
)((0) && (((int*)(0))[0] &= ~CCV_GARBAGE));(void)
((0) && (((int*)(0))[0] &= ~CCV_GARBAGE));(void)(
(0) && (((int*)(0))[0] &= ~CCV_GARBAGE));(void)((
0) && (((int*)(0))[0] &= ~CCV_GARBAGE));(void)((0
) && (((int*)(0))[0] &= ~CCV_GARBAGE));(void)((0)
&& (((int*)(0))[0] &= ~CCV_GARBAGE));(void)((0) &&
(((int*)(0))[0] &= ~CCV_GARBAGE));(void)((0) && (
((int*)(0))[0] &= ~CCV_GARBAGE));(void)((0) && ((
(int*)(0))[0] &= ~CCV_GARBAGE));(void)((0) && (((
int*)(0))[0] &= ~CCV_GARBAGE));(void)((0) && (((int
*)(0))[0] &= ~CCV_GARBAGE));(void)((0) && (((int*
)(0))[0] &= ~CCV_GARBAGE));(void)((0) && (((int*)
(0))[0] &= ~CCV_GARBAGE));(void)((0) && (((int*)(
0))[0] &= ~CCV_GARBAGE));(void)((0) && (((int*)(0
))[0] &= ~CCV_GARBAGE));(void)((0) && (((int*)(0)
)[0] &= ~CCV_GARBAGE));(void)((0) && (((int*)(0))
[0] &= ~CCV_GARBAGE));(void)((0) && (((int*)(0))[
0] &= ~CCV_GARBAGE));(void)((0) && (((int*)(0))[0
] &= ~CCV_GARBAGE));(void)((0) && (((int*)(0))[0]
&= ~CCV_GARBAGE));(void)((0) && (((int*)(0))[0] &=
~CCV_GARBAGE));(void)((0) && (((int*)(0))[0] &= ~
CCV_GARBAGE));(void)((0) && (((int*)(0))[0] &= ~CCV_GARBAGE
));(void)((0) && (((int*)(0))[0] &= ~CCV_GARBAGE)
);(void)((0) && (((int*)(0))[0] &= ~CCV_GARBAGE))
;(void)((0) && (((int*)(0))[0] &= ~CCV_GARBAGE));
(void)((0) && (((int*)(0))[0] &= ~CCV_GARBAGE));;
; return ; } }
;
409 if (a->data.u8 != db->data.u8)
410 memcpy(db->data.u8, a->data.u8, a->rows * a->step);
411 }
412 if (type & CCV_FLIP_Y)
413 _ccv_flip_y_self(db);
414 if (type & CCV_FLIP_X)
415 _ccv_flip_x_self(db);
416}
417
418void ccv_blur(ccv_dense_matrix_t* a, ccv_dense_matrix_t** b, int type, double sigma)
419{
420 ccv_declare_derived_signature(sig, a->sig != 0, ccv_sign_with_format(64, "ccv_blur(%la)", sigma), a->sig, CCV_EOF_SIGN)char _ccv_identifier_420[(64)]; memset(_ccv_identifier_420, 0
, (64)); snprintf(_ccv_identifier_420, (64), ("ccv_blur(%la)"
), sigma); size_t _ccv_string_size_420 = (64);; uint64_t sig =
(a->sig != 0) ? ccv_cache_generate_signature(_ccv_identifier_420
, _ccv_string_size_420, a->sig, ((uint64_t)0)) : 0;
;
1
Assuming field 'sig' is equal to 0
2
'?' condition is false
421 type = (type == 0) ? CCV_GET_DATA_TYPE(a->type)((a->type) & 0xFF000) | CCV_GET_CHANNEL(a->type)((a->type) & 0xFFF) : CCV_GET_DATA_TYPE(type)((type) & 0xFF000) | CCV_GET_CHANNEL(a->type)((a->type) & 0xFFF);
3
Assuming 'type' is not equal to 0
4
'?' condition is false
422 ccv_dense_matrix_t* db = *b = ccv_dense_matrix_renew(*b, a->rows, a->cols, CCV_ALL_DATA_TYPE(CCV_8U | CCV_32S | CCV_32F | CCV_64S | CCV_64F) | CCV_GET_CHANNEL(a->type)((a->type) & 0xFFF), type, sig);
423 ccv_object_return_if_cached(, db){ if ((!(db) || (((int*)(db))[0] & CCV_GARBAGE)) &&
(!(0) || (((int*)(0))[0] & CCV_GARBAGE)) && (!(0
) || (((int*)(0))[0] & CCV_GARBAGE)) && (!(0) || (
((int*)(0))[0] & CCV_GARBAGE)) && (!(0) || (((int
*)(0))[0] & CCV_GARBAGE)) && (!(0) || (((int*)(0)
)[0] & CCV_GARBAGE)) && (!(0) || (((int*)(0))[0] &
CCV_GARBAGE)) && (!(0) || (((int*)(0))[0] & CCV_GARBAGE
)) && (!(0) || (((int*)(0))[0] & CCV_GARBAGE)) &&
(!(0) || (((int*)(0))[0] & CCV_GARBAGE)) && (!(0
) || (((int*)(0))[0] & CCV_GARBAGE)) && (!(0) || (
((int*)(0))[0] & CCV_GARBAGE)) && (!(0) || (((int
*)(0))[0] & CCV_GARBAGE)) && (!(0) || (((int*)(0)
)[0] & CCV_GARBAGE)) && (!(0) || (((int*)(0))[0] &
CCV_GARBAGE)) && (!(0) || (((int*)(0))[0] & CCV_GARBAGE
)) && (!(0) || (((int*)(0))[0] & CCV_GARBAGE)) &&
(!(0) || (((int*)(0))[0] & CCV_GARBAGE)) && (!(0
) || (((int*)(0))[0] & CCV_GARBAGE)) && (!(0) || (
((int*)(0))[0] & CCV_GARBAGE)) && (!(0) || (((int
*)(0))[0] & CCV_GARBAGE)) && (!(0) || (((int*)(0)
)[0] & CCV_GARBAGE)) && (!(0) || (((int*)(0))[0] &
CCV_GARBAGE)) && (!(0) || (((int*)(0))[0] & CCV_GARBAGE
)) && (!(0) || (((int*)(0))[0] & CCV_GARBAGE)) &&
(!(0) || (((int*)(0))[0] & CCV_GARBAGE)) && (!(0
) || (((int*)(0))[0] & CCV_GARBAGE)) && (!(0) || (
((int*)(0))[0] & CCV_GARBAGE)) && (!(0) || (((int
*)(0))[0] & CCV_GARBAGE)) && (!(0) || (((int*)(0)
)[0] & CCV_GARBAGE)) && (!(0) || (((int*)(0))[0] &
CCV_GARBAGE)) && (!(0) || (((int*)(0))[0] & CCV_GARBAGE
)) && (!(0) || (((int*)(0))[0] & CCV_GARBAGE)) &&
(!(0) || (((int*)(0))[0] & CCV_GARBAGE)) && (!(0
) || (((int*)(0))[0] & CCV_GARBAGE)) && (!(0) || (
((int*)(0))[0] & CCV_GARBAGE)) && (!(0) || (((int
*)(0))[0] & CCV_GARBAGE)) && (!(0) || (((int*)(0)
)[0] & CCV_GARBAGE)) && (!(0) || (((int*)(0))[0] &
CCV_GARBAGE)) && (!(0) || (((int*)(0))[0] & CCV_GARBAGE
)) && (!(0) || (((int*)(0))[0] & CCV_GARBAGE)) &&
(!(0) || (((int*)(0))[0] & CCV_GARBAGE)) && (!(0
) || (((int*)(0))[0] & CCV_GARBAGE)) && (!(0) || (
((int*)(0))[0] & CCV_GARBAGE)) && (!(0) || (((int
*)(0))[0] & CCV_GARBAGE)) && (!(0) || (((int*)(0)
)[0] & CCV_GARBAGE)) && (!(0) || (((int*)(0))[0] &
CCV_GARBAGE)) && (!(0) || (((int*)(0))[0] & CCV_GARBAGE
)) && (!(0) || (((int*)(0))[0] & CCV_GARBAGE)) &&
(!(0) || (((int*)(0))[0] & CCV_GARBAGE)) && (!(0
) || (((int*)(0))[0] & CCV_GARBAGE)) && (!(0) || (
((int*)(0))[0] & CCV_GARBAGE)) && (!(0) || (((int
*)(0))[0] & CCV_GARBAGE)) && (!(0) || (((int*)(0)
)[0] & CCV_GARBAGE)) && (!(0) || (((int*)(0))[0] &
CCV_GARBAGE)) && (!(0) || (((int*)(0))[0] & CCV_GARBAGE
)) && (!(0) || (((int*)(0))[0] & CCV_GARBAGE)) &&
(!(0) || (((int*)(0))[0] & CCV_GARBAGE)) && (!(0
) || (((int*)(0))[0] & CCV_GARBAGE)) && (!(0) || (
((int*)(0))[0] & CCV_GARBAGE)) && (!(0) || (((int
*)(0))[0] & CCV_GARBAGE)) && (!(0) || (((int*)(0)
)[0] & CCV_GARBAGE)) && (!(0) || (((int*)(0))[0] &
CCV_GARBAGE))) { (void)((db) && (((int*)(db))[0] &=
~CCV_GARBAGE));(void)((0) && (((int*)(0))[0] &= ~
CCV_GARBAGE));(void)((0) && (((int*)(0))[0] &= ~CCV_GARBAGE
));(void)((0) && (((int*)(0))[0] &= ~CCV_GARBAGE)
);(void)((0) && (((int*)(0))[0] &= ~CCV_GARBAGE))
;(void)((0) && (((int*)(0))[0] &= ~CCV_GARBAGE));
(void)((0) && (((int*)(0))[0] &= ~CCV_GARBAGE));(
void)((0) && (((int*)(0))[0] &= ~CCV_GARBAGE));(void
)((0) && (((int*)(0))[0] &= ~CCV_GARBAGE));(void)
((0) && (((int*)(0))[0] &= ~CCV_GARBAGE));(void)(
(0) && (((int*)(0))[0] &= ~CCV_GARBAGE));(void)((
0) && (((int*)(0))[0] &= ~CCV_GARBAGE));(void)((0
) && (((int*)(0))[0] &= ~CCV_GARBAGE));(void)((0)
&& (((int*)(0))[0] &= ~CCV_GARBAGE));(void)((0) &&
(((int*)(0))[0] &= ~CCV_GARBAGE));(void)((0) && (
((int*)(0))[0] &= ~CCV_GARBAGE));(void)((0) && ((
(int*)(0))[0] &= ~CCV_GARBAGE));(void)((0) && (((
int*)(0))[0] &= ~CCV_GARBAGE));(void)((0) && (((int
*)(0))[0] &= ~CCV_GARBAGE));(void)((0) && (((int*
)(0))[0] &= ~CCV_GARBAGE));(void)((0) && (((int*)
(0))[0] &= ~CCV_GARBAGE));(void)((0) && (((int*)(
0))[0] &= ~CCV_GARBAGE));(void)((0) && (((int*)(0
))[0] &= ~CCV_GARBAGE));(void)((0) && (((int*)(0)
)[0] &= ~CCV_GARBAGE));(void)((0) && (((int*)(0))
[0] &= ~CCV_GARBAGE));(void)((0) && (((int*)(0))[
0] &= ~CCV_GARBAGE));(void)((0) && (((int*)(0))[0
] &= ~CCV_GARBAGE));(void)((0) && (((int*)(0))[0]
&= ~CCV_GARBAGE));(void)((0) && (((int*)(0))[0] &=
~CCV_GARBAGE));(void)((0) && (((int*)(0))[0] &= ~
CCV_GARBAGE));(void)((0) && (((int*)(0))[0] &= ~CCV_GARBAGE
));(void)((0) && (((int*)(0))[0] &= ~CCV_GARBAGE)
);(void)((0) && (((int*)(0))[0] &= ~CCV_GARBAGE))
;(void)((0) && (((int*)(0))[0] &= ~CCV_GARBAGE));
(void)((0) && (((int*)(0))[0] &= ~CCV_GARBAGE));(
void)((0) && (((int*)(0))[0] &= ~CCV_GARBAGE));(void
)((0) && (((int*)(0))[0] &= ~CCV_GARBAGE));(void)
((0) && (((int*)(0))[0] &= ~CCV_GARBAGE));(void)(
(0) && (((int*)(0))[0] &= ~CCV_GARBAGE));(void)((
0) && (((int*)(0))[0] &= ~CCV_GARBAGE));(void)((0
) && (((int*)(0))[0] &= ~CCV_GARBAGE));(void)((0)
&& (((int*)(0))[0] &= ~CCV_GARBAGE));(void)((0) &&
(((int*)(0))[0] &= ~CCV_GARBAGE));(void)((0) && (
((int*)(0))[0] &= ~CCV_GARBAGE));(void)((0) && ((
(int*)(0))[0] &= ~CCV_GARBAGE));(void)((0) && (((
int*)(0))[0] &= ~CCV_GARBAGE));(void)((0) && (((int
*)(0))[0] &= ~CCV_GARBAGE));(void)((0) && (((int*
)(0))[0] &= ~CCV_GARBAGE));(void)((0) && (((int*)
(0))[0] &= ~CCV_GARBAGE));(void)((0) && (((int*)(
0))[0] &= ~CCV_GARBAGE));(void)((0) && (((int*)(0
))[0] &= ~CCV_GARBAGE));(void)((0) && (((int*)(0)
)[0] &= ~CCV_GARBAGE));(void)((0) && (((int*)(0))
[0] &= ~CCV_GARBAGE));(void)((0) && (((int*)(0))[
0] &= ~CCV_GARBAGE));(void)((0) && (((int*)(0))[0
] &= ~CCV_GARBAGE));(void)((0) && (((int*)(0))[0]
&= ~CCV_GARBAGE));(void)((0) && (((int*)(0))[0] &=
~CCV_GARBAGE));(void)((0) && (((int*)(0))[0] &= ~
CCV_GARBAGE));(void)((0) && (((int*)(0))[0] &= ~CCV_GARBAGE
));(void)((0) && (((int*)(0))[0] &= ~CCV_GARBAGE)
);(void)((0) && (((int*)(0))[0] &= ~CCV_GARBAGE))
;(void)((0) && (((int*)(0))[0] &= ~CCV_GARBAGE));
(void)((0) && (((int*)(0))[0] &= ~CCV_GARBAGE));;
; return ; } }
;
5
Assuming 'db' is non-null
6
Assuming the condition is false
424 int fsz = ccv_max(1, (int)(4.0 * sigma + 1.0 - 1e-8))({ typeof (1) _a = (1); typeof ((int)(4.0 * sigma + 1.0 - 1e-8
)) _b = ((int)(4.0 * sigma + 1.0 - 1e-8)); (_a > _b) ? _a :
_b; })
* 2 + 1;
7
Assuming '_a' is <= '_b'
8
'?' condition is false
425 int hfz = fsz / 2;
426 assert(hfz > 0)((void) sizeof ((hfz > 0) ? 1 : 0), __extension__ ({ if (hfz
> 0) ; else __assert_fail ("hfz > 0", "ccv_basic.c", 426
, __extension__ __PRETTY_FUNCTION__); }))
;
9
Assuming 'hfz' is > 0
10
Taking true branch
427 unsigned char* buf = (unsigned char*)alloca(sizeof(double) * ccv_max(hfz * 2 + a->rows, (hfz * 2 + a->cols) * CCV_GET_CHANNEL(a->type)))__builtin_alloca (sizeof(double) * ({ typeof (hfz * 2 + a->
rows) _a = (hfz * 2 + a->rows); typeof ((hfz * 2 + a->cols
) * ((a->type) & 0xFFF)) _b = ((hfz * 2 + a->cols) *
((a->type) & 0xFFF)); (_a > _b) ? _a : _b; }))
;
11
Assuming '_a' is <= '_b'
12
'?' condition is false
428 unsigned char* filter = (unsigned char*)alloca(sizeof(double) * fsz)__builtin_alloca (sizeof(double) * fsz);
429 double tw = 0;
430 int i, j, k, ch = CCV_GET_CHANNEL(a->type)((a->type) & 0xFFF);
431 assert(fsz > 0)((void) sizeof ((fsz > 0) ? 1 : 0), __extension__ ({ if (fsz
> 0) ; else __assert_fail ("fsz > 0", "ccv_basic.c", 431
, __extension__ __PRETTY_FUNCTION__); }))
;
13
Assuming 'fsz' is > 0
14
Taking true branch
432 for (i = 0; i
14.1
'i' is < 'fsz'
15.1
'i' is < 'fsz'
< fsz
; i++)
15
Loop condition is true. Entering loop body
16
Loop condition is true. Entering loop body
17
Assuming 'i' is >= 'fsz'
433 tw += ((double*)filter)[i] = exp(-((i - hfz) * (i - hfz)) / (2.0 * sigma * sigma));
434 int no_8u_type = (db->type & CCV_8U) ? CCV_32S : db->type;
18
Assuming the condition is false
19
'?' condition is false
435 if (no_8u_type & CCV_32S)
20
Assuming the condition is true
21
Taking true branch
436 {
437 tw = 256.0 / tw;
438 for (i = 0; i
21.1
'i' is < 'fsz'
22.1
'i' is < 'fsz'
23.1
'i' is >= 'fsz'
< fsz; i++)
22
Loop condition is true. Entering loop body
23
Loop condition is true. Entering loop body
24
Loop condition is false. Execution continues on line 446
439 ((int*)filter)[i] = (int)(((double*)filter)[i] * tw + 0.5);
440 } else {
441 tw = 1.0 / tw;
442 for (i = 0; i < fsz; i++)
443 ccv_set_value(no_8u_type, filter, i, ((double*)filter)[i] * tw, 0)switch ((((no_8u_type)) & 0xFF000)) { case CCV_32S: ((int
*)(filter))[(i)] = (int)(((double*)filter)[i] * tw) >> 0
; break; case CCV_32F: ((float*)(filter))[(i)] = (float)((double
*)filter)[i] * tw; break; case CCV_64S: ((int64_t*)(filter))[
(i)] = (int64_t)(((double*)filter)[i] * tw) >> 0; break
; case CCV_64F: ((double*)(filter))[(i)] = (double)((double*)
filter)[i] * tw; break; default: ((unsigned char*)(filter))[(
i)] = ({ typeof (0) _a = (0); typeof (255) _b = (255); typeof
((int)(((double*)filter)[i] * tw) >> 0) _x = ((int)(((
double*)filter)[i] * tw) >> 0); (_x < _a) ? _a : ((_x
> _b) ? _b : _x); }); }
;
444 }
445 /* horizontal */
446 unsigned char* a_ptr = a->data.u8;
447 unsigned char* b_ptr = db->data.u8;
448 assert(ch > 0)((void) sizeof ((ch > 0) ? 1 : 0), __extension__ ({ if (ch
> 0) ; else __assert_fail ("ch > 0", "ccv_basic.c", 448
, __extension__ __PRETTY_FUNCTION__); }))
;
25
Assuming 'ch' is > 0
26
Taking true branch
449#define for_block(_for_type, _for_set_b, _for_get_b, _for_set_a, _for_get_a) \
450 for (i = 0; i < a->rows; i++) \
451 { \
452 for (j = 0; j < hfz; j++) \
453 for (k = 0; k < ch; k++) \
454 _for_set_b(buf, j * ch + k, _for_get_a(a_ptr, k)); \
455 for (j = 0; j < a->cols * ch; j++) \
456 _for_set_b(buf, j + hfz * ch, _for_get_a(a_ptr, j)); \
457 for (j = a->cols; j < hfz + a->cols; j++) \
458 for (k = 0; k < ch; k++) \
459 _for_set_b(buf, j * ch + hfz * ch + k, _for_get_a(a_ptr, (a->cols - 1) * ch + k)); \
460 for (j = 0; j < a->cols * ch; j++) \
461 { \
462 _for_type sum = 0; \
463 for (k = 0; k < fsz; k++) \
464 sum += _for_get_b(buf, k * ch + j) * _for_get_b(filter, k); \
465 _for_set_b(buf, j, sum, 8); \
466 } \
467 for (j = 0; j < a->cols * ch; j++) \
468 _for_set_a(b_ptr, j, _for_get_b(buf, j)); \
469 a_ptr += a->step; \
470 b_ptr += db->step; \
471 }
472 ccv_matrix_typeof_setter_getter(no_8u_type, ccv_matrix_setter, db->type, ccv_matrix_getter, a->type, for_block){ switch (((no_8u_type) & 0xFF000)) { case CCV_32S: { { switch
(((db->type) & 0xFF000)) { case CCV_32S: { { switch (
((a->type) & 0xFF000)) { case CCV_32S: { for_block(int
, _ccv_set_32s_value, _ccv_get_32s_value, _ccv_set_32s_value,
_ccv_get_32s_value); break; } case CCV_32F: { for_block(int,
_ccv_set_32s_value, _ccv_get_32s_value, _ccv_set_32s_value, _ccv_get_32f_value
); break; } case CCV_64S: { for_block(int, _ccv_set_32s_value
, _ccv_get_32s_value, _ccv_set_32s_value, _ccv_get_64s_value)
; break; } case CCV_64F: { for_block(int, _ccv_set_32s_value,
_ccv_get_32s_value, _ccv_set_32s_value, _ccv_get_64f_value);
break; } default: { for_block(int, _ccv_set_32s_value, _ccv_get_32s_value
, _ccv_set_32s_value, _ccv_get_8u_value); } } }; break; } case
CCV_32F: { { switch (((a->type) & 0xFF000)) { case CCV_32S
: { for_block(int, _ccv_set_32s_value, _ccv_get_32s_value, _ccv_set_32f_value
, _ccv_get_32s_value); break; } case CCV_32F: { for_block(int
, _ccv_set_32s_value, _ccv_get_32s_value, _ccv_set_32f_value,
_ccv_get_32f_value); break; } case CCV_64S: { for_block(int,
_ccv_set_32s_value, _ccv_get_32s_value, _ccv_set_32f_value, _ccv_get_64s_value
); break; } case CCV_64F: { for_block(int, _ccv_set_32s_value
, _ccv_get_32s_value, _ccv_set_32f_value, _ccv_get_64f_value)
; break; } default: { for_block(int, _ccv_set_32s_value, _ccv_get_32s_value
, _ccv_set_32f_value, _ccv_get_8u_value); } } }; break; } case
CCV_64S: { { switch (((a->type) & 0xFF000)) { case CCV_32S
: { for_block(int, _ccv_set_32s_value, _ccv_get_32s_value, _ccv_set_64s_value
, _ccv_get_32s_value); break; } case CCV_32F: { for_block(int
, _ccv_set_32s_value, _ccv_get_32s_value, _ccv_set_64s_value,
_ccv_get_32f_value); break; } case CCV_64S: { for_block(int,
_ccv_set_32s_value, _ccv_get_32s_value, _ccv_set_64s_value, _ccv_get_64s_value
); break; } case CCV_64F: { for_block(int, _ccv_set_32s_value
, _ccv_get_32s_value, _ccv_set_64s_value, _ccv_get_64f_value)
; break; } default: { for_block(int, _ccv_set_32s_value, _ccv_get_32s_value
, _ccv_set_64s_value, _ccv_get_8u_value); } } }; break; } case
CCV_64F: { { switch (((a->type) & 0xFF000)) { case CCV_32S
: { for_block(int, _ccv_set_32s_value, _ccv_get_32s_value, _ccv_set_64f_value
, _ccv_get_32s_value); break; } case CCV_32F: { for_block(int
, _ccv_set_32s_value, _ccv_get_32s_value, _ccv_set_64f_value,
_ccv_get_32f_value); break; } case CCV_64S: { for_block(int,
_ccv_set_32s_value, _ccv_get_32s_value, _ccv_set_64f_value, _ccv_get_64s_value
); break; } case CCV_64F: { for_block(int, _ccv_set_32s_value
, _ccv_get_32s_value, _ccv_set_64f_value, _ccv_get_64f_value)
; break; } default: { for_block(int, _ccv_set_32s_value, _ccv_get_32s_value
, _ccv_set_64f_value, _ccv_get_8u_value); } } }; break; } default
: { { switch (((a->type) & 0xFF000)) { case CCV_32S: {
for_block(int, _ccv_set_32s_value, _ccv_get_32s_value, _ccv_set_8u_value
, _ccv_get_32s_value); break; } case CCV_32F: { for_block(int
, _ccv_set_32s_value, _ccv_get_32s_value, _ccv_set_8u_value, _ccv_get_32f_value
); break; } case CCV_64S: { for_block(int, _ccv_set_32s_value
, _ccv_get_32s_value, _ccv_set_8u_value, _ccv_get_64s_value);
break; } case CCV_64F: { for_block(int, _ccv_set_32s_value, _ccv_get_32s_value
, _ccv_set_8u_value, _ccv_get_64f_value); break; } default: {
for_block(int, _ccv_set_32s_value, _ccv_get_32s_value, _ccv_set_8u_value
, _ccv_get_8u_value); } } }; } } }; break; } case CCV_32F: { {
switch (((db->type) & 0xFF000)) { case CCV_32S: { { switch
(((a->type) & 0xFF000)) { case CCV_32S: { for_block(float
, _ccv_set_32f_value, _ccv_get_32f_value, _ccv_set_32s_value,
_ccv_get_32s_value); break; } case CCV_32F: { for_block(float
, _ccv_set_32f_value, _ccv_get_32f_value, _ccv_set_32s_value,
_ccv_get_32f_value); break; } case CCV_64S: { for_block(float
, _ccv_set_32f_value, _ccv_get_32f_value, _ccv_set_32s_value,
_ccv_get_64s_value); break; } case CCV_64F: { for_block(float
, _ccv_set_32f_value, _ccv_get_32f_value, _ccv_set_32s_value,
_ccv_get_64f_value); break; } default: { for_block(float, _ccv_set_32f_value
, _ccv_get_32f_value, _ccv_set_32s_value, _ccv_get_8u_value);
} } }; break; } case CCV_32F: { { switch (((a->type) &
0xFF000)) { case CCV_32S: { for_block(float, _ccv_set_32f_value
, _ccv_get_32f_value, _ccv_set_32f_value, _ccv_get_32s_value)
; break; } case CCV_32F: { for_block(float, _ccv_set_32f_value
, _ccv_get_32f_value, _ccv_set_32f_value, _ccv_get_32f_value)
; break; } case CCV_64S: { for_block(float, _ccv_set_32f_value
, _ccv_get_32f_value, _ccv_set_32f_value, _ccv_get_64s_value)
; break; } case CCV_64F: { for_block(float, _ccv_set_32f_value
, _ccv_get_32f_value, _ccv_set_32f_value, _ccv_get_64f_value)
; break; } default: { for_block(float, _ccv_set_32f_value, _ccv_get_32f_value
, _ccv_set_32f_value, _ccv_get_8u_value); } } }; break; } case
CCV_64S: { { switch (((a->type) & 0xFF000)) { case CCV_32S
: { for_block(float, _ccv_set_32f_value, _ccv_get_32f_value, _ccv_set_64s_value
, _ccv_get_32s_value); break; } case CCV_32F: { for_block(float
, _ccv_set_32f_value, _ccv_get_32f_value, _ccv_set_64s_value,
_ccv_get_32f_value); break; } case CCV_64S: { for_block(float
, _ccv_set_32f_value, _ccv_get_32f_value, _ccv_set_64s_value,
_ccv_get_64s_value); break; } case CCV_64F: { for_block(float
, _ccv_set_32f_value, _ccv_get_32f_value, _ccv_set_64s_value,
_ccv_get_64f_value); break; } default: { for_block(float, _ccv_set_32f_value
, _ccv_get_32f_value, _ccv_set_64s_value, _ccv_get_8u_value);
} } }; break; } case CCV_64F: { { switch (((a->type) &
0xFF000)) { case CCV_32S: { for_block(float, _ccv_set_32f_value
, _ccv_get_32f_value, _ccv_set_64f_value, _ccv_get_32s_value)
; break; } case CCV_32F: { for_block(float, _ccv_set_32f_value
, _ccv_get_32f_value, _ccv_set_64f_value, _ccv_get_32f_value)
; break; } case CCV_64S: { for_block(float, _ccv_set_32f_value
, _ccv_get_32f_value, _ccv_set_64f_value, _ccv_get_64s_value)
; break; } case CCV_64F: { for_block(float, _ccv_set_32f_value
, _ccv_get_32f_value, _ccv_set_64f_value, _ccv_get_64f_value)
; break; } default: { for_block(float, _ccv_set_32f_value, _ccv_get_32f_value
, _ccv_set_64f_value, _ccv_get_8u_value); } } }; break; } default
: { { switch (((a->type) & 0xFF000)) { case CCV_32S: {
for_block(float, _ccv_set_32f_value, _ccv_get_32f_value, _ccv_set_8u_value
, _ccv_get_32s_value); break; } case CCV_32F: { for_block(float
, _ccv_set_32f_value, _ccv_get_32f_value, _ccv_set_8u_value, _ccv_get_32f_value
); break; } case CCV_64S: { for_block(float, _ccv_set_32f_value
, _ccv_get_32f_value, _ccv_set_8u_value, _ccv_get_64s_value);
break; } case CCV_64F: { for_block(float, _ccv_set_32f_value
, _ccv_get_32f_value, _ccv_set_8u_value, _ccv_get_64f_value);
break; } default: { for_block(float, _ccv_set_32f_value, _ccv_get_32f_value
, _ccv_set_8u_value, _ccv_get_8u_value); } } }; } } }; break;
} case CCV_64S: { { switch (((db->type) & 0xFF000)) {
case CCV_32S: { { switch (((a->type) & 0xFF000)) { case
CCV_32S: { for_block(int64_t, _ccv_set_64s_value, _ccv_get_64s_value
, _ccv_set_32s_value, _ccv_get_32s_value); break; } case CCV_32F
: { for_block(int64_t, _ccv_set_64s_value, _ccv_get_64s_value
, _ccv_set_32s_value, _ccv_get_32f_value); break; } case CCV_64S
: { for_block(int64_t, _ccv_set_64s_value, _ccv_get_64s_value
, _ccv_set_32s_value, _ccv_get_64s_value); break; } case CCV_64F
: { for_block(int64_t, _ccv_set_64s_value, _ccv_get_64s_value
, _ccv_set_32s_value, _ccv_get_64f_value); break; } default: {
for_block(int64_t, _ccv_set_64s_value, _ccv_get_64s_value, _ccv_set_32s_value
, _ccv_get_8u_value); } } }; break; } case CCV_32F: { { switch
(((a->type) & 0xFF000)) { case CCV_32S: { for_block(int64_t
, _ccv_set_64s_value, _ccv_get_64s_value, _ccv_set_32f_value,
_ccv_get_32s_value); break; } case CCV_32F: { for_block(int64_t
, _ccv_set_64s_value, _ccv_get_64s_value, _ccv_set_32f_value,
_ccv_get_32f_value); break; } case CCV_64S: { for_block(int64_t
, _ccv_set_64s_value, _ccv_get_64s_value, _ccv_set_32f_value,
_ccv_get_64s_value); break; } case CCV_64F: { for_block(int64_t
, _ccv_set_64s_value, _ccv_get_64s_value, _ccv_set_32f_value,
_ccv_get_64f_value); break; } default: { for_block(int64_t, _ccv_set_64s_value
, _ccv_get_64s_value, _ccv_set_32f_value, _ccv_get_8u_value);
} } }; break; } case CCV_64S: { { switch (((a->type) &
0xFF000)) { case CCV_32S: { for_block(int64_t, _ccv_set_64s_value
, _ccv_get_64s_value, _ccv_set_64s_value, _ccv_get_32s_value)
; break; } case CCV_32F: { for_block(int64_t, _ccv_set_64s_value
, _ccv_get_64s_value, _ccv_set_64s_value, _ccv_get_32f_value)
; break; } case CCV_64S: { for_block(int64_t, _ccv_set_64s_value
, _ccv_get_64s_value, _ccv_set_64s_value, _ccv_get_64s_value)
; break; } case CCV_64F: { for_block(int64_t, _ccv_set_64s_value
, _ccv_get_64s_value, _ccv_set_64s_value, _ccv_get_64f_value)
; break; } default: { for_block(int64_t, _ccv_set_64s_value, _ccv_get_64s_value
, _ccv_set_64s_value, _ccv_get_8u_value); } } }; break; } case
CCV_64F: { { switch (((a->type) & 0xFF000)) { case CCV_32S
: { for_block(int64_t, _ccv_set_64s_value, _ccv_get_64s_value
, _ccv_set_64f_value, _ccv_get_32s_value); break; } case CCV_32F
: { for_block(int64_t, _ccv_set_64s_value, _ccv_get_64s_value
, _ccv_set_64f_value, _ccv_get_32f_value); break; } case CCV_64S
: { for_block(int64_t, _ccv_set_64s_value, _ccv_get_64s_value
, _ccv_set_64f_value, _ccv_get_64s_value); break; } case CCV_64F
: { for_block(int64_t, _ccv_set_64s_value, _ccv_get_64s_value
, _ccv_set_64f_value, _ccv_get_64f_value); break; } default: {
for_block(int64_t, _ccv_set_64s_value, _ccv_get_64s_value, _ccv_set_64f_value
, _ccv_get_8u_value); } } }; break; } default: { { switch (((
a->type) & 0xFF000)) { case CCV_32S: { for_block(int64_t
, _ccv_set_64s_value, _ccv_get_64s_value, _ccv_set_8u_value, _ccv_get_32s_value
); break; } case CCV_32F: { for_block(int64_t, _ccv_set_64s_value
, _ccv_get_64s_value, _ccv_set_8u_value, _ccv_get_32f_value);
break; } case CCV_64S: { for_block(int64_t, _ccv_set_64s_value
, _ccv_get_64s_value, _ccv_set_8u_value, _ccv_get_64s_value);
break; } case CCV_64F: { for_block(int64_t, _ccv_set_64s_value
, _ccv_get_64s_value, _ccv_set_8u_value, _ccv_get_64f_value);
break; } default: { for_block(int64_t, _ccv_set_64s_value, _ccv_get_64s_value
, _ccv_set_8u_value, _ccv_get_8u_value); } } }; } } }; break;
} case CCV_64F: { { switch (((db->type) & 0xFF000)) {
case CCV_32S: { { switch (((a->type) & 0xFF000)) { case
CCV_32S: { for_block(double, _ccv_set_64f_value, _ccv_get_64f_value
, _ccv_set_32s_value, _ccv_get_32s_value); break; } case CCV_32F
: { for_block(double, _ccv_set_64f_value, _ccv_get_64f_value,
_ccv_set_32s_value, _ccv_get_32f_value); break; } case CCV_64S
: { for_block(double, _ccv_set_64f_value, _ccv_get_64f_value,
_ccv_set_32s_value, _ccv_get_64s_value); break; } case CCV_64F
: { for_block(double, _ccv_set_64f_value, _ccv_get_64f_value,
_ccv_set_32s_value, _ccv_get_64f_value); break; } default: {
for_block(double, _ccv_set_64f_value, _ccv_get_64f_value, _ccv_set_32s_value
, _ccv_get_8u_value); } } }; break; } case CCV_32F: { { switch
(((a->type) & 0xFF000)) { case CCV_32S: { for_block(double
, _ccv_set_64f_value, _ccv_get_64f_value, _ccv_set_32f_value,
_ccv_get_32s_value); break; } case CCV_32F: { for_block(double
, _ccv_set_64f_value, _ccv_get_64f_value, _ccv_set_32f_value,
_ccv_get_32f_value); break; } case CCV_64S: { for_block(double
, _ccv_set_64f_value, _ccv_get_64f_value, _ccv_set_32f_value,
_ccv_get_64s_value); break; } case CCV_64F: { for_block(double
, _ccv_set_64f_value, _ccv_get_64f_value, _ccv_set_32f_value,
_ccv_get_64f_value); break; } default: { for_block(double, _ccv_set_64f_value
, _ccv_get_64f_value, _ccv_set_32f_value, _ccv_get_8u_value);
} } }; break; } case CCV_64S: { { switch (((a->type) &
0xFF000)) { case CCV_32S: { for_block(double, _ccv_set_64f_value
, _ccv_get_64f_value, _ccv_set_64s_value, _ccv_get_32s_value)
; break; } case CCV_32F: { for_block(double, _ccv_set_64f_value
, _ccv_get_64f_value, _ccv_set_64s_value, _ccv_get_32f_value)
; break; } case CCV_64S: { for_block(double, _ccv_set_64f_value
, _ccv_get_64f_value, _ccv_set_64s_value, _ccv_get_64s_value)
; break; } case CCV_64F: { for_block(double, _ccv_set_64f_value
, _ccv_get_64f_value, _ccv_set_64s_value, _ccv_get_64f_value)
; break; } default: { for_block(double, _ccv_set_64f_value, _ccv_get_64f_value
, _ccv_set_64s_value, _ccv_get_8u_value); } } }; break; } case
CCV_64F: { { switch (((a->type) & 0xFF000)) { case CCV_32S
: { for_block(double, _ccv_set_64f_value, _ccv_get_64f_value,
_ccv_set_64f_value, _ccv_get_32s_value); break; } case CCV_32F
: { for_block(double, _ccv_set_64f_value, _ccv_get_64f_value,
_ccv_set_64f_value, _ccv_get_32f_value); break; } case CCV_64S
: { for_block(double, _ccv_set_64f_value, _ccv_get_64f_value,
_ccv_set_64f_value, _ccv_get_64s_value); break; } case CCV_64F
: { for_block(double, _ccv_set_64f_value, _ccv_get_64f_value,
_ccv_set_64f_value, _ccv_get_64f_value); break; } default: {
for_block(double, _ccv_set_64f_value, _ccv_get_64f_value, _ccv_set_64f_value
, _ccv_get_8u_value); } } }; break; } default: { { switch (((
a->type) & 0xFF000)) { case CCV_32S: { for_block(double
, _ccv_set_64f_value, _ccv_get_64f_value, _ccv_set_8u_value, _ccv_get_32s_value
); break; } case CCV_32F: { for_block(double, _ccv_set_64f_value
, _ccv_get_64f_value, _ccv_set_8u_value, _ccv_get_32f_value);
break; } case CCV_64S: { for_block(double, _ccv_set_64f_value
, _ccv_get_64f_value, _ccv_set_8u_value, _ccv_get_64s_value);
break; } case CCV_64F: { for_block(double, _ccv_set_64f_value
, _ccv_get_64f_value, _ccv_set_8u_value, _ccv_get_64f_value);
break; } default: { for_block(double, _ccv_set_64f_value, _ccv_get_64f_value
, _ccv_set_8u_value, _ccv_get_8u_value); } } }; } } }; break;
} default: { { switch (((db->type) & 0xFF000)) { case
CCV_32S: { { switch (((a->type) & 0xFF000)) { case CCV_32S
: { for_block(unsigned char, _ccv_set_8u_value, _ccv_get_8u_value
, _ccv_set_32s_value, _ccv_get_32s_value); break; } case CCV_32F
: { for_block(unsigned char, _ccv_set_8u_value, _ccv_get_8u_value
, _ccv_set_32s_value, _ccv_get_32f_value); break; } case CCV_64S
: { for_block(unsigned char, _ccv_set_8u_value, _ccv_get_8u_value
, _ccv_set_32s_value, _ccv_get_64s_value); break; } case CCV_64F
: { for_block(unsigned char, _ccv_set_8u_value, _ccv_get_8u_value
, _ccv_set_32s_value, _ccv_get_64f_value); break; } default: {
for_block(unsigned char, _ccv_set_8u_value, _ccv_get_8u_value
, _ccv_set_32s_value, _ccv_get_8u_value); } } }; break; } case
CCV_32F: { { switch (((a->type) & 0xFF000)) { case CCV_32S
: { for_block(unsigned char, _ccv_set_8u_value, _ccv_get_8u_value
, _ccv_set_32f_value, _ccv_get_32s_value); break; } case CCV_32F
: { for_block(unsigned char, _ccv_set_8u_value, _ccv_get_8u_value
, _ccv_set_32f_value, _ccv_get_32f_value); break; } case CCV_64S
: { for_block(unsigned char, _ccv_set_8u_value, _ccv_get_8u_value
, _ccv_set_32f_value, _ccv_get_64s_value); break; } case CCV_64F
: { for_block(unsigned char, _ccv_set_8u_value, _ccv_get_8u_value
, _ccv_set_32f_value, _ccv_get_64f_value); break; } default: {
for_block(unsigned char, _ccv_set_8u_value, _ccv_get_8u_value
, _ccv_set_32f_value, _ccv_get_8u_value); } } }; break; } case
CCV_64S: { { switch (((a->type) & 0xFF000)) { case CCV_32S
: { for_block(unsigned char, _ccv_set_8u_value, _ccv_get_8u_value
, _ccv_set_64s_value, _ccv_get_32s_value); break; } case CCV_32F
: { for_block(unsigned char, _ccv_set_8u_value, _ccv_get_8u_value
, _ccv_set_64s_value, _ccv_get_32f_value); break; } case CCV_64S
: { for_block(unsigned char, _ccv_set_8u_value, _ccv_get_8u_value
, _ccv_set_64s_value, _ccv_get_64s_value); break; } case CCV_64F
: { for_block(unsigned char, _ccv_set_8u_value, _ccv_get_8u_value
, _ccv_set_64s_value, _ccv_get_64f_value); break; } default: {
for_block(unsigned char, _ccv_set_8u_value, _ccv_get_8u_value
, _ccv_set_64s_value, _ccv_get_8u_value); } } }; break; } case
CCV_64F: { { switch (((a->type) & 0xFF000)) { case CCV_32S
: { for_block(unsigned char, _ccv_set_8u_value, _ccv_get_8u_value
, _ccv_set_64f_value, _ccv_get_32s_value); break; } case CCV_32F
: { for_block(unsigned char, _ccv_set_8u_value, _ccv_get_8u_value
, _ccv_set_64f_value, _ccv_get_32f_value); break; } case CCV_64S
: { for_block(unsigned char, _ccv_set_8u_value, _ccv_get_8u_value
, _ccv_set_64f_value, _ccv_get_64s_value); break; } case CCV_64F
: { for_block(unsigned char, _ccv_set_8u_value, _ccv_get_8u_value
, _ccv_set_64f_value, _ccv_get_64f_value); break; } default: {
for_block(unsigned char, _ccv_set_8u_value, _ccv_get_8u_value
, _ccv_set_64f_value, _ccv_get_8u_value); } } }; break; } default
: { { switch (((a->type) & 0xFF000)) { case CCV_32S: {
for_block(unsigned char, _ccv_set_8u_value, _ccv_get_8u_value
, _ccv_set_8u_value, _ccv_get_32s_value); break; } case CCV_32F
: { for_block(unsigned char, _ccv_set_8u_value, _ccv_get_8u_value
, _ccv_set_8u_value, _ccv_get_32f_value); break; } case CCV_64S
: { for_block(unsigned char, _ccv_set_8u_value, _ccv_get_8u_value
, _ccv_set_8u_value, _ccv_get_64s_value); break; } case CCV_64F
: { for_block(unsigned char, _ccv_set_8u_value, _ccv_get_8u_value
, _ccv_set_8u_value, _ccv_get_64f_value); break; } default: {
for_block(unsigned char, _ccv_set_8u_value, _ccv_get_8u_value
, _ccv_set_8u_value, _ccv_get_8u_value); } } }; } } }; } } }
;
27
Control jumps to the 'default' case at line 472
28
Control jumps to the 'default' case at line 472
29
Control jumps to 'case CCV_32S:' at line 472
30
Assuming 'i' is < field 'rows'
31
Loop condition is true. Entering loop body
32
Loop condition is true. Entering loop body
33
Loop condition is true. Entering loop body
34
Assuming '_x' is >= '_a'
35
'?' condition is false
36
Assuming '_x' is <= '_b'
37
'?' condition is false
38
Assuming 'k' is >= 'ch'
39
Loop condition is false. Execution continues on line 472
40
Assuming 'j' is >= 'hfz'
41
Loop condition is false. Execution continues on line 472
42
Assuming the condition is true
43
Loop condition is true. Entering loop body
44
'?' condition is false
45
'?' condition is false
46
Assuming the condition is false
47
Loop condition is false. Execution continues on line 472
48
Loop condition is true. Entering loop body
49
Loop condition is true. Entering loop body
50
'?' condition is false
51
'?' condition is false
52
Loop condition is false. Execution continues on line 472
53
Loop condition is false. Execution continues on line 472
54
Loop condition is true. Entering loop body
55
Loop condition is true. Entering loop body
56
The value 1 is assigned to 'k'
57
Loop condition is true. Entering loop body
58
The right operand of '*' is a garbage value
473#undef for_block
474 /* vertical */
475 b_ptr = db->data.u8;
476#define for_block(_for_type, _for_set_b, _for_get_b, _for_set_a, _for_get_a) \
477 for (i = 0; i < a->cols * ch; i++) \
478 { \
479 for (j = 0; j < hfz; j++) \
480 _for_set_b(buf, j, _for_get_a(b_ptr, i)); \
481 for (j = 0; j < a->rows; j++) \
482 _for_set_b(buf, j + hfz, _for_get_a(b_ptr + j * db->step, i)); \
483 for (j = a->rows; j < hfz + a->rows; j++) \
484 _for_set_b(buf, j + hfz, _for_get_a(b_ptr + (a->rows - 1) * db->step, i)); \
485 for (j = 0; j < a->rows; j++) \
486 { \
487 _for_type sum = 0; \
488 for (k = 0; k < fsz; k++) \
489 sum += _for_get_b(buf, k + j) * _for_get_b(filter, k); \
490 _for_set_b(buf, j, sum, 8); \
491 } \
492 for (j = 0; j < a->rows; j++) \
493 _for_set_a(b_ptr + j * db->step, i, _for_get_b(buf, j)); \
494 }
495 ccv_matrix_typeof_setter_getter(no_8u_type, ccv_matrix_setter_getter, db->type, for_block){ switch (((no_8u_type) & 0xFF000)) { case CCV_32S: { { switch
(((db->type) & 0xFF000)) { case CCV_32S: { for_block(
int, _ccv_set_32s_value, _ccv_get_32s_value, _ccv_set_32s_value
, _ccv_get_32s_value); break; } case CCV_32F: { for_block(int
, _ccv_set_32s_value, _ccv_get_32s_value, _ccv_set_32f_value,
_ccv_get_32f_value); break; } case CCV_64S: { for_block(int,
_ccv_set_32s_value, _ccv_get_32s_value, _ccv_set_64s_value, _ccv_get_64s_value
); break; } case CCV_64F: { for_block(int, _ccv_set_32s_value
, _ccv_get_32s_value, _ccv_set_64f_value, _ccv_get_64f_value)
; break; } default: { for_block(int, _ccv_set_32s_value, _ccv_get_32s_value
, _ccv_set_8u_value, _ccv_get_8u_value); } } }; break; } case
CCV_32F: { { switch (((db->type) & 0xFF000)) { case CCV_32S
: { for_block(float, _ccv_set_32f_value, _ccv_get_32f_value, _ccv_set_32s_value
, _ccv_get_32s_value); break; } case CCV_32F: { for_block(float
, _ccv_set_32f_value, _ccv_get_32f_value, _ccv_set_32f_value,
_ccv_get_32f_value); break; } case CCV_64S: { for_block(float
, _ccv_set_32f_value, _ccv_get_32f_value, _ccv_set_64s_value,
_ccv_get_64s_value); break; } case CCV_64F: { for_block(float
, _ccv_set_32f_value, _ccv_get_32f_value, _ccv_set_64f_value,
_ccv_get_64f_value); break; } default: { for_block(float, _ccv_set_32f_value
, _ccv_get_32f_value, _ccv_set_8u_value, _ccv_get_8u_value); }
} }; break; } case CCV_64S: { { switch (((db->type) &
0xFF000)) { case CCV_32S: { for_block(int64_t, _ccv_set_64s_value
, _ccv_get_64s_value, _ccv_set_32s_value, _ccv_get_32s_value)
; break; } case CCV_32F: { for_block(int64_t, _ccv_set_64s_value
, _ccv_get_64s_value, _ccv_set_32f_value, _ccv_get_32f_value)
; break; } case CCV_64S: { for_block(int64_t, _ccv_set_64s_value
, _ccv_get_64s_value, _ccv_set_64s_value, _ccv_get_64s_value)
; break; } case CCV_64F: { for_block(int64_t, _ccv_set_64s_value
, _ccv_get_64s_value, _ccv_set_64f_value, _ccv_get_64f_value)
; break; } default: { for_block(int64_t, _ccv_set_64s_value, _ccv_get_64s_value
, _ccv_set_8u_value, _ccv_get_8u_value); } } }; break; } case
CCV_64F: { { switch (((db->type) & 0xFF000)) { case CCV_32S
: { for_block(double, _ccv_set_64f_value, _ccv_get_64f_value,
_ccv_set_32s_value, _ccv_get_32s_value); break; } case CCV_32F
: { for_block(double, _ccv_set_64f_value, _ccv_get_64f_value,
_ccv_set_32f_value, _ccv_get_32f_value); break; } case CCV_64S
: { for_block(double, _ccv_set_64f_value, _ccv_get_64f_value,
_ccv_set_64s_value, _ccv_get_64s_value); break; } case CCV_64F
: { for_block(double, _ccv_set_64f_value, _ccv_get_64f_value,
_ccv_set_64f_value, _ccv_get_64f_value); break; } default: {
for_block(double, _ccv_set_64f_value, _ccv_get_64f_value, _ccv_set_8u_value
, _ccv_get_8u_value); } } }; break; } default: { { switch (((
db->type) & 0xFF000)) { case CCV_32S: { for_block(unsigned
char, _ccv_set_8u_value, _ccv_get_8u_value, _ccv_set_32s_value
, _ccv_get_32s_value); break; } case CCV_32F: { for_block(unsigned
char, _ccv_set_8u_value, _ccv_get_8u_value, _ccv_set_32f_value
, _ccv_get_32f_value); break; } case CCV_64S: { for_block(unsigned
char, _ccv_set_8u_value, _ccv_get_8u_value, _ccv_set_64s_value
, _ccv_get_64s_value); break; } case CCV_64F: { for_block(unsigned
char, _ccv_set_8u_value, _ccv_get_8u_value, _ccv_set_64f_value
, _ccv_get_64f_value); break; } default: { for_block(unsigned
char, _ccv_set_8u_value, _ccv_get_8u_value, _ccv_set_8u_value
, _ccv_get_8u_value); } } }; } } }
;
496#undef for_block
497}