Bug Summary

File:ccv_resample.c
Warning:line 74, column 18
The left expression of the compound assignment is an uninitialized value. The computed value will also be garbage

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_resample.c -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 pic -pic-level 2 -pic-is-pie -mframe-pointer=none -menable-no-infs -menable-no-nans -fapprox-func -funsafe-math-optimizations -fno-signed-zeros -mreassociate -freciprocal-math -ffp-contract=fast -fno-rounding-math -ffast-math -ffinite-math-only -complex-range=basic -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -target-feature +sse2 -tune-cpu generic -debugger-tuning=gdb -fdebug-compilation-dir=/home/liu/actions-runner/_work/ccv/ccv/lib -fcoverage-compilation-dir=/home/liu/actions-runner/_work/ccv/ccv/lib -resource-dir /usr/local/lib/clang/19 -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 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/19/include -internal-isystem /usr/local/include -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/12/../../../../x86_64-linux-gnu/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -O3 -ferror-limit 19 -fgnuc-version=4.2.1 -fskip-odr-check-in-gmf -vectorize-loops -vectorize-slp -analyzer-output=html -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /home/liu/actions-runner/_work/ccv/ccv/_analyze/2024-11-19-165557-113791-1 -x c ccv_resample.c
1#include "ccv.h"
2#include "ccv_internal.h"
3
4/* area interpolation resample is adopted from OpenCV */
5
6typedef struct {
7 int si, di;
8 unsigned int alpha;
9} ccv_int_alpha;
10
11static void _ccv_resample_area_8u(ccv_dense_matrix_t* a, ccv_dense_matrix_t* b, double rows_scale, double cols_scale)
12{
13 assert(a->cols > 0 && b->cols > 0)((void) sizeof ((a->cols > 0 && b->cols >
0) ? 1 : 0), __extension__ ({ if (a->cols > 0 &&
b->cols > 0) ; else __assert_fail ("a->cols > 0 && b->cols > 0"
, "ccv_resample.c", 13, __extension__ __PRETTY_FUNCTION__); }
))
;
1
Assuming field 'cols' is > 0
2
Assuming field 'cols' is > 0
3
Taking true branch
14 int ch = ccv_clamp(CCV_GET_CHANNEL(a->type), 1, 4)({ typeof (1) _a = (1); typeof (4) _b = (4); typeof (((a->
type) & 0xFFF)) _x = (((a->type) & 0xFFF)); (_x <
_a) ? _a : ((_x > _b) ? _b : _x); })
;
4
Assuming '_x' is >= '_a'
5
'?' condition is false
6
Assuming '_x' is <= '_b'
7
'?' condition is false
15 unsigned char* workspace = 0;
16 ccv_int_alpha* xofs;
17 unsigned int* buf;
18 unsigned int* sum;
19 if (a->cols > 1024 || b->cols * ch > 1024)
8
Assuming field 'cols' is <= 1024
9
Assuming the condition is false
10
Taking false branch
20 {
21 workspace = (unsigned char*)ccmallocmalloc(sizeof(ccv_int_alpha) * a->cols * 2 + 2 * b->cols * ch * sizeof(unsigned int));
22 xofs = (ccv_int_alpha*)workspace;
23 buf = (unsigned int*)(workspace + sizeof(ccv_int_alpha) * a->cols * 2);
24 sum = buf + b->cols * ch;
25 } else {
26 xofs = (ccv_int_alpha*)alloca(sizeof(ccv_int_alpha) * a->cols * 2)__builtin_alloca (sizeof(ccv_int_alpha) * a->cols * 2);
27 buf = (unsigned int*)alloca(b->cols * ch * sizeof(unsigned int))__builtin_alloca (b->cols * ch * sizeof(unsigned int));
28 sum = (unsigned int*)alloca(b->cols * ch * sizeof(unsigned int))__builtin_alloca (b->cols * ch * sizeof(unsigned int));
29 }
30 double scale_x = (double)1 / cols_scale;
31 double scale_y = (double)1 / rows_scale;
32 // double scale = 1.f / (scale_x * scale_y);
33 unsigned int inv_scale_256 = (int)(scale_x * scale_y * 0x10000);
34 int dx, dy, sx, sy, i, k;
35 for (dx = 0, k = 0; dx
10.1
'dx' is < field 'cols'
< b->cols
; dx++)
11
Loop condition is true. Entering loop body
20
Assuming 'dx' is < field 'cols'
21
Loop condition is true. Entering loop body
28
Assuming 'dx' is >= field 'cols'
29
Loop condition is false. Execution continues on line 61
36 {
37 double fsx1 = dx * scale_x, fsx2 = fsx1 + scale_x;
38 int sx1 = (int)(fsx1 + 1.0 - 1e-6), sx2 = (int)(fsx2);
39
40 if (sx1 > fsx1)
12
Assuming 'sx1' is <= 'fsx1'
13
Taking false branch
22
Assuming 'sx1' is <= 'fsx1'
23
Taking false branch
41 {
42 xofs[k].di = dx * ch;
43 xofs[k].si = ccv_min(sx1 - 1, a->cols - 1)({ typeof (sx1 - 1) _a = (sx1 - 1); typeof (a->cols - 1) _b
= (a->cols - 1); (_a < _b) ? _a : _b; })
* ch;
44 xofs[k++].alpha = (unsigned int)((sx1 - fsx1) * 0x100);
45 }
46
47 for (sx = sx1; sx < sx2; sx++)
14
Assuming 'sx' is >= 'sx2'
15
Loop condition is false. Execution continues on line 54
24
Assuming 'sx' is >= 'sx2'
25
Loop condition is false. Execution continues on line 54
48 {
49 xofs[k].di = dx * ch;
50 xofs[k].si = ccv_min(sx, a->cols - 1)({ typeof (sx) _a = (sx); typeof (a->cols - 1) _b = (a->
cols - 1); (_a < _b) ? _a : _b; })
* ch;
51 xofs[k++].alpha = 256;
52 }
53
54 if (fsx2 - sx2 > 1e-3)
16
Assuming the condition is true
17
Taking true branch
26
Assuming the condition is false
27
Taking false branch
55 {
56 xofs[k].di = dx * ch;
57 xofs[k].si = ccv_min(sx2, a->cols - 1)({ typeof (sx2) _a = (sx2); typeof (a->cols - 1) _b = (a->
cols - 1); (_a < _b) ? _a : _b; })
* ch;
18
Assuming '_a' is >= '_b'
19
'?' condition is false
58 xofs[k++].alpha = (unsigned int)((fsx2 - sx2) * 256);
59 }
60 }
61 int xofs_count = k;
62 for (dx = 0; dx < b->cols * ch; dx++)
30
Assuming the condition is false
31
Loop condition is false. Execution continues on line 64
63 buf[dx] = sum[dx] = 0;
64 dy = 0;
65 int dy_weight_256 = 0;
66 for (sy = 0; sy < a->rows; sy++)
32
Assuming 'sy' is < field 'rows'
33
Loop condition is true. Entering loop body
67 {
68 unsigned char* a_ptr = a->data.u8 + a->step * sy;
69 for (k = 0; k < xofs_count; k++)
34
Loop condition is true. Entering loop body
70 {
71 int dxn = xofs[k].di;
72 unsigned int alpha = xofs[k].alpha;
73 for (i = 0; i
34.1
'i' is < 'ch'
< ch; i++)
35
Loop condition is true. Entering loop body
74 buf[dxn + i] += a_ptr[xofs[k].si + i] * alpha;
36
The left expression of the compound assignment is an uninitialized value. The computed value will also be garbage
75 }
76 if ((dy + 1) * scale_y <= sy + 1)
77 {
78 unsigned int beta = (int)(ccv_max(sy + 1 - (dy + 1) * scale_y, 0.f)({ typeof (sy + 1 - (dy + 1) * scale_y) _a = (sy + 1 - (dy + 1
) * scale_y); typeof (0.f) _b = (0.f); (_a > _b) ? _a : _b
; })
* 256);
79 unsigned int beta1 = 256 - beta;
80 unsigned char* b_ptr = b->data.u8 + b->step * dy;
81 if (sy == a->rows - 1)
82 beta = (int)(scale_y * 256);
83 else
84 dy_weight_256 = beta;
85 if (beta <= 0)
86 {
87 for (dx = 0; dx < b->cols * ch; dx++)
88 {
89 b_ptr[dx] = ccv_clamp((sum[dx] + buf[dx] * 256) / inv_scale_256, 0, 255)({ typeof (0) _a = (0); typeof (255) _b = (255); typeof ((sum
[dx] + buf[dx] * 256) / inv_scale_256) _x = ((sum[dx] + buf[dx
] * 256) / inv_scale_256); (_x < _a) ? _a : ((_x > _b) ?
_b : _x); })
;
90 sum[dx] = buf[dx] = 0;
91 }
92 } else {
93 for (dx = 0; dx < b->cols * ch; dx++)
94 {
95 b_ptr[dx] = ccv_clamp((sum[dx] + buf[dx] * beta1) / inv_scale_256, 0, 255)({ typeof (0) _a = (0); typeof (255) _b = (255); typeof ((sum
[dx] + buf[dx] * beta1) / inv_scale_256) _x = ((sum[dx] + buf
[dx] * beta1) / inv_scale_256); (_x < _a) ? _a : ((_x >
_b) ? _b : _x); })
;
96 sum[dx] = buf[dx] * beta;
97 buf[dx] = 0;
98 }
99 }
100 dy++;
101 } else {
102 if (sy == a->rows - 1)
103 {
104 dy_weight_256 = (int)(scale_y * 256) - dy_weight_256;
105 for(dx = 0; dx < b->cols * ch; dx++)
106 {
107 sum[dx] += buf[dx] * dy_weight_256;
108 buf[dx] = 0;
109 }
110 } else {
111 dy_weight_256 += 256;
112 for(dx = 0; dx < b->cols * ch; dx++)
113 {
114 sum[dx] += buf[dx] * 256;
115 buf[dx] = 0;
116 }
117 }
118 }
119 }
120 for (; dy < b->rows; dy++)
121 {
122 unsigned char* b_ptr = b->data.u8 + b->step * dy;
123 for (dx = 0; dx < b->cols * ch; dx++)
124 b_ptr[dx] = ccv_clamp(sum[dx] / inv_scale_256, 0, 255)({ typeof (0) _a = (0); typeof (255) _b = (255); typeof (sum[
dx] / inv_scale_256) _x = (sum[dx] / inv_scale_256); (_x <
_a) ? _a : ((_x > _b) ? _b : _x); })
;
125 }
126 if (workspace)
127 ccfreefree(workspace);
128}
129
130typedef struct {
131 int si, di;
132 float alpha;
133} ccv_area_alpha_t;
134
135static void _ccv_resample_area(ccv_dense_matrix_t* a, ccv_dense_matrix_t* b, double rows_scale, double cols_scale)
136{
137 assert(a->cols > 0 && b->cols > 0)((void) sizeof ((a->cols > 0 && b->cols >
0) ? 1 : 0), __extension__ ({ if (a->cols > 0 &&
b->cols > 0) ; else __assert_fail ("a->cols > 0 && b->cols > 0"
, "ccv_resample.c", 137, __extension__ __PRETTY_FUNCTION__); }
))
;
138 int ch = CCV_GET_CHANNEL(a->type)((a->type) & 0xFFF);
139 unsigned char* workspace = 0;
140 ccv_area_alpha_t* xofs;
141 float* buf;
142 float* sum;
143 if (a->cols > 1024 || b->cols * ch > 1024)
144 {
145 workspace = (unsigned char*)ccmallocmalloc(sizeof(ccv_area_alpha_t) * a->cols * 2 + 2 * b->cols * ch * sizeof(float));
146 xofs = (ccv_area_alpha_t*)workspace;
147 buf = (float*)(workspace + sizeof(ccv_area_alpha_t) * a->cols * 2);
148 sum = buf + b->cols * ch;
149 } else {
150 xofs = (ccv_area_alpha_t*)alloca(sizeof(ccv_area_alpha_t) * a->cols * 2)__builtin_alloca (sizeof(ccv_area_alpha_t) * a->cols * 2);
151 buf = (float*)alloca(b->cols * ch * sizeof(float))__builtin_alloca (b->cols * ch * sizeof(float));
152 sum = (float*)alloca(b->cols * ch * sizeof(float))__builtin_alloca (b->cols * ch * sizeof(float));
153 }
154 double scale_x = (double)1 / cols_scale;
155 double scale_y = (double)1 / rows_scale;
156 double scale = 1.f / (scale_x * scale_y);
157 int dx, dy, sx, sy, i, k;
158 for (dx = 0, k = 0; dx < b->cols; dx++)
159 {
160 double fsx1 = dx * scale_x, fsx2 = fsx1 + scale_x;
161 int sx1 = (int)(fsx1 + 1.0 - 1e-6), sx2 = (int)(fsx2);
162
163 if (sx1 > fsx1)
164 {
165 xofs[k].di = dx * ch;
166 xofs[k].si = ccv_min(sx1 - 1, a->cols - 1)({ typeof (sx1 - 1) _a = (sx1 - 1); typeof (a->cols - 1) _b
= (a->cols - 1); (_a < _b) ? _a : _b; })
* ch;
167 xofs[k++].alpha = (float)((sx1 - fsx1) * scale);
168 }
169
170 for (sx = sx1; sx < sx2; sx++)
171 {
172 xofs[k].di = dx * ch;
173 xofs[k].si = ccv_min(sx, a->cols - 1)({ typeof (sx) _a = (sx); typeof (a->cols - 1) _b = (a->
cols - 1); (_a < _b) ? _a : _b; })
* ch;
174 xofs[k++].alpha = (float)scale;
175 }
176
177 if (fsx2 - sx2 > 1e-3)
178 {
179 xofs[k].di = dx * ch;
180 xofs[k].si = ccv_min(sx2, a->cols - 1)({ typeof (sx2) _a = (sx2); typeof (a->cols - 1) _b = (a->
cols - 1); (_a < _b) ? _a : _b; })
* ch;
181 xofs[k++].alpha = (float)((fsx2 - sx2) * scale);
182 }
183 }
184 int xofs_count = k;
185 for (dx = 0; dx < b->cols * ch; dx++)
186 buf[dx] = sum[dx] = 0;
187 dy = 0;
188 float dy_weight = 0;
189#define for_block(_for_get, _for_set) \
190 for (sy = 0; sy < a->rows; sy++) \
191 { \
192 unsigned char* a_ptr = a->data.u8 + a->step * sy; \
193 for (k = 0; k < xofs_count; k++) \
194 { \
195 int dxn = xofs[k].di; \
196 float alpha = xofs[k].alpha; \
197 for (i = 0; i < ch; i++) \
198 buf[dxn + i] += _for_get(a_ptr, xofs[k].si + i) * alpha; \
199 } \
200 if ((dy + 1) * scale_y <= sy + 1) \
201 { \
202 float beta = ccv_max(sy + 1 - (dy + 1) * scale_y, 0.f)({ typeof (sy + 1 - (dy + 1) * scale_y) _a = (sy + 1 - (dy + 1
) * scale_y); typeof (0.f) _b = (0.f); (_a > _b) ? _a : _b
; })
; \
203 float beta1 = 1 - beta; \
204 unsigned char* b_ptr = b->data.u8 + b->step * dy; \
205 if (sy == a->rows - 1) \
206 beta = scale_y; /* Such that if there are any residue, we will scale it up. */ \
207 else \
208 dy_weight = beta; \
209 if (fabs(beta) < 1e-3) \
210 { \
211 for (dx = 0; dx < b->cols * ch; dx++) \
212 { \
213 _for_set(b_ptr, dx, sum[dx] + buf[dx]); \
214 sum[dx] = buf[dx] = 0; \
215 } \
216 } else { \
217 for (dx = 0; dx < b->cols * ch; dx++) \
218 { \
219 _for_set(b_ptr, dx, sum[dx] + buf[dx] * beta1); \
220 sum[dx] = buf[dx] * beta; \
221 buf[dx] = 0; \
222 } \
223 } \
224 dy++; \
225 } else { \
226 if (sy == a->rows - 1) \
227 { \
228 dy_weight = scale_y - dy_weight; \
229 for(dx = 0; dx < b->cols * ch; dx++) \
230 { \
231 sum[dx] += buf[dx] * dy_weight; \
232 buf[dx] = 0; \
233 } \
234 } else { \
235 dy_weight += 1; \
236 for(dx = 0; dx < b->cols * ch; dx++) \
237 { \
238 sum[dx] += buf[dx]; \
239 buf[dx] = 0; \
240 } \
241 } \
242 } \
243 } \
244 for (; dy < b->rows; dy++) \
245 { \
246 unsigned char* b_ptr = b->data.u8 + b->step * dy; \
247 for (dx = 0; dx < b->cols * ch; dx++) \
248 _for_set(b_ptr, dx, sum[dx]); \
249 }
250 ccv_matrix_getter(a->type, ccv_matrix_setter, b->type, for_block){ switch (((a->type) & 0xFF000)) { case CCV_32S: { { switch
(((b->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
(((b->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
(((b->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
(((b->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 (((
b->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); } } }; } } }
;
251#undef for_block
252 if (workspace)
253 ccfreefree(workspace);
254}
255
256typedef struct {
257 int si[4];
258 float coeffs[4];
259} ccv_cubic_coeffs_t;
260
261typedef struct {
262 int si[4];
263 int coeffs[4];
264} ccv_cubic_integer_coeffs_t;
265
266static void _ccv_init_cubic_coeffs(int si, int sz, float s, ccv_cubic_coeffs_t* coeff)
267{
268 const float A = -0.75f;
269 coeff->si[0] = ccv_min(ccv_max(si - 1, 0), sz - 1)({ typeof (({ typeof (si - 1) _a = (si - 1); typeof (0) _b = (
0); (_a > _b) ? _a : _b; })) _a = (({ typeof (si - 1) _a =
(si - 1); typeof (0) _b = (0); (_a > _b) ? _a : _b; })); typeof
(sz - 1) _b = (sz - 1); (_a < _b) ? _a : _b; })
;
270 coeff->si[1] = ccv_min(ccv_max(si, 0), sz - 1)({ typeof (({ typeof (si) _a = (si); typeof (0) _b = (0); (_a
> _b) ? _a : _b; })) _a = (({ typeof (si) _a = (si); typeof
(0) _b = (0); (_a > _b) ? _a : _b; })); typeof (sz - 1) _b
= (sz - 1); (_a < _b) ? _a : _b; })
;
271 coeff->si[2] = ccv_min(ccv_max(si + 1, 0), sz - 1)({ typeof (({ typeof (si + 1) _a = (si + 1); typeof (0) _b = (
0); (_a > _b) ? _a : _b; })) _a = (({ typeof (si + 1) _a =
(si + 1); typeof (0) _b = (0); (_a > _b) ? _a : _b; })); typeof
(sz - 1) _b = (sz - 1); (_a < _b) ? _a : _b; })
;
272 coeff->si[3] = ccv_min(ccv_max(si + 2, 0), sz - 1)({ typeof (({ typeof (si + 2) _a = (si + 2); typeof (0) _b = (
0); (_a > _b) ? _a : _b; })) _a = (({ typeof (si + 2) _a =
(si + 2); typeof (0) _b = (0); (_a > _b) ? _a : _b; })); typeof
(sz - 1) _b = (sz - 1); (_a < _b) ? _a : _b; })
;
273 float x = s - si;
274 coeff->coeffs[0] = ((A * (x + 1) - 5 * A) * (x + 1) + 8 * A) * (x + 1) - 4 * A;
275 coeff->coeffs[1] = ((A + 2) * x - (A + 3)) * x * x + 1;
276 coeff->coeffs[2] = ((A + 2) * (1 - x) - (A + 3)) * (1 - x) * (1 - x) + 1;
277 coeff->coeffs[3] = 1.f - coeff->coeffs[0] - coeff->coeffs[1] - coeff->coeffs[2];
278}
279
280static void _ccv_resample_cubic_float_only(ccv_dense_matrix_t* a, ccv_dense_matrix_t* b, double rows_scale, double cols_scale)
281{
282 assert(CCV_GET_DATA_TYPE(b->type) == CCV_32F || CCV_GET_DATA_TYPE(b->type) == CCV_64F)((void) sizeof ((((b->type) & 0xFF000) == CCV_32F || (
(b->type) & 0xFF000) == CCV_64F) ? 1 : 0), __extension__
({ if (((b->type) & 0xFF000) == CCV_32F || ((b->type
) & 0xFF000) == CCV_64F) ; else __assert_fail ("CCV_GET_DATA_TYPE(b->type) == CCV_32F || CCV_GET_DATA_TYPE(b->type) == CCV_64F"
, "ccv_resample.c", 282, __extension__ __PRETTY_FUNCTION__); }
))
;
283 int i, j, k, ch = CCV_GET_CHANNEL(a->type)((a->type) & 0xFFF);
284 assert(b->cols > 0 && b->step > 0)((void) sizeof ((b->cols > 0 && b->step >
0) ? 1 : 0), __extension__ ({ if (b->cols > 0 &&
b->step > 0) ; else __assert_fail ("b->cols > 0 && b->step > 0"
, "ccv_resample.c", 284, __extension__ __PRETTY_FUNCTION__); }
))
;
285 unsigned char* workspace = 0;
286 ccv_cubic_coeffs_t* xofs;
287 unsigned char* buf;
288 if (b->step > 2048)
289 {
290 workspace = (unsigned char*)ccmallocmalloc(sizeof(ccv_cubic_coeffs_t) * b->cols + b->step * 4);
291 xofs = (ccv_cubic_coeffs_t*)workspace;
292 buf = (unsigned char*)(workspace + sizeof(ccv_cubic_coeffs_t) * b->cols);
293 } else {
294 xofs = (ccv_cubic_coeffs_t*)alloca(sizeof(ccv_cubic_coeffs_t) * b->cols)__builtin_alloca (sizeof(ccv_cubic_coeffs_t) * b->cols);
295 buf = (unsigned char*)alloca(b->step * 4)__builtin_alloca (b->step * 4);
296 }
297 double scale_x = (double)1 / cols_scale;
298 for (i = 0; i < b->cols; i++)
299 {
300 double sx = (i + 0.5) * scale_x - 0.5;
301 _ccv_init_cubic_coeffs((int)sx, a->cols, (float)sx, xofs + i);
302 }
303 double scale_y = (double)1 / rows_scale;
304#ifdef __clang_analyzer__1
305 memset(buf, 0, b->step * 4);
306#endif
307 unsigned char* a_ptr = a->data.u8;
308 unsigned char* b_ptr = b->data.u8;
309 int psi = -1, siy = 0;
310#define for_block(_for_get, _for_set_b, _for_get_b) \
311 for (i = 0; i < b->rows; i++) \
312 { \
313 ccv_cubic_coeffs_t yofs; \
314 double sy = (i + 0.5) * scale_y - 0.5; \
315 _ccv_init_cubic_coeffs((int)sy, a->rows, (float)sy, &yofs); \
316 if (yofs.si[3] > psi) \
317 { \
318 for (; siy <= yofs.si[3]; siy++) \
319 { \
320 unsigned char* row = buf + (siy & 0x3) * b->step; \
321 for (j = 0; j < b->cols; j++) \
322 for (k = 0; k < ch; k++) \
323 _for_set_b(row, j * ch + k, _for_get(a_ptr, xofs[j].si[0] * ch + k) * xofs[j].coeffs[0] + \
324 _for_get(a_ptr, xofs[j].si[1] * ch + k) * xofs[j].coeffs[1] + \
325 _for_get(a_ptr, xofs[j].si[2] * ch + k) * xofs[j].coeffs[2] + \
326 _for_get(a_ptr, xofs[j].si[3] * ch + k) * xofs[j].coeffs[3]); \
327 a_ptr += a->step; \
328 } \
329 psi = yofs.si[3]; \
330 } \
331 unsigned char* row[4] = { \
332 buf + (yofs.si[0] & 0x3) * b->step, \
333 buf + (yofs.si[1] & 0x3) * b->step, \
334 buf + (yofs.si[2] & 0x3) * b->step, \
335 buf + (yofs.si[3] & 0x3) * b->step, \
336 }; \
337 for (j = 0; j < b->cols * ch; j++) \
338 _for_set_b(b_ptr, j, _for_get_b(row[0], j, 0) * yofs.coeffs[0] + _for_get_b(row[1], j) * yofs.coeffs[1] + \
339 _for_get_b(row[2], j, 0) * yofs.coeffs[2] + _for_get_b(row[3], j) * yofs.coeffs[3]); \
340 b_ptr += b->step; \
341 }
342 ccv_matrix_getter(a->type, ccv_matrix_setter_getter_float_only, b->type, for_block){ switch (((a->type) & 0xFF000)) { case CCV_32S: { { switch
(((b->type) & 0xFF000)) { case CCV_32F: { for_block(_ccv_get_32s_value
, _ccv_set_32f_value, _ccv_get_32f_value); break; } case CCV_64F
: { for_block(_ccv_get_32s_value, _ccv_set_64f_value, _ccv_get_64f_value
); break; } default: { ((void) sizeof (((b->type & CCV_32F
) || (b->type & CCV_64F)) ? 1 : 0), __extension__ ({ if
((b->type & CCV_32F) || (b->type & CCV_64F)) ;
else __assert_fail ("(b->type & CCV_32F) || (b->type & CCV_64F)"
, "ccv_resample.c", 342, __extension__ __PRETTY_FUNCTION__); }
)); } } }; break; } case CCV_32F: { { switch (((b->type) &
0xFF000)) { case CCV_32F: { for_block(_ccv_get_32f_value, _ccv_set_32f_value
, _ccv_get_32f_value); break; } case CCV_64F: { for_block(_ccv_get_32f_value
, _ccv_set_64f_value, _ccv_get_64f_value); break; } default: {
((void) sizeof (((b->type & CCV_32F) || (b->type &
CCV_64F)) ? 1 : 0), __extension__ ({ if ((b->type & CCV_32F
) || (b->type & CCV_64F)) ; else __assert_fail ("(b->type & CCV_32F) || (b->type & CCV_64F)"
, "ccv_resample.c", 342, __extension__ __PRETTY_FUNCTION__); }
)); } } }; break; } case CCV_64S: { { switch (((b->type) &
0xFF000)) { case CCV_32F: { for_block(_ccv_get_64s_value, _ccv_set_32f_value
, _ccv_get_32f_value); break; } case CCV_64F: { for_block(_ccv_get_64s_value
, _ccv_set_64f_value, _ccv_get_64f_value); break; } default: {
((void) sizeof (((b->type & CCV_32F) || (b->type &
CCV_64F)) ? 1 : 0), __extension__ ({ if ((b->type & CCV_32F
) || (b->type & CCV_64F)) ; else __assert_fail ("(b->type & CCV_32F) || (b->type & CCV_64F)"
, "ccv_resample.c", 342, __extension__ __PRETTY_FUNCTION__); }
)); } } }; break; } case CCV_64F: { { switch (((b->type) &
0xFF000)) { case CCV_32F: { for_block(_ccv_get_64f_value, _ccv_set_32f_value
, _ccv_get_32f_value); break; } case CCV_64F: { for_block(_ccv_get_64f_value
, _ccv_set_64f_value, _ccv_get_64f_value); break; } default: {
((void) sizeof (((b->type & CCV_32F) || (b->type &
CCV_64F)) ? 1 : 0), __extension__ ({ if ((b->type & CCV_32F
) || (b->type & CCV_64F)) ; else __assert_fail ("(b->type & CCV_32F) || (b->type & CCV_64F)"
, "ccv_resample.c", 342, __extension__ __PRETTY_FUNCTION__); }
)); } } }; break; } default: { { switch (((b->type) & 0xFF000
)) { case CCV_32F: { for_block(_ccv_get_8u_value, _ccv_set_32f_value
, _ccv_get_32f_value); break; } case CCV_64F: { for_block(_ccv_get_8u_value
, _ccv_set_64f_value, _ccv_get_64f_value); break; } default: {
((void) sizeof (((b->type & CCV_32F) || (b->type &
CCV_64F)) ? 1 : 0), __extension__ ({ if ((b->type & CCV_32F
) || (b->type & CCV_64F)) ; else __assert_fail ("(b->type & CCV_32F) || (b->type & CCV_64F)"
, "ccv_resample.c", 342, __extension__ __PRETTY_FUNCTION__); }
)); } } }; } } }
;
343#undef for_block
344 if (workspace)
345 ccfreefree(workspace);
346}
347
348static void _ccv_init_cubic_integer_coeffs(int si, int sz, float s, ccv_cubic_integer_coeffs_t* coeff)
349{
350 const float A = -0.75f;
351 coeff->si[0] = ccv_min(ccv_max(si - 1, 0), sz - 1)({ typeof (({ typeof (si - 1) _a = (si - 1); typeof (0) _b = (
0); (_a > _b) ? _a : _b; })) _a = (({ typeof (si - 1) _a =
(si - 1); typeof (0) _b = (0); (_a > _b) ? _a : _b; })); typeof
(sz - 1) _b = (sz - 1); (_a < _b) ? _a : _b; })
;
352 coeff->si[1] = ccv_min(ccv_max(si, 0), sz - 1)({ typeof (({ typeof (si) _a = (si); typeof (0) _b = (0); (_a
> _b) ? _a : _b; })) _a = (({ typeof (si) _a = (si); typeof
(0) _b = (0); (_a > _b) ? _a : _b; })); typeof (sz - 1) _b
= (sz - 1); (_a < _b) ? _a : _b; })
;
353 coeff->si[2] = ccv_min(ccv_max(si + 1, 0), sz - 1)({ typeof (({ typeof (si + 1) _a = (si + 1); typeof (0) _b = (
0); (_a > _b) ? _a : _b; })) _a = (({ typeof (si + 1) _a =
(si + 1); typeof (0) _b = (0); (_a > _b) ? _a : _b; })); typeof
(sz - 1) _b = (sz - 1); (_a < _b) ? _a : _b; })
;
354 coeff->si[3] = ccv_min(ccv_max(si + 2, 0), sz - 1)({ typeof (({ typeof (si + 2) _a = (si + 2); typeof (0) _b = (
0); (_a > _b) ? _a : _b; })) _a = (({ typeof (si + 2) _a =
(si + 2); typeof (0) _b = (0); (_a > _b) ? _a : _b; })); typeof
(sz - 1) _b = (sz - 1); (_a < _b) ? _a : _b; })
;
355 float x = s - si;
356 const int W_BITS = 1 << 6;
357 coeff->coeffs[0] = (int)((((A * (x + 1) - 5 * A) * (x + 1) + 8 * A) * (x + 1) - 4 * A) * W_BITS + 0.5);
358 coeff->coeffs[1] = (int)((((A + 2) * x - (A + 3)) * x * x + 1) * W_BITS + 0.5);
359 coeff->coeffs[2] = (int)((((A + 2) * (1 - x) - (A + 3)) * (1 - x) * (1 - x) + 1) * W_BITS + 0.5);
360 coeff->coeffs[3] = W_BITS - coeff->coeffs[0] - coeff->coeffs[1] - coeff->coeffs[2];
361}
362
363static void _ccv_resample_cubic_integer_only(ccv_dense_matrix_t* a, ccv_dense_matrix_t* b, double rows_scale, double cols_scale)
364{
365 assert(CCV_GET_DATA_TYPE(b->type) == CCV_8U || CCV_GET_DATA_TYPE(b->type) == CCV_32S || CCV_GET_DATA_TYPE(b->type) == CCV_64S)((void) sizeof ((((b->type) & 0xFF000) == CCV_8U || ((
b->type) & 0xFF000) == CCV_32S || ((b->type) & 0xFF000
) == CCV_64S) ? 1 : 0), __extension__ ({ if (((b->type) &
0xFF000) == CCV_8U || ((b->type) & 0xFF000) == CCV_32S
|| ((b->type) & 0xFF000) == CCV_64S) ; else __assert_fail
("CCV_GET_DATA_TYPE(b->type) == CCV_8U || CCV_GET_DATA_TYPE(b->type) == CCV_32S || CCV_GET_DATA_TYPE(b->type) == CCV_64S"
, "ccv_resample.c", 365, __extension__ __PRETTY_FUNCTION__); }
))
;
366 int i, j, k, ch = CCV_GET_CHANNEL(a->type)((a->type) & 0xFFF);
367 int no_8u_type = (b->type & CCV_8U) ? CCV_32S : b->type;
368 assert(b->cols > 0)((void) sizeof ((b->cols > 0) ? 1 : 0), __extension__ (
{ if (b->cols > 0) ; else __assert_fail ("b->cols > 0"
, "ccv_resample.c", 368, __extension__ __PRETTY_FUNCTION__); }
))
;
369 unsigned char* workspace = 0;
370 ccv_cubic_integer_coeffs_t* xofs;
371 unsigned char* buf;
372 int bufstep = b->cols * ch * CCV_GET_DATA_TYPE_SIZE(no_8u_type)_ccv_get_data_type_size[((no_8u_type) & 0xFF000) >>
12]
;
373 if (b->step > 2048)
374 {
375 workspace = (unsigned char*)ccmallocmalloc(sizeof(ccv_cubic_integer_coeffs_t) * b->cols + bufstep * 4);
376 xofs = (ccv_cubic_integer_coeffs_t*)workspace;
377 buf = (unsigned char*)(workspace + sizeof(ccv_cubic_integer_coeffs_t) * b->cols);
378 } else {
379 xofs = (ccv_cubic_integer_coeffs_t*)alloca(sizeof(ccv_cubic_integer_coeffs_t) * b->cols)__builtin_alloca (sizeof(ccv_cubic_integer_coeffs_t) * b->
cols)
;
380 buf = (unsigned char*)alloca(bufstep * 4)__builtin_alloca (bufstep * 4);
381 }
382 double scale_x = (double)1 / cols_scale;
383 for (i = 0; i < b->cols; i++)
384 {
385 double sx = (i + 0.5) * scale_x - 0.5;
386 _ccv_init_cubic_integer_coeffs((int)sx, a->cols, (float)sx, xofs + i);
387 }
388 double scale_y = (double)1 / rows_scale;
389#ifdef __clang_analyzer__1
390 memset(buf, 0, bufstep * 4);
391#endif
392 unsigned char* a_ptr = a->data.u8;
393 unsigned char* b_ptr = b->data.u8;
394 int psi = -1, siy = 0;
395#define for_block(_for_get_a, _for_set, _for_get, _for_set_b) \
396 for (i = 0; i < b->rows; i++) \
397 { \
398 ccv_cubic_integer_coeffs_t yofs; \
399 double sy = (i + 0.5) * scale_y - 0.5; \
400 _ccv_init_cubic_integer_coeffs((int)sy, a->rows, (float)sy, &yofs); \
401 if (yofs.si[3] > psi) \
402 { \
403 for (; siy <= yofs.si[3]; siy++) \
404 { \
405 unsigned char* row = buf + (siy & 0x3) * bufstep; \
406 for (j = 0; j < b->cols; j++) \
407 for (k = 0; k < ch; k++) \
408 _for_set(row, j * ch + k, _for_get_a(a_ptr, xofs[j].si[0] * ch + k) * xofs[j].coeffs[0] + \
409 _for_get_a(a_ptr, xofs[j].si[1] * ch + k) * xofs[j].coeffs[1] + \
410 _for_get_a(a_ptr, xofs[j].si[2] * ch + k) * xofs[j].coeffs[2] + \
411 _for_get_a(a_ptr, xofs[j].si[3] * ch + k) * xofs[j].coeffs[3]); \
412 a_ptr += a->step; \
413 } \
414 psi = yofs.si[3]; \
415 } \
416 unsigned char* row[4] = { \
417 buf + (yofs.si[0] & 0x3) * bufstep, \
418 buf + (yofs.si[1] & 0x3) * bufstep, \
419 buf + (yofs.si[2] & 0x3) * bufstep, \
420 buf + (yofs.si[3] & 0x3) * bufstep, \
421 }; \
422 for (j = 0; j < b->cols * ch; j++) \
423 _for_set_b(b_ptr, j, ccv_descale(_for_get(row[0], j) * yofs.coeffs[0] + _for_get(row[1], j) * yofs.coeffs[1] + \(((_for_get(row[0], j) * yofs.coeffs[0] + _for_get(row[1], j)
* yofs.coeffs[1] + _for_get(row[2], j) * yofs.coeffs[2] + _for_get
(row[3], j) * yofs.coeffs[3]) + (1 << ((12) - 1))) >>
(12))
424 _for_get(row[2], j) * yofs.coeffs[2] + _for_get(row[3], j) * yofs.coeffs[3], 12)(((_for_get(row[0], j) * yofs.coeffs[0] + _for_get(row[1], j)
* yofs.coeffs[1] + _for_get(row[2], j) * yofs.coeffs[2] + _for_get
(row[3], j) * yofs.coeffs[3]) + (1 << ((12) - 1))) >>
(12))
); \
425 b_ptr += b->step; \
426 }
427 ccv_matrix_getter(a->type, ccv_matrix_setter_getter_integer_only, no_8u_type, ccv_matrix_setter_integer_only, b->type, for_block){ switch (((a->type) & 0xFF000)) { case CCV_32S: { { switch
(((no_8u_type) & 0xFF000)) { case CCV_32S: { { switch ((
(b->type) & 0xFF000)) { case CCV_32S: { for_block(_ccv_get_32s_value
, _ccv_set_32s_value, _ccv_get_32s_value, _ccv_set_32s_value)
; break; } case CCV_64S: { for_block(_ccv_get_32s_value, _ccv_set_32s_value
, _ccv_get_32s_value, _ccv_set_64s_value); break; } case CCV_8U
: { for_block(_ccv_get_32s_value, _ccv_set_32s_value, _ccv_get_32s_value
, _ccv_set_8u_value); break; } default: { ((void) sizeof (((b
->type & CCV_32S) || (b->type & CCV_64S) || (b->
type & CCV_8U)) ? 1 : 0), __extension__ ({ if ((b->type
& CCV_32S) || (b->type & CCV_64S) || (b->type &
CCV_8U)) ; else __assert_fail ("(b->type & CCV_32S) || (b->type & CCV_64S) || (b->type & CCV_8U)"
, "ccv_resample.c", 427, __extension__ __PRETTY_FUNCTION__); }
)); } } }; break; } case CCV_64S: { { switch (((b->type) &
0xFF000)) { case CCV_32S: { for_block(_ccv_get_32s_value, _ccv_set_64s_value
, _ccv_get_64s_value, _ccv_set_32s_value); break; } case CCV_64S
: { for_block(_ccv_get_32s_value, _ccv_set_64s_value, _ccv_get_64s_value
, _ccv_set_64s_value); break; } case CCV_8U: { for_block(_ccv_get_32s_value
, _ccv_set_64s_value, _ccv_get_64s_value, _ccv_set_8u_value);
break; } default: { ((void) sizeof (((b->type & CCV_32S
) || (b->type & CCV_64S) || (b->type & CCV_8U))
? 1 : 0), __extension__ ({ if ((b->type & CCV_32S) ||
(b->type & CCV_64S) || (b->type & CCV_8U)) ; else
__assert_fail ("(b->type & CCV_32S) || (b->type & CCV_64S) || (b->type & CCV_8U)"
, "ccv_resample.c", 427, __extension__ __PRETTY_FUNCTION__); }
)); } } }; break; } case CCV_8U: { { switch (((b->type) &
0xFF000)) { case CCV_32S: { for_block(_ccv_get_32s_value, _ccv_set_8u_value
, _ccv_get_8u_value, _ccv_set_32s_value); break; } case CCV_64S
: { for_block(_ccv_get_32s_value, _ccv_set_8u_value, _ccv_get_8u_value
, _ccv_set_64s_value); break; } case CCV_8U: { for_block(_ccv_get_32s_value
, _ccv_set_8u_value, _ccv_get_8u_value, _ccv_set_8u_value); break
; } default: { ((void) sizeof (((b->type & CCV_32S) ||
(b->type & CCV_64S) || (b->type & CCV_8U)) ? 1
: 0), __extension__ ({ if ((b->type & CCV_32S) || (b->
type & CCV_64S) || (b->type & CCV_8U)) ; else __assert_fail
("(b->type & CCV_32S) || (b->type & CCV_64S) || (b->type & CCV_8U)"
, "ccv_resample.c", 427, __extension__ __PRETTY_FUNCTION__); }
)); } } }; break; } default: { ((void) sizeof (((no_8u_type &
CCV_32S) || (no_8u_type & CCV_64S) || (no_8u_type & CCV_8U
)) ? 1 : 0), __extension__ ({ if ((no_8u_type & CCV_32S) ||
(no_8u_type & CCV_64S) || (no_8u_type & CCV_8U)) ; else
__assert_fail ("(no_8u_type & CCV_32S) || (no_8u_type & CCV_64S) || (no_8u_type & CCV_8U)"
, "ccv_resample.c", 427, __extension__ __PRETTY_FUNCTION__); }
)); } } }; break; } case CCV_32F: { { switch (((no_8u_type) &
0xFF000)) { case CCV_32S: { { switch (((b->type) & 0xFF000
)) { case CCV_32S: { for_block(_ccv_get_32f_value, _ccv_set_32s_value
, _ccv_get_32s_value, _ccv_set_32s_value); break; } case CCV_64S
: { for_block(_ccv_get_32f_value, _ccv_set_32s_value, _ccv_get_32s_value
, _ccv_set_64s_value); break; } case CCV_8U: { for_block(_ccv_get_32f_value
, _ccv_set_32s_value, _ccv_get_32s_value, _ccv_set_8u_value);
break; } default: { ((void) sizeof (((b->type & CCV_32S
) || (b->type & CCV_64S) || (b->type & CCV_8U))
? 1 : 0), __extension__ ({ if ((b->type & CCV_32S) ||
(b->type & CCV_64S) || (b->type & CCV_8U)) ; else
__assert_fail ("(b->type & CCV_32S) || (b->type & CCV_64S) || (b->type & CCV_8U)"
, "ccv_resample.c", 427, __extension__ __PRETTY_FUNCTION__); }
)); } } }; break; } case CCV_64S: { { switch (((b->type) &
0xFF000)) { case CCV_32S: { for_block(_ccv_get_32f_value, _ccv_set_64s_value
, _ccv_get_64s_value, _ccv_set_32s_value); break; } case CCV_64S
: { for_block(_ccv_get_32f_value, _ccv_set_64s_value, _ccv_get_64s_value
, _ccv_set_64s_value); break; } case CCV_8U: { for_block(_ccv_get_32f_value
, _ccv_set_64s_value, _ccv_get_64s_value, _ccv_set_8u_value);
break; } default: { ((void) sizeof (((b->type & CCV_32S
) || (b->type & CCV_64S) || (b->type & CCV_8U))
? 1 : 0), __extension__ ({ if ((b->type & CCV_32S) ||
(b->type & CCV_64S) || (b->type & CCV_8U)) ; else
__assert_fail ("(b->type & CCV_32S) || (b->type & CCV_64S) || (b->type & CCV_8U)"
, "ccv_resample.c", 427, __extension__ __PRETTY_FUNCTION__); }
)); } } }; break; } case CCV_8U: { { switch (((b->type) &
0xFF000)) { case CCV_32S: { for_block(_ccv_get_32f_value, _ccv_set_8u_value
, _ccv_get_8u_value, _ccv_set_32s_value); break; } case CCV_64S
: { for_block(_ccv_get_32f_value, _ccv_set_8u_value, _ccv_get_8u_value
, _ccv_set_64s_value); break; } case CCV_8U: { for_block(_ccv_get_32f_value
, _ccv_set_8u_value, _ccv_get_8u_value, _ccv_set_8u_value); break
; } default: { ((void) sizeof (((b->type & CCV_32S) ||
(b->type & CCV_64S) || (b->type & CCV_8U)) ? 1
: 0), __extension__ ({ if ((b->type & CCV_32S) || (b->
type & CCV_64S) || (b->type & CCV_8U)) ; else __assert_fail
("(b->type & CCV_32S) || (b->type & CCV_64S) || (b->type & CCV_8U)"
, "ccv_resample.c", 427, __extension__ __PRETTY_FUNCTION__); }
)); } } }; break; } default: { ((void) sizeof (((no_8u_type &
CCV_32S) || (no_8u_type & CCV_64S) || (no_8u_type & CCV_8U
)) ? 1 : 0), __extension__ ({ if ((no_8u_type & CCV_32S) ||
(no_8u_type & CCV_64S) || (no_8u_type & CCV_8U)) ; else
__assert_fail ("(no_8u_type & CCV_32S) || (no_8u_type & CCV_64S) || (no_8u_type & CCV_8U)"
, "ccv_resample.c", 427, __extension__ __PRETTY_FUNCTION__); }
)); } } }; break; } case CCV_64S: { { switch (((no_8u_type) &
0xFF000)) { case CCV_32S: { { switch (((b->type) & 0xFF000
)) { case CCV_32S: { for_block(_ccv_get_64s_value, _ccv_set_32s_value
, _ccv_get_32s_value, _ccv_set_32s_value); break; } case CCV_64S
: { for_block(_ccv_get_64s_value, _ccv_set_32s_value, _ccv_get_32s_value
, _ccv_set_64s_value); break; } case CCV_8U: { for_block(_ccv_get_64s_value
, _ccv_set_32s_value, _ccv_get_32s_value, _ccv_set_8u_value);
break; } default: { ((void) sizeof (((b->type & CCV_32S
) || (b->type & CCV_64S) || (b->type & CCV_8U))
? 1 : 0), __extension__ ({ if ((b->type & CCV_32S) ||
(b->type & CCV_64S) || (b->type & CCV_8U)) ; else
__assert_fail ("(b->type & CCV_32S) || (b->type & CCV_64S) || (b->type & CCV_8U)"
, "ccv_resample.c", 427, __extension__ __PRETTY_FUNCTION__); }
)); } } }; break; } case CCV_64S: { { switch (((b->type) &
0xFF000)) { case CCV_32S: { for_block(_ccv_get_64s_value, _ccv_set_64s_value
, _ccv_get_64s_value, _ccv_set_32s_value); break; } case CCV_64S
: { for_block(_ccv_get_64s_value, _ccv_set_64s_value, _ccv_get_64s_value
, _ccv_set_64s_value); break; } case CCV_8U: { for_block(_ccv_get_64s_value
, _ccv_set_64s_value, _ccv_get_64s_value, _ccv_set_8u_value);
break; } default: { ((void) sizeof (((b->type & CCV_32S
) || (b->type & CCV_64S) || (b->type & CCV_8U))
? 1 : 0), __extension__ ({ if ((b->type & CCV_32S) ||
(b->type & CCV_64S) || (b->type & CCV_8U)) ; else
__assert_fail ("(b->type & CCV_32S) || (b->type & CCV_64S) || (b->type & CCV_8U)"
, "ccv_resample.c", 427, __extension__ __PRETTY_FUNCTION__); }
)); } } }; break; } case CCV_8U: { { switch (((b->type) &
0xFF000)) { case CCV_32S: { for_block(_ccv_get_64s_value, _ccv_set_8u_value
, _ccv_get_8u_value, _ccv_set_32s_value); break; } case CCV_64S
: { for_block(_ccv_get_64s_value, _ccv_set_8u_value, _ccv_get_8u_value
, _ccv_set_64s_value); break; } case CCV_8U: { for_block(_ccv_get_64s_value
, _ccv_set_8u_value, _ccv_get_8u_value, _ccv_set_8u_value); break
; } default: { ((void) sizeof (((b->type & CCV_32S) ||
(b->type & CCV_64S) || (b->type & CCV_8U)) ? 1
: 0), __extension__ ({ if ((b->type & CCV_32S) || (b->
type & CCV_64S) || (b->type & CCV_8U)) ; else __assert_fail
("(b->type & CCV_32S) || (b->type & CCV_64S) || (b->type & CCV_8U)"
, "ccv_resample.c", 427, __extension__ __PRETTY_FUNCTION__); }
)); } } }; break; } default: { ((void) sizeof (((no_8u_type &
CCV_32S) || (no_8u_type & CCV_64S) || (no_8u_type & CCV_8U
)) ? 1 : 0), __extension__ ({ if ((no_8u_type & CCV_32S) ||
(no_8u_type & CCV_64S) || (no_8u_type & CCV_8U)) ; else
__assert_fail ("(no_8u_type & CCV_32S) || (no_8u_type & CCV_64S) || (no_8u_type & CCV_8U)"
, "ccv_resample.c", 427, __extension__ __PRETTY_FUNCTION__); }
)); } } }; break; } case CCV_64F: { { switch (((no_8u_type) &
0xFF000)) { case CCV_32S: { { switch (((b->type) & 0xFF000
)) { case CCV_32S: { for_block(_ccv_get_64f_value, _ccv_set_32s_value
, _ccv_get_32s_value, _ccv_set_32s_value); break; } case CCV_64S
: { for_block(_ccv_get_64f_value, _ccv_set_32s_value, _ccv_get_32s_value
, _ccv_set_64s_value); break; } case CCV_8U: { for_block(_ccv_get_64f_value
, _ccv_set_32s_value, _ccv_get_32s_value, _ccv_set_8u_value);
break; } default: { ((void) sizeof (((b->type & CCV_32S
) || (b->type & CCV_64S) || (b->type & CCV_8U))
? 1 : 0), __extension__ ({ if ((b->type & CCV_32S) ||
(b->type & CCV_64S) || (b->type & CCV_8U)) ; else
__assert_fail ("(b->type & CCV_32S) || (b->type & CCV_64S) || (b->type & CCV_8U)"
, "ccv_resample.c", 427, __extension__ __PRETTY_FUNCTION__); }
)); } } }; break; } case CCV_64S: { { switch (((b->type) &
0xFF000)) { case CCV_32S: { for_block(_ccv_get_64f_value, _ccv_set_64s_value
, _ccv_get_64s_value, _ccv_set_32s_value); break; } case CCV_64S
: { for_block(_ccv_get_64f_value, _ccv_set_64s_value, _ccv_get_64s_value
, _ccv_set_64s_value); break; } case CCV_8U: { for_block(_ccv_get_64f_value
, _ccv_set_64s_value, _ccv_get_64s_value, _ccv_set_8u_value);
break; } default: { ((void) sizeof (((b->type & CCV_32S
) || (b->type & CCV_64S) || (b->type & CCV_8U))
? 1 : 0), __extension__ ({ if ((b->type & CCV_32S) ||
(b->type & CCV_64S) || (b->type & CCV_8U)) ; else
__assert_fail ("(b->type & CCV_32S) || (b->type & CCV_64S) || (b->type & CCV_8U)"
, "ccv_resample.c", 427, __extension__ __PRETTY_FUNCTION__); }
)); } } }; break; } case CCV_8U: { { switch (((b->type) &
0xFF000)) { case CCV_32S: { for_block(_ccv_get_64f_value, _ccv_set_8u_value
, _ccv_get_8u_value, _ccv_set_32s_value); break; } case CCV_64S
: { for_block(_ccv_get_64f_value, _ccv_set_8u_value, _ccv_get_8u_value
, _ccv_set_64s_value); break; } case CCV_8U: { for_block(_ccv_get_64f_value
, _ccv_set_8u_value, _ccv_get_8u_value, _ccv_set_8u_value); break
; } default: { ((void) sizeof (((b->type & CCV_32S) ||
(b->type & CCV_64S) || (b->type & CCV_8U)) ? 1
: 0), __extension__ ({ if ((b->type & CCV_32S) || (b->
type & CCV_64S) || (b->type & CCV_8U)) ; else __assert_fail
("(b->type & CCV_32S) || (b->type & CCV_64S) || (b->type & CCV_8U)"
, "ccv_resample.c", 427, __extension__ __PRETTY_FUNCTION__); }
)); } } }; break; } default: { ((void) sizeof (((no_8u_type &
CCV_32S) || (no_8u_type & CCV_64S) || (no_8u_type & CCV_8U
)) ? 1 : 0), __extension__ ({ if ((no_8u_type & CCV_32S) ||
(no_8u_type & CCV_64S) || (no_8u_type & CCV_8U)) ; else
__assert_fail ("(no_8u_type & CCV_32S) || (no_8u_type & CCV_64S) || (no_8u_type & CCV_8U)"
, "ccv_resample.c", 427, __extension__ __PRETTY_FUNCTION__); }
)); } } }; break; } default: { { switch (((no_8u_type) & 0xFF000
)) { case CCV_32S: { { switch (((b->type) & 0xFF000)) {
case CCV_32S: { for_block(_ccv_get_8u_value, _ccv_set_32s_value
, _ccv_get_32s_value, _ccv_set_32s_value); break; } case CCV_64S
: { for_block(_ccv_get_8u_value, _ccv_set_32s_value, _ccv_get_32s_value
, _ccv_set_64s_value); break; } case CCV_8U: { for_block(_ccv_get_8u_value
, _ccv_set_32s_value, _ccv_get_32s_value, _ccv_set_8u_value);
break; } default: { ((void) sizeof (((b->type & CCV_32S
) || (b->type & CCV_64S) || (b->type & CCV_8U))
? 1 : 0), __extension__ ({ if ((b->type & CCV_32S) ||
(b->type & CCV_64S) || (b->type & CCV_8U)) ; else
__assert_fail ("(b->type & CCV_32S) || (b->type & CCV_64S) || (b->type & CCV_8U)"
, "ccv_resample.c", 427, __extension__ __PRETTY_FUNCTION__); }
)); } } }; break; } case CCV_64S: { { switch (((b->type) &
0xFF000)) { case CCV_32S: { for_block(_ccv_get_8u_value, _ccv_set_64s_value
, _ccv_get_64s_value, _ccv_set_32s_value); break; } case CCV_64S
: { for_block(_ccv_get_8u_value, _ccv_set_64s_value, _ccv_get_64s_value
, _ccv_set_64s_value); break; } case CCV_8U: { for_block(_ccv_get_8u_value
, _ccv_set_64s_value, _ccv_get_64s_value, _ccv_set_8u_value);
break; } default: { ((void) sizeof (((b->type & CCV_32S
) || (b->type & CCV_64S) || (b->type & CCV_8U))
? 1 : 0), __extension__ ({ if ((b->type & CCV_32S) ||
(b->type & CCV_64S) || (b->type & CCV_8U)) ; else
__assert_fail ("(b->type & CCV_32S) || (b->type & CCV_64S) || (b->type & CCV_8U)"
, "ccv_resample.c", 427, __extension__ __PRETTY_FUNCTION__); }
)); } } }; break; } case CCV_8U: { { switch (((b->type) &
0xFF000)) { case CCV_32S: { for_block(_ccv_get_8u_value, _ccv_set_8u_value
, _ccv_get_8u_value, _ccv_set_32s_value); break; } case CCV_64S
: { for_block(_ccv_get_8u_value, _ccv_set_8u_value, _ccv_get_8u_value
, _ccv_set_64s_value); break; } case CCV_8U: { for_block(_ccv_get_8u_value
, _ccv_set_8u_value, _ccv_get_8u_value, _ccv_set_8u_value); break
; } default: { ((void) sizeof (((b->type & CCV_32S) ||
(b->type & CCV_64S) || (b->type & CCV_8U)) ? 1
: 0), __extension__ ({ if ((b->type & CCV_32S) || (b->
type & CCV_64S) || (b->type & CCV_8U)) ; else __assert_fail
("(b->type & CCV_32S) || (b->type & CCV_64S) || (b->type & CCV_8U)"
, "ccv_resample.c", 427, __extension__ __PRETTY_FUNCTION__); }
)); } } }; break; } default: { ((void) sizeof (((no_8u_type &
CCV_32S) || (no_8u_type & CCV_64S) || (no_8u_type & CCV_8U
)) ? 1 : 0), __extension__ ({ if ((no_8u_type & CCV_32S) ||
(no_8u_type & CCV_64S) || (no_8u_type & CCV_8U)) ; else
__assert_fail ("(no_8u_type & CCV_32S) || (no_8u_type & CCV_64S) || (no_8u_type & CCV_8U)"
, "ccv_resample.c", 427, __extension__ __PRETTY_FUNCTION__); }
)); } } }; } } }
;
428#undef for_block
429 if (workspace)
430 ccfreefree(workspace);
431}
432
433void ccv_resample(ccv_dense_matrix_t* a, ccv_dense_matrix_t** b, int btype, double rows_scale, double cols_scale, int type)
434{
435 assert(rows_scale > 0 && cols_scale > 0)((void) sizeof ((rows_scale > 0 && cols_scale >
0) ? 1 : 0), __extension__ ({ if (rows_scale > 0 &&
cols_scale > 0) ; else __assert_fail ("rows_scale > 0 && cols_scale > 0"
, "ccv_resample.c", 435, __extension__ __PRETTY_FUNCTION__); }
))
;
436 ccv_declare_derived_signature(sig, a->sig != 0, ccv_sign_with_format(64, "ccv_resample(%f,%f,%d)", rows_scale, cols_scale, type), a->sig, CCV_EOF_SIGN)char _ccv_identifier_436[(64)]; memset(_ccv_identifier_436, 0
, (64)); snprintf(_ccv_identifier_436, (64), ("ccv_resample(%f,%f,%d)"
), rows_scale, cols_scale, type); size_t _ccv_string_size_436
= (64);; uint64_t sig = (a->sig != 0) ? ccv_cache_generate_signature
(_ccv_identifier_436, _ccv_string_size_436, a->sig, ((uint64_t
)0)) : 0;
;
437 btype = (btype == 0) ? CCV_GET_DATA_TYPE(a->type)((a->type) & 0xFF000) | CCV_GET_CHANNEL(a->type)((a->type) & 0xFFF) : CCV_GET_DATA_TYPE(btype)((btype) & 0xFF000) | CCV_GET_CHANNEL(a->type)((a->type) & 0xFFF);
438 int rows, cols;
439 if (*b)
440 {
441 rows = (*b)->rows;
442 cols = (*b)->cols;
443 } else {
444 rows = (int)(a->rows * rows_scale + 0.5);
445 cols = (int)(a->cols * cols_scale + 0.5);
446 }
447 ccv_dense_matrix_t* db = *b = ccv_dense_matrix_renew(*b, rows, cols, CCV_ALL_DATA_TYPE(CCV_8U | CCV_32S | CCV_32F | CCV_64S | CCV_64F | CCV_16F | CCV_QX
)
| CCV_GET_CHANNEL(a->type)((a->type) & 0xFFF), btype, sig);
448 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 ; } }
;
449 if (a->rows == db->rows && a->cols == db->cols)
450 {
451 if (CCV_GET_CHANNEL(a->type)((a->type) & 0xFFF) == CCV_GET_CHANNEL(db->type)((db->type) & 0xFFF) && CCV_GET_DATA_TYPE(db->type)((db->type) & 0xFF000) == CCV_GET_DATA_TYPE(a->type)((a->type) & 0xFF000))
452 memcpy(db->data.u8, a->data.u8, a->rows * a->step);
453 else {
454 ccv_shift(a, (ccv_matrix_t**)&db, 0, 0, 0);
455 }
456 return;
457 }
458 if ((type & CCV_INTER_AREA) && a->rows >= db->rows && a->cols >= db->cols)
459 {
460 /* using the fast alternative (fix point scale, 0x100 to avoid overflow) */
461 if (CCV_GET_DATA_TYPE(a->type)((a->type) & 0xFF000) == CCV_8U && CCV_GET_DATA_TYPE(db->type)((db->type) & 0xFF000) == CCV_8U && a->rows * a->cols / (db->rows * db->cols) < 0x100)
462 _ccv_resample_area_8u(a, db, rows_scale, cols_scale);
463 else
464 _ccv_resample_area(a, db, rows_scale, cols_scale);
465 } else if (type & CCV_INTER_CUBIC) {
466 if (CCV_GET_DATA_TYPE(db->type)((db->type) & 0xFF000) == CCV_32F || CCV_GET_DATA_TYPE(db->type)((db->type) & 0xFF000) == CCV_64F)
467 _ccv_resample_cubic_float_only(a, db, rows_scale, cols_scale);
468 else
469 _ccv_resample_cubic_integer_only(a, db, rows_scale, cols_scale);
470 } else if (type & CCV_INTER_LINEAR) {
471 assert(0 && "CCV_INTER_LINEAR is not implemented")((void) sizeof ((0 && "CCV_INTER_LINEAR is not implemented"
) ? 1 : 0), __extension__ ({ if (0 && "CCV_INTER_LINEAR is not implemented"
) ; else __assert_fail ("0 && \"CCV_INTER_LINEAR is not implemented\""
, "ccv_resample.c", 471, __extension__ __PRETTY_FUNCTION__); }
))
;
472 } else if (type & CCV_INTER_LANCZOS) {
473 assert(0 && "CCV_INTER_LANCZOS is not implemented")((void) sizeof ((0 && "CCV_INTER_LANCZOS is not implemented"
) ? 1 : 0), __extension__ ({ if (0 && "CCV_INTER_LANCZOS is not implemented"
) ; else __assert_fail ("0 && \"CCV_INTER_LANCZOS is not implemented\""
, "ccv_resample.c", 473, __extension__ __PRETTY_FUNCTION__); }
))
;
474 } else {
475 assert(0 && "Not implemented")((void) sizeof ((0 && "Not implemented") ? 1 : 0), __extension__
({ if (0 && "Not implemented") ; else __assert_fail (
"0 && \"Not implemented\"", "ccv_resample.c", 475, __extension__
__PRETTY_FUNCTION__); }))
;
476 }
477}
478
479/* the following code is adopted from OpenCV cvPyrDown */
480void ccv_sample_down(ccv_dense_matrix_t* a, ccv_dense_matrix_t** b, int type, int src_x, int src_y)
481{
482 assert(src_x >= 0 && src_y >= 0)((void) sizeof ((src_x >= 0 && src_y >= 0) ? 1 :
0), __extension__ ({ if (src_x >= 0 && src_y >=
0) ; else __assert_fail ("src_x >= 0 && src_y >= 0"
, "ccv_resample.c", 482, __extension__ __PRETTY_FUNCTION__); }
))
;
483 ccv_declare_derived_signature(sig, a->sig != 0, ccv_sign_with_format(64, "ccv_sample_down(%d,%d)", src_x, src_y), a->sig, CCV_EOF_SIGN)char _ccv_identifier_483[(64)]; memset(_ccv_identifier_483, 0
, (64)); snprintf(_ccv_identifier_483, (64), ("ccv_sample_down(%d,%d)"
), src_x, src_y); size_t _ccv_string_size_483 = (64);; uint64_t
sig = (a->sig != 0) ? ccv_cache_generate_signature(_ccv_identifier_483
, _ccv_string_size_483, a->sig, ((uint64_t)0)) : 0;
;
484 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);
485 ccv_dense_matrix_t* db = *b = ccv_dense_matrix_renew(*b, a->rows / 2, a->cols / 2, CCV_ALL_DATA_TYPE(CCV_8U | CCV_32S | CCV_32F | CCV_64S | CCV_64F | CCV_16F | CCV_QX
)
| CCV_GET_CHANNEL(a->type)((a->type) & 0xFFF), type, sig);
486 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 ; } }
;
487 int ch = CCV_GET_CHANNEL(a->type)((a->type) & 0xFFF);
488 int cols0 = db->cols - 1 - src_x;
489 int dy, sy = -2 + src_y, sx = src_x * ch, dx, k;
490 unsigned char* workspace = 0;
491 int* tab;
492 unsigned char* buf;
493 if (a->cols + src_x + 2 > 1024 || db->cols * ch > 1024)
494 {
495 workspace = (unsigned char*)ccmallocmalloc((a->cols + src_x + 2) * ch * sizeof(int) + 5 * db->cols * ch * ccv_max(CCV_GET_DATA_TYPE_SIZE(db->type), sizeof(int))({ typeof (_ccv_get_data_type_size[((db->type) & 0xFF000
) >> 12]) _a = (_ccv_get_data_type_size[((db->type) &
0xFF000) >> 12]); typeof (sizeof(int)) _b = (sizeof(int
)); (_a > _b) ? _a : _b; })
);
496 tab = (int*)workspace;
497 buf = (unsigned char*)(workspace + (a->cols + src_x + 2) * ch * sizeof(int));
498 } else {
499 tab = (int*)alloca((a->cols + src_x + 2) * ch * sizeof(int))__builtin_alloca ((a->cols + src_x + 2) * ch * sizeof(int)
)
;
500 buf = (unsigned char*)alloca(5 * db->cols * ch * ccv_max(CCV_GET_DATA_TYPE_SIZE(db->type), sizeof(int)))__builtin_alloca (5 * db->cols * ch * ({ typeof (_ccv_get_data_type_size
[((db->type) & 0xFF000) >> 12]) _a = (_ccv_get_data_type_size
[((db->type) & 0xFF000) >> 12]); typeof (sizeof(
int)) _b = (sizeof(int)); (_a > _b) ? _a : _b; }))
;
501 }
502 for (dx = 0; dx < a->cols + src_x + 2; dx++)
503 for (k = 0; k < ch; k++)
504 tab[dx * ch + k] = ((dx >= a->cols) ? a->cols * 2 - 1 - dx : dx) * ch + k;
505 int bufstep = db->cols * ch * ccv_max(CCV_GET_DATA_TYPE_SIZE(db->type), sizeof(int))({ typeof (_ccv_get_data_type_size[((db->type) & 0xFF000
) >> 12]) _a = (_ccv_get_data_type_size[((db->type) &
0xFF000) >> 12]); typeof (sizeof(int)) _b = (sizeof(int
)); (_a > _b) ? _a : _b; })
;
506#ifdef __clang_analyzer__1
507 memset(buf, 0, 5 * bufstep);
508#endif
509 unsigned char* b_ptr = db->data.u8;
510 /* why is src_y * 4 in computing the offset of row?
511 * Essentially, it means sy - src_y but in a manner that doesn't result negative number.
512 * notice that we added src_y before when computing sy in the first place, however,
513 * it is not desirable to have that offset when we try to wrap it into our 5-row buffer (
514 * because in later rearrangement, we have no src_y to backup the arrangement). In
515 * such micro scope, we managed to stripe 5 addition into one shift and addition. */
516#define for_block(_for_get_a, _for_set, _for_get, _for_set_b) \
517 for (dy = 0; dy < db->rows; dy++) \
518 { \
519 for(; sy <= dy * 2 + 2 + src_y; sy++) \
520 { \
521 unsigned char* row = buf + ((sy + src_y * 4 + 2) % 5) * bufstep; \
522 int _sy = (sy < 0) ? -1 - sy : (sy >= a->rows) ? a->rows * 2 - 1 - sy : sy; \
523 unsigned char* a_ptr = a->data.u8 + a->step * _sy; \
524 for (k = 0; k < ch; k++) \
525 _for_set(row, k, _for_get_a(a_ptr, sx + k) * 10 + _for_get_a(a_ptr, ch + sx + k) * 5 + _for_get_a(a_ptr, 2 * ch + sx + k)); \
526 for(dx = ch; dx < cols0 * ch; dx += ch) \
527 for (k = 0; k < ch; k++) \
528 _for_set(row, dx + k, _for_get_a(a_ptr, dx * 2 + sx + k) * 6 + (_for_get_a(a_ptr, dx * 2 + sx + k - ch) + _for_get_a(a_ptr, dx * 2 + sx + k + ch)) * 4 + _for_get_a(a_ptr, dx * 2 + sx + k - ch * 2) + _for_get_a(a_ptr, dx * 2 + sx + k + ch * 2)); \
529 x_block(_for_get_a, _for_set, _for_get, _for_set_b); \
530 } \
531 unsigned char* rows[5]; \
532 for(k = 0; k < 5; k++) \
533 rows[k] = buf + ((dy * 2 + k) % 5) * bufstep; \
534 for(dx = 0; dx < db->cols * ch; dx++) \
535 _for_set_b(b_ptr, dx, (_for_get(rows[2], dx) * 6 + (_for_get(rows[1], dx) + _for_get(rows[3], dx)) * 4 + _for_get(rows[0], dx) + _for_get(rows[4], dx)) / 256); \
536 b_ptr += db->step; \
537 }
538 int no_8u_type = (a->type & CCV_8U) ? CCV_32S : a->type;
539 if (src_x > 0)
540 {
541#define x_block(_for_get_a, _for_set, _for_get, _for_set_b) \
542 for (dx = cols0 * ch; dx < db->cols * ch; dx += ch) \
543 for (k = 0; k < ch; k++) \
544 _for_set(row, dx + k, _for_get_a(a_ptr, tab[dx * 2 + sx + k]) * 6 + (_for_get_a(a_ptr, tab[dx * 2 + sx + k - ch]) + _for_get_a(a_ptr, tab[dx * 2 + sx + k + ch])) * 4 + _for_get_a(a_ptr, tab[dx * 2 + sx + k - ch * 2]) + _for_get_a(a_ptr, tab[dx * 2 + sx + k + ch * 2]));
545 ccv_matrix_getter_a(a->type, ccv_matrix_setter_getter, no_8u_type, ccv_matrix_setter_b, db->type, for_block){ switch (((a->type) & 0xFF000)) { case CCV_32S: { { switch
(((no_8u_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, _ccv_set_32s_value)
; break; } case CCV_32F: { for_block(_ccv_get_32s_value, _ccv_set_32s_value
, _ccv_get_32s_value, _ccv_set_32f_value); break; } case CCV_64S
: { for_block(_ccv_get_32s_value, _ccv_set_32s_value, _ccv_get_32s_value
, _ccv_set_64s_value); break; } case CCV_64F: { for_block(_ccv_get_32s_value
, _ccv_set_32s_value, _ccv_get_32s_value, _ccv_set_64f_value)
; break; } default: { for_block(_ccv_get_32s_value, _ccv_set_32s_value
, _ccv_get_32s_value, _ccv_set_8u_value); } } }; break; } case
CCV_32F: { { switch (((db->type) & 0xFF000)) { case CCV_32S
: { for_block(_ccv_get_32s_value, _ccv_set_32f_value, _ccv_get_32f_value
, _ccv_set_32s_value); break; } case CCV_32F: { for_block(_ccv_get_32s_value
, _ccv_set_32f_value, _ccv_get_32f_value, _ccv_set_32f_value)
; break; } case CCV_64S: { for_block(_ccv_get_32s_value, _ccv_set_32f_value
, _ccv_get_32f_value, _ccv_set_64s_value); break; } case CCV_64F
: { for_block(_ccv_get_32s_value, _ccv_set_32f_value, _ccv_get_32f_value
, _ccv_set_64f_value); break; } default: { for_block(_ccv_get_32s_value
, _ccv_set_32f_value, _ccv_get_32f_value, _ccv_set_8u_value);
} } }; break; } case CCV_64S: { { switch (((db->type) &
0xFF000)) { case CCV_32S: { for_block(_ccv_get_32s_value, _ccv_set_64s_value
, _ccv_get_64s_value, _ccv_set_32s_value); break; } case CCV_32F
: { for_block(_ccv_get_32s_value, _ccv_set_64s_value, _ccv_get_64s_value
, _ccv_set_32f_value); break; } case CCV_64S: { for_block(_ccv_get_32s_value
, _ccv_set_64s_value, _ccv_get_64s_value, _ccv_set_64s_value)
; break; } case CCV_64F: { for_block(_ccv_get_32s_value, _ccv_set_64s_value
, _ccv_get_64s_value, _ccv_set_64f_value); break; } default: {
for_block(_ccv_get_32s_value, _ccv_set_64s_value, _ccv_get_64s_value
, _ccv_set_8u_value); } } }; break; } case CCV_64F: { { switch
(((db->type) & 0xFF000)) { case CCV_32S: { for_block(
_ccv_get_32s_value, _ccv_set_64f_value, _ccv_get_64f_value, _ccv_set_32s_value
); break; } case CCV_32F: { for_block(_ccv_get_32s_value, _ccv_set_64f_value
, _ccv_get_64f_value, _ccv_set_32f_value); break; } case CCV_64S
: { for_block(_ccv_get_32s_value, _ccv_set_64f_value, _ccv_get_64f_value
, _ccv_set_64s_value); break; } case CCV_64F: { for_block(_ccv_get_32s_value
, _ccv_set_64f_value, _ccv_get_64f_value, _ccv_set_64f_value)
; break; } default: { for_block(_ccv_get_32s_value, _ccv_set_64f_value
, _ccv_get_64f_value, _ccv_set_8u_value); } } }; break; } default
: { { switch (((db->type) & 0xFF000)) { case CCV_32S: {
for_block(_ccv_get_32s_value, _ccv_set_8u_value, _ccv_get_8u_value
, _ccv_set_32s_value); break; } case CCV_32F: { for_block(_ccv_get_32s_value
, _ccv_set_8u_value, _ccv_get_8u_value, _ccv_set_32f_value); break
; } case CCV_64S: { for_block(_ccv_get_32s_value, _ccv_set_8u_value
, _ccv_get_8u_value, _ccv_set_64s_value); break; } case CCV_64F
: { for_block(_ccv_get_32s_value, _ccv_set_8u_value, _ccv_get_8u_value
, _ccv_set_64f_value); break; } default: { for_block(_ccv_get_32s_value
, _ccv_set_8u_value, _ccv_get_8u_value, _ccv_set_8u_value); }
} }; } } }; break; } case CCV_32F: { { switch (((no_8u_type)
& 0xFF000)) { case CCV_32S: { { switch (((db->type) &
0xFF000)) { case CCV_32S: { for_block(_ccv_get_32f_value, _ccv_set_32s_value
, _ccv_get_32s_value, _ccv_set_32s_value); break; } case CCV_32F
: { for_block(_ccv_get_32f_value, _ccv_set_32s_value, _ccv_get_32s_value
, _ccv_set_32f_value); break; } case CCV_64S: { for_block(_ccv_get_32f_value
, _ccv_set_32s_value, _ccv_get_32s_value, _ccv_set_64s_value)
; break; } case CCV_64F: { for_block(_ccv_get_32f_value, _ccv_set_32s_value
, _ccv_get_32s_value, _ccv_set_64f_value); break; } default: {
for_block(_ccv_get_32f_value, _ccv_set_32s_value, _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_32f_value, _ccv_get_32f_value, _ccv_set_32s_value
); break; } case CCV_32F: { for_block(_ccv_get_32f_value, _ccv_set_32f_value
, _ccv_get_32f_value, _ccv_set_32f_value); break; } case CCV_64S
: { for_block(_ccv_get_32f_value, _ccv_set_32f_value, _ccv_get_32f_value
, _ccv_set_64s_value); break; } case CCV_64F: { for_block(_ccv_get_32f_value
, _ccv_set_32f_value, _ccv_get_32f_value, _ccv_set_64f_value)
; break; } default: { for_block(_ccv_get_32f_value, _ccv_set_32f_value
, _ccv_get_32f_value, _ccv_set_8u_value); } } }; break; } case
CCV_64S: { { switch (((db->type) & 0xFF000)) { case CCV_32S
: { for_block(_ccv_get_32f_value, _ccv_set_64s_value, _ccv_get_64s_value
, _ccv_set_32s_value); break; } case CCV_32F: { for_block(_ccv_get_32f_value
, _ccv_set_64s_value, _ccv_get_64s_value, _ccv_set_32f_value)
; break; } case CCV_64S: { for_block(_ccv_get_32f_value, _ccv_set_64s_value
, _ccv_get_64s_value, _ccv_set_64s_value); break; } case CCV_64F
: { for_block(_ccv_get_32f_value, _ccv_set_64s_value, _ccv_get_64s_value
, _ccv_set_64f_value); break; } default: { for_block(_ccv_get_32f_value
, _ccv_set_64s_value, _ccv_get_64s_value, _ccv_set_8u_value);
} } }; break; } case CCV_64F: { { switch (((db->type) &
0xFF000)) { case CCV_32S: { for_block(_ccv_get_32f_value, _ccv_set_64f_value
, _ccv_get_64f_value, _ccv_set_32s_value); break; } case CCV_32F
: { for_block(_ccv_get_32f_value, _ccv_set_64f_value, _ccv_get_64f_value
, _ccv_set_32f_value); break; } case CCV_64S: { for_block(_ccv_get_32f_value
, _ccv_set_64f_value, _ccv_get_64f_value, _ccv_set_64s_value)
; break; } case CCV_64F: { for_block(_ccv_get_32f_value, _ccv_set_64f_value
, _ccv_get_64f_value, _ccv_set_64f_value); break; } default: {
for_block(_ccv_get_32f_value, _ccv_set_64f_value, _ccv_get_64f_value
, _ccv_set_8u_value); } } }; break; } default: { { switch (((
db->type) & 0xFF000)) { case CCV_32S: { for_block(_ccv_get_32f_value
, _ccv_set_8u_value, _ccv_get_8u_value, _ccv_set_32s_value); break
; } case CCV_32F: { for_block(_ccv_get_32f_value, _ccv_set_8u_value
, _ccv_get_8u_value, _ccv_set_32f_value); break; } case CCV_64S
: { for_block(_ccv_get_32f_value, _ccv_set_8u_value, _ccv_get_8u_value
, _ccv_set_64s_value); break; } case CCV_64F: { for_block(_ccv_get_32f_value
, _ccv_set_8u_value, _ccv_get_8u_value, _ccv_set_64f_value); break
; } default: { for_block(_ccv_get_32f_value, _ccv_set_8u_value
, _ccv_get_8u_value, _ccv_set_8u_value); } } }; } } }; break;
} case CCV_64S: { { switch (((no_8u_type) & 0xFF000)) { case
CCV_32S: { { switch (((db->type) & 0xFF000)) { case CCV_32S
: { for_block(_ccv_get_64s_value, _ccv_set_32s_value, _ccv_get_32s_value
, _ccv_set_32s_value); break; } case CCV_32F: { for_block(_ccv_get_64s_value
, _ccv_set_32s_value, _ccv_get_32s_value, _ccv_set_32f_value)
; break; } case CCV_64S: { for_block(_ccv_get_64s_value, _ccv_set_32s_value
, _ccv_get_32s_value, _ccv_set_64s_value); break; } case CCV_64F
: { for_block(_ccv_get_64s_value, _ccv_set_32s_value, _ccv_get_32s_value
, _ccv_set_64f_value); break; } default: { for_block(_ccv_get_64s_value
, _ccv_set_32s_value, _ccv_get_32s_value, _ccv_set_8u_value);
} } }; break; } case CCV_32F: { { switch (((db->type) &
0xFF000)) { case CCV_32S: { for_block(_ccv_get_64s_value, _ccv_set_32f_value
, _ccv_get_32f_value, _ccv_set_32s_value); break; } case CCV_32F
: { for_block(_ccv_get_64s_value, _ccv_set_32f_value, _ccv_get_32f_value
, _ccv_set_32f_value); break; } case CCV_64S: { for_block(_ccv_get_64s_value
, _ccv_set_32f_value, _ccv_get_32f_value, _ccv_set_64s_value)
; break; } case CCV_64F: { for_block(_ccv_get_64s_value, _ccv_set_32f_value
, _ccv_get_32f_value, _ccv_set_64f_value); break; } default: {
for_block(_ccv_get_64s_value, _ccv_set_32f_value, _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_64s_value, _ccv_get_64s_value, _ccv_set_32s_value
); break; } case CCV_32F: { for_block(_ccv_get_64s_value, _ccv_set_64s_value
, _ccv_get_64s_value, _ccv_set_32f_value); break; } case CCV_64S
: { for_block(_ccv_get_64s_value, _ccv_set_64s_value, _ccv_get_64s_value
, _ccv_set_64s_value); break; } case CCV_64F: { for_block(_ccv_get_64s_value
, _ccv_set_64s_value, _ccv_get_64s_value, _ccv_set_64f_value)
; break; } default: { for_block(_ccv_get_64s_value, _ccv_set_64s_value
, _ccv_get_64s_value, _ccv_set_8u_value); } } }; break; } case
CCV_64F: { { switch (((db->type) & 0xFF000)) { case CCV_32S
: { for_block(_ccv_get_64s_value, _ccv_set_64f_value, _ccv_get_64f_value
, _ccv_set_32s_value); break; } case CCV_32F: { for_block(_ccv_get_64s_value
, _ccv_set_64f_value, _ccv_get_64f_value, _ccv_set_32f_value)
; break; } case CCV_64S: { for_block(_ccv_get_64s_value, _ccv_set_64f_value
, _ccv_get_64f_value, _ccv_set_64s_value); break; } case CCV_64F
: { for_block(_ccv_get_64s_value, _ccv_set_64f_value, _ccv_get_64f_value
, _ccv_set_64f_value); break; } default: { for_block(_ccv_get_64s_value
, _ccv_set_64f_value, _ccv_get_64f_value, _ccv_set_8u_value);
} } }; break; } default: { { switch (((db->type) & 0xFF000
)) { case CCV_32S: { for_block(_ccv_get_64s_value, _ccv_set_8u_value
, _ccv_get_8u_value, _ccv_set_32s_value); break; } case CCV_32F
: { for_block(_ccv_get_64s_value, _ccv_set_8u_value, _ccv_get_8u_value
, _ccv_set_32f_value); break; } case CCV_64S: { for_block(_ccv_get_64s_value
, _ccv_set_8u_value, _ccv_get_8u_value, _ccv_set_64s_value); break
; } case CCV_64F: { for_block(_ccv_get_64s_value, _ccv_set_8u_value
, _ccv_get_8u_value, _ccv_set_64f_value); break; } default: {
for_block(_ccv_get_64s_value, _ccv_set_8u_value, _ccv_get_8u_value
, _ccv_set_8u_value); } } }; } } }; break; } case CCV_64F: { {
switch (((no_8u_type) & 0xFF000)) { case CCV_32S: { { switch
(((db->type) & 0xFF000)) { case CCV_32S: { for_block(
_ccv_get_64f_value, _ccv_set_32s_value, _ccv_get_32s_value, _ccv_set_32s_value
); break; } case CCV_32F: { for_block(_ccv_get_64f_value, _ccv_set_32s_value
, _ccv_get_32s_value, _ccv_set_32f_value); break; } case CCV_64S
: { for_block(_ccv_get_64f_value, _ccv_set_32s_value, _ccv_get_32s_value
, _ccv_set_64s_value); break; } case CCV_64F: { for_block(_ccv_get_64f_value
, _ccv_set_32s_value, _ccv_get_32s_value, _ccv_set_64f_value)
; break; } default: { for_block(_ccv_get_64f_value, _ccv_set_32s_value
, _ccv_get_32s_value, _ccv_set_8u_value); } } }; break; } case
CCV_32F: { { switch (((db->type) & 0xFF000)) { case CCV_32S
: { for_block(_ccv_get_64f_value, _ccv_set_32f_value, _ccv_get_32f_value
, _ccv_set_32s_value); break; } case CCV_32F: { for_block(_ccv_get_64f_value
, _ccv_set_32f_value, _ccv_get_32f_value, _ccv_set_32f_value)
; break; } case CCV_64S: { for_block(_ccv_get_64f_value, _ccv_set_32f_value
, _ccv_get_32f_value, _ccv_set_64s_value); break; } case CCV_64F
: { for_block(_ccv_get_64f_value, _ccv_set_32f_value, _ccv_get_32f_value
, _ccv_set_64f_value); break; } default: { for_block(_ccv_get_64f_value
, _ccv_set_32f_value, _ccv_get_32f_value, _ccv_set_8u_value);
} } }; break; } case CCV_64S: { { switch (((db->type) &
0xFF000)) { case CCV_32S: { for_block(_ccv_get_64f_value, _ccv_set_64s_value
, _ccv_get_64s_value, _ccv_set_32s_value); break; } case CCV_32F
: { for_block(_ccv_get_64f_value, _ccv_set_64s_value, _ccv_get_64s_value
, _ccv_set_32f_value); break; } case CCV_64S: { for_block(_ccv_get_64f_value
, _ccv_set_64s_value, _ccv_get_64s_value, _ccv_set_64s_value)
; break; } case CCV_64F: { for_block(_ccv_get_64f_value, _ccv_set_64s_value
, _ccv_get_64s_value, _ccv_set_64f_value); break; } default: {
for_block(_ccv_get_64f_value, _ccv_set_64s_value, _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_64f_value, _ccv_get_64f_value, _ccv_set_32s_value
); break; } case CCV_32F: { for_block(_ccv_get_64f_value, _ccv_set_64f_value
, _ccv_get_64f_value, _ccv_set_32f_value); break; } case CCV_64S
: { for_block(_ccv_get_64f_value, _ccv_set_64f_value, _ccv_get_64f_value
, _ccv_set_64s_value); break; } case CCV_64F: { for_block(_ccv_get_64f_value
, _ccv_set_64f_value, _ccv_get_64f_value, _ccv_set_64f_value)
; break; } default: { for_block(_ccv_get_64f_value, _ccv_set_64f_value
, _ccv_get_64f_value, _ccv_set_8u_value); } } }; break; } default
: { { switch (((db->type) & 0xFF000)) { case CCV_32S: {
for_block(_ccv_get_64f_value, _ccv_set_8u_value, _ccv_get_8u_value
, _ccv_set_32s_value); break; } case CCV_32F: { for_block(_ccv_get_64f_value
, _ccv_set_8u_value, _ccv_get_8u_value, _ccv_set_32f_value); break
; } case CCV_64S: { for_block(_ccv_get_64f_value, _ccv_set_8u_value
, _ccv_get_8u_value, _ccv_set_64s_value); break; } case CCV_64F
: { for_block(_ccv_get_64f_value, _ccv_set_8u_value, _ccv_get_8u_value
, _ccv_set_64f_value); break; } default: { for_block(_ccv_get_64f_value
, _ccv_set_8u_value, _ccv_get_8u_value, _ccv_set_8u_value); }
} }; } } }; break; } default: { { switch (((no_8u_type) &
0xFF000)) { case CCV_32S: { { switch (((db->type) & 0xFF000
)) { case CCV_32S: { for_block(_ccv_get_8u_value, _ccv_set_32s_value
, _ccv_get_32s_value, _ccv_set_32s_value); break; } case CCV_32F
: { for_block(_ccv_get_8u_value, _ccv_set_32s_value, _ccv_get_32s_value
, _ccv_set_32f_value); break; } case CCV_64S: { for_block(_ccv_get_8u_value
, _ccv_set_32s_value, _ccv_get_32s_value, _ccv_set_64s_value)
; break; } case CCV_64F: { for_block(_ccv_get_8u_value, _ccv_set_32s_value
, _ccv_get_32s_value, _ccv_set_64f_value); break; } default: {
for_block(_ccv_get_8u_value, _ccv_set_32s_value, _ccv_get_32s_value
, _ccv_set_8u_value); } } }; break; } case CCV_32F: { { switch
(((db->type) & 0xFF000)) { case CCV_32S: { for_block(
_ccv_get_8u_value, _ccv_set_32f_value, _ccv_get_32f_value, _ccv_set_32s_value
); break; } case CCV_32F: { for_block(_ccv_get_8u_value, _ccv_set_32f_value
, _ccv_get_32f_value, _ccv_set_32f_value); break; } case CCV_64S
: { for_block(_ccv_get_8u_value, _ccv_set_32f_value, _ccv_get_32f_value
, _ccv_set_64s_value); break; } case CCV_64F: { for_block(_ccv_get_8u_value
, _ccv_set_32f_value, _ccv_get_32f_value, _ccv_set_64f_value)
; break; } default: { for_block(_ccv_get_8u_value, _ccv_set_32f_value
, _ccv_get_32f_value, _ccv_set_8u_value); } } }; break; } case
CCV_64S: { { switch (((db->type) & 0xFF000)) { case CCV_32S
: { for_block(_ccv_get_8u_value, _ccv_set_64s_value, _ccv_get_64s_value
, _ccv_set_32s_value); break; } case CCV_32F: { for_block(_ccv_get_8u_value
, _ccv_set_64s_value, _ccv_get_64s_value, _ccv_set_32f_value)
; break; } case CCV_64S: { for_block(_ccv_get_8u_value, _ccv_set_64s_value
, _ccv_get_64s_value, _ccv_set_64s_value); break; } case CCV_64F
: { for_block(_ccv_get_8u_value, _ccv_set_64s_value, _ccv_get_64s_value
, _ccv_set_64f_value); break; } default: { for_block(_ccv_get_8u_value
, _ccv_set_64s_value, _ccv_get_64s_value, _ccv_set_8u_value);
} } }; break; } case CCV_64F: { { switch (((db->type) &
0xFF000)) { case CCV_32S: { for_block(_ccv_get_8u_value, _ccv_set_64f_value
, _ccv_get_64f_value, _ccv_set_32s_value); break; } case CCV_32F
: { for_block(_ccv_get_8u_value, _ccv_set_64f_value, _ccv_get_64f_value
, _ccv_set_32f_value); break; } case CCV_64S: { for_block(_ccv_get_8u_value
, _ccv_set_64f_value, _ccv_get_64f_value, _ccv_set_64s_value)
; break; } case CCV_64F: { for_block(_ccv_get_8u_value, _ccv_set_64f_value
, _ccv_get_64f_value, _ccv_set_64f_value); break; } default: {
for_block(_ccv_get_8u_value, _ccv_set_64f_value, _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_8u_value, _ccv_get_8u_value, _ccv_set_32s_value); break
; } case CCV_32F: { for_block(_ccv_get_8u_value, _ccv_set_8u_value
, _ccv_get_8u_value, _ccv_set_32f_value); break; } case CCV_64S
: { for_block(_ccv_get_8u_value, _ccv_set_8u_value, _ccv_get_8u_value
, _ccv_set_64s_value); break; } case CCV_64F: { for_block(_ccv_get_8u_value
, _ccv_set_8u_value, _ccv_get_8u_value, _ccv_set_64f_value); break
; } default: { for_block(_ccv_get_8u_value, _ccv_set_8u_value
, _ccv_get_8u_value, _ccv_set_8u_value); } } }; } } }; } } }
;
546#undef x_block
547 } else {
548#define x_block(_for_get_a, _for_set, _for_get, _for_set_b) \
549 for (k = 0; k < ch; k++) \
550 _for_set(row, (db->cols - 1) * ch + k, _for_get_a(a_ptr, a->cols * ch + sx - ch + k) * 10 + _for_get_a(a_ptr, (a->cols - 2) * ch + sx + k) * 5 + _for_get_a(a_ptr, (a->cols - 3) * ch + sx + k));
551 ccv_matrix_getter_a(a->type, ccv_matrix_setter_getter, no_8u_type, ccv_matrix_setter_b, db->type, for_block){ switch (((a->type) & 0xFF000)) { case CCV_32S: { { switch
(((no_8u_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, _ccv_set_32s_value)
; break; } case CCV_32F: { for_block(_ccv_get_32s_value, _ccv_set_32s_value
, _ccv_get_32s_value, _ccv_set_32f_value); break; } case CCV_64S
: { for_block(_ccv_get_32s_value, _ccv_set_32s_value, _ccv_get_32s_value
, _ccv_set_64s_value); break; } case CCV_64F: { for_block(_ccv_get_32s_value
, _ccv_set_32s_value, _ccv_get_32s_value, _ccv_set_64f_value)
; break; } default: { for_block(_ccv_get_32s_value, _ccv_set_32s_value
, _ccv_get_32s_value, _ccv_set_8u_value); } } }; break; } case
CCV_32F: { { switch (((db->type) & 0xFF000)) { case CCV_32S
: { for_block(_ccv_get_32s_value, _ccv_set_32f_value, _ccv_get_32f_value
, _ccv_set_32s_value); break; } case CCV_32F: { for_block(_ccv_get_32s_value
, _ccv_set_32f_value, _ccv_get_32f_value, _ccv_set_32f_value)
; break; } case CCV_64S: { for_block(_ccv_get_32s_value, _ccv_set_32f_value
, _ccv_get_32f_value, _ccv_set_64s_value); break; } case CCV_64F
: { for_block(_ccv_get_32s_value, _ccv_set_32f_value, _ccv_get_32f_value
, _ccv_set_64f_value); break; } default: { for_block(_ccv_get_32s_value
, _ccv_set_32f_value, _ccv_get_32f_value, _ccv_set_8u_value);
} } }; break; } case CCV_64S: { { switch (((db->type) &
0xFF000)) { case CCV_32S: { for_block(_ccv_get_32s_value, _ccv_set_64s_value
, _ccv_get_64s_value, _ccv_set_32s_value); break; } case CCV_32F
: { for_block(_ccv_get_32s_value, _ccv_set_64s_value, _ccv_get_64s_value
, _ccv_set_32f_value); break; } case CCV_64S: { for_block(_ccv_get_32s_value
, _ccv_set_64s_value, _ccv_get_64s_value, _ccv_set_64s_value)
; break; } case CCV_64F: { for_block(_ccv_get_32s_value, _ccv_set_64s_value
, _ccv_get_64s_value, _ccv_set_64f_value); break; } default: {
for_block(_ccv_get_32s_value, _ccv_set_64s_value, _ccv_get_64s_value
, _ccv_set_8u_value); } } }; break; } case CCV_64F: { { switch
(((db->type) & 0xFF000)) { case CCV_32S: { for_block(
_ccv_get_32s_value, _ccv_set_64f_value, _ccv_get_64f_value, _ccv_set_32s_value
); break; } case CCV_32F: { for_block(_ccv_get_32s_value, _ccv_set_64f_value
, _ccv_get_64f_value, _ccv_set_32f_value); break; } case CCV_64S
: { for_block(_ccv_get_32s_value, _ccv_set_64f_value, _ccv_get_64f_value
, _ccv_set_64s_value); break; } case CCV_64F: { for_block(_ccv_get_32s_value
, _ccv_set_64f_value, _ccv_get_64f_value, _ccv_set_64f_value)
; break; } default: { for_block(_ccv_get_32s_value, _ccv_set_64f_value
, _ccv_get_64f_value, _ccv_set_8u_value); } } }; break; } default
: { { switch (((db->type) & 0xFF000)) { case CCV_32S: {
for_block(_ccv_get_32s_value, _ccv_set_8u_value, _ccv_get_8u_value
, _ccv_set_32s_value); break; } case CCV_32F: { for_block(_ccv_get_32s_value
, _ccv_set_8u_value, _ccv_get_8u_value, _ccv_set_32f_value); break
; } case CCV_64S: { for_block(_ccv_get_32s_value, _ccv_set_8u_value
, _ccv_get_8u_value, _ccv_set_64s_value); break; } case CCV_64F
: { for_block(_ccv_get_32s_value, _ccv_set_8u_value, _ccv_get_8u_value
, _ccv_set_64f_value); break; } default: { for_block(_ccv_get_32s_value
, _ccv_set_8u_value, _ccv_get_8u_value, _ccv_set_8u_value); }
} }; } } }; break; } case CCV_32F: { { switch (((no_8u_type)
& 0xFF000)) { case CCV_32S: { { switch (((db->type) &
0xFF000)) { case CCV_32S: { for_block(_ccv_get_32f_value, _ccv_set_32s_value
, _ccv_get_32s_value, _ccv_set_32s_value); break; } case CCV_32F
: { for_block(_ccv_get_32f_value, _ccv_set_32s_value, _ccv_get_32s_value
, _ccv_set_32f_value); break; } case CCV_64S: { for_block(_ccv_get_32f_value
, _ccv_set_32s_value, _ccv_get_32s_value, _ccv_set_64s_value)
; break; } case CCV_64F: { for_block(_ccv_get_32f_value, _ccv_set_32s_value
, _ccv_get_32s_value, _ccv_set_64f_value); break; } default: {
for_block(_ccv_get_32f_value, _ccv_set_32s_value, _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_32f_value, _ccv_get_32f_value, _ccv_set_32s_value
); break; } case CCV_32F: { for_block(_ccv_get_32f_value, _ccv_set_32f_value
, _ccv_get_32f_value, _ccv_set_32f_value); break; } case CCV_64S
: { for_block(_ccv_get_32f_value, _ccv_set_32f_value, _ccv_get_32f_value
, _ccv_set_64s_value); break; } case CCV_64F: { for_block(_ccv_get_32f_value
, _ccv_set_32f_value, _ccv_get_32f_value, _ccv_set_64f_value)
; break; } default: { for_block(_ccv_get_32f_value, _ccv_set_32f_value
, _ccv_get_32f_value, _ccv_set_8u_value); } } }; break; } case
CCV_64S: { { switch (((db->type) & 0xFF000)) { case CCV_32S
: { for_block(_ccv_get_32f_value, _ccv_set_64s_value, _ccv_get_64s_value
, _ccv_set_32s_value); break; } case CCV_32F: { for_block(_ccv_get_32f_value
, _ccv_set_64s_value, _ccv_get_64s_value, _ccv_set_32f_value)
; break; } case CCV_64S: { for_block(_ccv_get_32f_value, _ccv_set_64s_value
, _ccv_get_64s_value, _ccv_set_64s_value); break; } case CCV_64F
: { for_block(_ccv_get_32f_value, _ccv_set_64s_value, _ccv_get_64s_value
, _ccv_set_64f_value); break; } default: { for_block(_ccv_get_32f_value
, _ccv_set_64s_value, _ccv_get_64s_value, _ccv_set_8u_value);
} } }; break; } case CCV_64F: { { switch (((db->type) &
0xFF000)) { case CCV_32S: { for_block(_ccv_get_32f_value, _ccv_set_64f_value
, _ccv_get_64f_value, _ccv_set_32s_value); break; } case CCV_32F
: { for_block(_ccv_get_32f_value, _ccv_set_64f_value, _ccv_get_64f_value
, _ccv_set_32f_value); break; } case CCV_64S: { for_block(_ccv_get_32f_value
, _ccv_set_64f_value, _ccv_get_64f_value, _ccv_set_64s_value)
; break; } case CCV_64F: { for_block(_ccv_get_32f_value, _ccv_set_64f_value
, _ccv_get_64f_value, _ccv_set_64f_value); break; } default: {
for_block(_ccv_get_32f_value, _ccv_set_64f_value, _ccv_get_64f_value
, _ccv_set_8u_value); } } }; break; } default: { { switch (((
db->type) & 0xFF000)) { case CCV_32S: { for_block(_ccv_get_32f_value
, _ccv_set_8u_value, _ccv_get_8u_value, _ccv_set_32s_value); break
; } case CCV_32F: { for_block(_ccv_get_32f_value, _ccv_set_8u_value
, _ccv_get_8u_value, _ccv_set_32f_value); break; } case CCV_64S
: { for_block(_ccv_get_32f_value, _ccv_set_8u_value, _ccv_get_8u_value
, _ccv_set_64s_value); break; } case CCV_64F: { for_block(_ccv_get_32f_value
, _ccv_set_8u_value, _ccv_get_8u_value, _ccv_set_64f_value); break
; } default: { for_block(_ccv_get_32f_value, _ccv_set_8u_value
, _ccv_get_8u_value, _ccv_set_8u_value); } } }; } } }; break;
} case CCV_64S: { { switch (((no_8u_type) & 0xFF000)) { case
CCV_32S: { { switch (((db->type) & 0xFF000)) { case CCV_32S
: { for_block(_ccv_get_64s_value, _ccv_set_32s_value, _ccv_get_32s_value
, _ccv_set_32s_value); break; } case CCV_32F: { for_block(_ccv_get_64s_value
, _ccv_set_32s_value, _ccv_get_32s_value, _ccv_set_32f_value)
; break; } case CCV_64S: { for_block(_ccv_get_64s_value, _ccv_set_32s_value
, _ccv_get_32s_value, _ccv_set_64s_value); break; } case CCV_64F
: { for_block(_ccv_get_64s_value, _ccv_set_32s_value, _ccv_get_32s_value
, _ccv_set_64f_value); break; } default: { for_block(_ccv_get_64s_value
, _ccv_set_32s_value, _ccv_get_32s_value, _ccv_set_8u_value);
} } }; break; } case CCV_32F: { { switch (((db->type) &
0xFF000)) { case CCV_32S: { for_block(_ccv_get_64s_value, _ccv_set_32f_value
, _ccv_get_32f_value, _ccv_set_32s_value); break; } case CCV_32F
: { for_block(_ccv_get_64s_value, _ccv_set_32f_value, _ccv_get_32f_value
, _ccv_set_32f_value); break; } case CCV_64S: { for_block(_ccv_get_64s_value
, _ccv_set_32f_value, _ccv_get_32f_value, _ccv_set_64s_value)
; break; } case CCV_64F: { for_block(_ccv_get_64s_value, _ccv_set_32f_value
, _ccv_get_32f_value, _ccv_set_64f_value); break; } default: {
for_block(_ccv_get_64s_value, _ccv_set_32f_value, _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_64s_value, _ccv_get_64s_value, _ccv_set_32s_value
); break; } case CCV_32F: { for_block(_ccv_get_64s_value, _ccv_set_64s_value
, _ccv_get_64s_value, _ccv_set_32f_value); break; } case CCV_64S
: { for_block(_ccv_get_64s_value, _ccv_set_64s_value, _ccv_get_64s_value
, _ccv_set_64s_value); break; } case CCV_64F: { for_block(_ccv_get_64s_value
, _ccv_set_64s_value, _ccv_get_64s_value, _ccv_set_64f_value)
; break; } default: { for_block(_ccv_get_64s_value, _ccv_set_64s_value
, _ccv_get_64s_value, _ccv_set_8u_value); } } }; break; } case
CCV_64F: { { switch (((db->type) & 0xFF000)) { case CCV_32S
: { for_block(_ccv_get_64s_value, _ccv_set_64f_value, _ccv_get_64f_value
, _ccv_set_32s_value); break; } case CCV_32F: { for_block(_ccv_get_64s_value
, _ccv_set_64f_value, _ccv_get_64f_value, _ccv_set_32f_value)
; break; } case CCV_64S: { for_block(_ccv_get_64s_value, _ccv_set_64f_value
, _ccv_get_64f_value, _ccv_set_64s_value); break; } case CCV_64F
: { for_block(_ccv_get_64s_value, _ccv_set_64f_value, _ccv_get_64f_value
, _ccv_set_64f_value); break; } default: { for_block(_ccv_get_64s_value
, _ccv_set_64f_value, _ccv_get_64f_value, _ccv_set_8u_value);
} } }; break; } default: { { switch (((db->type) & 0xFF000
)) { case CCV_32S: { for_block(_ccv_get_64s_value, _ccv_set_8u_value
, _ccv_get_8u_value, _ccv_set_32s_value); break; } case CCV_32F
: { for_block(_ccv_get_64s_value, _ccv_set_8u_value, _ccv_get_8u_value
, _ccv_set_32f_value); break; } case CCV_64S: { for_block(_ccv_get_64s_value
, _ccv_set_8u_value, _ccv_get_8u_value, _ccv_set_64s_value); break
; } case CCV_64F: { for_block(_ccv_get_64s_value, _ccv_set_8u_value
, _ccv_get_8u_value, _ccv_set_64f_value); break; } default: {
for_block(_ccv_get_64s_value, _ccv_set_8u_value, _ccv_get_8u_value
, _ccv_set_8u_value); } } }; } } }; break; } case CCV_64F: { {
switch (((no_8u_type) & 0xFF000)) { case CCV_32S: { { switch
(((db->type) & 0xFF000)) { case CCV_32S: { for_block(
_ccv_get_64f_value, _ccv_set_32s_value, _ccv_get_32s_value, _ccv_set_32s_value
); break; } case CCV_32F: { for_block(_ccv_get_64f_value, _ccv_set_32s_value
, _ccv_get_32s_value, _ccv_set_32f_value); break; } case CCV_64S
: { for_block(_ccv_get_64f_value, _ccv_set_32s_value, _ccv_get_32s_value
, _ccv_set_64s_value); break; } case CCV_64F: { for_block(_ccv_get_64f_value
, _ccv_set_32s_value, _ccv_get_32s_value, _ccv_set_64f_value)
; break; } default: { for_block(_ccv_get_64f_value, _ccv_set_32s_value
, _ccv_get_32s_value, _ccv_set_8u_value); } } }; break; } case
CCV_32F: { { switch (((db->type) & 0xFF000)) { case CCV_32S
: { for_block(_ccv_get_64f_value, _ccv_set_32f_value, _ccv_get_32f_value
, _ccv_set_32s_value); break; } case CCV_32F: { for_block(_ccv_get_64f_value
, _ccv_set_32f_value, _ccv_get_32f_value, _ccv_set_32f_value)
; break; } case CCV_64S: { for_block(_ccv_get_64f_value, _ccv_set_32f_value
, _ccv_get_32f_value, _ccv_set_64s_value); break; } case CCV_64F
: { for_block(_ccv_get_64f_value, _ccv_set_32f_value, _ccv_get_32f_value
, _ccv_set_64f_value); break; } default: { for_block(_ccv_get_64f_value
, _ccv_set_32f_value, _ccv_get_32f_value, _ccv_set_8u_value);
} } }; break; } case CCV_64S: { { switch (((db->type) &
0xFF000)) { case CCV_32S: { for_block(_ccv_get_64f_value, _ccv_set_64s_value
, _ccv_get_64s_value, _ccv_set_32s_value); break; } case CCV_32F
: { for_block(_ccv_get_64f_value, _ccv_set_64s_value, _ccv_get_64s_value
, _ccv_set_32f_value); break; } case CCV_64S: { for_block(_ccv_get_64f_value
, _ccv_set_64s_value, _ccv_get_64s_value, _ccv_set_64s_value)
; break; } case CCV_64F: { for_block(_ccv_get_64f_value, _ccv_set_64s_value
, _ccv_get_64s_value, _ccv_set_64f_value); break; } default: {
for_block(_ccv_get_64f_value, _ccv_set_64s_value, _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_64f_value, _ccv_get_64f_value, _ccv_set_32s_value
); break; } case CCV_32F: { for_block(_ccv_get_64f_value, _ccv_set_64f_value
, _ccv_get_64f_value, _ccv_set_32f_value); break; } case CCV_64S
: { for_block(_ccv_get_64f_value, _ccv_set_64f_value, _ccv_get_64f_value
, _ccv_set_64s_value); break; } case CCV_64F: { for_block(_ccv_get_64f_value
, _ccv_set_64f_value, _ccv_get_64f_value, _ccv_set_64f_value)
; break; } default: { for_block(_ccv_get_64f_value, _ccv_set_64f_value
, _ccv_get_64f_value, _ccv_set_8u_value); } } }; break; } default
: { { switch (((db->type) & 0xFF000)) { case CCV_32S: {
for_block(_ccv_get_64f_value, _ccv_set_8u_value, _ccv_get_8u_value
, _ccv_set_32s_value); break; } case CCV_32F: { for_block(_ccv_get_64f_value
, _ccv_set_8u_value, _ccv_get_8u_value, _ccv_set_32f_value); break
; } case CCV_64S: { for_block(_ccv_get_64f_value, _ccv_set_8u_value
, _ccv_get_8u_value, _ccv_set_64s_value); break; } case CCV_64F
: { for_block(_ccv_get_64f_value, _ccv_set_8u_value, _ccv_get_8u_value
, _ccv_set_64f_value); break; } default: { for_block(_ccv_get_64f_value
, _ccv_set_8u_value, _ccv_get_8u_value, _ccv_set_8u_value); }
} }; } } }; break; } default: { { switch (((no_8u_type) &
0xFF000)) { case CCV_32S: { { switch (((db->type) & 0xFF000
)) { case CCV_32S: { for_block(_ccv_get_8u_value, _ccv_set_32s_value
, _ccv_get_32s_value, _ccv_set_32s_value); break; } case CCV_32F
: { for_block(_ccv_get_8u_value, _ccv_set_32s_value, _ccv_get_32s_value
, _ccv_set_32f_value); break; } case CCV_64S: { for_block(_ccv_get_8u_value
, _ccv_set_32s_value, _ccv_get_32s_value, _ccv_set_64s_value)
; break; } case CCV_64F: { for_block(_ccv_get_8u_value, _ccv_set_32s_value
, _ccv_get_32s_value, _ccv_set_64f_value); break; } default: {
for_block(_ccv_get_8u_value, _ccv_set_32s_value, _ccv_get_32s_value
, _ccv_set_8u_value); } } }; break; } case CCV_32F: { { switch
(((db->type) & 0xFF000)) { case CCV_32S: { for_block(
_ccv_get_8u_value, _ccv_set_32f_value, _ccv_get_32f_value, _ccv_set_32s_value
); break; } case CCV_32F: { for_block(_ccv_get_8u_value, _ccv_set_32f_value
, _ccv_get_32f_value, _ccv_set_32f_value); break; } case CCV_64S
: { for_block(_ccv_get_8u_value, _ccv_set_32f_value, _ccv_get_32f_value
, _ccv_set_64s_value); break; } case CCV_64F: { for_block(_ccv_get_8u_value
, _ccv_set_32f_value, _ccv_get_32f_value, _ccv_set_64f_value)
; break; } default: { for_block(_ccv_get_8u_value, _ccv_set_32f_value
, _ccv_get_32f_value, _ccv_set_8u_value); } } }; break; } case
CCV_64S: { { switch (((db->type) & 0xFF000)) { case CCV_32S
: { for_block(_ccv_get_8u_value, _ccv_set_64s_value, _ccv_get_64s_value
, _ccv_set_32s_value); break; } case CCV_32F: { for_block(_ccv_get_8u_value
, _ccv_set_64s_value, _ccv_get_64s_value, _ccv_set_32f_value)
; break; } case CCV_64S: { for_block(_ccv_get_8u_value, _ccv_set_64s_value
, _ccv_get_64s_value, _ccv_set_64s_value); break; } case CCV_64F
: { for_block(_ccv_get_8u_value, _ccv_set_64s_value, _ccv_get_64s_value
, _ccv_set_64f_value); break; } default: { for_block(_ccv_get_8u_value
, _ccv_set_64s_value, _ccv_get_64s_value, _ccv_set_8u_value);
} } }; break; } case CCV_64F: { { switch (((db->type) &
0xFF000)) { case CCV_32S: { for_block(_ccv_get_8u_value, _ccv_set_64f_value
, _ccv_get_64f_value, _ccv_set_32s_value); break; } case CCV_32F
: { for_block(_ccv_get_8u_value, _ccv_set_64f_value, _ccv_get_64f_value
, _ccv_set_32f_value); break; } case CCV_64S: { for_block(_ccv_get_8u_value
, _ccv_set_64f_value, _ccv_get_64f_value, _ccv_set_64s_value)
; break; } case CCV_64F: { for_block(_ccv_get_8u_value, _ccv_set_64f_value
, _ccv_get_64f_value, _ccv_set_64f_value); break; } default: {
for_block(_ccv_get_8u_value, _ccv_set_64f_value, _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_8u_value, _ccv_get_8u_value, _ccv_set_32s_value); break
; } case CCV_32F: { for_block(_ccv_get_8u_value, _ccv_set_8u_value
, _ccv_get_8u_value, _ccv_set_32f_value); break; } case CCV_64S
: { for_block(_ccv_get_8u_value, _ccv_set_8u_value, _ccv_get_8u_value
, _ccv_set_64s_value); break; } case CCV_64F: { for_block(_ccv_get_8u_value
, _ccv_set_8u_value, _ccv_get_8u_value, _ccv_set_64f_value); break
; } default: { for_block(_ccv_get_8u_value, _ccv_set_8u_value
, _ccv_get_8u_value, _ccv_set_8u_value); } } }; } } }; } } }
;
552#undef x_block
553 }
554#undef for_block
555 if (workspace)
556 ccfreefree(workspace);
557}
558
559void ccv_sample_up(ccv_dense_matrix_t* a, ccv_dense_matrix_t** b, int type, int src_x, int src_y)
560{
561 assert(src_x >= 0 && src_y >= 0)((void) sizeof ((src_x >= 0 && src_y >= 0) ? 1 :
0), __extension__ ({ if (src_x >= 0 && src_y >=
0) ; else __assert_fail ("src_x >= 0 && src_y >= 0"
, "ccv_resample.c", 561, __extension__ __PRETTY_FUNCTION__); }
))
;
562 ccv_declare_derived_signature(sig, a->sig != 0, ccv_sign_with_format(64, "ccv_sample_up(%d,%d)", src_x, src_y), a->sig, CCV_EOF_SIGN)char _ccv_identifier_562[(64)]; memset(_ccv_identifier_562, 0
, (64)); snprintf(_ccv_identifier_562, (64), ("ccv_sample_up(%d,%d)"
), src_x, src_y); size_t _ccv_string_size_562 = (64);; uint64_t
sig = (a->sig != 0) ? ccv_cache_generate_signature(_ccv_identifier_562
, _ccv_string_size_562, a->sig, ((uint64_t)0)) : 0;
;
563 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);
564 ccv_dense_matrix_t* db = *b = ccv_dense_matrix_renew(*b, a->rows * 2, a->cols * 2, CCV_ALL_DATA_TYPE(CCV_8U | CCV_32S | CCV_32F | CCV_64S | CCV_64F | CCV_16F | CCV_QX
)
| CCV_GET_CHANNEL(a->type)((a->type) & 0xFFF), type, sig);
565 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 ; } }
;
566 int ch = CCV_GET_CHANNEL(a->type)((a->type) & 0xFFF);
567 int cols0 = a->cols - 1 - src_x;
568 assert(a->cols > 0 && cols0 > 0)((void) sizeof ((a->cols > 0 && cols0 > 0) ?
1 : 0), __extension__ ({ if (a->cols > 0 && cols0
> 0) ; else __assert_fail ("a->cols > 0 && cols0 > 0"
, "ccv_resample.c", 568, __extension__ __PRETTY_FUNCTION__); }
))
;
569 int y, x, sy = -1 + src_y, sx = src_x * ch, k;
570 unsigned char* workspace = 0;
571 int* tab;
572 unsigned char* buf;
573 if (a->cols + src_x + 2 > 1024 || db->cols * ch > 1024)
574 {
575 workspace = (unsigned char*)ccmallocmalloc((a->cols + src_x + 2) * ch * sizeof(int) + 3 * db->cols * ch * ccv_max(CCV_GET_DATA_TYPE_SIZE(db->type), sizeof(int))({ typeof (_ccv_get_data_type_size[((db->type) & 0xFF000
) >> 12]) _a = (_ccv_get_data_type_size[((db->type) &
0xFF000) >> 12]); typeof (sizeof(int)) _b = (sizeof(int
)); (_a > _b) ? _a : _b; })
);
576 tab = (int*)workspace;
577 buf = (unsigned char*)(workspace + (a->cols + src_x + 2) * ch * sizeof(int));
578 } else {
579 tab = (int*)alloca((a->cols + src_x + 2) * ch * sizeof(int))__builtin_alloca ((a->cols + src_x + 2) * ch * sizeof(int)
)
;
580 buf = (unsigned char*)alloca(3 * db->cols * ch * ccv_max(CCV_GET_DATA_TYPE_SIZE(db->type), sizeof(int)))__builtin_alloca (3 * db->cols * ch * ({ typeof (_ccv_get_data_type_size
[((db->type) & 0xFF000) >> 12]) _a = (_ccv_get_data_type_size
[((db->type) & 0xFF000) >> 12]); typeof (sizeof(
int)) _b = (sizeof(int)); (_a > _b) ? _a : _b; }))
;
581 }
582 for (x = 0; x < a->cols + src_x + 2; x++)
583 for (k = 0; k < ch; k++)
584 tab[x * ch + k] = ((x >= a->cols) ? a->cols * 2 - 1 - x : x) * ch + k;
585 int bufstep = db->cols * ch * ccv_max(CCV_GET_DATA_TYPE_SIZE(db->type), sizeof(int))({ typeof (_ccv_get_data_type_size[((db->type) & 0xFF000
) >> 12]) _a = (_ccv_get_data_type_size[((db->type) &
0xFF000) >> 12]); typeof (sizeof(int)) _b = (sizeof(int
)); (_a > _b) ? _a : _b; })
;
586#ifdef __clang_analyzer__1
587 memset(buf, 0, 3 * bufstep);
588#endif
589 unsigned char* b_ptr = db->data.u8;
590 /* why src_y * 2: the same argument as in ccv_sample_down */
591#define for_block(_for_get_a, _for_set, _for_get, _for_set_b) \
592 for (y = 0; y < a->rows; y++) \
593 { \
594 for (; sy <= y + 1 + src_y; sy++) \
595 { \
596 unsigned char* row = buf + ((sy + src_y * 2 + 1) % 3) * bufstep; \
597 int _sy = (sy < 0) ? -1 - sy : (sy >= a->rows) ? a->rows * 2 - 1 - sy : sy; \
598 unsigned char* a_ptr = a->data.u8 + a->step * _sy; \
599 if (a->cols == 1) \
600 { \
601 for (k = 0; k < ch; k++) \
602 { \
603 _for_set(row, k, _for_get_a(a_ptr, k) * (G025 + G075 + G125)); \
604 _for_set(row, k + ch, _for_get_a(a_ptr, k) * (G025 + G075 + G125)); \
605 } \
606 continue; \
607 } \
608 if (sx == 0) \
609 { \
610 for (k = 0; k < ch; k++) \
611 { \
612 _for_set(row, k, _for_get_a(a_ptr, k + sx) * (G025 + G075) + _for_get_a(a_ptr, k + sx + ch) * G125); \
613 _for_set(row, k + ch, _for_get_a(a_ptr, k + sx) * (G125 + G025) + _for_get_a(a_ptr, k + sx + ch) * G075); \
614 } \
615 } \
616 /* some serious flaw in computing Gaussian weighting in previous version
617 * specially, we are doing perfect upsampling (2x) so, it concerns a grid like:
618 * XXYY
619 * XXYY
620 * in this case, to upsampling, the weight should be from distance 0.25 and 1.25, and 0.25 and 0.75
621 * previously, it was mistakingly be 0.0 1.0, 0.5 0.5 (imperfect upsampling (2x - 1)) */ \
622 for (x = (sx == 0) ? ch : 0; x < cols0 * ch; x += ch) \
623 { \
624 for (k = 0; k < ch; k++) \
625 { \
626 _for_set(row, x * 2 + k, _for_get_a(a_ptr, x + sx - ch + k) * G075 + _for_get_a(a_ptr, x + sx + k) * G025 + _for_get_a(a_ptr, x + sx + ch + k) * G125); \
627 _for_set(row, x * 2 + ch + k, _for_get_a(a_ptr, x + sx - ch + k) * G125 + _for_get_a(a_ptr, x + sx + k) * G025 + _for_get_a(a_ptr, x + sx + ch + k) * G075); \
628 } \
629 } \
630 x_block(_for_get_a, _for_set, _for_get, _for_set_b); \
631 } \
632 unsigned char* rows[3]; \
633 for (k = 0; k < 3; k++) \
634 rows[k] = buf + ((y + k) % 3) * bufstep; \
635 for (x = 0; x < db->cols * ch; x++) \
636 { \
637 _for_set_b(b_ptr, x, (_for_get(rows[0], x) * G075 + _for_get(rows[1], x) * G025 + _for_get(rows[2], x) * G125) / GALL); \
638 _for_set_b(b_ptr + db->step, x, (_for_get(rows[0], x) * G125 + _for_get(rows[1], x) * G025 + _for_get(rows[2], x) * G075) / GALL); \
639 } \
640 b_ptr += 2 * db->step; \
641 }
642 int no_8u_type = (a->type & CCV_8U) ? CCV_32S : a->type;
643 /* unswitch if condition in manual way */
644 if ((a->type & CCV_8U) || (a->type & CCV_32S) || (a->type & CCV_64S))
645 {
646#define G025 (23)
647#define G075 (8)
648#define G125 (1)
649#define GALL (1024)
650 if (src_x > 0)
651 {
652#define x_block(_for_get_a, _for_set, _for_get, _for_set_b) \
653 for (x = cols0 * ch; x < a->cols * ch; x += ch) \
654 for (k = 0; k < ch; k++) \
655 { \
656 _for_set(row, x * 2 + k, _for_get_a(a_ptr, tab[x + sx - ch + k]) * G075 + _for_get_a(a_ptr, tab[x + sx + k]) * G025 + _for_get_a(a_ptr, tab[x + sx + ch + k]) * G125); \
657 _for_set(row, x * 2 + ch + k, _for_get_a(a_ptr, tab[x + sx - ch + k]) * G125 + _for_get_a(a_ptr, tab[x + sx + k]) * G025 + _for_get_a(a_ptr, tab[x + sx + ch + k], 0) * G075); \
658 }
659 ccv_matrix_getter_integer_only(a->type, ccv_matrix_setter_getter_integer_only, no_8u_type, ccv_matrix_setter_b, db->type, for_block){ switch (((a->type) & 0xFF000)) { case CCV_32S: { { switch
(((no_8u_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, _ccv_set_32s_value)
; break; } case CCV_32F: { for_block(_ccv_get_32s_value, _ccv_set_32s_value
, _ccv_get_32s_value, _ccv_set_32f_value); break; } case CCV_64S
: { for_block(_ccv_get_32s_value, _ccv_set_32s_value, _ccv_get_32s_value
, _ccv_set_64s_value); break; } case CCV_64F: { for_block(_ccv_get_32s_value
, _ccv_set_32s_value, _ccv_get_32s_value, _ccv_set_64f_value)
; break; } default: { for_block(_ccv_get_32s_value, _ccv_set_32s_value
, _ccv_get_32s_value, _ccv_set_8u_value); } } }; break; } case
CCV_64S: { { switch (((db->type) & 0xFF000)) { case CCV_32S
: { for_block(_ccv_get_32s_value, _ccv_set_64s_value, _ccv_get_64s_value
, _ccv_set_32s_value); break; } case CCV_32F: { for_block(_ccv_get_32s_value
, _ccv_set_64s_value, _ccv_get_64s_value, _ccv_set_32f_value)
; break; } case CCV_64S: { for_block(_ccv_get_32s_value, _ccv_set_64s_value
, _ccv_get_64s_value, _ccv_set_64s_value); break; } case CCV_64F
: { for_block(_ccv_get_32s_value, _ccv_set_64s_value, _ccv_get_64s_value
, _ccv_set_64f_value); break; } default: { for_block(_ccv_get_32s_value
, _ccv_set_64s_value, _ccv_get_64s_value, _ccv_set_8u_value);
} } }; break; } case CCV_8U: { { switch (((db->type) &
0xFF000)) { case CCV_32S: { for_block(_ccv_get_32s_value, _ccv_set_8u_value
, _ccv_get_8u_value, _ccv_set_32s_value); break; } case CCV_32F
: { for_block(_ccv_get_32s_value, _ccv_set_8u_value, _ccv_get_8u_value
, _ccv_set_32f_value); break; } case CCV_64S: { for_block(_ccv_get_32s_value
, _ccv_set_8u_value, _ccv_get_8u_value, _ccv_set_64s_value); break
; } case CCV_64F: { for_block(_ccv_get_32s_value, _ccv_set_8u_value
, _ccv_get_8u_value, _ccv_set_64f_value); break; } default: {
for_block(_ccv_get_32s_value, _ccv_set_8u_value, _ccv_get_8u_value
, _ccv_set_8u_value); } } }; break; } default: { ((void) sizeof
(((no_8u_type & CCV_32S) || (no_8u_type & CCV_64S) ||
(no_8u_type & CCV_8U)) ? 1 : 0), __extension__ ({ if ((no_8u_type
& CCV_32S) || (no_8u_type & CCV_64S) || (no_8u_type &
CCV_8U)) ; else __assert_fail ("(no_8u_type & CCV_32S) || (no_8u_type & CCV_64S) || (no_8u_type & CCV_8U)"
, "ccv_resample.c", 659, __extension__ __PRETTY_FUNCTION__); }
)); } } }; break; } case CCV_64S: { { switch (((no_8u_type) &
0xFF000)) { case CCV_32S: { { switch (((db->type) & 0xFF000
)) { case CCV_32S: { for_block(_ccv_get_64s_value, _ccv_set_32s_value
, _ccv_get_32s_value, _ccv_set_32s_value); break; } case CCV_32F
: { for_block(_ccv_get_64s_value, _ccv_set_32s_value, _ccv_get_32s_value
, _ccv_set_32f_value); break; } case CCV_64S: { for_block(_ccv_get_64s_value
, _ccv_set_32s_value, _ccv_get_32s_value, _ccv_set_64s_value)
; break; } case CCV_64F: { for_block(_ccv_get_64s_value, _ccv_set_32s_value
, _ccv_get_32s_value, _ccv_set_64f_value); break; } default: {
for_block(_ccv_get_64s_value, _ccv_set_32s_value, _ccv_get_32s_value
, _ccv_set_8u_value); } } }; break; } case CCV_64S: { { switch
(((db->type) & 0xFF000)) { case CCV_32S: { for_block(
_ccv_get_64s_value, _ccv_set_64s_value, _ccv_get_64s_value, _ccv_set_32s_value
); break; } case CCV_32F: { for_block(_ccv_get_64s_value, _ccv_set_64s_value
, _ccv_get_64s_value, _ccv_set_32f_value); break; } case CCV_64S
: { for_block(_ccv_get_64s_value, _ccv_set_64s_value, _ccv_get_64s_value
, _ccv_set_64s_value); break; } case CCV_64F: { for_block(_ccv_get_64s_value
, _ccv_set_64s_value, _ccv_get_64s_value, _ccv_set_64f_value)
; break; } default: { for_block(_ccv_get_64s_value, _ccv_set_64s_value
, _ccv_get_64s_value, _ccv_set_8u_value); } } }; break; } case
CCV_8U: { { switch (((db->type) & 0xFF000)) { case CCV_32S
: { for_block(_ccv_get_64s_value, _ccv_set_8u_value, _ccv_get_8u_value
, _ccv_set_32s_value); break; } case CCV_32F: { for_block(_ccv_get_64s_value
, _ccv_set_8u_value, _ccv_get_8u_value, _ccv_set_32f_value); break
; } case CCV_64S: { for_block(_ccv_get_64s_value, _ccv_set_8u_value
, _ccv_get_8u_value, _ccv_set_64s_value); break; } case CCV_64F
: { for_block(_ccv_get_64s_value, _ccv_set_8u_value, _ccv_get_8u_value
, _ccv_set_64f_value); break; } default: { for_block(_ccv_get_64s_value
, _ccv_set_8u_value, _ccv_get_8u_value, _ccv_set_8u_value); }
} }; break; } default: { ((void) sizeof (((no_8u_type & CCV_32S
) || (no_8u_type & CCV_64S) || (no_8u_type & CCV_8U))
? 1 : 0), __extension__ ({ if ((no_8u_type & CCV_32S) ||
(no_8u_type & CCV_64S) || (no_8u_type & CCV_8U)) ; else
__assert_fail ("(no_8u_type & CCV_32S) || (no_8u_type & CCV_64S) || (no_8u_type & CCV_8U)"
, "ccv_resample.c", 659, __extension__ __PRETTY_FUNCTION__); }
)); } } }; break; } case CCV_8U: { { switch (((no_8u_type) &
0xFF000)) { case CCV_32S: { { switch (((db->type) & 0xFF000
)) { case CCV_32S: { for_block(_ccv_get_8u_value, _ccv_set_32s_value
, _ccv_get_32s_value, _ccv_set_32s_value); break; } case CCV_32F
: { for_block(_ccv_get_8u_value, _ccv_set_32s_value, _ccv_get_32s_value
, _ccv_set_32f_value); break; } case CCV_64S: { for_block(_ccv_get_8u_value
, _ccv_set_32s_value, _ccv_get_32s_value, _ccv_set_64s_value)
; break; } case CCV_64F: { for_block(_ccv_get_8u_value, _ccv_set_32s_value
, _ccv_get_32s_value, _ccv_set_64f_value); break; } default: {
for_block(_ccv_get_8u_value, _ccv_set_32s_value, _ccv_get_32s_value
, _ccv_set_8u_value); } } }; break; } case CCV_64S: { { switch
(((db->type) & 0xFF000)) { case CCV_32S: { for_block(
_ccv_get_8u_value, _ccv_set_64s_value, _ccv_get_64s_value, _ccv_set_32s_value
); break; } case CCV_32F: { for_block(_ccv_get_8u_value, _ccv_set_64s_value
, _ccv_get_64s_value, _ccv_set_32f_value); break; } case CCV_64S
: { for_block(_ccv_get_8u_value, _ccv_set_64s_value, _ccv_get_64s_value
, _ccv_set_64s_value); break; } case CCV_64F: { for_block(_ccv_get_8u_value
, _ccv_set_64s_value, _ccv_get_64s_value, _ccv_set_64f_value)
; break; } default: { for_block(_ccv_get_8u_value, _ccv_set_64s_value
, _ccv_get_64s_value, _ccv_set_8u_value); } } }; break; } case
CCV_8U: { { switch (((db->type) & 0xFF000)) { case CCV_32S
: { for_block(_ccv_get_8u_value, _ccv_set_8u_value, _ccv_get_8u_value
, _ccv_set_32s_value); break; } case CCV_32F: { for_block(_ccv_get_8u_value
, _ccv_set_8u_value, _ccv_get_8u_value, _ccv_set_32f_value); break
; } case CCV_64S: { for_block(_ccv_get_8u_value, _ccv_set_8u_value
, _ccv_get_8u_value, _ccv_set_64s_value); break; } case CCV_64F
: { for_block(_ccv_get_8u_value, _ccv_set_8u_value, _ccv_get_8u_value
, _ccv_set_64f_value); break; } default: { for_block(_ccv_get_8u_value
, _ccv_set_8u_value, _ccv_get_8u_value, _ccv_set_8u_value); }
} }; break; } default: { ((void) sizeof (((no_8u_type & CCV_32S
) || (no_8u_type & CCV_64S) || (no_8u_type & CCV_8U))
? 1 : 0), __extension__ ({ if ((no_8u_type & CCV_32S) ||
(no_8u_type & CCV_64S) || (no_8u_type & CCV_8U)) ; else
__assert_fail ("(no_8u_type & CCV_32S) || (no_8u_type & CCV_64S) || (no_8u_type & CCV_8U)"
, "ccv_resample.c", 659, __extension__ __PRETTY_FUNCTION__); }
)); } } }; break; } default: { ((void) sizeof (((a->type &
CCV_32S) || (a->type & CCV_64S) || (a->type & CCV_8U
)) ? 1 : 0), __extension__ ({ if ((a->type & CCV_32S) ||
(a->type & CCV_64S) || (a->type & CCV_8U)) ; else
__assert_fail ("(a->type & CCV_32S) || (a->type & CCV_64S) || (a->type & CCV_8U)"
, "ccv_resample.c", 659, __extension__ __PRETTY_FUNCTION__); }
)); } } }
;
660#undef x_block
661 } else {
662#define x_block(_for_get_a, _for_set, _for_get, _for_set_b) \
663 for (k = 0; k < ch; k++) \
664 { \
665 _for_set(row, (a->cols - 1) * 2 * ch + k, _for_get_a(a_ptr, (a->cols - 2) * ch + k) * G075 + _for_get_a(a_ptr, (a->cols - 1) * ch + k) * (G025 + G125)); \
666 _for_set(row, (a->cols - 1) * 2 * ch + ch + k, _for_get_a(a_ptr, (a->cols - 2) * ch + k) * G125 + _for_get_a(a_ptr, (a->cols - 1) * ch + k) * (G025 + G075)); \
667 }
668 ccv_matrix_getter_integer_only(a->type, ccv_matrix_setter_getter_integer_only, no_8u_type, ccv_matrix_setter_b, db->type, for_block){ switch (((a->type) & 0xFF000)) { case CCV_32S: { { switch
(((no_8u_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, _ccv_set_32s_value)
; break; } case CCV_32F: { for_block(_ccv_get_32s_value, _ccv_set_32s_value
, _ccv_get_32s_value, _ccv_set_32f_value); break; } case CCV_64S
: { for_block(_ccv_get_32s_value, _ccv_set_32s_value, _ccv_get_32s_value
, _ccv_set_64s_value); break; } case CCV_64F: { for_block(_ccv_get_32s_value
, _ccv_set_32s_value, _ccv_get_32s_value, _ccv_set_64f_value)
; break; } default: { for_block(_ccv_get_32s_value, _ccv_set_32s_value
, _ccv_get_32s_value, _ccv_set_8u_value); } } }; break; } case
CCV_64S: { { switch (((db->type) & 0xFF000)) { case CCV_32S
: { for_block(_ccv_get_32s_value, _ccv_set_64s_value, _ccv_get_64s_value
, _ccv_set_32s_value); break; } case CCV_32F: { for_block(_ccv_get_32s_value
, _ccv_set_64s_value, _ccv_get_64s_value, _ccv_set_32f_value)
; break; } case CCV_64S: { for_block(_ccv_get_32s_value, _ccv_set_64s_value
, _ccv_get_64s_value, _ccv_set_64s_value); break; } case CCV_64F
: { for_block(_ccv_get_32s_value, _ccv_set_64s_value, _ccv_get_64s_value
, _ccv_set_64f_value); break; } default: { for_block(_ccv_get_32s_value
, _ccv_set_64s_value, _ccv_get_64s_value, _ccv_set_8u_value);
} } }; break; } case CCV_8U: { { switch (((db->type) &
0xFF000)) { case CCV_32S: { for_block(_ccv_get_32s_value, _ccv_set_8u_value
, _ccv_get_8u_value, _ccv_set_32s_value); break; } case CCV_32F
: { for_block(_ccv_get_32s_value, _ccv_set_8u_value, _ccv_get_8u_value
, _ccv_set_32f_value); break; } case CCV_64S: { for_block(_ccv_get_32s_value
, _ccv_set_8u_value, _ccv_get_8u_value, _ccv_set_64s_value); break
; } case CCV_64F: { for_block(_ccv_get_32s_value, _ccv_set_8u_value
, _ccv_get_8u_value, _ccv_set_64f_value); break; } default: {
for_block(_ccv_get_32s_value, _ccv_set_8u_value, _ccv_get_8u_value
, _ccv_set_8u_value); } } }; break; } default: { ((void) sizeof
(((no_8u_type & CCV_32S) || (no_8u_type & CCV_64S) ||
(no_8u_type & CCV_8U)) ? 1 : 0), __extension__ ({ if ((no_8u_type
& CCV_32S) || (no_8u_type & CCV_64S) || (no_8u_type &
CCV_8U)) ; else __assert_fail ("(no_8u_type & CCV_32S) || (no_8u_type & CCV_64S) || (no_8u_type & CCV_8U)"
, "ccv_resample.c", 668, __extension__ __PRETTY_FUNCTION__); }
)); } } }; break; } case CCV_64S: { { switch (((no_8u_type) &
0xFF000)) { case CCV_32S: { { switch (((db->type) & 0xFF000
)) { case CCV_32S: { for_block(_ccv_get_64s_value, _ccv_set_32s_value
, _ccv_get_32s_value, _ccv_set_32s_value); break; } case CCV_32F
: { for_block(_ccv_get_64s_value, _ccv_set_32s_value, _ccv_get_32s_value
, _ccv_set_32f_value); break; } case CCV_64S: { for_block(_ccv_get_64s_value
, _ccv_set_32s_value, _ccv_get_32s_value, _ccv_set_64s_value)
; break; } case CCV_64F: { for_block(_ccv_get_64s_value, _ccv_set_32s_value
, _ccv_get_32s_value, _ccv_set_64f_value); break; } default: {
for_block(_ccv_get_64s_value, _ccv_set_32s_value, _ccv_get_32s_value
, _ccv_set_8u_value); } } }; break; } case CCV_64S: { { switch
(((db->type) & 0xFF000)) { case CCV_32S: { for_block(
_ccv_get_64s_value, _ccv_set_64s_value, _ccv_get_64s_value, _ccv_set_32s_value
); break; } case CCV_32F: { for_block(_ccv_get_64s_value, _ccv_set_64s_value
, _ccv_get_64s_value, _ccv_set_32f_value); break; } case CCV_64S
: { for_block(_ccv_get_64s_value, _ccv_set_64s_value, _ccv_get_64s_value
, _ccv_set_64s_value); break; } case CCV_64F: { for_block(_ccv_get_64s_value
, _ccv_set_64s_value, _ccv_get_64s_value, _ccv_set_64f_value)
; break; } default: { for_block(_ccv_get_64s_value, _ccv_set_64s_value
, _ccv_get_64s_value, _ccv_set_8u_value); } } }; break; } case
CCV_8U: { { switch (((db->type) & 0xFF000)) { case CCV_32S
: { for_block(_ccv_get_64s_value, _ccv_set_8u_value, _ccv_get_8u_value
, _ccv_set_32s_value); break; } case CCV_32F: { for_block(_ccv_get_64s_value
, _ccv_set_8u_value, _ccv_get_8u_value, _ccv_set_32f_value); break
; } case CCV_64S: { for_block(_ccv_get_64s_value, _ccv_set_8u_value
, _ccv_get_8u_value, _ccv_set_64s_value); break; } case CCV_64F
: { for_block(_ccv_get_64s_value, _ccv_set_8u_value, _ccv_get_8u_value
, _ccv_set_64f_value); break; } default: { for_block(_ccv_get_64s_value
, _ccv_set_8u_value, _ccv_get_8u_value, _ccv_set_8u_value); }
} }; break; } default: { ((void) sizeof (((no_8u_type & CCV_32S
) || (no_8u_type & CCV_64S) || (no_8u_type & CCV_8U))
? 1 : 0), __extension__ ({ if ((no_8u_type & CCV_32S) ||
(no_8u_type & CCV_64S) || (no_8u_type & CCV_8U)) ; else
__assert_fail ("(no_8u_type & CCV_32S) || (no_8u_type & CCV_64S) || (no_8u_type & CCV_8U)"
, "ccv_resample.c", 668, __extension__ __PRETTY_FUNCTION__); }
)); } } }; break; } case CCV_8U: { { switch (((no_8u_type) &
0xFF000)) { case CCV_32S: { { switch (((db->type) & 0xFF000
)) { case CCV_32S: { for_block(_ccv_get_8u_value, _ccv_set_32s_value
, _ccv_get_32s_value, _ccv_set_32s_value); break; } case CCV_32F
: { for_block(_ccv_get_8u_value, _ccv_set_32s_value, _ccv_get_32s_value
, _ccv_set_32f_value); break; } case CCV_64S: { for_block(_ccv_get_8u_value
, _ccv_set_32s_value, _ccv_get_32s_value, _ccv_set_64s_value)
; break; } case CCV_64F: { for_block(_ccv_get_8u_value, _ccv_set_32s_value
, _ccv_get_32s_value, _ccv_set_64f_value); break; } default: {
for_block(_ccv_get_8u_value, _ccv_set_32s_value, _ccv_get_32s_value
, _ccv_set_8u_value); } } }; break; } case CCV_64S: { { switch
(((db->type) & 0xFF000)) { case CCV_32S: { for_block(
_ccv_get_8u_value, _ccv_set_64s_value, _ccv_get_64s_value, _ccv_set_32s_value
); break; } case CCV_32F: { for_block(_ccv_get_8u_value, _ccv_set_64s_value
, _ccv_get_64s_value, _ccv_set_32f_value); break; } case CCV_64S
: { for_block(_ccv_get_8u_value, _ccv_set_64s_value, _ccv_get_64s_value
, _ccv_set_64s_value); break; } case CCV_64F: { for_block(_ccv_get_8u_value
, _ccv_set_64s_value, _ccv_get_64s_value, _ccv_set_64f_value)
; break; } default: { for_block(_ccv_get_8u_value, _ccv_set_64s_value
, _ccv_get_64s_value, _ccv_set_8u_value); } } }; break; } case
CCV_8U: { { switch (((db->type) & 0xFF000)) { case CCV_32S
: { for_block(_ccv_get_8u_value, _ccv_set_8u_value, _ccv_get_8u_value
, _ccv_set_32s_value); break; } case CCV_32F: { for_block(_ccv_get_8u_value
, _ccv_set_8u_value, _ccv_get_8u_value, _ccv_set_32f_value); break
; } case CCV_64S: { for_block(_ccv_get_8u_value, _ccv_set_8u_value
, _ccv_get_8u_value, _ccv_set_64s_value); break; } case CCV_64F
: { for_block(_ccv_get_8u_value, _ccv_set_8u_value, _ccv_get_8u_value
, _ccv_set_64f_value); break; } default: { for_block(_ccv_get_8u_value
, _ccv_set_8u_value, _ccv_get_8u_value, _ccv_set_8u_value); }
} }; break; } default: { ((void) sizeof (((no_8u_type & CCV_32S
) || (no_8u_type & CCV_64S) || (no_8u_type & CCV_8U))
? 1 : 0), __extension__ ({ if ((no_8u_type & CCV_32S) ||
(no_8u_type & CCV_64S) || (no_8u_type & CCV_8U)) ; else
__assert_fail ("(no_8u_type & CCV_32S) || (no_8u_type & CCV_64S) || (no_8u_type & CCV_8U)"
, "ccv_resample.c", 668, __extension__ __PRETTY_FUNCTION__); }
)); } } }; break; } default: { ((void) sizeof (((a->type &
CCV_32S) || (a->type & CCV_64S) || (a->type & CCV_8U
)) ? 1 : 0), __extension__ ({ if ((a->type & CCV_32S) ||
(a->type & CCV_64S) || (a->type & CCV_8U)) ; else
__assert_fail ("(a->type & CCV_32S) || (a->type & CCV_64S) || (a->type & CCV_8U)"
, "ccv_resample.c", 668, __extension__ __PRETTY_FUNCTION__); }
)); } } }
;
669#undef x_block
670 }
671#undef GALL
672#undef G125
673#undef G075
674#undef G025
675 } else {
676#define G025 (0.705385)
677#define G075 (0.259496)
678#define G125 (0.035119)
679#define GALL (1)
680 if (src_x > 0)
681 {
682#define x_block(_for_get_a, _for_set, _for_get, _for_set_b) \
683 for (x = cols0 * ch; x < a->cols * ch; x += ch) \
684 for (k = 0; k < ch; k++) \
685 { \
686 _for_set(row, x * 2 + k, _for_get_a(a_ptr, tab[x + sx - ch + k]) * G075 + _for_get_a(a_ptr, tab[x + sx + k]) * G025 + _for_get_a(a_ptr, tab[x + sx + ch + k]) * G125); \
687 _for_set(row, x * 2 + ch + k, _for_get_a(a_ptr, tab[x + sx - ch + k]) * G125 + _for_get_a(a_ptr, tab[x + sx + k]) * G025 + _for_get_a(a_ptr, tab[x + sx + ch + k]) * G075); \
688 }
689 ccv_matrix_getter_float_only(a->type, ccv_matrix_setter_getter_float_only, no_8u_type, ccv_matrix_setter_b, db->type, for_block){ switch (((a->type) & 0xFF000)) { case CCV_32F: { { switch
(((no_8u_type) & 0xFF000)) { case CCV_32F: { { switch ((
(db->type) & 0xFF000)) { case CCV_32S: { for_block(_ccv_get_32f_value
, _ccv_set_32f_value, _ccv_get_32f_value, _ccv_set_32s_value)
; break; } case CCV_32F: { for_block(_ccv_get_32f_value, _ccv_set_32f_value
, _ccv_get_32f_value, _ccv_set_32f_value); break; } case CCV_64S
: { for_block(_ccv_get_32f_value, _ccv_set_32f_value, _ccv_get_32f_value
, _ccv_set_64s_value); break; } case CCV_64F: { for_block(_ccv_get_32f_value
, _ccv_set_32f_value, _ccv_get_32f_value, _ccv_set_64f_value)
; break; } default: { for_block(_ccv_get_32f_value, _ccv_set_32f_value
, _ccv_get_32f_value, _ccv_set_8u_value); } } }; break; } case
CCV_64F: { { switch (((db->type) & 0xFF000)) { case CCV_32S
: { for_block(_ccv_get_32f_value, _ccv_set_64f_value, _ccv_get_64f_value
, _ccv_set_32s_value); break; } case CCV_32F: { for_block(_ccv_get_32f_value
, _ccv_set_64f_value, _ccv_get_64f_value, _ccv_set_32f_value)
; break; } case CCV_64S: { for_block(_ccv_get_32f_value, _ccv_set_64f_value
, _ccv_get_64f_value, _ccv_set_64s_value); break; } case CCV_64F
: { for_block(_ccv_get_32f_value, _ccv_set_64f_value, _ccv_get_64f_value
, _ccv_set_64f_value); break; } default: { for_block(_ccv_get_32f_value
, _ccv_set_64f_value, _ccv_get_64f_value, _ccv_set_8u_value);
} } }; break; } default: { ((void) sizeof (((no_8u_type &
CCV_32F) || (no_8u_type & CCV_64F)) ? 1 : 0), __extension__
({ if ((no_8u_type & CCV_32F) || (no_8u_type & CCV_64F
)) ; else __assert_fail ("(no_8u_type & CCV_32F) || (no_8u_type & CCV_64F)"
, "ccv_resample.c", 689, __extension__ __PRETTY_FUNCTION__); }
)); } } }; break; } case CCV_64F: { { switch (((no_8u_type) &
0xFF000)) { case CCV_32F: { { switch (((db->type) & 0xFF000
)) { case CCV_32S: { for_block(_ccv_get_64f_value, _ccv_set_32f_value
, _ccv_get_32f_value, _ccv_set_32s_value); break; } case CCV_32F
: { for_block(_ccv_get_64f_value, _ccv_set_32f_value, _ccv_get_32f_value
, _ccv_set_32f_value); break; } case CCV_64S: { for_block(_ccv_get_64f_value
, _ccv_set_32f_value, _ccv_get_32f_value, _ccv_set_64s_value)
; break; } case CCV_64F: { for_block(_ccv_get_64f_value, _ccv_set_32f_value
, _ccv_get_32f_value, _ccv_set_64f_value); break; } default: {
for_block(_ccv_get_64f_value, _ccv_set_32f_value, _ccv_get_32f_value
, _ccv_set_8u_value); } } }; break; } case CCV_64F: { { switch
(((db->type) & 0xFF000)) { case CCV_32S: { for_block(
_ccv_get_64f_value, _ccv_set_64f_value, _ccv_get_64f_value, _ccv_set_32s_value
); break; } case CCV_32F: { for_block(_ccv_get_64f_value, _ccv_set_64f_value
, _ccv_get_64f_value, _ccv_set_32f_value); break; } case CCV_64S
: { for_block(_ccv_get_64f_value, _ccv_set_64f_value, _ccv_get_64f_value
, _ccv_set_64s_value); break; } case CCV_64F: { for_block(_ccv_get_64f_value
, _ccv_set_64f_value, _ccv_get_64f_value, _ccv_set_64f_value)
; break; } default: { for_block(_ccv_get_64f_value, _ccv_set_64f_value
, _ccv_get_64f_value, _ccv_set_8u_value); } } }; break; } default
: { ((void) sizeof (((no_8u_type & CCV_32F) || (no_8u_type
& CCV_64F)) ? 1 : 0), __extension__ ({ if ((no_8u_type &
CCV_32F) || (no_8u_type & CCV_64F)) ; else __assert_fail
("(no_8u_type & CCV_32F) || (no_8u_type & CCV_64F)",
"ccv_resample.c", 689, __extension__ __PRETTY_FUNCTION__); }
)); } } }; break; } default: { ((void) sizeof (((a->type &
CCV_32F) || (a->type & CCV_64F)) ? 1 : 0), __extension__
({ if ((a->type & CCV_32F) || (a->type & CCV_64F
)) ; else __assert_fail ("(a->type & CCV_32F) || (a->type & CCV_64F)"
, "ccv_resample.c", 689, __extension__ __PRETTY_FUNCTION__); }
)); } } }
;
690#undef x_block
691 } else {
692#define x_block(_for_get_a, _for_set, _for_get, _for_set_b) \
693 for (k = 0; k < ch; k++) \
694 { \
695 _for_set(row, (a->cols - 1) * 2 * ch + k, _for_get_a(a_ptr, (a->cols - 2) * ch + k) * G075 + _for_get_a(a_ptr, (a->cols - 1) * ch + k) * (G025 + G125)); \
696 _for_set(row, (a->cols - 1) * 2 * ch + ch + k, _for_get_a(a_ptr, (a->cols - 2) * ch + k) * G125 + _for_get_a(a_ptr, (a->cols - 1) * ch + k) * (G025 + G075)); \
697 }
698 ccv_matrix_getter_float_only(a->type, ccv_matrix_setter_getter_float_only, no_8u_type, ccv_matrix_setter_b, db->type, for_block){ switch (((a->type) & 0xFF000)) { case CCV_32F: { { switch
(((no_8u_type) & 0xFF000)) { case CCV_32F: { { switch ((
(db->type) & 0xFF000)) { case CCV_32S: { for_block(_ccv_get_32f_value
, _ccv_set_32f_value, _ccv_get_32f_value, _ccv_set_32s_value)
; break; } case CCV_32F: { for_block(_ccv_get_32f_value, _ccv_set_32f_value
, _ccv_get_32f_value, _ccv_set_32f_value); break; } case CCV_64S
: { for_block(_ccv_get_32f_value, _ccv_set_32f_value, _ccv_get_32f_value
, _ccv_set_64s_value); break; } case CCV_64F: { for_block(_ccv_get_32f_value
, _ccv_set_32f_value, _ccv_get_32f_value, _ccv_set_64f_value)
; break; } default: { for_block(_ccv_get_32f_value, _ccv_set_32f_value
, _ccv_get_32f_value, _ccv_set_8u_value); } } }; break; } case
CCV_64F: { { switch (((db->type) & 0xFF000)) { case CCV_32S
: { for_block(_ccv_get_32f_value, _ccv_set_64f_value, _ccv_get_64f_value
, _ccv_set_32s_value); break; } case CCV_32F: { for_block(_ccv_get_32f_value
, _ccv_set_64f_value, _ccv_get_64f_value, _ccv_set_32f_value)
; break; } case CCV_64S: { for_block(_ccv_get_32f_value, _ccv_set_64f_value
, _ccv_get_64f_value, _ccv_set_64s_value); break; } case CCV_64F
: { for_block(_ccv_get_32f_value, _ccv_set_64f_value, _ccv_get_64f_value
, _ccv_set_64f_value); break; } default: { for_block(_ccv_get_32f_value
, _ccv_set_64f_value, _ccv_get_64f_value, _ccv_set_8u_value);
} } }; break; } default: { ((void) sizeof (((no_8u_type &
CCV_32F) || (no_8u_type & CCV_64F)) ? 1 : 0), __extension__
({ if ((no_8u_type & CCV_32F) || (no_8u_type & CCV_64F
)) ; else __assert_fail ("(no_8u_type & CCV_32F) || (no_8u_type & CCV_64F)"
, "ccv_resample.c", 698, __extension__ __PRETTY_FUNCTION__); }
)); } } }; break; } case CCV_64F: { { switch (((no_8u_type) &
0xFF000)) { case CCV_32F: { { switch (((db->type) & 0xFF000
)) { case CCV_32S: { for_block(_ccv_get_64f_value, _ccv_set_32f_value
, _ccv_get_32f_value, _ccv_set_32s_value); break; } case CCV_32F
: { for_block(_ccv_get_64f_value, _ccv_set_32f_value, _ccv_get_32f_value
, _ccv_set_32f_value); break; } case CCV_64S: { for_block(_ccv_get_64f_value
, _ccv_set_32f_value, _ccv_get_32f_value, _ccv_set_64s_value)
; break; } case CCV_64F: { for_block(_ccv_get_64f_value, _ccv_set_32f_value
, _ccv_get_32f_value, _ccv_set_64f_value); break; } default: {
for_block(_ccv_get_64f_value, _ccv_set_32f_value, _ccv_get_32f_value
, _ccv_set_8u_value); } } }; break; } case CCV_64F: { { switch
(((db->type) & 0xFF000)) { case CCV_32S: { for_block(
_ccv_get_64f_value, _ccv_set_64f_value, _ccv_get_64f_value, _ccv_set_32s_value
); break; } case CCV_32F: { for_block(_ccv_get_64f_value, _ccv_set_64f_value
, _ccv_get_64f_value, _ccv_set_32f_value); break; } case CCV_64S
: { for_block(_ccv_get_64f_value, _ccv_set_64f_value, _ccv_get_64f_value
, _ccv_set_64s_value); break; } case CCV_64F: { for_block(_ccv_get_64f_value
, _ccv_set_64f_value, _ccv_get_64f_value, _ccv_set_64f_value)
; break; } default: { for_block(_ccv_get_64f_value, _ccv_set_64f_value
, _ccv_get_64f_value, _ccv_set_8u_value); } } }; break; } default
: { ((void) sizeof (((no_8u_type & CCV_32F) || (no_8u_type
& CCV_64F)) ? 1 : 0), __extension__ ({ if ((no_8u_type &
CCV_32F) || (no_8u_type & CCV_64F)) ; else __assert_fail
("(no_8u_type & CCV_32F) || (no_8u_type & CCV_64F)",
"ccv_resample.c", 698, __extension__ __PRETTY_FUNCTION__); }
)); } } }; break; } default: { ((void) sizeof (((a->type &
CCV_32F) || (a->type & CCV_64F)) ? 1 : 0), __extension__
({ if ((a->type & CCV_32F) || (a->type & CCV_64F
)) ; else __assert_fail ("(a->type & CCV_32F) || (a->type & CCV_64F)"
, "ccv_resample.c", 698, __extension__ __PRETTY_FUNCTION__); }
)); } } }
;
699#undef x_block
700 }
701#undef GALL
702#undef G125
703#undef G075
704#undef G025
705 }
706#undef for_block
707 if (workspace)
708 ccfreefree(workspace);
709}