1 /* Generated by Cython 0.25.2 */
3 #define PY_SSIZE_T_CLEAN
6 #error Python headers needed to compile C extensions, please install development version of Python.
7 #elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03020000)
8 #error Cython requires Python 2.6+ or Python 3.2+.
10 #define CYTHON_ABI "0_25_2"
13 #define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
15 #if !defined(WIN32) && !defined(MS_WINDOWS)
27 #define DL_IMPORT(t) t
30 #define DL_EXPORT(t) t
32 #ifndef HAVE_LONG_LONG
33 #if PY_VERSION_HEX >= 0x03030000 || (PY_MAJOR_VERSION == 2 && PY_VERSION_HEX >= 0x02070000)
34 #define HAVE_LONG_LONG
38 #define PY_LONG_LONG LONG_LONG
41 #define Py_HUGE_VAL HUGE_VAL
44 #define CYTHON_COMPILING_IN_PYPY 1
45 #define CYTHON_COMPILING_IN_PYSTON 0
46 #define CYTHON_COMPILING_IN_CPYTHON 0
47 #undef CYTHON_USE_TYPE_SLOTS
48 #define CYTHON_USE_TYPE_SLOTS 0
49 #undef CYTHON_USE_ASYNC_SLOTS
50 #define CYTHON_USE_ASYNC_SLOTS 0
51 #undef CYTHON_USE_PYLIST_INTERNALS
52 #define CYTHON_USE_PYLIST_INTERNALS 0
53 #undef CYTHON_USE_UNICODE_INTERNALS
54 #define CYTHON_USE_UNICODE_INTERNALS 0
55 #undef CYTHON_USE_UNICODE_WRITER
56 #define CYTHON_USE_UNICODE_WRITER 0
57 #undef CYTHON_USE_PYLONG_INTERNALS
58 #define CYTHON_USE_PYLONG_INTERNALS 0
59 #undef CYTHON_AVOID_BORROWED_REFS
60 #define CYTHON_AVOID_BORROWED_REFS 1
61 #undef CYTHON_ASSUME_SAFE_MACROS
62 #define CYTHON_ASSUME_SAFE_MACROS 0
63 #undef CYTHON_UNPACK_METHODS
64 #define CYTHON_UNPACK_METHODS 0
65 #undef CYTHON_FAST_THREAD_STATE
66 #define CYTHON_FAST_THREAD_STATE 0
67 #undef CYTHON_FAST_PYCALL
68 #define CYTHON_FAST_PYCALL 0
69 #elif defined(PYSTON_VERSION)
70 #define CYTHON_COMPILING_IN_PYPY 0
71 #define CYTHON_COMPILING_IN_PYSTON 1
72 #define CYTHON_COMPILING_IN_CPYTHON 0
73 #ifndef CYTHON_USE_TYPE_SLOTS
74 #define CYTHON_USE_TYPE_SLOTS 1
76 #undef CYTHON_USE_ASYNC_SLOTS
77 #define CYTHON_USE_ASYNC_SLOTS 0
78 #undef CYTHON_USE_PYLIST_INTERNALS
79 #define CYTHON_USE_PYLIST_INTERNALS 0
80 #ifndef CYTHON_USE_UNICODE_INTERNALS
81 #define CYTHON_USE_UNICODE_INTERNALS 1
83 #undef CYTHON_USE_UNICODE_WRITER
84 #define CYTHON_USE_UNICODE_WRITER 0
85 #undef CYTHON_USE_PYLONG_INTERNALS
86 #define CYTHON_USE_PYLONG_INTERNALS 0
87 #ifndef CYTHON_AVOID_BORROWED_REFS
88 #define CYTHON_AVOID_BORROWED_REFS 0
90 #ifndef CYTHON_ASSUME_SAFE_MACROS
91 #define CYTHON_ASSUME_SAFE_MACROS 1
93 #ifndef CYTHON_UNPACK_METHODS
94 #define CYTHON_UNPACK_METHODS 1
96 #undef CYTHON_FAST_THREAD_STATE
97 #define CYTHON_FAST_THREAD_STATE 0
98 #undef CYTHON_FAST_PYCALL
99 #define CYTHON_FAST_PYCALL 0
101 #define CYTHON_COMPILING_IN_PYPY 0
102 #define CYTHON_COMPILING_IN_PYSTON 0
103 #define CYTHON_COMPILING_IN_CPYTHON 1
104 #ifndef CYTHON_USE_TYPE_SLOTS
105 #define CYTHON_USE_TYPE_SLOTS 1
107 #if PY_MAJOR_VERSION < 3
108 #undef CYTHON_USE_ASYNC_SLOTS
109 #define CYTHON_USE_ASYNC_SLOTS 0
110 #elif !defined(CYTHON_USE_ASYNC_SLOTS)
111 #define CYTHON_USE_ASYNC_SLOTS 1
113 #if PY_VERSION_HEX < 0x02070000
114 #undef CYTHON_USE_PYLONG_INTERNALS
115 #define CYTHON_USE_PYLONG_INTERNALS 0
116 #elif !defined(CYTHON_USE_PYLONG_INTERNALS)
117 #define CYTHON_USE_PYLONG_INTERNALS 1
119 #ifndef CYTHON_USE_PYLIST_INTERNALS
120 #define CYTHON_USE_PYLIST_INTERNALS 1
122 #ifndef CYTHON_USE_UNICODE_INTERNALS
123 #define CYTHON_USE_UNICODE_INTERNALS 1
125 #if PY_VERSION_HEX < 0x030300F0
126 #undef CYTHON_USE_UNICODE_WRITER
127 #define CYTHON_USE_UNICODE_WRITER 0
128 #elif !defined(CYTHON_USE_UNICODE_WRITER)
129 #define CYTHON_USE_UNICODE_WRITER 1
131 #ifndef CYTHON_AVOID_BORROWED_REFS
132 #define CYTHON_AVOID_BORROWED_REFS 0
134 #ifndef CYTHON_ASSUME_SAFE_MACROS
135 #define CYTHON_ASSUME_SAFE_MACROS 1
137 #ifndef CYTHON_UNPACK_METHODS
138 #define CYTHON_UNPACK_METHODS 1
140 #ifndef CYTHON_FAST_THREAD_STATE
141 #define CYTHON_FAST_THREAD_STATE 1
143 #ifndef CYTHON_FAST_PYCALL
144 #define CYTHON_FAST_PYCALL 1
147 #if !defined(CYTHON_FAST_PYCCALL)
148 #define CYTHON_FAST_PYCCALL (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1)
150 #if CYTHON_USE_PYLONG_INTERNALS
151 #include "longintrepr.h"
156 #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag)
157 #define Py_OptimizeFlag 0
159 #define __PYX_BUILD_PY_SSIZE_T "n"
160 #define CYTHON_FORMAT_SSIZE_T "z"
161 #if PY_MAJOR_VERSION < 3
162 #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
163 #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
164 PyCode_New(a+k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
165 #define __Pyx_DefaultClassType PyClass_Type
167 #define __Pyx_BUILTIN_MODULE_NAME "builtins"
168 #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\
169 PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)
170 #define __Pyx_DefaultClassType PyType_Type
172 #ifndef Py_TPFLAGS_CHECKTYPES
173 #define Py_TPFLAGS_CHECKTYPES 0
175 #ifndef Py_TPFLAGS_HAVE_INDEX
176 #define Py_TPFLAGS_HAVE_INDEX 0
178 #ifndef Py_TPFLAGS_HAVE_NEWBUFFER
179 #define Py_TPFLAGS_HAVE_NEWBUFFER 0
181 #ifndef Py_TPFLAGS_HAVE_FINALIZE
182 #define Py_TPFLAGS_HAVE_FINALIZE 0
184 #ifndef METH_FASTCALL
185 #define METH_FASTCALL 0x80
186 typedef PyObject *(*__Pyx_PyCFunctionFast) (PyObject *self, PyObject **args,
187 Py_ssize_t nargs, PyObject *kwnames);
189 #define __Pyx_PyCFunctionFast _PyCFunctionFast
191 #if CYTHON_FAST_PYCCALL
192 #define __Pyx_PyFastCFunction_Check(func)\
193 ((PyCFunction_Check(func) && (METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST)))))
195 #define __Pyx_PyFastCFunction_Check(func) 0
197 #if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
198 #define CYTHON_PEP393_ENABLED 1
199 #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ?\
200 0 : _PyUnicode_Ready((PyObject *)(op)))
201 #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u)
202 #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i)
203 #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) PyUnicode_MAX_CHAR_VALUE(u)
204 #define __Pyx_PyUnicode_KIND(u) PyUnicode_KIND(u)
205 #define __Pyx_PyUnicode_DATA(u) PyUnicode_DATA(u)
206 #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i)
207 #define __Pyx_PyUnicode_WRITE(k, d, i, ch) PyUnicode_WRITE(k, d, i, ch)
208 #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u)))
210 #define CYTHON_PEP393_ENABLED 0
211 #define PyUnicode_1BYTE_KIND 1
212 #define PyUnicode_2BYTE_KIND 2
213 #define PyUnicode_4BYTE_KIND 4
214 #define __Pyx_PyUnicode_READY(op) (0)
215 #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u)
216 #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i]))
217 #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) ((sizeof(Py_UNICODE) == 2) ? 65535 : 1114111)
218 #define __Pyx_PyUnicode_KIND(u) (sizeof(Py_UNICODE))
219 #define __Pyx_PyUnicode_DATA(u) ((void*)PyUnicode_AS_UNICODE(u))
220 #define __Pyx_PyUnicode_READ(k, d, i) ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i]))
221 #define __Pyx_PyUnicode_WRITE(k, d, i, ch) (((void)(k)), ((Py_UNICODE*)d)[i] = ch)
222 #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_SIZE(u))
224 #if CYTHON_COMPILING_IN_PYPY
225 #define __Pyx_PyUnicode_Concat(a, b) PyNumber_Add(a, b)
226 #define __Pyx_PyUnicode_ConcatSafe(a, b) PyNumber_Add(a, b)
228 #define __Pyx_PyUnicode_Concat(a, b) PyUnicode_Concat(a, b)
229 #define __Pyx_PyUnicode_ConcatSafe(a, b) ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\
230 PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b))
232 #if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains)
233 #define PyUnicode_Contains(u, s) PySequence_Contains(u, s)
235 #if CYTHON_COMPILING_IN_PYPY && !defined(PyByteArray_Check)
236 #define PyByteArray_Check(obj) PyObject_TypeCheck(obj, &PyByteArray_Type)
238 #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Format)
239 #define PyObject_Format(obj, fmt) PyObject_CallMethod(obj, "__format__", "O", fmt)
241 #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc)
242 #define PyObject_Malloc(s) PyMem_Malloc(s)
243 #define PyObject_Free(p) PyMem_Free(p)
244 #define PyObject_Realloc(p) PyMem_Realloc(p)
246 #if CYTHON_COMPILING_IN_PYSTON
247 #define __Pyx_PyCode_HasFreeVars(co) PyCode_HasFreeVars(co)
248 #define __Pyx_PyFrame_SetLineNumber(frame, lineno) PyFrame_SetLineNumber(frame, lineno)
250 #define __Pyx_PyCode_HasFreeVars(co) (PyCode_GetNumFree(co) > 0)
251 #define __Pyx_PyFrame_SetLineNumber(frame, lineno) (frame)->f_lineno = (lineno)
253 #define __Pyx_PyString_FormatSafe(a, b) ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b))
254 #define __Pyx_PyUnicode_FormatSafe(a, b) ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b))
255 #if PY_MAJOR_VERSION >= 3
256 #define __Pyx_PyString_Format(a, b) PyUnicode_Format(a, b)
258 #define __Pyx_PyString_Format(a, b) PyString_Format(a, b)
260 #if PY_MAJOR_VERSION < 3 && !defined(PyObject_ASCII)
261 #define PyObject_ASCII(o) PyObject_Repr(o)
263 #if PY_MAJOR_VERSION >= 3
264 #define PyBaseString_Type PyUnicode_Type
265 #define PyStringObject PyUnicodeObject
266 #define PyString_Type PyUnicode_Type
267 #define PyString_Check PyUnicode_Check
268 #define PyString_CheckExact PyUnicode_CheckExact
270 #if PY_MAJOR_VERSION >= 3
271 #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj)
272 #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj)
274 #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj))
275 #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj))
277 #ifndef PySet_CheckExact
278 #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type)
280 #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
281 #define __Pyx_PyException_Check(obj) __Pyx_TypeCheck(obj, PyExc_Exception)
282 #if PY_MAJOR_VERSION >= 3
283 #define PyIntObject PyLongObject
284 #define PyInt_Type PyLong_Type
285 #define PyInt_Check(op) PyLong_Check(op)
286 #define PyInt_CheckExact(op) PyLong_CheckExact(op)
287 #define PyInt_FromString PyLong_FromString
288 #define PyInt_FromUnicode PyLong_FromUnicode
289 #define PyInt_FromLong PyLong_FromLong
290 #define PyInt_FromSize_t PyLong_FromSize_t
291 #define PyInt_FromSsize_t PyLong_FromSsize_t
292 #define PyInt_AsLong PyLong_AsLong
293 #define PyInt_AS_LONG PyLong_AS_LONG
294 #define PyInt_AsSsize_t PyLong_AsSsize_t
295 #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask
296 #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
297 #define PyNumber_Int PyNumber_Long
299 #if PY_MAJOR_VERSION >= 3
300 #define PyBoolObject PyLongObject
302 #if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY
303 #ifndef PyUnicode_InternFromString
304 #define PyUnicode_InternFromString(s) PyUnicode_FromString(s)
307 #if PY_VERSION_HEX < 0x030200A4
308 typedef long Py_hash_t;
309 #define __Pyx_PyInt_FromHash_t PyInt_FromLong
310 #define __Pyx_PyInt_AsHash_t PyInt_AsLong
312 #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
313 #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t
315 #if PY_MAJOR_VERSION >= 3
316 #define __Pyx_PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func))
318 #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass)
320 #if CYTHON_USE_ASYNC_SLOTS
321 #if PY_VERSION_HEX >= 0x030500B1
322 #define __Pyx_PyAsyncMethodsStruct PyAsyncMethods
323 #define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async)
329 } __Pyx_PyAsyncMethodsStruct;
330 #define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved))
333 #define __Pyx_PyType_AsAsync(obj) NULL
335 #ifndef CYTHON_RESTRICT
336 #if defined(__GNUC__)
337 #define CYTHON_RESTRICT __restrict__
338 #elif defined(_MSC_VER) && _MSC_VER >= 1400
339 #define CYTHON_RESTRICT __restrict
340 #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
341 #define CYTHON_RESTRICT restrict
343 #define CYTHON_RESTRICT
346 #ifndef CYTHON_UNUSED
347 # if defined(__GNUC__)
348 # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
349 # define CYTHON_UNUSED __attribute__ ((__unused__))
351 # define CYTHON_UNUSED
353 # elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
354 # define CYTHON_UNUSED __attribute__ ((__unused__))
356 # define CYTHON_UNUSED
359 #ifndef CYTHON_MAYBE_UNUSED_VAR
360 # if defined(__cplusplus)
361 template<class T> void CYTHON_MAYBE_UNUSED_VAR( const T& ) { }
363 # define CYTHON_MAYBE_UNUSED_VAR(x) (void)(x)
366 #ifndef CYTHON_NCP_UNUSED
367 # if CYTHON_COMPILING_IN_CPYTHON
368 # define CYTHON_NCP_UNUSED
370 # define CYTHON_NCP_UNUSED CYTHON_UNUSED
373 #define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None)
375 #ifndef CYTHON_INLINE
376 #if defined(__clang__)
377 #define CYTHON_INLINE __inline__ __attribute__ ((__unused__))
378 #elif defined(__GNUC__)
379 #define CYTHON_INLINE __inline__
380 #elif defined(_MSC_VER)
381 #define CYTHON_INLINE __inline
382 #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
383 #define CYTHON_INLINE inline
385 #define CYTHON_INLINE
389 #if defined(WIN32) || defined(MS_WINDOWS)
390 #define _USE_MATH_DEFINES
394 #define __PYX_NAN() ((float) NAN)
396 static CYTHON_INLINE float __PYX_NAN() {
398 memset(&value, 0xFF, sizeof(value));
402 #if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL)
403 #define __Pyx_truncl trunc
405 #define __Pyx_truncl truncl
409 #define __PYX_ERR(f_index, lineno, Ln_error) \
411 __pyx_filename = __pyx_f[f_index]; __pyx_lineno = lineno; __pyx_clineno = __LINE__; goto Ln_error; \
414 #if PY_MAJOR_VERSION >= 3
415 #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y)
416 #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y)
418 #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y)
419 #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y)
422 #ifndef __PYX_EXTERN_C
424 #define __PYX_EXTERN_C extern "C"
426 #define __PYX_EXTERN_C extern
430 #define __PYX_HAVE__pycocotools___mask
431 #define __PYX_HAVE_API__pycocotools___mask
435 #include "numpy/arrayobject.h"
436 #include "numpy/ufuncobject.h"
442 #ifdef PYREX_WITHOUT_ASSERTIONS
443 #define CYTHON_WITHOUT_ASSERTIONS
446 typedef struct {PyObject **p; const char *s; const Py_ssize_t n; const char* encoding;
447 const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry;
449 #define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
450 #define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT 0
451 #define __PYX_DEFAULT_STRING_ENCODING ""
452 #define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString
453 #define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
454 #define __Pyx_uchar_cast(c) ((unsigned char)c)
455 #define __Pyx_long_cast(x) ((long)x)
456 #define __Pyx_fits_Py_ssize_t(v, type, is_signed) (\
457 (sizeof(type) < sizeof(Py_ssize_t)) ||\
458 (sizeof(type) > sizeof(Py_ssize_t) &&\
459 likely(v < (type)PY_SSIZE_T_MAX ||\
460 v == (type)PY_SSIZE_T_MAX) &&\
461 (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\
462 v == (type)PY_SSIZE_T_MIN))) ||\
463 (sizeof(type) == sizeof(Py_ssize_t) &&\
464 (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\
465 v == (type)PY_SSIZE_T_MAX))) )
466 #if defined (__cplusplus) && __cplusplus >= 201103L
468 #define __Pyx_sst_abs(value) std::abs(value)
469 #elif SIZEOF_INT >= SIZEOF_SIZE_T
470 #define __Pyx_sst_abs(value) abs(value)
471 #elif SIZEOF_LONG >= SIZEOF_SIZE_T
472 #define __Pyx_sst_abs(value) labs(value)
473 #elif defined (_MSC_VER) && defined (_M_X64)
474 #define __Pyx_sst_abs(value) _abs64(value)
475 #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
476 #define __Pyx_sst_abs(value) llabs(value)
477 #elif defined (__GNUC__)
478 #define __Pyx_sst_abs(value) __builtin_llabs(value)
480 #define __Pyx_sst_abs(value) ((value<0) ? -value : value)
482 static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject*);
483 static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
484 #define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s))
485 #define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l)
486 #define __Pyx_PyBytes_FromString PyBytes_FromString
487 #define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
488 static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*);
489 #if PY_MAJOR_VERSION < 3
490 #define __Pyx_PyStr_FromString __Pyx_PyBytes_FromString
491 #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
493 #define __Pyx_PyStr_FromString __Pyx_PyUnicode_FromString
494 #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
496 #define __Pyx_PyObject_AsSString(s) ((signed char*) __Pyx_PyObject_AsString(s))
497 #define __Pyx_PyObject_AsUString(s) ((unsigned char*) __Pyx_PyObject_AsString(s))
498 #define __Pyx_PyObject_FromCString(s) __Pyx_PyObject_FromString((const char*)s)
499 #define __Pyx_PyBytes_FromCString(s) __Pyx_PyBytes_FromString((const char*)s)
500 #define __Pyx_PyByteArray_FromCString(s) __Pyx_PyByteArray_FromString((const char*)s)
501 #define __Pyx_PyStr_FromCString(s) __Pyx_PyStr_FromString((const char*)s)
502 #define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s)
503 #if PY_MAJOR_VERSION < 3
504 static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u)
506 const Py_UNICODE *u_end = u;
508 return (size_t)(u_end - u - 1);
511 #define __Pyx_Py_UNICODE_strlen Py_UNICODE_strlen
513 #define __Pyx_PyUnicode_FromUnicode(u) PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u))
514 #define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode
515 #define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode
516 #define __Pyx_NewRef(obj) (Py_INCREF(obj), obj)
517 #define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None)
518 #define __Pyx_PyBool_FromLong(b) ((b) ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False))
519 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
520 static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x);
521 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
522 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
523 #if CYTHON_ASSUME_SAFE_MACROS
524 #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
526 #define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
528 #define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
529 #if PY_MAJOR_VERSION >= 3
530 #define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x))
532 #define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x))
534 #define __Pyx_PyNumber_Float(x) (PyFloat_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Float(x))
535 #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
536 static int __Pyx_sys_getdefaultencoding_not_ascii;
537 static int __Pyx_init_sys_getdefaultencoding_params(void) {
539 PyObject* default_encoding = NULL;
540 PyObject* ascii_chars_u = NULL;
541 PyObject* ascii_chars_b = NULL;
542 const char* default_encoding_c;
543 sys = PyImport_ImportModule("sys");
545 default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL);
547 if (!default_encoding) goto bad;
548 default_encoding_c = PyBytes_AsString(default_encoding);
549 if (!default_encoding_c) goto bad;
550 if (strcmp(default_encoding_c, "ascii") == 0) {
551 __Pyx_sys_getdefaultencoding_not_ascii = 0;
553 char ascii_chars[128];
555 for (c = 0; c < 128; c++) {
558 __Pyx_sys_getdefaultencoding_not_ascii = 1;
559 ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL);
560 if (!ascii_chars_u) goto bad;
561 ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL);
562 if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) {
565 "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.",
569 Py_DECREF(ascii_chars_u);
570 Py_DECREF(ascii_chars_b);
572 Py_DECREF(default_encoding);
575 Py_XDECREF(default_encoding);
576 Py_XDECREF(ascii_chars_u);
577 Py_XDECREF(ascii_chars_b);
581 #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3
582 #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
584 #define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
585 #if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
586 static char* __PYX_DEFAULT_STRING_ENCODING;
587 static int __Pyx_init_sys_getdefaultencoding_params(void) {
589 PyObject* default_encoding = NULL;
590 char* default_encoding_c;
591 sys = PyImport_ImportModule("sys");
593 default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
595 if (!default_encoding) goto bad;
596 default_encoding_c = PyBytes_AsString(default_encoding);
597 if (!default_encoding_c) goto bad;
598 __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c));
599 if (!__PYX_DEFAULT_STRING_ENCODING) goto bad;
600 strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c);
601 Py_DECREF(default_encoding);
604 Py_XDECREF(default_encoding);
611 /* Test for GCC > 2.95 */
612 #if defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))
613 #define likely(x) __builtin_expect(!!(x), 1)
614 #define unlikely(x) __builtin_expect(!!(x), 0)
615 #else /* !__GNUC__ or GCC < 2.95 */
616 #define likely(x) (x)
617 #define unlikely(x) (x)
618 #endif /* __GNUC__ */
620 static PyObject *__pyx_m;
621 static PyObject *__pyx_d;
622 static PyObject *__pyx_b;
623 static PyObject *__pyx_empty_tuple;
624 static PyObject *__pyx_empty_bytes;
625 static PyObject *__pyx_empty_unicode;
626 static int __pyx_lineno;
627 static int __pyx_clineno = 0;
628 static const char * __pyx_cfilenm= __FILE__;
629 static const char *__pyx_filename;
632 #if !defined(CYTHON_CCOMPLEX)
633 #if defined(__cplusplus)
634 #define CYTHON_CCOMPLEX 1
635 #elif defined(_Complex_I)
636 #define CYTHON_CCOMPLEX 1
638 #define CYTHON_CCOMPLEX 0
648 #if CYTHON_CCOMPLEX && !defined(__cplusplus) && defined(__sun__) && defined(__GNUC__)
650 #define _Complex_I 1.0fj
654 static const char *__pyx_f[] = {
655 "pycocotools/_mask.pyx",
659 /* BufferFormatStructs.proto */
660 #define IS_UNSIGNED(type) (((type) -1) > 0)
661 struct __Pyx_StructField_;
662 #define __PYX_BUF_FLAGS_PACKED_STRUCT (1 << 0)
665 struct __Pyx_StructField_* fields;
673 typedef struct __Pyx_StructField_ {
674 __Pyx_TypeInfo* type;
679 __Pyx_StructField* field;
680 size_t parent_offset;
681 } __Pyx_BufFmt_StackElem;
683 __Pyx_StructField root;
684 __Pyx_BufFmt_StackElem* head;
686 size_t new_count, enc_count;
687 size_t struct_alignment;
693 } __Pyx_BufFmt_Context;
696 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":725
697 * # in Cython to enable them only on the right systems.
699 * ctypedef npy_int8 int8_t # <<<<<<<<<<<<<<
700 * ctypedef npy_int16 int16_t
701 * ctypedef npy_int32 int32_t
703 typedef npy_int8 __pyx_t_5numpy_int8_t;
705 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":726
707 * ctypedef npy_int8 int8_t
708 * ctypedef npy_int16 int16_t # <<<<<<<<<<<<<<
709 * ctypedef npy_int32 int32_t
710 * ctypedef npy_int64 int64_t
712 typedef npy_int16 __pyx_t_5numpy_int16_t;
714 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":727
715 * ctypedef npy_int8 int8_t
716 * ctypedef npy_int16 int16_t
717 * ctypedef npy_int32 int32_t # <<<<<<<<<<<<<<
718 * ctypedef npy_int64 int64_t
719 * #ctypedef npy_int96 int96_t
721 typedef npy_int32 __pyx_t_5numpy_int32_t;
723 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":728
724 * ctypedef npy_int16 int16_t
725 * ctypedef npy_int32 int32_t
726 * ctypedef npy_int64 int64_t # <<<<<<<<<<<<<<
727 * #ctypedef npy_int96 int96_t
728 * #ctypedef npy_int128 int128_t
730 typedef npy_int64 __pyx_t_5numpy_int64_t;
732 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":732
733 * #ctypedef npy_int128 int128_t
735 * ctypedef npy_uint8 uint8_t # <<<<<<<<<<<<<<
736 * ctypedef npy_uint16 uint16_t
737 * ctypedef npy_uint32 uint32_t
739 typedef npy_uint8 __pyx_t_5numpy_uint8_t;
741 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":733
743 * ctypedef npy_uint8 uint8_t
744 * ctypedef npy_uint16 uint16_t # <<<<<<<<<<<<<<
745 * ctypedef npy_uint32 uint32_t
746 * ctypedef npy_uint64 uint64_t
748 typedef npy_uint16 __pyx_t_5numpy_uint16_t;
750 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":734
751 * ctypedef npy_uint8 uint8_t
752 * ctypedef npy_uint16 uint16_t
753 * ctypedef npy_uint32 uint32_t # <<<<<<<<<<<<<<
754 * ctypedef npy_uint64 uint64_t
755 * #ctypedef npy_uint96 uint96_t
757 typedef npy_uint32 __pyx_t_5numpy_uint32_t;
759 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":735
760 * ctypedef npy_uint16 uint16_t
761 * ctypedef npy_uint32 uint32_t
762 * ctypedef npy_uint64 uint64_t # <<<<<<<<<<<<<<
763 * #ctypedef npy_uint96 uint96_t
764 * #ctypedef npy_uint128 uint128_t
766 typedef npy_uint64 __pyx_t_5numpy_uint64_t;
768 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":739
769 * #ctypedef npy_uint128 uint128_t
771 * ctypedef npy_float32 float32_t # <<<<<<<<<<<<<<
772 * ctypedef npy_float64 float64_t
773 * #ctypedef npy_float80 float80_t
775 typedef npy_float32 __pyx_t_5numpy_float32_t;
777 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":740
779 * ctypedef npy_float32 float32_t
780 * ctypedef npy_float64 float64_t # <<<<<<<<<<<<<<
781 * #ctypedef npy_float80 float80_t
782 * #ctypedef npy_float128 float128_t
784 typedef npy_float64 __pyx_t_5numpy_float64_t;
786 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":749
787 * # The int types are mapped a bit surprising --
788 * # numpy.int corresponds to 'l' and numpy.long to 'q'
789 * ctypedef npy_long int_t # <<<<<<<<<<<<<<
790 * ctypedef npy_longlong long_t
791 * ctypedef npy_longlong longlong_t
793 typedef npy_long __pyx_t_5numpy_int_t;
795 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":750
796 * # numpy.int corresponds to 'l' and numpy.long to 'q'
797 * ctypedef npy_long int_t
798 * ctypedef npy_longlong long_t # <<<<<<<<<<<<<<
799 * ctypedef npy_longlong longlong_t
802 typedef npy_longlong __pyx_t_5numpy_long_t;
804 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":751
805 * ctypedef npy_long int_t
806 * ctypedef npy_longlong long_t
807 * ctypedef npy_longlong longlong_t # <<<<<<<<<<<<<<
809 * ctypedef npy_ulong uint_t
811 typedef npy_longlong __pyx_t_5numpy_longlong_t;
813 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":753
814 * ctypedef npy_longlong longlong_t
816 * ctypedef npy_ulong uint_t # <<<<<<<<<<<<<<
817 * ctypedef npy_ulonglong ulong_t
818 * ctypedef npy_ulonglong ulonglong_t
820 typedef npy_ulong __pyx_t_5numpy_uint_t;
822 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":754
824 * ctypedef npy_ulong uint_t
825 * ctypedef npy_ulonglong ulong_t # <<<<<<<<<<<<<<
826 * ctypedef npy_ulonglong ulonglong_t
829 typedef npy_ulonglong __pyx_t_5numpy_ulong_t;
831 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":755
832 * ctypedef npy_ulong uint_t
833 * ctypedef npy_ulonglong ulong_t
834 * ctypedef npy_ulonglong ulonglong_t # <<<<<<<<<<<<<<
836 * ctypedef npy_intp intp_t
838 typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t;
840 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":757
841 * ctypedef npy_ulonglong ulonglong_t
843 * ctypedef npy_intp intp_t # <<<<<<<<<<<<<<
844 * ctypedef npy_uintp uintp_t
847 typedef npy_intp __pyx_t_5numpy_intp_t;
849 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":758
851 * ctypedef npy_intp intp_t
852 * ctypedef npy_uintp uintp_t # <<<<<<<<<<<<<<
854 * ctypedef npy_double float_t
856 typedef npy_uintp __pyx_t_5numpy_uintp_t;
858 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":760
859 * ctypedef npy_uintp uintp_t
861 * ctypedef npy_double float_t # <<<<<<<<<<<<<<
862 * ctypedef npy_double double_t
863 * ctypedef npy_longdouble longdouble_t
865 typedef npy_double __pyx_t_5numpy_float_t;
867 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":761
869 * ctypedef npy_double float_t
870 * ctypedef npy_double double_t # <<<<<<<<<<<<<<
871 * ctypedef npy_longdouble longdouble_t
874 typedef npy_double __pyx_t_5numpy_double_t;
876 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":762
877 * ctypedef npy_double float_t
878 * ctypedef npy_double double_t
879 * ctypedef npy_longdouble longdouble_t # <<<<<<<<<<<<<<
881 * ctypedef npy_cfloat cfloat_t
883 typedef npy_longdouble __pyx_t_5numpy_longdouble_t;
884 /* Declarations.proto */
887 typedef ::std::complex< float > __pyx_t_float_complex;
889 typedef float _Complex __pyx_t_float_complex;
892 typedef struct { float real, imag; } __pyx_t_float_complex;
894 static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float, float);
896 /* Declarations.proto */
899 typedef ::std::complex< double > __pyx_t_double_complex;
901 typedef double _Complex __pyx_t_double_complex;
904 typedef struct { double real, imag; } __pyx_t_double_complex;
906 static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double, double);
909 /*--- Type declarations ---*/
910 struct __pyx_obj_11pycocotools_5_mask_RLEs;
911 struct __pyx_obj_11pycocotools_5_mask_Masks;
913 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":764
914 * ctypedef npy_longdouble longdouble_t
916 * ctypedef npy_cfloat cfloat_t # <<<<<<<<<<<<<<
917 * ctypedef npy_cdouble cdouble_t
918 * ctypedef npy_clongdouble clongdouble_t
920 typedef npy_cfloat __pyx_t_5numpy_cfloat_t;
922 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":765
924 * ctypedef npy_cfloat cfloat_t
925 * ctypedef npy_cdouble cdouble_t # <<<<<<<<<<<<<<
926 * ctypedef npy_clongdouble clongdouble_t
929 typedef npy_cdouble __pyx_t_5numpy_cdouble_t;
931 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":766
932 * ctypedef npy_cfloat cfloat_t
933 * ctypedef npy_cdouble cdouble_t
934 * ctypedef npy_clongdouble clongdouble_t # <<<<<<<<<<<<<<
936 * ctypedef npy_cdouble complex_t
938 typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t;
940 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":768
941 * ctypedef npy_clongdouble clongdouble_t
943 * ctypedef npy_cdouble complex_t # <<<<<<<<<<<<<<
945 * cdef inline object PyArray_MultiIterNew1(a):
947 typedef npy_cdouble __pyx_t_5numpy_complex_t;
949 /* "pycocotools/_mask.pyx":56
950 * # python class to wrap RLE array in C
951 * # the class handles the memory allocation and deallocation
952 * cdef class RLEs: # <<<<<<<<<<<<<<
956 struct __pyx_obj_11pycocotools_5_mask_RLEs {
963 /* "pycocotools/_mask.pyx":77
964 * # python class to wrap Mask array in C
965 * # the class handles the memory allocation and deallocation
966 * cdef class Masks: # <<<<<<<<<<<<<<
970 struct __pyx_obj_11pycocotools_5_mask_Masks {
979 /* --- Runtime support code (head) --- */
981 #ifndef CYTHON_REFNANNY
982 #define CYTHON_REFNANNY 0
986 void (*INCREF)(void*, PyObject*, int);
987 void (*DECREF)(void*, PyObject*, int);
988 void (*GOTREF)(void*, PyObject*, int);
989 void (*GIVEREF)(void*, PyObject*, int);
990 void* (*SetupContext)(const char*, int, const char*);
991 void (*FinishContext)(void**);
992 } __Pyx_RefNannyAPIStruct;
993 static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
994 static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname);
995 #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
997 #define __Pyx_RefNannySetupContext(name, acquire_gil)\
999 PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
1000 __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
1001 PyGILState_Release(__pyx_gilstate_save);\
1003 __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
1006 #define __Pyx_RefNannySetupContext(name, acquire_gil)\
1007 __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
1009 #define __Pyx_RefNannyFinishContext()\
1010 __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
1011 #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1012 #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1013 #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1014 #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
1015 #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0)
1016 #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0)
1017 #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0)
1018 #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0)
1020 #define __Pyx_RefNannyDeclarations
1021 #define __Pyx_RefNannySetupContext(name, acquire_gil)
1022 #define __Pyx_RefNannyFinishContext()
1023 #define __Pyx_INCREF(r) Py_INCREF(r)
1024 #define __Pyx_DECREF(r) Py_DECREF(r)
1025 #define __Pyx_GOTREF(r)
1026 #define __Pyx_GIVEREF(r)
1027 #define __Pyx_XINCREF(r) Py_XINCREF(r)
1028 #define __Pyx_XDECREF(r) Py_XDECREF(r)
1029 #define __Pyx_XGOTREF(r)
1030 #define __Pyx_XGIVEREF(r)
1032 #define __Pyx_XDECREF_SET(r, v) do {\
1033 PyObject *tmp = (PyObject *) r;\
1034 r = v; __Pyx_XDECREF(tmp);\
1036 #define __Pyx_DECREF_SET(r, v) do {\
1037 PyObject *tmp = (PyObject *) r;\
1038 r = v; __Pyx_DECREF(tmp);\
1040 #define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
1041 #define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)
1043 /* PyObjectGetAttrStr.proto */
1044 #if CYTHON_USE_TYPE_SLOTS
1045 static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
1046 PyTypeObject* tp = Py_TYPE(obj);
1047 if (likely(tp->tp_getattro))
1048 return tp->tp_getattro(obj, attr_name);
1049 #if PY_MAJOR_VERSION < 3
1050 if (likely(tp->tp_getattr))
1051 return tp->tp_getattr(obj, PyString_AS_STRING(attr_name));
1053 return PyObject_GetAttr(obj, attr_name);
1056 #define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
1059 /* GetBuiltinName.proto */
1060 static PyObject *__Pyx_GetBuiltinName(PyObject *name);
1062 /* RaiseDoubleKeywords.proto */
1063 static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name);
1065 /* ParseKeywords.proto */
1066 static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],\
1067 PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,\
1068 const char* function_name);
1070 /* RaiseArgTupleInvalid.proto */
1071 static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
1072 Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found);
1074 /* IncludeStringH.proto */
1077 /* BytesEquals.proto */
1078 static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals);
1080 /* UnicodeEquals.proto */
1081 static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals);
1083 /* StrEquals.proto */
1084 #if PY_MAJOR_VERSION >= 3
1085 #define __Pyx_PyString_Equals __Pyx_PyUnicode_Equals
1087 #define __Pyx_PyString_Equals __Pyx_PyBytes_Equals
1090 /* PyObjectCall.proto */
1091 #if CYTHON_COMPILING_IN_CPYTHON
1092 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw);
1094 #define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw)
1097 /* PyThreadStateGet.proto */
1098 #if CYTHON_FAST_THREAD_STATE
1099 #define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate;
1100 #define __Pyx_PyThreadState_assign __pyx_tstate = PyThreadState_GET();
1102 #define __Pyx_PyThreadState_declare
1103 #define __Pyx_PyThreadState_assign
1106 /* PyErrFetchRestore.proto */
1107 #if CYTHON_FAST_THREAD_STATE
1108 #define __Pyx_ErrRestoreWithState(type, value, tb) __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb)
1109 #define __Pyx_ErrFetchWithState(type, value, tb) __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb)
1110 #define __Pyx_ErrRestore(type, value, tb) __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb)
1111 #define __Pyx_ErrFetch(type, value, tb) __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb)
1112 static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
1113 static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1115 #define __Pyx_ErrRestoreWithState(type, value, tb) PyErr_Restore(type, value, tb)
1116 #define __Pyx_ErrFetchWithState(type, value, tb) PyErr_Fetch(type, value, tb)
1117 #define __Pyx_ErrRestore(type, value, tb) PyErr_Restore(type, value, tb)
1118 #define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb)
1121 /* RaiseException.proto */
1122 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause);
1124 /* ExtTypeTest.proto */
1125 static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type);
1127 /* ArgTypeTest.proto */
1128 static CYTHON_INLINE int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed,
1129 const char *name, int exact);
1131 /* ListAppend.proto */
1132 #if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
1133 static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) {
1134 PyListObject* L = (PyListObject*) list;
1135 Py_ssize_t len = Py_SIZE(list);
1136 if (likely(L->allocated > len) & likely(len > (L->allocated >> 1))) {
1138 PyList_SET_ITEM(list, len, x);
1139 Py_SIZE(list) = len+1;
1142 return PyList_Append(list, x);
1145 #define __Pyx_PyList_Append(L,x) PyList_Append(L,x)
1148 /* PyIntBinop.proto */
1149 #if !CYTHON_COMPILING_IN_PYPY
1150 static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, long intval, int inplace);
1152 #define __Pyx_PyInt_AddObjC(op1, op2, intval, inplace)\
1153 (inplace ? PyNumber_InPlaceAdd(op1, op2) : PyNumber_Add(op1, op2))
1156 /* PyIntBinop.proto */
1157 #if !CYTHON_COMPILING_IN_PYPY
1158 static PyObject* __Pyx_PyInt_EqObjC(PyObject *op1, PyObject *op2, long intval, int inplace);
1160 #define __Pyx_PyInt_EqObjC(op1, op2, intval, inplace)\
1161 PyObject_RichCompare(op1, op2, Py_EQ)
1164 /* GetModuleGlobalName.proto */
1165 static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name);
1167 /* PyCFunctionFastCall.proto */
1168 #if CYTHON_FAST_PYCCALL
1169 static CYTHON_INLINE PyObject *__Pyx_PyCFunction_FastCall(PyObject *func, PyObject **args, Py_ssize_t nargs);
1171 #define __Pyx_PyCFunction_FastCall(func, args, nargs) (assert(0), NULL)
1174 /* PyFunctionFastCall.proto */
1175 #if CYTHON_FAST_PYCALL
1176 #define __Pyx_PyFunction_FastCall(func, args, nargs)\
1177 __Pyx_PyFunction_FastCallDict((func), (args), (nargs), NULL)
1178 #if 1 || PY_VERSION_HEX < 0x030600B1
1179 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, int nargs, PyObject *kwargs);
1181 #define __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs) _PyFunction_FastCallDict(func, args, nargs, kwargs)
1185 /* PyObjectCallMethO.proto */
1186 #if CYTHON_COMPILING_IN_CPYTHON
1187 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg);
1190 /* PyObjectCallOneArg.proto */
1191 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg);
1193 /* GetItemInt.proto */
1194 #define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
1195 (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
1196 __Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck) :\
1197 (is_list ? (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL) :\
1198 __Pyx_GetItemInt_Generic(o, to_py_func(i))))
1199 #define __Pyx_GetItemInt_List(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
1200 (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
1201 __Pyx_GetItemInt_List_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
1202 (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL))
1203 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
1204 int wraparound, int boundscheck);
1205 #define __Pyx_GetItemInt_Tuple(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
1206 (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
1207 __Pyx_GetItemInt_Tuple_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
1208 (PyErr_SetString(PyExc_IndexError, "tuple index out of range"), (PyObject*)NULL))
1209 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
1210 int wraparound, int boundscheck);
1211 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j);
1212 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i,
1213 int is_list, int wraparound, int boundscheck);
1215 /* BufferFormatCheck.proto */
1216 static CYTHON_INLINE int __Pyx_GetBufferAndValidate(Py_buffer* buf, PyObject* obj,
1217 __Pyx_TypeInfo* dtype, int flags, int nd, int cast, __Pyx_BufFmt_StackElem* stack);
1218 static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info);
1219 static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts);
1220 static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx,
1221 __Pyx_BufFmt_StackElem* stack,
1222 __Pyx_TypeInfo* type); // PROTO
1224 /* ListCompAppend.proto */
1225 #if CYTHON_USE_PYLIST_INTERNALS && CYTHON_ASSUME_SAFE_MACROS
1226 static CYTHON_INLINE int __Pyx_ListComp_Append(PyObject* list, PyObject* x) {
1227 PyListObject* L = (PyListObject*) list;
1228 Py_ssize_t len = Py_SIZE(list);
1229 if (likely(L->allocated > len)) {
1231 PyList_SET_ITEM(list, len, x);
1232 Py_SIZE(list) = len+1;
1235 return PyList_Append(list, x);
1238 #define __Pyx_ListComp_Append(L,x) PyList_Append(L,x)
1241 /* FetchCommonType.proto */
1242 static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type);
1244 /* CythonFunction.proto */
1245 #define __Pyx_CyFunction_USED 1
1246 #include <structmember.h>
1247 #define __Pyx_CYFUNCTION_STATICMETHOD 0x01
1248 #define __Pyx_CYFUNCTION_CLASSMETHOD 0x02
1249 #define __Pyx_CYFUNCTION_CCLASS 0x04
1250 #define __Pyx_CyFunction_GetClosure(f)\
1251 (((__pyx_CyFunctionObject *) (f))->func_closure)
1252 #define __Pyx_CyFunction_GetClassObj(f)\
1253 (((__pyx_CyFunctionObject *) (f))->func_classobj)
1254 #define __Pyx_CyFunction_Defaults(type, f)\
1255 ((type *)(((__pyx_CyFunctionObject *) (f))->defaults))
1256 #define __Pyx_CyFunction_SetDefaultsGetter(f, g)\
1257 ((__pyx_CyFunctionObject *) (f))->defaults_getter = (g)
1259 PyCFunctionObject func;
1260 #if PY_VERSION_HEX < 0x030500A0
1261 PyObject *func_weakreflist;
1263 PyObject *func_dict;
1264 PyObject *func_name;
1265 PyObject *func_qualname;
1267 PyObject *func_globals;
1268 PyObject *func_code;
1269 PyObject *func_closure;
1270 PyObject *func_classobj;
1272 int defaults_pyobjects;
1274 PyObject *defaults_tuple;
1275 PyObject *defaults_kwdict;
1276 PyObject *(*defaults_getter)(PyObject *);
1277 PyObject *func_annotations;
1278 } __pyx_CyFunctionObject;
1279 static PyTypeObject *__pyx_CyFunctionType = 0;
1280 #define __Pyx_CyFunction_NewEx(ml, flags, qualname, self, module, globals, code)\
1281 __Pyx_CyFunction_New(__pyx_CyFunctionType, ml, flags, qualname, self, module, globals, code)
1282 static PyObject *__Pyx_CyFunction_New(PyTypeObject *, PyMethodDef *ml,
1283 int flags, PyObject* qualname,
1285 PyObject *module, PyObject *globals,
1287 static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *m,
1290 static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *m,
1292 static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *m,
1294 static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *m,
1296 static int __pyx_CyFunction_init(void);
1298 /* BufferFallbackError.proto */
1299 static void __Pyx_RaiseBufferFallbackError(void);
1302 static CYTHON_INLINE Py_ssize_t __Pyx_div_Py_ssize_t(Py_ssize_t, Py_ssize_t);
1304 /* BufferIndexError.proto */
1305 static void __Pyx_RaiseBufferIndexError(int axis);
1307 #define __Pyx_BufPtrStrided1d(type, buf, i0, s0) (type)((char*)buf + i0 * s0)
1308 /* PySequenceContains.proto */
1309 static CYTHON_INLINE int __Pyx_PySequence_ContainsTF(PyObject* item, PyObject* seq, int eq) {
1310 int result = PySequence_Contains(seq, item);
1311 return unlikely(result < 0) ? result : (result == (eq == Py_EQ));
1314 /* DictGetItem.proto */
1315 #if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY
1316 static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) {
1318 value = PyDict_GetItemWithError(d, key);
1319 if (unlikely(!value)) {
1320 if (!PyErr_Occurred()) {
1321 PyObject* args = PyTuple_Pack(1, key);
1323 PyErr_SetObject(PyExc_KeyError, args);
1332 #define __Pyx_PyDict_GetItem(d, key) PyObject_GetItem(d, key)
1335 /* RaiseTooManyValuesToUnpack.proto */
1336 static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);
1338 /* RaiseNeedMoreValuesToUnpack.proto */
1339 static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);
1341 /* RaiseNoneIterError.proto */
1342 static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void);
1344 /* SaveResetException.proto */
1345 #if CYTHON_FAST_THREAD_STATE
1346 #define __Pyx_ExceptionSave(type, value, tb) __Pyx__ExceptionSave(__pyx_tstate, type, value, tb)
1347 static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1348 #define __Pyx_ExceptionReset(type, value, tb) __Pyx__ExceptionReset(__pyx_tstate, type, value, tb)
1349 static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
1351 #define __Pyx_ExceptionSave(type, value, tb) PyErr_GetExcInfo(type, value, tb)
1352 #define __Pyx_ExceptionReset(type, value, tb) PyErr_SetExcInfo(type, value, tb)
1355 /* PyErrExceptionMatches.proto */
1356 #if CYTHON_FAST_THREAD_STATE
1357 #define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err)
1358 static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err);
1360 #define __Pyx_PyErr_ExceptionMatches(err) PyErr_ExceptionMatches(err)
1363 /* GetException.proto */
1364 #if CYTHON_FAST_THREAD_STATE
1365 #define __Pyx_GetException(type, value, tb) __Pyx__GetException(__pyx_tstate, type, value, tb)
1366 static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
1368 static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb);
1372 static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level);
1374 /* CodeObjectCache.proto */
1376 PyCodeObject* code_object;
1378 } __Pyx_CodeObjectCacheEntry;
1379 struct __Pyx_CodeObjectCache {
1382 __Pyx_CodeObjectCacheEntry* entries;
1384 static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL};
1385 static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line);
1386 static PyCodeObject *__pyx_find_code_object(int code_line);
1387 static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object);
1389 /* AddTraceback.proto */
1390 static void __Pyx_AddTraceback(const char *funcname, int c_line,
1391 int py_line, const char *filename);
1393 /* BufferStructDeclare.proto */
1395 Py_ssize_t shape, strides, suboffsets;
1396 } __Pyx_Buf_DimInfo;
1402 __Pyx_Buffer *rcbuffer;
1404 __Pyx_Buf_DimInfo diminfo[8];
1405 } __Pyx_LocalBuf_ND;
1407 #if PY_MAJOR_VERSION < 3
1408 static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags);
1409 static void __Pyx_ReleaseBuffer(Py_buffer *view);
1411 #define __Pyx_GetBuffer PyObject_GetBuffer
1412 #define __Pyx_ReleaseBuffer PyBuffer_Release
1417 static Py_ssize_t __Pyx_zeros[] = {0, 0, 0, 0, 0, 0, 0, 0};
1418 static Py_ssize_t __Pyx_minusones[] = {-1, -1, -1, -1, -1, -1, -1, -1};
1420 /* CIntToPy.proto */
1421 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value);
1423 /* CIntToPy.proto */
1424 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_siz(siz value);
1426 /* CIntToPy.proto */
1427 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_Py_intptr_t(Py_intptr_t value);
1429 /* RealImag.proto */
1432 #define __Pyx_CREAL(z) ((z).real())
1433 #define __Pyx_CIMAG(z) ((z).imag())
1435 #define __Pyx_CREAL(z) (__real__(z))
1436 #define __Pyx_CIMAG(z) (__imag__(z))
1439 #define __Pyx_CREAL(z) ((z).real)
1440 #define __Pyx_CIMAG(z) ((z).imag)
1442 #if defined(__cplusplus) && CYTHON_CCOMPLEX\
1443 && (defined(_WIN32) || defined(__clang__) || (defined(__GNUC__) && (__GNUC__ >= 5 || __GNUC__ == 4 && __GNUC_MINOR__ >= 4 )) || __cplusplus >= 201103)
1444 #define __Pyx_SET_CREAL(z,x) ((z).real(x))
1445 #define __Pyx_SET_CIMAG(z,y) ((z).imag(y))
1447 #define __Pyx_SET_CREAL(z,x) __Pyx_CREAL(z) = (x)
1448 #define __Pyx_SET_CIMAG(z,y) __Pyx_CIMAG(z) = (y)
1451 /* Arithmetic.proto */
1453 #define __Pyx_c_eq_float(a, b) ((a)==(b))
1454 #define __Pyx_c_sum_float(a, b) ((a)+(b))
1455 #define __Pyx_c_diff_float(a, b) ((a)-(b))
1456 #define __Pyx_c_prod_float(a, b) ((a)*(b))
1457 #define __Pyx_c_quot_float(a, b) ((a)/(b))
1458 #define __Pyx_c_neg_float(a) (-(a))
1460 #define __Pyx_c_is_zero_float(z) ((z)==(float)0)
1461 #define __Pyx_c_conj_float(z) (::std::conj(z))
1463 #define __Pyx_c_abs_float(z) (::std::abs(z))
1464 #define __Pyx_c_pow_float(a, b) (::std::pow(a, b))
1467 #define __Pyx_c_is_zero_float(z) ((z)==0)
1468 #define __Pyx_c_conj_float(z) (conjf(z))
1470 #define __Pyx_c_abs_float(z) (cabsf(z))
1471 #define __Pyx_c_pow_float(a, b) (cpowf(a, b))
1475 static CYTHON_INLINE int __Pyx_c_eq_float(__pyx_t_float_complex, __pyx_t_float_complex);
1476 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sum_float(__pyx_t_float_complex, __pyx_t_float_complex);
1477 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_diff_float(__pyx_t_float_complex, __pyx_t_float_complex);
1478 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prod_float(__pyx_t_float_complex, __pyx_t_float_complex);
1479 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex, __pyx_t_float_complex);
1480 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_neg_float(__pyx_t_float_complex);
1481 static CYTHON_INLINE int __Pyx_c_is_zero_float(__pyx_t_float_complex);
1482 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conj_float(__pyx_t_float_complex);
1484 static CYTHON_INLINE float __Pyx_c_abs_float(__pyx_t_float_complex);
1485 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_pow_float(__pyx_t_float_complex, __pyx_t_float_complex);
1489 /* Arithmetic.proto */
1491 #define __Pyx_c_eq_double(a, b) ((a)==(b))
1492 #define __Pyx_c_sum_double(a, b) ((a)+(b))
1493 #define __Pyx_c_diff_double(a, b) ((a)-(b))
1494 #define __Pyx_c_prod_double(a, b) ((a)*(b))
1495 #define __Pyx_c_quot_double(a, b) ((a)/(b))
1496 #define __Pyx_c_neg_double(a) (-(a))
1498 #define __Pyx_c_is_zero_double(z) ((z)==(double)0)
1499 #define __Pyx_c_conj_double(z) (::std::conj(z))
1501 #define __Pyx_c_abs_double(z) (::std::abs(z))
1502 #define __Pyx_c_pow_double(a, b) (::std::pow(a, b))
1505 #define __Pyx_c_is_zero_double(z) ((z)==0)
1506 #define __Pyx_c_conj_double(z) (conj(z))
1508 #define __Pyx_c_abs_double(z) (cabs(z))
1509 #define __Pyx_c_pow_double(a, b) (cpow(a, b))
1513 static CYTHON_INLINE int __Pyx_c_eq_double(__pyx_t_double_complex, __pyx_t_double_complex);
1514 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum_double(__pyx_t_double_complex, __pyx_t_double_complex);
1515 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff_double(__pyx_t_double_complex, __pyx_t_double_complex);
1516 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod_double(__pyx_t_double_complex, __pyx_t_double_complex);
1517 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex, __pyx_t_double_complex);
1518 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg_double(__pyx_t_double_complex);
1519 static CYTHON_INLINE int __Pyx_c_is_zero_double(__pyx_t_double_complex);
1520 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj_double(__pyx_t_double_complex);
1522 static CYTHON_INLINE double __Pyx_c_abs_double(__pyx_t_double_complex);
1523 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow_double(__pyx_t_double_complex, __pyx_t_double_complex);
1527 /* CIntToPy.proto */
1528 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value);
1530 /* CIntToPy.proto */
1531 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum__NPY_TYPES(enum NPY_TYPES value);
1533 /* CIntFromPy.proto */
1534 static CYTHON_INLINE siz __Pyx_PyInt_As_siz(PyObject *);
1536 /* CIntFromPy.proto */
1537 static CYTHON_INLINE size_t __Pyx_PyInt_As_size_t(PyObject *);
1539 /* CIntFromPy.proto */
1540 static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *);
1542 /* CIntFromPy.proto */
1543 static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *);
1545 /* CheckBinaryVersion.proto */
1546 static int __Pyx_check_binary_version(void);
1548 /* PyIdentifierFromString.proto */
1549 #if !defined(__Pyx_PyIdentifier_FromString)
1550 #if PY_MAJOR_VERSION < 3
1551 #define __Pyx_PyIdentifier_FromString(s) PyString_FromString(s)
1553 #define __Pyx_PyIdentifier_FromString(s) PyUnicode_FromString(s)
1557 /* ModuleImport.proto */
1558 static PyObject *__Pyx_ImportModule(const char *name);
1560 /* TypeImport.proto */
1561 static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict);
1563 /* InitStrings.proto */
1564 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t);
1567 /* Module declarations from 'cpython.buffer' */
1569 /* Module declarations from 'libc.string' */
1571 /* Module declarations from 'libc.stdio' */
1573 /* Module declarations from '__builtin__' */
1575 /* Module declarations from 'cpython.type' */
1576 static PyTypeObject *__pyx_ptype_7cpython_4type_type = 0;
1578 /* Module declarations from 'cpython' */
1580 /* Module declarations from 'cpython.object' */
1582 /* Module declarations from 'cpython.ref' */
1584 /* Module declarations from 'libc.stdlib' */
1586 /* Module declarations from 'numpy' */
1588 /* Module declarations from 'numpy' */
1589 static PyTypeObject *__pyx_ptype_5numpy_dtype = 0;
1590 static PyTypeObject *__pyx_ptype_5numpy_flatiter = 0;
1591 static PyTypeObject *__pyx_ptype_5numpy_broadcast = 0;
1592 static PyTypeObject *__pyx_ptype_5numpy_ndarray = 0;
1593 static PyTypeObject *__pyx_ptype_5numpy_ufunc = 0;
1594 static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *, char *, char *, int *); /*proto*/
1595 static CYTHON_INLINE int __pyx_f_5numpy_import_array(void); /*proto*/
1597 /* Module declarations from 'pycocotools._mask' */
1598 static PyTypeObject *__pyx_ptype_11pycocotools_5_mask_RLEs = 0;
1599 static PyTypeObject *__pyx_ptype_11pycocotools_5_mask_Masks = 0;
1600 static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_5numpy_uint8_t = { "uint8_t", NULL, sizeof(__pyx_t_5numpy_uint8_t), { 0 }, 0, IS_UNSIGNED(__pyx_t_5numpy_uint8_t) ? 'U' : 'I', IS_UNSIGNED(__pyx_t_5numpy_uint8_t), 0 };
1601 static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_5numpy_double_t = { "double_t", NULL, sizeof(__pyx_t_5numpy_double_t), { 0 }, 0, 'R', 0, 0 };
1602 static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_5numpy_uint32_t = { "uint32_t", NULL, sizeof(__pyx_t_5numpy_uint32_t), { 0 }, 0, IS_UNSIGNED(__pyx_t_5numpy_uint32_t) ? 'U' : 'I', IS_UNSIGNED(__pyx_t_5numpy_uint32_t), 0 };
1603 #define __Pyx_MODULE_NAME "pycocotools._mask"
1604 int __pyx_module_is_main_pycocotools___mask = 0;
1606 /* Implementation of 'pycocotools._mask' */
1607 static PyObject *__pyx_builtin_range;
1608 static PyObject *__pyx_builtin_AttributeError;
1609 static PyObject *__pyx_builtin_enumerate;
1610 static PyObject *__pyx_builtin_ValueError;
1611 static PyObject *__pyx_builtin_RuntimeError;
1612 static PyObject *__pyx_builtin_ImportError;
1613 static const char __pyx_k_F[] = "F";
1614 static const char __pyx_k_N[] = "N";
1615 static const char __pyx_k_R[] = "R";
1616 static const char __pyx_k_a[] = "_a";
1617 static const char __pyx_k_h[] = "h";
1618 static const char __pyx_k_i[] = "i";
1619 static const char __pyx_k_j[] = "j";
1620 static const char __pyx_k_m[] = "m";
1621 static const char __pyx_k_n[] = "n";
1622 static const char __pyx_k_p[] = "p";
1623 static const char __pyx_k_w[] = "w";
1624 static const char __pyx_k_Rs[] = "Rs";
1625 static const char __pyx_k_bb[] = "bb";
1626 static const char __pyx_k_dt[] = "dt";
1627 static const char __pyx_k_gt[] = "gt";
1628 static const char __pyx_k_np[] = "np";
1629 static const char __pyx_k_a_2[] = "a";
1630 static const char __pyx_k_all[] = "all";
1631 static const char __pyx_k_iou[] = "_iou";
1632 static const char __pyx_k_len[] = "_len";
1633 static const char __pyx_k_obj[] = "obj";
1634 static const char __pyx_k_sys[] = "sys";
1635 static const char __pyx_k_area[] = "area";
1636 static const char __pyx_k_bb_2[] = "_bb";
1637 static const char __pyx_k_cnts[] = "cnts";
1638 static const char __pyx_k_data[] = "data";
1639 static const char __pyx_k_main[] = "__main__";
1640 static const char __pyx_k_mask[] = "mask";
1641 static const char __pyx_k_objs[] = "objs";
1642 static const char __pyx_k_poly[] = "poly";
1643 static const char __pyx_k_size[] = "size";
1644 static const char __pyx_k_test[] = "__test__";
1645 static const char __pyx_k_utf8[] = "utf8";
1646 static const char __pyx_k_array[] = "array";
1647 static const char __pyx_k_bbIou[] = "_bbIou";
1648 static const char __pyx_k_dtype[] = "dtype";
1649 static const char __pyx_k_iou_2[] = "iou";
1650 static const char __pyx_k_isbox[] = "isbox";
1651 static const char __pyx_k_isrle[] = "isrle";
1652 static const char __pyx_k_masks[] = "masks";
1653 static const char __pyx_k_merge[] = "merge";
1654 static const char __pyx_k_numpy[] = "numpy";
1655 static const char __pyx_k_order[] = "order";
1656 static const char __pyx_k_pyobj[] = "pyobj";
1657 static const char __pyx_k_range[] = "range";
1658 static const char __pyx_k_shape[] = "shape";
1659 static const char __pyx_k_uint8[] = "uint8";
1660 static const char __pyx_k_zeros[] = "zeros";
1661 static const char __pyx_k_astype[] = "astype";
1662 static const char __pyx_k_author[] = "__author__";
1663 static const char __pyx_k_counts[] = "counts";
1664 static const char __pyx_k_decode[] = "decode";
1665 static const char __pyx_k_double[] = "double";
1666 static const char __pyx_k_encode[] = "encode";
1667 static const char __pyx_k_frBbox[] = "frBbox";
1668 static const char __pyx_k_frPoly[] = "frPoly";
1669 static const char __pyx_k_import[] = "__import__";
1670 static const char __pyx_k_iouFun[] = "_iouFun";
1671 static const char __pyx_k_rleIou[] = "_rleIou";
1672 static const char __pyx_k_toBbox[] = "toBbox";
1673 static const char __pyx_k_ucRles[] = "ucRles";
1674 static const char __pyx_k_uint32[] = "uint32";
1675 static const char __pyx_k_iscrowd[] = "iscrowd";
1676 static const char __pyx_k_np_poly[] = "np_poly";
1677 static const char __pyx_k_preproc[] = "_preproc";
1678 static const char __pyx_k_reshape[] = "reshape";
1679 static const char __pyx_k_rleObjs[] = "rleObjs";
1680 static const char __pyx_k_tsungyi[] = "tsungyi";
1681 static const char __pyx_k_c_string[] = "c_string";
1682 static const char __pyx_k_frString[] = "_frString";
1683 static const char __pyx_k_toString[] = "_toString";
1684 static const char __pyx_k_enumerate[] = "enumerate";
1685 static const char __pyx_k_intersect[] = "intersect";
1686 static const char __pyx_k_py_string[] = "py_string";
1687 static const char __pyx_k_pyiscrowd[] = "pyiscrowd";
1688 static const char __pyx_k_ValueError[] = "ValueError";
1689 static const char __pyx_k_ImportError[] = "ImportError";
1690 static const char __pyx_k_frPyObjects[] = "frPyObjects";
1691 static const char __pyx_k_RuntimeError[] = "RuntimeError";
1692 static const char __pyx_k_version_info[] = "version_info";
1693 static const char __pyx_k_AttributeError[] = "AttributeError";
1694 static const char __pyx_k_PYTHON_VERSION[] = "PYTHON_VERSION";
1695 static const char __pyx_k_iou_locals__len[] = "iou.<locals>._len";
1696 static const char __pyx_k_frUncompressedRLE[] = "frUncompressedRLE";
1697 static const char __pyx_k_iou_locals__bbIou[] = "iou.<locals>._bbIou";
1698 static const char __pyx_k_pycocotools__mask[] = "pycocotools._mask";
1699 static const char __pyx_k_iou_locals__rleIou[] = "iou.<locals>._rleIou";
1700 static const char __pyx_k_iou_locals__preproc[] = "iou.<locals>._preproc";
1701 static const char __pyx_k_input_data_type_not_allowed[] = "input data type not allowed.";
1702 static const char __pyx_k_input_type_is_not_supported[] = "input type is not supported.";
1703 static const char __pyx_k_ndarray_is_not_C_contiguous[] = "ndarray is not C contiguous";
1704 static const char __pyx_k_Python_version_must_be_2_or_3[] = "Python version must be 2 or 3";
1705 static const char __pyx_k_home_yjr_PycharmProjects_Faster[] = "/home/yjr/PycharmProjects/Faster-RCNN_TF/data/lib_coco/PythonAPI/pycocotools/_mask.pyx";
1706 static const char __pyx_k_numpy_core_multiarray_failed_to[] = "numpy.core.multiarray failed to import";
1707 static const char __pyx_k_numpy_ndarray_input_is_only_for[] = "numpy ndarray input is only for *bounding boxes* and should have Nx4 dimension";
1708 static const char __pyx_k_unknown_dtype_code_in_numpy_pxd[] = "unknown dtype code in numpy.pxd (%d)";
1709 static const char __pyx_k_unrecognized_type_The_following[] = "unrecognized type. The following type: RLEs (rle), np.ndarray (box), and list (box) are supported.";
1710 static const char __pyx_k_Format_string_allocated_too_shor[] = "Format string allocated too short, see comment in numpy.pxd";
1711 static const char __pyx_k_Non_native_byte_order_not_suppor[] = "Non-native byte order not supported";
1712 static const char __pyx_k_The_dt_and_gt_should_have_the_sa[] = "The dt and gt should have the same data type, either RLEs, list or np.ndarray";
1713 static const char __pyx_k_list_input_can_be_bounding_box_N[] = "list input can be bounding box (Nx4) or RLEs ([RLE])";
1714 static const char __pyx_k_ndarray_is_not_Fortran_contiguou[] = "ndarray is not Fortran contiguous";
1715 static const char __pyx_k_numpy_core_umath_failed_to_impor[] = "numpy.core.umath failed to import";
1716 static const char __pyx_k_Format_string_allocated_too_shor_2[] = "Format string allocated too short.";
1717 static PyObject *__pyx_n_s_AttributeError;
1718 static PyObject *__pyx_n_s_F;
1719 static PyObject *__pyx_kp_u_Format_string_allocated_too_shor;
1720 static PyObject *__pyx_kp_u_Format_string_allocated_too_shor_2;
1721 static PyObject *__pyx_n_s_ImportError;
1722 static PyObject *__pyx_n_s_N;
1723 static PyObject *__pyx_kp_u_Non_native_byte_order_not_suppor;
1724 static PyObject *__pyx_n_s_PYTHON_VERSION;
1725 static PyObject *__pyx_kp_s_Python_version_must_be_2_or_3;
1726 static PyObject *__pyx_n_s_R;
1727 static PyObject *__pyx_n_s_Rs;
1728 static PyObject *__pyx_n_s_RuntimeError;
1729 static PyObject *__pyx_kp_s_The_dt_and_gt_should_have_the_sa;
1730 static PyObject *__pyx_n_s_ValueError;
1731 static PyObject *__pyx_n_s_a;
1732 static PyObject *__pyx_n_s_a_2;
1733 static PyObject *__pyx_n_s_all;
1734 static PyObject *__pyx_n_s_area;
1735 static PyObject *__pyx_n_s_array;
1736 static PyObject *__pyx_n_s_astype;
1737 static PyObject *__pyx_n_s_author;
1738 static PyObject *__pyx_n_s_bb;
1739 static PyObject *__pyx_n_s_bbIou;
1740 static PyObject *__pyx_n_s_bb_2;
1741 static PyObject *__pyx_n_s_c_string;
1742 static PyObject *__pyx_n_s_cnts;
1743 static PyObject *__pyx_n_s_counts;
1744 static PyObject *__pyx_n_s_data;
1745 static PyObject *__pyx_n_s_decode;
1746 static PyObject *__pyx_n_s_double;
1747 static PyObject *__pyx_n_s_dt;
1748 static PyObject *__pyx_n_s_dtype;
1749 static PyObject *__pyx_n_s_encode;
1750 static PyObject *__pyx_n_s_enumerate;
1751 static PyObject *__pyx_n_s_frBbox;
1752 static PyObject *__pyx_n_s_frPoly;
1753 static PyObject *__pyx_n_s_frPyObjects;
1754 static PyObject *__pyx_n_s_frString;
1755 static PyObject *__pyx_n_s_frUncompressedRLE;
1756 static PyObject *__pyx_n_s_gt;
1757 static PyObject *__pyx_n_s_h;
1758 static PyObject *__pyx_kp_s_home_yjr_PycharmProjects_Faster;
1759 static PyObject *__pyx_n_s_i;
1760 static PyObject *__pyx_n_s_import;
1761 static PyObject *__pyx_kp_s_input_data_type_not_allowed;
1762 static PyObject *__pyx_kp_s_input_type_is_not_supported;
1763 static PyObject *__pyx_n_s_intersect;
1764 static PyObject *__pyx_n_s_iou;
1765 static PyObject *__pyx_n_s_iouFun;
1766 static PyObject *__pyx_n_s_iou_2;
1767 static PyObject *__pyx_n_s_iou_locals__bbIou;
1768 static PyObject *__pyx_n_s_iou_locals__len;
1769 static PyObject *__pyx_n_s_iou_locals__preproc;
1770 static PyObject *__pyx_n_s_iou_locals__rleIou;
1771 static PyObject *__pyx_n_s_isbox;
1772 static PyObject *__pyx_n_s_iscrowd;
1773 static PyObject *__pyx_n_s_isrle;
1774 static PyObject *__pyx_n_s_j;
1775 static PyObject *__pyx_n_s_len;
1776 static PyObject *__pyx_kp_s_list_input_can_be_bounding_box_N;
1777 static PyObject *__pyx_n_s_m;
1778 static PyObject *__pyx_n_s_main;
1779 static PyObject *__pyx_n_s_mask;
1780 static PyObject *__pyx_n_s_masks;
1781 static PyObject *__pyx_n_s_merge;
1782 static PyObject *__pyx_n_s_n;
1783 static PyObject *__pyx_kp_u_ndarray_is_not_C_contiguous;
1784 static PyObject *__pyx_kp_u_ndarray_is_not_Fortran_contiguou;
1785 static PyObject *__pyx_n_s_np;
1786 static PyObject *__pyx_n_s_np_poly;
1787 static PyObject *__pyx_n_s_numpy;
1788 static PyObject *__pyx_kp_s_numpy_core_multiarray_failed_to;
1789 static PyObject *__pyx_kp_s_numpy_core_umath_failed_to_impor;
1790 static PyObject *__pyx_kp_s_numpy_ndarray_input_is_only_for;
1791 static PyObject *__pyx_n_s_obj;
1792 static PyObject *__pyx_n_s_objs;
1793 static PyObject *__pyx_n_s_order;
1794 static PyObject *__pyx_n_s_p;
1795 static PyObject *__pyx_n_s_poly;
1796 static PyObject *__pyx_n_s_preproc;
1797 static PyObject *__pyx_n_s_py_string;
1798 static PyObject *__pyx_n_s_pycocotools__mask;
1799 static PyObject *__pyx_n_s_pyiscrowd;
1800 static PyObject *__pyx_n_s_pyobj;
1801 static PyObject *__pyx_n_s_range;
1802 static PyObject *__pyx_n_s_reshape;
1803 static PyObject *__pyx_n_s_rleIou;
1804 static PyObject *__pyx_n_s_rleObjs;
1805 static PyObject *__pyx_n_s_shape;
1806 static PyObject *__pyx_n_s_size;
1807 static PyObject *__pyx_n_s_sys;
1808 static PyObject *__pyx_n_s_test;
1809 static PyObject *__pyx_n_s_toBbox;
1810 static PyObject *__pyx_n_s_toString;
1811 static PyObject *__pyx_n_s_tsungyi;
1812 static PyObject *__pyx_n_s_ucRles;
1813 static PyObject *__pyx_n_s_uint32;
1814 static PyObject *__pyx_n_s_uint8;
1815 static PyObject *__pyx_kp_u_unknown_dtype_code_in_numpy_pxd;
1816 static PyObject *__pyx_kp_s_unrecognized_type_The_following;
1817 static PyObject *__pyx_n_s_utf8;
1818 static PyObject *__pyx_n_s_version_info;
1819 static PyObject *__pyx_n_s_w;
1820 static PyObject *__pyx_n_s_zeros;
1821 static int __pyx_pf_11pycocotools_5_mask_4RLEs___cinit__(struct __pyx_obj_11pycocotools_5_mask_RLEs *__pyx_v_self, siz __pyx_v_n); /* proto */
1822 static void __pyx_pf_11pycocotools_5_mask_4RLEs_2__dealloc__(struct __pyx_obj_11pycocotools_5_mask_RLEs *__pyx_v_self); /* proto */
1823 static PyObject *__pyx_pf_11pycocotools_5_mask_4RLEs_4__getattr__(struct __pyx_obj_11pycocotools_5_mask_RLEs *__pyx_v_self, PyObject *__pyx_v_key); /* proto */
1824 static int __pyx_pf_11pycocotools_5_mask_5Masks___cinit__(struct __pyx_obj_11pycocotools_5_mask_Masks *__pyx_v_self, PyObject *__pyx_v_h, PyObject *__pyx_v_w, PyObject *__pyx_v_n); /* proto */
1825 static PyObject *__pyx_pf_11pycocotools_5_mask_5Masks_2__array__(struct __pyx_obj_11pycocotools_5_mask_Masks *__pyx_v_self); /* proto */
1826 static PyObject *__pyx_pf_11pycocotools_5_mask__toString(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_11pycocotools_5_mask_RLEs *__pyx_v_Rs); /* proto */
1827 static PyObject *__pyx_pf_11pycocotools_5_mask_2_frString(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_rleObjs); /* proto */
1828 static PyObject *__pyx_pf_11pycocotools_5_mask_4encode(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_mask); /* proto */
1829 static PyObject *__pyx_pf_11pycocotools_5_mask_6decode(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_rleObjs); /* proto */
1830 static PyObject *__pyx_pf_11pycocotools_5_mask_8merge(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_rleObjs, PyObject *__pyx_v_intersect); /* proto */
1831 static PyObject *__pyx_pf_11pycocotools_5_mask_10area(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_rleObjs); /* proto */
1832 static PyObject *__pyx_pf_11pycocotools_5_mask_3iou__preproc(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_objs); /* proto */
1833 static PyObject *__pyx_pf_11pycocotools_5_mask_3iou_2_rleIou(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_11pycocotools_5_mask_RLEs *__pyx_v_dt, struct __pyx_obj_11pycocotools_5_mask_RLEs *__pyx_v_gt, PyArrayObject *__pyx_v_iscrowd, siz __pyx_v_m, siz __pyx_v_n, PyArrayObject *__pyx_v__iou); /* proto */
1834 static PyObject *__pyx_pf_11pycocotools_5_mask_3iou_4_bbIou(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_dt, PyArrayObject *__pyx_v_gt, PyArrayObject *__pyx_v_iscrowd, siz __pyx_v_m, siz __pyx_v_n, PyArrayObject *__pyx_v__iou); /* proto */
1835 static PyObject *__pyx_pf_11pycocotools_5_mask_3iou_6_len(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_obj); /* proto */
1836 static PyObject *__pyx_pf_11pycocotools_5_mask_12iou(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_dt, PyObject *__pyx_v_gt, PyObject *__pyx_v_pyiscrowd); /* proto */
1837 static PyObject *__pyx_pf_11pycocotools_5_mask_14toBbox(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_rleObjs); /* proto */
1838 static PyObject *__pyx_pf_11pycocotools_5_mask_16frBbox(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_bb, siz __pyx_v_h, siz __pyx_v_w); /* proto */
1839 static PyObject *__pyx_pf_11pycocotools_5_mask_18frPoly(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_poly, siz __pyx_v_h, siz __pyx_v_w); /* proto */
1840 static PyObject *__pyx_pf_11pycocotools_5_mask_20frUncompressedRLE(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_ucRles, CYTHON_UNUSED siz __pyx_v_h, CYTHON_UNUSED siz __pyx_v_w); /* proto */
1841 static PyObject *__pyx_pf_11pycocotools_5_mask_22frPyObjects(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_pyobj, PyObject *__pyx_v_h, PyObject *__pyx_v_w); /* proto */
1842 static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /* proto */
1843 static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info); /* proto */
1844 static PyObject *__pyx_tp_new_11pycocotools_5_mask_RLEs(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
1845 static PyObject *__pyx_tp_new_11pycocotools_5_mask_Masks(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
1846 static PyObject *__pyx_int_0;
1847 static PyObject *__pyx_int_1;
1848 static PyObject *__pyx_int_2;
1849 static PyObject *__pyx_int_3;
1850 static PyObject *__pyx_int_4;
1851 static PyObject *__pyx_tuple_;
1852 static PyObject *__pyx_tuple__2;
1853 static PyObject *__pyx_tuple__3;
1854 static PyObject *__pyx_tuple__4;
1855 static PyObject *__pyx_tuple__5;
1856 static PyObject *__pyx_tuple__6;
1857 static PyObject *__pyx_tuple__7;
1858 static PyObject *__pyx_tuple__9;
1859 static PyObject *__pyx_tuple__11;
1860 static PyObject *__pyx_tuple__13;
1861 static PyObject *__pyx_tuple__15;
1862 static PyObject *__pyx_tuple__16;
1863 static PyObject *__pyx_tuple__17;
1864 static PyObject *__pyx_tuple__18;
1865 static PyObject *__pyx_tuple__19;
1866 static PyObject *__pyx_tuple__20;
1867 static PyObject *__pyx_tuple__21;
1868 static PyObject *__pyx_tuple__22;
1869 static PyObject *__pyx_tuple__23;
1870 static PyObject *__pyx_tuple__24;
1871 static PyObject *__pyx_tuple__25;
1872 static PyObject *__pyx_tuple__26;
1873 static PyObject *__pyx_tuple__27;
1874 static PyObject *__pyx_tuple__28;
1875 static PyObject *__pyx_tuple__30;
1876 static PyObject *__pyx_tuple__32;
1877 static PyObject *__pyx_tuple__34;
1878 static PyObject *__pyx_tuple__36;
1879 static PyObject *__pyx_tuple__38;
1880 static PyObject *__pyx_tuple__40;
1881 static PyObject *__pyx_tuple__42;
1882 static PyObject *__pyx_tuple__44;
1883 static PyObject *__pyx_tuple__46;
1884 static PyObject *__pyx_tuple__48;
1885 static PyObject *__pyx_tuple__50;
1886 static PyObject *__pyx_codeobj__8;
1887 static PyObject *__pyx_codeobj__10;
1888 static PyObject *__pyx_codeobj__12;
1889 static PyObject *__pyx_codeobj__14;
1890 static PyObject *__pyx_codeobj__29;
1891 static PyObject *__pyx_codeobj__31;
1892 static PyObject *__pyx_codeobj__33;
1893 static PyObject *__pyx_codeobj__35;
1894 static PyObject *__pyx_codeobj__37;
1895 static PyObject *__pyx_codeobj__39;
1896 static PyObject *__pyx_codeobj__41;
1897 static PyObject *__pyx_codeobj__43;
1898 static PyObject *__pyx_codeobj__45;
1899 static PyObject *__pyx_codeobj__47;
1900 static PyObject *__pyx_codeobj__49;
1901 static PyObject *__pyx_codeobj__51;
1903 /* "pycocotools/_mask.pyx":60
1906 * def __cinit__(self, siz n =0): # <<<<<<<<<<<<<<
1907 * rlesInit(&self._R, n)
1911 /* Python wrapper */
1912 static int __pyx_pw_11pycocotools_5_mask_4RLEs_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
1913 static int __pyx_pw_11pycocotools_5_mask_4RLEs_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
1916 __Pyx_RefNannyDeclarations
1917 __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
1919 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_n,0};
1920 PyObject* values[1] = {0};
1921 if (unlikely(__pyx_kwds)) {
1923 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
1925 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
1927 default: goto __pyx_L5_argtuple_error;
1929 kw_args = PyDict_Size(__pyx_kwds);
1933 PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_n);
1934 if (value) { values[0] = value; kw_args--; }
1937 if (unlikely(kw_args > 0)) {
1938 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(0, 60, __pyx_L3_error)
1941 switch (PyTuple_GET_SIZE(__pyx_args)) {
1942 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
1944 default: goto __pyx_L5_argtuple_error;
1948 __pyx_v_n = __Pyx_PyInt_As_siz(values[0]); if (unlikely((__pyx_v_n == ((siz)-1)) && PyErr_Occurred())) __PYX_ERR(0, 60, __pyx_L3_error)
1950 __pyx_v_n = ((siz)0);
1953 goto __pyx_L4_argument_unpacking_done;
1954 __pyx_L5_argtuple_error:;
1955 __Pyx_RaiseArgtupleInvalid("__cinit__", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 60, __pyx_L3_error)
1957 __Pyx_AddTraceback("pycocotools._mask.RLEs.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
1958 __Pyx_RefNannyFinishContext();
1960 __pyx_L4_argument_unpacking_done:;
1961 __pyx_r = __pyx_pf_11pycocotools_5_mask_4RLEs___cinit__(((struct __pyx_obj_11pycocotools_5_mask_RLEs *)__pyx_v_self), __pyx_v_n);
1963 /* function exit code */
1964 __Pyx_RefNannyFinishContext();
1968 static int __pyx_pf_11pycocotools_5_mask_4RLEs___cinit__(struct __pyx_obj_11pycocotools_5_mask_RLEs *__pyx_v_self, siz __pyx_v_n) {
1970 __Pyx_RefNannyDeclarations
1971 __Pyx_RefNannySetupContext("__cinit__", 0);
1973 /* "pycocotools/_mask.pyx":61
1975 * def __cinit__(self, siz n =0):
1976 * rlesInit(&self._R, n) # <<<<<<<<<<<<<<
1980 rlesInit((&__pyx_v_self->_R), __pyx_v_n);
1982 /* "pycocotools/_mask.pyx":62
1983 * def __cinit__(self, siz n =0):
1984 * rlesInit(&self._R, n)
1985 * self._n = n # <<<<<<<<<<<<<<
1987 * # free the RLE array here
1989 __pyx_v_self->_n = __pyx_v_n;
1991 /* "pycocotools/_mask.pyx":60
1994 * def __cinit__(self, siz n =0): # <<<<<<<<<<<<<<
1995 * rlesInit(&self._R, n)
1999 /* function exit code */
2001 __Pyx_RefNannyFinishContext();
2005 /* "pycocotools/_mask.pyx":65
2007 * # free the RLE array here
2008 * def __dealloc__(self): # <<<<<<<<<<<<<<
2009 * if self._R is not NULL:
2010 * for i in range(self._n):
2013 /* Python wrapper */
2014 static void __pyx_pw_11pycocotools_5_mask_4RLEs_3__dealloc__(PyObject *__pyx_v_self); /*proto*/
2015 static void __pyx_pw_11pycocotools_5_mask_4RLEs_3__dealloc__(PyObject *__pyx_v_self) {
2016 __Pyx_RefNannyDeclarations
2017 __Pyx_RefNannySetupContext("__dealloc__ (wrapper)", 0);
2018 __pyx_pf_11pycocotools_5_mask_4RLEs_2__dealloc__(((struct __pyx_obj_11pycocotools_5_mask_RLEs *)__pyx_v_self));
2020 /* function exit code */
2021 __Pyx_RefNannyFinishContext();
2024 static void __pyx_pf_11pycocotools_5_mask_4RLEs_2__dealloc__(struct __pyx_obj_11pycocotools_5_mask_RLEs *__pyx_v_self) {
2026 __Pyx_RefNannyDeclarations
2030 __Pyx_RefNannySetupContext("__dealloc__", 0);
2032 /* "pycocotools/_mask.pyx":66
2033 * # free the RLE array here
2034 * def __dealloc__(self):
2035 * if self._R is not NULL: # <<<<<<<<<<<<<<
2036 * for i in range(self._n):
2037 * free(self._R[i].cnts)
2039 __pyx_t_1 = ((__pyx_v_self->_R != NULL) != 0);
2042 /* "pycocotools/_mask.pyx":67
2043 * def __dealloc__(self):
2044 * if self._R is not NULL:
2045 * for i in range(self._n): # <<<<<<<<<<<<<<
2046 * free(self._R[i].cnts)
2049 __pyx_t_2 = __pyx_v_self->_n;
2050 for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
2051 __pyx_v_i = __pyx_t_3;
2053 /* "pycocotools/_mask.pyx":68
2054 * if self._R is not NULL:
2055 * for i in range(self._n):
2056 * free(self._R[i].cnts) # <<<<<<<<<<<<<<
2058 * def __getattr__(self, key):
2060 free((__pyx_v_self->_R[__pyx_v_i]).cnts);
2063 /* "pycocotools/_mask.pyx":69
2064 * for i in range(self._n):
2065 * free(self._R[i].cnts)
2066 * free(self._R) # <<<<<<<<<<<<<<
2067 * def __getattr__(self, key):
2070 free(__pyx_v_self->_R);
2072 /* "pycocotools/_mask.pyx":66
2073 * # free the RLE array here
2074 * def __dealloc__(self):
2075 * if self._R is not NULL: # <<<<<<<<<<<<<<
2076 * for i in range(self._n):
2077 * free(self._R[i].cnts)
2081 /* "pycocotools/_mask.pyx":65
2083 * # free the RLE array here
2084 * def __dealloc__(self): # <<<<<<<<<<<<<<
2085 * if self._R is not NULL:
2086 * for i in range(self._n):
2089 /* function exit code */
2090 __Pyx_RefNannyFinishContext();
2093 /* "pycocotools/_mask.pyx":70
2094 * free(self._R[i].cnts)
2096 * def __getattr__(self, key): # <<<<<<<<<<<<<<
2101 /* Python wrapper */
2102 static PyObject *__pyx_pw_11pycocotools_5_mask_4RLEs_5__getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_key); /*proto*/
2103 static PyObject *__pyx_pw_11pycocotools_5_mask_4RLEs_5__getattr__(PyObject *__pyx_v_self, PyObject *__pyx_v_key) {
2104 PyObject *__pyx_r = 0;
2105 __Pyx_RefNannyDeclarations
2106 __Pyx_RefNannySetupContext("__getattr__ (wrapper)", 0);
2107 __pyx_r = __pyx_pf_11pycocotools_5_mask_4RLEs_4__getattr__(((struct __pyx_obj_11pycocotools_5_mask_RLEs *)__pyx_v_self), ((PyObject *)__pyx_v_key));
2109 /* function exit code */
2110 __Pyx_RefNannyFinishContext();
2114 static PyObject *__pyx_pf_11pycocotools_5_mask_4RLEs_4__getattr__(struct __pyx_obj_11pycocotools_5_mask_RLEs *__pyx_v_self, PyObject *__pyx_v_key) {
2115 PyObject *__pyx_r = NULL;
2116 __Pyx_RefNannyDeclarations
2118 PyObject *__pyx_t_2 = NULL;
2119 PyObject *__pyx_t_3 = NULL;
2120 __Pyx_RefNannySetupContext("__getattr__", 0);
2122 /* "pycocotools/_mask.pyx":71
2124 * def __getattr__(self, key):
2125 * if key == 'n': # <<<<<<<<<<<<<<
2127 * raise AttributeError(key)
2129 __pyx_t_1 = (__Pyx_PyString_Equals(__pyx_v_key, __pyx_n_s_n, Py_EQ)); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 71, __pyx_L1_error)
2132 /* "pycocotools/_mask.pyx":72
2133 * def __getattr__(self, key):
2135 * return self._n # <<<<<<<<<<<<<<
2136 * raise AttributeError(key)
2139 __Pyx_XDECREF(__pyx_r);
2140 __pyx_t_2 = __Pyx_PyInt_From_siz(__pyx_v_self->_n); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 72, __pyx_L1_error)
2141 __Pyx_GOTREF(__pyx_t_2);
2142 __pyx_r = __pyx_t_2;
2146 /* "pycocotools/_mask.pyx":71
2148 * def __getattr__(self, key):
2149 * if key == 'n': # <<<<<<<<<<<<<<
2151 * raise AttributeError(key)
2155 /* "pycocotools/_mask.pyx":73
2158 * raise AttributeError(key) # <<<<<<<<<<<<<<
2160 * # python class to wrap Mask array in C
2162 __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 73, __pyx_L1_error)
2163 __Pyx_GOTREF(__pyx_t_2);
2164 __Pyx_INCREF(__pyx_v_key);
2165 __Pyx_GIVEREF(__pyx_v_key);
2166 PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_key);
2167 __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_AttributeError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 73, __pyx_L1_error)
2168 __Pyx_GOTREF(__pyx_t_3);
2169 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2170 __Pyx_Raise(__pyx_t_3, 0, 0, 0);
2171 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
2172 __PYX_ERR(0, 73, __pyx_L1_error)
2174 /* "pycocotools/_mask.pyx":70
2175 * free(self._R[i].cnts)
2177 * def __getattr__(self, key): # <<<<<<<<<<<<<<
2182 /* function exit code */
2184 __Pyx_XDECREF(__pyx_t_2);
2185 __Pyx_XDECREF(__pyx_t_3);
2186 __Pyx_AddTraceback("pycocotools._mask.RLEs.__getattr__", __pyx_clineno, __pyx_lineno, __pyx_filename);
2189 __Pyx_XGIVEREF(__pyx_r);
2190 __Pyx_RefNannyFinishContext();
2194 /* "pycocotools/_mask.pyx":83
2197 * def __cinit__(self, h, w, n): # <<<<<<<<<<<<<<
2198 * self._mask = <byte*> malloc(h*w*n* sizeof(byte))
2202 /* Python wrapper */
2203 static int __pyx_pw_11pycocotools_5_mask_5Masks_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
2204 static int __pyx_pw_11pycocotools_5_mask_5Masks_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
2205 PyObject *__pyx_v_h = 0;
2206 PyObject *__pyx_v_w = 0;
2207 PyObject *__pyx_v_n = 0;
2209 __Pyx_RefNannyDeclarations
2210 __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
2212 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_h,&__pyx_n_s_w,&__pyx_n_s_n,0};
2213 PyObject* values[3] = {0,0,0};
2214 if (unlikely(__pyx_kwds)) {
2216 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
2218 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
2219 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2220 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2222 default: goto __pyx_L5_argtuple_error;
2224 kw_args = PyDict_Size(__pyx_kwds);
2227 if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_h)) != 0)) kw_args--;
2228 else goto __pyx_L5_argtuple_error;
2230 if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_w)) != 0)) kw_args--;
2232 __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 3, 3, 1); __PYX_ERR(0, 83, __pyx_L3_error)
2235 if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_n)) != 0)) kw_args--;
2237 __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 3, 3, 2); __PYX_ERR(0, 83, __pyx_L3_error)
2240 if (unlikely(kw_args > 0)) {
2241 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__cinit__") < 0)) __PYX_ERR(0, 83, __pyx_L3_error)
2243 } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
2244 goto __pyx_L5_argtuple_error;
2246 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
2247 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
2248 values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
2250 __pyx_v_h = values[0];
2251 __pyx_v_w = values[1];
2252 __pyx_v_n = values[2];
2254 goto __pyx_L4_argument_unpacking_done;
2255 __pyx_L5_argtuple_error:;
2256 __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 83, __pyx_L3_error)
2258 __Pyx_AddTraceback("pycocotools._mask.Masks.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
2259 __Pyx_RefNannyFinishContext();
2261 __pyx_L4_argument_unpacking_done:;
2262 __pyx_r = __pyx_pf_11pycocotools_5_mask_5Masks___cinit__(((struct __pyx_obj_11pycocotools_5_mask_Masks *)__pyx_v_self), __pyx_v_h, __pyx_v_w, __pyx_v_n);
2264 /* function exit code */
2265 __Pyx_RefNannyFinishContext();
2269 static int __pyx_pf_11pycocotools_5_mask_5Masks___cinit__(struct __pyx_obj_11pycocotools_5_mask_Masks *__pyx_v_self, PyObject *__pyx_v_h, PyObject *__pyx_v_w, PyObject *__pyx_v_n) {
2271 __Pyx_RefNannyDeclarations
2272 PyObject *__pyx_t_1 = NULL;
2273 PyObject *__pyx_t_2 = NULL;
2274 PyObject *__pyx_t_3 = NULL;
2277 __Pyx_RefNannySetupContext("__cinit__", 0);
2279 /* "pycocotools/_mask.pyx":84
2281 * def __cinit__(self, h, w, n):
2282 * self._mask = <byte*> malloc(h*w*n* sizeof(byte)) # <<<<<<<<<<<<<<
2286 __pyx_t_1 = PyNumber_Multiply(__pyx_v_h, __pyx_v_w); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 84, __pyx_L1_error)
2287 __Pyx_GOTREF(__pyx_t_1);
2288 __pyx_t_2 = PyNumber_Multiply(__pyx_t_1, __pyx_v_n); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 84, __pyx_L1_error)
2289 __Pyx_GOTREF(__pyx_t_2);
2290 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2291 __pyx_t_1 = __Pyx_PyInt_FromSize_t((sizeof(byte))); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 84, __pyx_L1_error)
2292 __Pyx_GOTREF(__pyx_t_1);
2293 __pyx_t_3 = PyNumber_Multiply(__pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 84, __pyx_L1_error)
2294 __Pyx_GOTREF(__pyx_t_3);
2295 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2296 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2297 __pyx_t_4 = __Pyx_PyInt_As_size_t(__pyx_t_3); if (unlikely((__pyx_t_4 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 84, __pyx_L1_error)
2298 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
2299 __pyx_v_self->_mask = ((byte *)malloc(__pyx_t_4));
2301 /* "pycocotools/_mask.pyx":85
2302 * def __cinit__(self, h, w, n):
2303 * self._mask = <byte*> malloc(h*w*n* sizeof(byte))
2304 * self._h = h # <<<<<<<<<<<<<<
2308 __pyx_t_5 = __Pyx_PyInt_As_siz(__pyx_v_h); if (unlikely((__pyx_t_5 == ((siz)-1)) && PyErr_Occurred())) __PYX_ERR(0, 85, __pyx_L1_error)
2309 __pyx_v_self->_h = __pyx_t_5;
2311 /* "pycocotools/_mask.pyx":86
2312 * self._mask = <byte*> malloc(h*w*n* sizeof(byte))
2314 * self._w = w # <<<<<<<<<<<<<<
2316 * # def __dealloc__(self):
2318 __pyx_t_5 = __Pyx_PyInt_As_siz(__pyx_v_w); if (unlikely((__pyx_t_5 == ((siz)-1)) && PyErr_Occurred())) __PYX_ERR(0, 86, __pyx_L1_error)
2319 __pyx_v_self->_w = __pyx_t_5;
2321 /* "pycocotools/_mask.pyx":87
2324 * self._n = n # <<<<<<<<<<<<<<
2325 * # def __dealloc__(self):
2326 * # the memory management of _mask has been passed to np.ndarray
2328 __pyx_t_5 = __Pyx_PyInt_As_siz(__pyx_v_n); if (unlikely((__pyx_t_5 == ((siz)-1)) && PyErr_Occurred())) __PYX_ERR(0, 87, __pyx_L1_error)
2329 __pyx_v_self->_n = __pyx_t_5;
2331 /* "pycocotools/_mask.pyx":83
2334 * def __cinit__(self, h, w, n): # <<<<<<<<<<<<<<
2335 * self._mask = <byte*> malloc(h*w*n* sizeof(byte))
2339 /* function exit code */
2343 __Pyx_XDECREF(__pyx_t_1);
2344 __Pyx_XDECREF(__pyx_t_2);
2345 __Pyx_XDECREF(__pyx_t_3);
2346 __Pyx_AddTraceback("pycocotools._mask.Masks.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
2349 __Pyx_RefNannyFinishContext();
2353 /* "pycocotools/_mask.pyx":93
2355 * # called when passing into np.array() and return an np.ndarray in column-major order
2356 * def __array__(self): # <<<<<<<<<<<<<<
2357 * cdef np.npy_intp shape[1]
2358 * shape[0] = <np.npy_intp> self._h*self._w*self._n
2361 /* Python wrapper */
2362 static PyObject *__pyx_pw_11pycocotools_5_mask_5Masks_3__array__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/
2363 static PyObject *__pyx_pw_11pycocotools_5_mask_5Masks_3__array__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) {
2364 PyObject *__pyx_r = 0;
2365 __Pyx_RefNannyDeclarations
2366 __Pyx_RefNannySetupContext("__array__ (wrapper)", 0);
2367 __pyx_r = __pyx_pf_11pycocotools_5_mask_5Masks_2__array__(((struct __pyx_obj_11pycocotools_5_mask_Masks *)__pyx_v_self));
2369 /* function exit code */
2370 __Pyx_RefNannyFinishContext();
2374 static PyObject *__pyx_pf_11pycocotools_5_mask_5Masks_2__array__(struct __pyx_obj_11pycocotools_5_mask_Masks *__pyx_v_self) {
2375 npy_intp __pyx_v_shape[1];
2376 PyObject *__pyx_v_ndarray = NULL;
2377 PyObject *__pyx_r = NULL;
2378 __Pyx_RefNannyDeclarations
2379 PyObject *__pyx_t_1 = NULL;
2380 PyObject *__pyx_t_2 = NULL;
2381 PyObject *__pyx_t_3 = NULL;
2382 PyObject *__pyx_t_4 = NULL;
2383 PyObject *__pyx_t_5 = NULL;
2384 __Pyx_RefNannySetupContext("__array__", 0);
2386 /* "pycocotools/_mask.pyx":95
2387 * def __array__(self):
2388 * cdef np.npy_intp shape[1]
2389 * shape[0] = <np.npy_intp> self._h*self._w*self._n # <<<<<<<<<<<<<<
2390 * # Create a 1D array, and reshape it to fortran/Matlab column-major array
2391 * ndarray = np.PyArray_SimpleNewFromData(1, shape, np.NPY_UINT8, self._mask).reshape((self._h, self._w, self._n), order='F')
2393 (__pyx_v_shape[0]) = ((((npy_intp)__pyx_v_self->_h) * __pyx_v_self->_w) * __pyx_v_self->_n);
2395 /* "pycocotools/_mask.pyx":97
2396 * shape[0] = <np.npy_intp> self._h*self._w*self._n
2397 * # Create a 1D array, and reshape it to fortran/Matlab column-major array
2398 * ndarray = np.PyArray_SimpleNewFromData(1, shape, np.NPY_UINT8, self._mask).reshape((self._h, self._w, self._n), order='F') # <<<<<<<<<<<<<<
2399 * # The _mask allocated by Masks is now handled by ndarray
2400 * PyArray_ENABLEFLAGS(ndarray, np.NPY_OWNDATA)
2402 __pyx_t_1 = PyArray_SimpleNewFromData(1, __pyx_v_shape, NPY_UINT8, __pyx_v_self->_mask); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 97, __pyx_L1_error)
2403 __Pyx_GOTREF(__pyx_t_1);
2404 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_reshape); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 97, __pyx_L1_error)
2405 __Pyx_GOTREF(__pyx_t_2);
2406 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2407 __pyx_t_1 = __Pyx_PyInt_From_siz(__pyx_v_self->_h); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 97, __pyx_L1_error)
2408 __Pyx_GOTREF(__pyx_t_1);
2409 __pyx_t_3 = __Pyx_PyInt_From_siz(__pyx_v_self->_w); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 97, __pyx_L1_error)
2410 __Pyx_GOTREF(__pyx_t_3);
2411 __pyx_t_4 = __Pyx_PyInt_From_siz(__pyx_v_self->_n); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 97, __pyx_L1_error)
2412 __Pyx_GOTREF(__pyx_t_4);
2413 __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 97, __pyx_L1_error)
2414 __Pyx_GOTREF(__pyx_t_5);
2415 __Pyx_GIVEREF(__pyx_t_1);
2416 PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1);
2417 __Pyx_GIVEREF(__pyx_t_3);
2418 PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_3);
2419 __Pyx_GIVEREF(__pyx_t_4);
2420 PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_4);
2424 __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 97, __pyx_L1_error)
2425 __Pyx_GOTREF(__pyx_t_4);
2426 __Pyx_GIVEREF(__pyx_t_5);
2427 PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5);
2429 __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 97, __pyx_L1_error)
2430 __Pyx_GOTREF(__pyx_t_5);
2431 if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_order, __pyx_n_s_F) < 0) __PYX_ERR(0, 97, __pyx_L1_error)
2432 __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 97, __pyx_L1_error)
2433 __Pyx_GOTREF(__pyx_t_3);
2434 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
2435 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
2436 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
2437 __pyx_v_ndarray = __pyx_t_3;
2440 /* "pycocotools/_mask.pyx":99
2441 * ndarray = np.PyArray_SimpleNewFromData(1, shape, np.NPY_UINT8, self._mask).reshape((self._h, self._w, self._n), order='F')
2442 * # The _mask allocated by Masks is now handled by ndarray
2443 * PyArray_ENABLEFLAGS(ndarray, np.NPY_OWNDATA) # <<<<<<<<<<<<<<
2447 if (!(likely(((__pyx_v_ndarray) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_ndarray, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 99, __pyx_L1_error)
2448 PyArray_ENABLEFLAGS(((PyArrayObject *)__pyx_v_ndarray), NPY_OWNDATA);
2450 /* "pycocotools/_mask.pyx":100
2451 * # The _mask allocated by Masks is now handled by ndarray
2452 * PyArray_ENABLEFLAGS(ndarray, np.NPY_OWNDATA)
2453 * return ndarray # <<<<<<<<<<<<<<
2455 * # internal conversion from Python RLEs object to compressed RLE format
2457 __Pyx_XDECREF(__pyx_r);
2458 __Pyx_INCREF(__pyx_v_ndarray);
2459 __pyx_r = __pyx_v_ndarray;
2462 /* "pycocotools/_mask.pyx":93
2464 * # called when passing into np.array() and return an np.ndarray in column-major order
2465 * def __array__(self): # <<<<<<<<<<<<<<
2466 * cdef np.npy_intp shape[1]
2467 * shape[0] = <np.npy_intp> self._h*self._w*self._n
2470 /* function exit code */
2472 __Pyx_XDECREF(__pyx_t_1);
2473 __Pyx_XDECREF(__pyx_t_2);
2474 __Pyx_XDECREF(__pyx_t_3);
2475 __Pyx_XDECREF(__pyx_t_4);
2476 __Pyx_XDECREF(__pyx_t_5);
2477 __Pyx_AddTraceback("pycocotools._mask.Masks.__array__", __pyx_clineno, __pyx_lineno, __pyx_filename);
2480 __Pyx_XDECREF(__pyx_v_ndarray);
2481 __Pyx_XGIVEREF(__pyx_r);
2482 __Pyx_RefNannyFinishContext();
2486 /* "pycocotools/_mask.pyx":103
2488 * # internal conversion from Python RLEs object to compressed RLE format
2489 * def _toString(RLEs Rs): # <<<<<<<<<<<<<<
2491 * cdef bytes py_string
2494 /* Python wrapper */
2495 static PyObject *__pyx_pw_11pycocotools_5_mask_1_toString(PyObject *__pyx_self, PyObject *__pyx_v_Rs); /*proto*/
2496 static PyMethodDef __pyx_mdef_11pycocotools_5_mask_1_toString = {"_toString", (PyCFunction)__pyx_pw_11pycocotools_5_mask_1_toString, METH_O, 0};
2497 static PyObject *__pyx_pw_11pycocotools_5_mask_1_toString(PyObject *__pyx_self, PyObject *__pyx_v_Rs) {
2498 PyObject *__pyx_r = 0;
2499 __Pyx_RefNannyDeclarations
2500 __Pyx_RefNannySetupContext("_toString (wrapper)", 0);
2501 if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_Rs), __pyx_ptype_11pycocotools_5_mask_RLEs, 1, "Rs", 0))) __PYX_ERR(0, 103, __pyx_L1_error)
2502 __pyx_r = __pyx_pf_11pycocotools_5_mask__toString(__pyx_self, ((struct __pyx_obj_11pycocotools_5_mask_RLEs *)__pyx_v_Rs));
2504 /* function exit code */
2509 __Pyx_RefNannyFinishContext();
2513 static PyObject *__pyx_pf_11pycocotools_5_mask__toString(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_11pycocotools_5_mask_RLEs *__pyx_v_Rs) {
2515 PyObject *__pyx_v_py_string = 0;
2516 char *__pyx_v_c_string;
2517 PyObject *__pyx_v_objs = NULL;
2519 PyObject *__pyx_r = NULL;
2520 __Pyx_RefNannyDeclarations
2521 PyObject *__pyx_t_1 = NULL;
2524 PyObject *__pyx_t_4 = NULL;
2525 PyObject *__pyx_t_5 = NULL;
2526 PyObject *__pyx_t_6 = NULL;
2528 __Pyx_RefNannySetupContext("_toString", 0);
2530 /* "pycocotools/_mask.pyx":104
2531 * # internal conversion from Python RLEs object to compressed RLE format
2532 * def _toString(RLEs Rs):
2533 * cdef siz n = Rs.n # <<<<<<<<<<<<<<
2534 * cdef bytes py_string
2535 * cdef char* c_string
2537 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_Rs), __pyx_n_s_n); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 104, __pyx_L1_error)
2538 __Pyx_GOTREF(__pyx_t_1);
2539 __pyx_t_2 = __Pyx_PyInt_As_siz(__pyx_t_1); if (unlikely((__pyx_t_2 == ((siz)-1)) && PyErr_Occurred())) __PYX_ERR(0, 104, __pyx_L1_error)
2540 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2541 __pyx_v_n = __pyx_t_2;
2543 /* "pycocotools/_mask.pyx":107
2544 * cdef bytes py_string
2545 * cdef char* c_string
2546 * objs = [] # <<<<<<<<<<<<<<
2547 * for i in range(n):
2548 * c_string = rleToString( <RLE*> &Rs._R[i] )
2550 __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 107, __pyx_L1_error)
2551 __Pyx_GOTREF(__pyx_t_1);
2552 __pyx_v_objs = ((PyObject*)__pyx_t_1);
2555 /* "pycocotools/_mask.pyx":108
2556 * cdef char* c_string
2558 * for i in range(n): # <<<<<<<<<<<<<<
2559 * c_string = rleToString( <RLE*> &Rs._R[i] )
2560 * py_string = c_string
2562 __pyx_t_2 = __pyx_v_n;
2563 for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) {
2564 __pyx_v_i = __pyx_t_3;
2566 /* "pycocotools/_mask.pyx":109
2568 * for i in range(n):
2569 * c_string = rleToString( <RLE*> &Rs._R[i] ) # <<<<<<<<<<<<<<
2570 * py_string = c_string
2573 __pyx_v_c_string = rleToString(((RLE *)(&(__pyx_v_Rs->_R[__pyx_v_i]))));
2575 /* "pycocotools/_mask.pyx":110
2576 * for i in range(n):
2577 * c_string = rleToString( <RLE*> &Rs._R[i] )
2578 * py_string = c_string # <<<<<<<<<<<<<<
2580 * 'size': [Rs._R[i].h, Rs._R[i].w],
2582 __pyx_t_1 = __Pyx_PyBytes_FromString(__pyx_v_c_string); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 110, __pyx_L1_error)
2583 __Pyx_GOTREF(__pyx_t_1);
2584 __Pyx_XDECREF_SET(__pyx_v_py_string, ((PyObject*)__pyx_t_1));
2587 /* "pycocotools/_mask.pyx":112
2588 * py_string = c_string
2590 * 'size': [Rs._R[i].h, Rs._R[i].w], # <<<<<<<<<<<<<<
2591 * 'counts': py_string
2594 __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 112, __pyx_L1_error)
2595 __Pyx_GOTREF(__pyx_t_1);
2596 __pyx_t_4 = __Pyx_PyInt_From_siz((__pyx_v_Rs->_R[__pyx_v_i]).h); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 112, __pyx_L1_error)
2597 __Pyx_GOTREF(__pyx_t_4);
2598 __pyx_t_5 = __Pyx_PyInt_From_siz((__pyx_v_Rs->_R[__pyx_v_i]).w); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 112, __pyx_L1_error)
2599 __Pyx_GOTREF(__pyx_t_5);
2600 __pyx_t_6 = PyList_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 112, __pyx_L1_error)
2601 __Pyx_GOTREF(__pyx_t_6);
2602 __Pyx_GIVEREF(__pyx_t_4);
2603 PyList_SET_ITEM(__pyx_t_6, 0, __pyx_t_4);
2604 __Pyx_GIVEREF(__pyx_t_5);
2605 PyList_SET_ITEM(__pyx_t_6, 1, __pyx_t_5);
2608 if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_size, __pyx_t_6) < 0) __PYX_ERR(0, 112, __pyx_L1_error)
2609 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
2611 /* "pycocotools/_mask.pyx":114
2612 * 'size': [Rs._R[i].h, Rs._R[i].w],
2613 * 'counts': py_string
2614 * }) # <<<<<<<<<<<<<<
2618 if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_counts, __pyx_v_py_string) < 0) __PYX_ERR(0, 112, __pyx_L1_error)
2620 /* "pycocotools/_mask.pyx":111
2621 * c_string = rleToString( <RLE*> &Rs._R[i] )
2622 * py_string = c_string
2623 * objs.append({ # <<<<<<<<<<<<<<
2624 * 'size': [Rs._R[i].h, Rs._R[i].w],
2625 * 'counts': py_string
2627 __pyx_t_7 = __Pyx_PyList_Append(__pyx_v_objs, __pyx_t_1); if (unlikely(__pyx_t_7 == -1)) __PYX_ERR(0, 111, __pyx_L1_error)
2628 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
2630 /* "pycocotools/_mask.pyx":115
2631 * 'counts': py_string
2633 * free(c_string) # <<<<<<<<<<<<<<
2637 free(__pyx_v_c_string);
2640 /* "pycocotools/_mask.pyx":116
2643 * return objs # <<<<<<<<<<<<<<
2645 * # internal conversion from compressed RLE format to Python RLEs object
2647 __Pyx_XDECREF(__pyx_r);
2648 __Pyx_INCREF(__pyx_v_objs);
2649 __pyx_r = __pyx_v_objs;
2652 /* "pycocotools/_mask.pyx":103
2654 * # internal conversion from Python RLEs object to compressed RLE format
2655 * def _toString(RLEs Rs): # <<<<<<<<<<<<<<
2657 * cdef bytes py_string
2660 /* function exit code */
2662 __Pyx_XDECREF(__pyx_t_1);
2663 __Pyx_XDECREF(__pyx_t_4);
2664 __Pyx_XDECREF(__pyx_t_5);
2665 __Pyx_XDECREF(__pyx_t_6);
2666 __Pyx_AddTraceback("pycocotools._mask._toString", __pyx_clineno, __pyx_lineno, __pyx_filename);
2669 __Pyx_XDECREF(__pyx_v_py_string);
2670 __Pyx_XDECREF(__pyx_v_objs);
2671 __Pyx_XGIVEREF(__pyx_r);
2672 __Pyx_RefNannyFinishContext();
2676 /* "pycocotools/_mask.pyx":119
2678 * # internal conversion from compressed RLE format to Python RLEs object
2679 * def _frString(rleObjs): # <<<<<<<<<<<<<<
2680 * cdef siz n = len(rleObjs)
2684 /* Python wrapper */
2685 static PyObject *__pyx_pw_11pycocotools_5_mask_3_frString(PyObject *__pyx_self, PyObject *__pyx_v_rleObjs); /*proto*/
2686 static PyMethodDef __pyx_mdef_11pycocotools_5_mask_3_frString = {"_frString", (PyCFunction)__pyx_pw_11pycocotools_5_mask_3_frString, METH_O, 0};
2687 static PyObject *__pyx_pw_11pycocotools_5_mask_3_frString(PyObject *__pyx_self, PyObject *__pyx_v_rleObjs) {
2688 PyObject *__pyx_r = 0;
2689 __Pyx_RefNannyDeclarations
2690 __Pyx_RefNannySetupContext("_frString (wrapper)", 0);
2691 __pyx_r = __pyx_pf_11pycocotools_5_mask_2_frString(__pyx_self, ((PyObject *)__pyx_v_rleObjs));
2693 /* function exit code */
2694 __Pyx_RefNannyFinishContext();
2698 static PyObject *__pyx_pf_11pycocotools_5_mask_2_frString(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_rleObjs) {
2700 struct __pyx_obj_11pycocotools_5_mask_RLEs *__pyx_v_Rs = NULL;
2701 PyObject *__pyx_v_py_string = 0;
2702 char *__pyx_v_c_string;
2703 PyObject *__pyx_v_i = NULL;
2704 PyObject *__pyx_v_obj = NULL;
2705 PyObject *__pyx_r = NULL;
2706 __Pyx_RefNannyDeclarations
2707 Py_ssize_t __pyx_t_1;
2708 PyObject *__pyx_t_2 = NULL;
2709 PyObject *__pyx_t_3 = NULL;
2710 PyObject *(*__pyx_t_4)(PyObject *);
2711 PyObject *__pyx_t_5 = NULL;
2712 PyObject *__pyx_t_6 = NULL;
2714 PyObject *__pyx_t_8 = NULL;
2715 PyObject *__pyx_t_9 = NULL;
2716 PyObject *__pyx_t_10 = NULL;
2717 PyObject *__pyx_t_11 = NULL;
2719 Py_ssize_t __pyx_t_13;
2722 __Pyx_RefNannySetupContext("_frString", 0);
2724 /* "pycocotools/_mask.pyx":120
2725 * # internal conversion from compressed RLE format to Python RLEs object
2726 * def _frString(rleObjs):
2727 * cdef siz n = len(rleObjs) # <<<<<<<<<<<<<<
2729 * cdef bytes py_string
2731 __pyx_t_1 = PyObject_Length(__pyx_v_rleObjs); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(0, 120, __pyx_L1_error)
2732 __pyx_v_n = __pyx_t_1;
2734 /* "pycocotools/_mask.pyx":121
2735 * def _frString(rleObjs):
2736 * cdef siz n = len(rleObjs)
2737 * Rs = RLEs(n) # <<<<<<<<<<<<<<
2738 * cdef bytes py_string
2739 * cdef char* c_string
2741 __pyx_t_2 = __Pyx_PyInt_From_siz(__pyx_v_n); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 121, __pyx_L1_error)
2742 __Pyx_GOTREF(__pyx_t_2);
2743 __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 121, __pyx_L1_error)
2744 __Pyx_GOTREF(__pyx_t_3);
2745 __Pyx_GIVEREF(__pyx_t_2);
2746 PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
2748 __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_11pycocotools_5_mask_RLEs), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 121, __pyx_L1_error)
2749 __Pyx_GOTREF(__pyx_t_2);
2750 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
2751 __pyx_v_Rs = ((struct __pyx_obj_11pycocotools_5_mask_RLEs *)__pyx_t_2);
2754 /* "pycocotools/_mask.pyx":124
2755 * cdef bytes py_string
2756 * cdef char* c_string
2757 * for i, obj in enumerate(rleObjs): # <<<<<<<<<<<<<<
2758 * if PYTHON_VERSION == 2:
2759 * py_string = str(obj['counts']).encode('utf8')
2761 __Pyx_INCREF(__pyx_int_0);
2762 __pyx_t_2 = __pyx_int_0;
2763 if (likely(PyList_CheckExact(__pyx_v_rleObjs)) || PyTuple_CheckExact(__pyx_v_rleObjs)) {
2764 __pyx_t_3 = __pyx_v_rleObjs; __Pyx_INCREF(__pyx_t_3); __pyx_t_1 = 0;
2767 __pyx_t_1 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_rleObjs); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 124, __pyx_L1_error)
2768 __Pyx_GOTREF(__pyx_t_3);
2769 __pyx_t_4 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 124, __pyx_L1_error)
2772 if (likely(!__pyx_t_4)) {
2773 if (likely(PyList_CheckExact(__pyx_t_3))) {
2774 if (__pyx_t_1 >= PyList_GET_SIZE(__pyx_t_3)) break;
2775 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
2776 __pyx_t_5 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_1); __Pyx_INCREF(__pyx_t_5); __pyx_t_1++; if (unlikely(0 < 0)) __PYX_ERR(0, 124, __pyx_L1_error)
2778 __pyx_t_5 = PySequence_ITEM(__pyx_t_3, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 124, __pyx_L1_error)
2779 __Pyx_GOTREF(__pyx_t_5);
2782 if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
2783 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
2784 __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_1); __Pyx_INCREF(__pyx_t_5); __pyx_t_1++; if (unlikely(0 < 0)) __PYX_ERR(0, 124, __pyx_L1_error)
2786 __pyx_t_5 = PySequence_ITEM(__pyx_t_3, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 124, __pyx_L1_error)
2787 __Pyx_GOTREF(__pyx_t_5);
2791 __pyx_t_5 = __pyx_t_4(__pyx_t_3);
2792 if (unlikely(!__pyx_t_5)) {
2793 PyObject* exc_type = PyErr_Occurred();
2795 if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
2796 else __PYX_ERR(0, 124, __pyx_L1_error)
2800 __Pyx_GOTREF(__pyx_t_5);
2802 __Pyx_XDECREF_SET(__pyx_v_obj, __pyx_t_5);
2804 __Pyx_INCREF(__pyx_t_2);
2805 __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_2);
2806 __pyx_t_5 = __Pyx_PyInt_AddObjC(__pyx_t_2, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 124, __pyx_L1_error)
2807 __Pyx_GOTREF(__pyx_t_5);
2808 __Pyx_DECREF(__pyx_t_2);
2809 __pyx_t_2 = __pyx_t_5;
2812 /* "pycocotools/_mask.pyx":125
2813 * cdef char* c_string
2814 * for i, obj in enumerate(rleObjs):
2815 * if PYTHON_VERSION == 2: # <<<<<<<<<<<<<<
2816 * py_string = str(obj['counts']).encode('utf8')
2817 * elif PYTHON_VERSION == 3:
2819 __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_PYTHON_VERSION); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 125, __pyx_L1_error)
2820 __Pyx_GOTREF(__pyx_t_5);
2821 __pyx_t_6 = __Pyx_PyInt_EqObjC(__pyx_t_5, __pyx_int_2, 2, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 125, __pyx_L1_error)
2822 __Pyx_GOTREF(__pyx_t_6);
2823 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
2824 __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 125, __pyx_L1_error)
2825 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
2828 /* "pycocotools/_mask.pyx":126
2829 * for i, obj in enumerate(rleObjs):
2830 * if PYTHON_VERSION == 2:
2831 * py_string = str(obj['counts']).encode('utf8') # <<<<<<<<<<<<<<
2832 * elif PYTHON_VERSION == 3:
2833 * py_string = str.encode(obj['counts']) if type(obj['counts']) == str else obj['counts']
2835 __pyx_t_6 = PyObject_GetItem(__pyx_v_obj, __pyx_n_s_counts); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 126, __pyx_L1_error)
2836 __Pyx_GOTREF(__pyx_t_6);
2837 __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 126, __pyx_L1_error)
2838 __Pyx_GOTREF(__pyx_t_5);
2839 __Pyx_GIVEREF(__pyx_t_6);
2840 PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_6);
2842 __pyx_t_6 = __Pyx_PyObject_Call(((PyObject *)(&PyString_Type)), __pyx_t_5, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 126, __pyx_L1_error)
2843 __Pyx_GOTREF(__pyx_t_6);
2844 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
2845 __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_encode); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 126, __pyx_L1_error)
2846 __Pyx_GOTREF(__pyx_t_5);
2847 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
2848 __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_tuple_, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 126, __pyx_L1_error)
2849 __Pyx_GOTREF(__pyx_t_6);
2850 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
2851 if (!(likely(PyBytes_CheckExact(__pyx_t_6))||((__pyx_t_6) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_6)->tp_name), 0))) __PYX_ERR(0, 126, __pyx_L1_error)
2852 __Pyx_XDECREF_SET(__pyx_v_py_string, ((PyObject*)__pyx_t_6));
2855 /* "pycocotools/_mask.pyx":125
2856 * cdef char* c_string
2857 * for i, obj in enumerate(rleObjs):
2858 * if PYTHON_VERSION == 2: # <<<<<<<<<<<<<<
2859 * py_string = str(obj['counts']).encode('utf8')
2860 * elif PYTHON_VERSION == 3:
2865 /* "pycocotools/_mask.pyx":127
2866 * if PYTHON_VERSION == 2:
2867 * py_string = str(obj['counts']).encode('utf8')
2868 * elif PYTHON_VERSION == 3: # <<<<<<<<<<<<<<
2869 * py_string = str.encode(obj['counts']) if type(obj['counts']) == str else obj['counts']
2872 __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_PYTHON_VERSION); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 127, __pyx_L1_error)
2873 __Pyx_GOTREF(__pyx_t_6);
2874 __pyx_t_5 = __Pyx_PyInt_EqObjC(__pyx_t_6, __pyx_int_3, 3, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 127, __pyx_L1_error)
2875 __Pyx_GOTREF(__pyx_t_5);
2876 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
2877 __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 127, __pyx_L1_error)
2878 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
2881 /* "pycocotools/_mask.pyx":128
2882 * py_string = str(obj['counts']).encode('utf8')
2883 * elif PYTHON_VERSION == 3:
2884 * py_string = str.encode(obj['counts']) if type(obj['counts']) == str else obj['counts'] # <<<<<<<<<<<<<<
2886 * raise Exception('Python version must be 2 or 3')
2888 __pyx_t_6 = PyObject_GetItem(__pyx_v_obj, __pyx_n_s_counts); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 128, __pyx_L1_error)
2889 __Pyx_GOTREF(__pyx_t_6);
2890 __pyx_t_8 = PyObject_RichCompare(((PyObject *)Py_TYPE(__pyx_t_6)), ((PyObject *)(&PyString_Type)), Py_EQ); __Pyx_XGOTREF(__pyx_t_8); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 128, __pyx_L1_error)
2891 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
2892 __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 128, __pyx_L1_error)
2893 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
2895 __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)(&PyString_Type)), __pyx_n_s_encode); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 128, __pyx_L1_error)
2896 __Pyx_GOTREF(__pyx_t_6);
2897 __pyx_t_9 = PyObject_GetItem(__pyx_v_obj, __pyx_n_s_counts); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 128, __pyx_L1_error)
2898 __Pyx_GOTREF(__pyx_t_9);
2900 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_6))) {
2901 __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_6);
2902 if (likely(__pyx_t_10)) {
2903 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
2904 __Pyx_INCREF(__pyx_t_10);
2905 __Pyx_INCREF(function);
2906 __Pyx_DECREF_SET(__pyx_t_6, function);
2910 __pyx_t_8 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_9); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 128, __pyx_L1_error)
2911 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
2912 __Pyx_GOTREF(__pyx_t_8);
2914 #if CYTHON_FAST_PYCALL
2915 if (PyFunction_Check(__pyx_t_6)) {
2916 PyObject *__pyx_temp[2] = {__pyx_t_10, __pyx_t_9};
2917 __pyx_t_8 = __Pyx_PyFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 128, __pyx_L1_error)
2918 __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
2919 __Pyx_GOTREF(__pyx_t_8);
2920 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
2923 #if CYTHON_FAST_PYCCALL
2924 if (__Pyx_PyFastCFunction_Check(__pyx_t_6)) {
2925 PyObject *__pyx_temp[2] = {__pyx_t_10, __pyx_t_9};
2926 __pyx_t_8 = __Pyx_PyCFunction_FastCall(__pyx_t_6, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 128, __pyx_L1_error)
2927 __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
2928 __Pyx_GOTREF(__pyx_t_8);
2929 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
2933 __pyx_t_11 = PyTuple_New(1+1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 128, __pyx_L1_error)
2934 __Pyx_GOTREF(__pyx_t_11);
2935 __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_10); __pyx_t_10 = NULL;
2936 __Pyx_GIVEREF(__pyx_t_9);
2937 PyTuple_SET_ITEM(__pyx_t_11, 0+1, __pyx_t_9);
2939 __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_11, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 128, __pyx_L1_error)
2940 __Pyx_GOTREF(__pyx_t_8);
2941 __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
2944 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
2945 if (!(likely(PyBytes_CheckExact(__pyx_t_8))||((__pyx_t_8) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_8)->tp_name), 0))) __PYX_ERR(0, 128, __pyx_L1_error)
2946 __pyx_t_5 = __pyx_t_8;
2949 __pyx_t_8 = PyObject_GetItem(__pyx_v_obj, __pyx_n_s_counts); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 128, __pyx_L1_error)
2950 __Pyx_GOTREF(__pyx_t_8);
2951 if (!(likely(PyBytes_CheckExact(__pyx_t_8))||((__pyx_t_8) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "bytes", Py_TYPE(__pyx_t_8)->tp_name), 0))) __PYX_ERR(0, 128, __pyx_L1_error)
2952 __pyx_t_5 = __pyx_t_8;
2955 __Pyx_XDECREF_SET(__pyx_v_py_string, ((PyObject*)__pyx_t_5));
2958 /* "pycocotools/_mask.pyx":127
2959 * if PYTHON_VERSION == 2:
2960 * py_string = str(obj['counts']).encode('utf8')
2961 * elif PYTHON_VERSION == 3: # <<<<<<<<<<<<<<
2962 * py_string = str.encode(obj['counts']) if type(obj['counts']) == str else obj['counts']
2968 /* "pycocotools/_mask.pyx":130
2969 * py_string = str.encode(obj['counts']) if type(obj['counts']) == str else obj['counts']
2971 * raise Exception('Python version must be 2 or 3') # <<<<<<<<<<<<<<
2972 * c_string = py_string
2973 * rleFrString( <RLE*> &Rs._R[i], <char*> c_string, obj['size'][0], obj['size'][1] )
2976 __pyx_t_5 = __Pyx_PyObject_Call(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])), __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 130, __pyx_L1_error)
2977 __Pyx_GOTREF(__pyx_t_5);
2978 __Pyx_Raise(__pyx_t_5, 0, 0, 0);
2979 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
2980 __PYX_ERR(0, 130, __pyx_L1_error)
2984 /* "pycocotools/_mask.pyx":131
2986 * raise Exception('Python version must be 2 or 3')
2987 * c_string = py_string # <<<<<<<<<<<<<<
2988 * rleFrString( <RLE*> &Rs._R[i], <char*> c_string, obj['size'][0], obj['size'][1] )
2991 __pyx_t_12 = __Pyx_PyObject_AsString(__pyx_v_py_string); if (unlikely((!__pyx_t_12) && PyErr_Occurred())) __PYX_ERR(0, 131, __pyx_L1_error)
2992 __pyx_v_c_string = __pyx_t_12;
2994 /* "pycocotools/_mask.pyx":132
2995 * raise Exception('Python version must be 2 or 3')
2996 * c_string = py_string
2997 * rleFrString( <RLE*> &Rs._R[i], <char*> c_string, obj['size'][0], obj['size'][1] ) # <<<<<<<<<<<<<<
3001 __pyx_t_13 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_13 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 132, __pyx_L1_error)
3002 __pyx_t_5 = PyObject_GetItem(__pyx_v_obj, __pyx_n_s_size); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 132, __pyx_L1_error)
3003 __Pyx_GOTREF(__pyx_t_5);
3004 __pyx_t_8 = __Pyx_GetItemInt(__pyx_t_5, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 132, __pyx_L1_error)
3005 __Pyx_GOTREF(__pyx_t_8);
3006 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
3007 __pyx_t_14 = __Pyx_PyInt_As_siz(__pyx_t_8); if (unlikely((__pyx_t_14 == ((siz)-1)) && PyErr_Occurred())) __PYX_ERR(0, 132, __pyx_L1_error)
3008 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
3009 __pyx_t_8 = PyObject_GetItem(__pyx_v_obj, __pyx_n_s_size); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 132, __pyx_L1_error)
3010 __Pyx_GOTREF(__pyx_t_8);
3011 __pyx_t_5 = __Pyx_GetItemInt(__pyx_t_8, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 132, __pyx_L1_error)
3012 __Pyx_GOTREF(__pyx_t_5);
3013 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
3014 __pyx_t_15 = __Pyx_PyInt_As_siz(__pyx_t_5); if (unlikely((__pyx_t_15 == ((siz)-1)) && PyErr_Occurred())) __PYX_ERR(0, 132, __pyx_L1_error)
3015 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
3016 rleFrString(((RLE *)(&(__pyx_v_Rs->_R[__pyx_t_13]))), ((char *)__pyx_v_c_string), __pyx_t_14, __pyx_t_15);
3018 /* "pycocotools/_mask.pyx":124
3019 * cdef bytes py_string
3020 * cdef char* c_string
3021 * for i, obj in enumerate(rleObjs): # <<<<<<<<<<<<<<
3022 * if PYTHON_VERSION == 2:
3023 * py_string = str(obj['counts']).encode('utf8')
3026 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3027 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3029 /* "pycocotools/_mask.pyx":133
3030 * c_string = py_string
3031 * rleFrString( <RLE*> &Rs._R[i], <char*> c_string, obj['size'][0], obj['size'][1] )
3032 * return Rs # <<<<<<<<<<<<<<
3034 * # encode mask to RLEs objects
3036 __Pyx_XDECREF(__pyx_r);
3037 __Pyx_INCREF(((PyObject *)__pyx_v_Rs));
3038 __pyx_r = ((PyObject *)__pyx_v_Rs);
3041 /* "pycocotools/_mask.pyx":119
3043 * # internal conversion from compressed RLE format to Python RLEs object
3044 * def _frString(rleObjs): # <<<<<<<<<<<<<<
3045 * cdef siz n = len(rleObjs)
3049 /* function exit code */
3051 __Pyx_XDECREF(__pyx_t_2);
3052 __Pyx_XDECREF(__pyx_t_3);
3053 __Pyx_XDECREF(__pyx_t_5);
3054 __Pyx_XDECREF(__pyx_t_6);
3055 __Pyx_XDECREF(__pyx_t_8);
3056 __Pyx_XDECREF(__pyx_t_9);
3057 __Pyx_XDECREF(__pyx_t_10);
3058 __Pyx_XDECREF(__pyx_t_11);
3059 __Pyx_AddTraceback("pycocotools._mask._frString", __pyx_clineno, __pyx_lineno, __pyx_filename);
3062 __Pyx_XDECREF((PyObject *)__pyx_v_Rs);
3063 __Pyx_XDECREF(__pyx_v_py_string);
3064 __Pyx_XDECREF(__pyx_v_i);
3065 __Pyx_XDECREF(__pyx_v_obj);
3066 __Pyx_XGIVEREF(__pyx_r);
3067 __Pyx_RefNannyFinishContext();
3071 /* "pycocotools/_mask.pyx":137
3072 * # encode mask to RLEs objects
3073 * # list of RLE string can be generated by RLEs member function
3074 * def encode(np.ndarray[np.uint8_t, ndim=3, mode='fortran'] mask): # <<<<<<<<<<<<<<
3075 * h, w, n = mask.shape[0], mask.shape[1], mask.shape[2]
3076 * cdef RLEs Rs = RLEs(n)
3079 /* Python wrapper */
3080 static PyObject *__pyx_pw_11pycocotools_5_mask_5encode(PyObject *__pyx_self, PyObject *__pyx_v_mask); /*proto*/
3081 static PyMethodDef __pyx_mdef_11pycocotools_5_mask_5encode = {"encode", (PyCFunction)__pyx_pw_11pycocotools_5_mask_5encode, METH_O, 0};
3082 static PyObject *__pyx_pw_11pycocotools_5_mask_5encode(PyObject *__pyx_self, PyObject *__pyx_v_mask) {
3083 PyObject *__pyx_r = 0;
3084 __Pyx_RefNannyDeclarations
3085 __Pyx_RefNannySetupContext("encode (wrapper)", 0);
3086 if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_mask), __pyx_ptype_5numpy_ndarray, 1, "mask", 0))) __PYX_ERR(0, 137, __pyx_L1_error)
3087 __pyx_r = __pyx_pf_11pycocotools_5_mask_4encode(__pyx_self, ((PyArrayObject *)__pyx_v_mask));
3089 /* function exit code */
3094 __Pyx_RefNannyFinishContext();
3098 static PyObject *__pyx_pf_11pycocotools_5_mask_4encode(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_mask) {
3102 struct __pyx_obj_11pycocotools_5_mask_RLEs *__pyx_v_Rs = 0;
3103 PyObject *__pyx_v_objs = NULL;
3104 __Pyx_LocalBuf_ND __pyx_pybuffernd_mask;
3105 __Pyx_Buffer __pyx_pybuffer_mask;
3106 PyObject *__pyx_r = NULL;
3107 __Pyx_RefNannyDeclarations
3111 PyObject *__pyx_t_4 = NULL;
3112 PyObject *__pyx_t_5 = NULL;
3113 PyObject *__pyx_t_6 = NULL;
3114 PyObject *__pyx_t_7 = NULL;
3115 __Pyx_RefNannySetupContext("encode", 0);
3116 __pyx_pybuffer_mask.pybuffer.buf = NULL;
3117 __pyx_pybuffer_mask.refcount = 0;
3118 __pyx_pybuffernd_mask.data = NULL;
3119 __pyx_pybuffernd_mask.rcbuffer = &__pyx_pybuffer_mask;
3121 __Pyx_BufFmt_StackElem __pyx_stack[1];
3122 if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_mask.rcbuffer->pybuffer, (PyObject*)__pyx_v_mask, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint8_t, PyBUF_FORMAT| PyBUF_F_CONTIGUOUS, 3, 0, __pyx_stack) == -1)) __PYX_ERR(0, 137, __pyx_L1_error)
3124 __pyx_pybuffernd_mask.diminfo[0].strides = __pyx_pybuffernd_mask.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_mask.diminfo[0].shape = __pyx_pybuffernd_mask.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_mask.diminfo[1].strides = __pyx_pybuffernd_mask.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_mask.diminfo[1].shape = __pyx_pybuffernd_mask.rcbuffer->pybuffer.shape[1]; __pyx_pybuffernd_mask.diminfo[2].strides = __pyx_pybuffernd_mask.rcbuffer->pybuffer.strides[2]; __pyx_pybuffernd_mask.diminfo[2].shape = __pyx_pybuffernd_mask.rcbuffer->pybuffer.shape[2];
3126 /* "pycocotools/_mask.pyx":138
3127 * # list of RLE string can be generated by RLEs member function
3128 * def encode(np.ndarray[np.uint8_t, ndim=3, mode='fortran'] mask):
3129 * h, w, n = mask.shape[0], mask.shape[1], mask.shape[2] # <<<<<<<<<<<<<<
3130 * cdef RLEs Rs = RLEs(n)
3131 * rleEncode(Rs._R,<byte*>mask.data,h,w,n)
3133 __pyx_t_1 = (__pyx_v_mask->dimensions[0]);
3134 __pyx_t_2 = (__pyx_v_mask->dimensions[1]);
3135 __pyx_t_3 = (__pyx_v_mask->dimensions[2]);
3136 __pyx_v_h = __pyx_t_1;
3137 __pyx_v_w = __pyx_t_2;
3138 __pyx_v_n = __pyx_t_3;
3140 /* "pycocotools/_mask.pyx":139
3141 * def encode(np.ndarray[np.uint8_t, ndim=3, mode='fortran'] mask):
3142 * h, w, n = mask.shape[0], mask.shape[1], mask.shape[2]
3143 * cdef RLEs Rs = RLEs(n) # <<<<<<<<<<<<<<
3144 * rleEncode(Rs._R,<byte*>mask.data,h,w,n)
3145 * objs = _toString(Rs)
3147 __pyx_t_4 = __Pyx_PyInt_From_Py_intptr_t(__pyx_v_n); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 139, __pyx_L1_error)
3148 __Pyx_GOTREF(__pyx_t_4);
3149 __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 139, __pyx_L1_error)
3150 __Pyx_GOTREF(__pyx_t_5);
3151 __Pyx_GIVEREF(__pyx_t_4);
3152 PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4);
3154 __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_11pycocotools_5_mask_RLEs), __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 139, __pyx_L1_error)
3155 __Pyx_GOTREF(__pyx_t_4);
3156 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
3157 __pyx_v_Rs = ((struct __pyx_obj_11pycocotools_5_mask_RLEs *)__pyx_t_4);
3160 /* "pycocotools/_mask.pyx":140
3161 * h, w, n = mask.shape[0], mask.shape[1], mask.shape[2]
3162 * cdef RLEs Rs = RLEs(n)
3163 * rleEncode(Rs._R,<byte*>mask.data,h,w,n) # <<<<<<<<<<<<<<
3164 * objs = _toString(Rs)
3167 rleEncode(__pyx_v_Rs->_R, ((byte *)__pyx_v_mask->data), __pyx_v_h, __pyx_v_w, __pyx_v_n);
3169 /* "pycocotools/_mask.pyx":141
3170 * cdef RLEs Rs = RLEs(n)
3171 * rleEncode(Rs._R,<byte*>mask.data,h,w,n)
3172 * objs = _toString(Rs) # <<<<<<<<<<<<<<
3176 __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_toString); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 141, __pyx_L1_error)
3177 __Pyx_GOTREF(__pyx_t_5);
3179 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
3180 __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
3181 if (likely(__pyx_t_6)) {
3182 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
3183 __Pyx_INCREF(__pyx_t_6);
3184 __Pyx_INCREF(function);
3185 __Pyx_DECREF_SET(__pyx_t_5, function);
3189 __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_5, ((PyObject *)__pyx_v_Rs)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 141, __pyx_L1_error)
3190 __Pyx_GOTREF(__pyx_t_4);
3192 #if CYTHON_FAST_PYCALL
3193 if (PyFunction_Check(__pyx_t_5)) {
3194 PyObject *__pyx_temp[2] = {__pyx_t_6, ((PyObject *)__pyx_v_Rs)};
3195 __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 141, __pyx_L1_error)
3196 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
3197 __Pyx_GOTREF(__pyx_t_4);
3200 #if CYTHON_FAST_PYCCALL
3201 if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
3202 PyObject *__pyx_temp[2] = {__pyx_t_6, ((PyObject *)__pyx_v_Rs)};
3203 __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 141, __pyx_L1_error)
3204 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
3205 __Pyx_GOTREF(__pyx_t_4);
3209 __pyx_t_7 = PyTuple_New(1+1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 141, __pyx_L1_error)
3210 __Pyx_GOTREF(__pyx_t_7);
3211 __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_6); __pyx_t_6 = NULL;
3212 __Pyx_INCREF(((PyObject *)__pyx_v_Rs));
3213 __Pyx_GIVEREF(((PyObject *)__pyx_v_Rs));
3214 PyTuple_SET_ITEM(__pyx_t_7, 0+1, ((PyObject *)__pyx_v_Rs));
3215 __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_7, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 141, __pyx_L1_error)
3216 __Pyx_GOTREF(__pyx_t_4);
3217 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
3220 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
3221 __pyx_v_objs = __pyx_t_4;
3224 /* "pycocotools/_mask.pyx":142
3225 * rleEncode(Rs._R,<byte*>mask.data,h,w,n)
3226 * objs = _toString(Rs)
3227 * return objs # <<<<<<<<<<<<<<
3229 * # decode mask from compressed list of RLE string or RLEs object
3231 __Pyx_XDECREF(__pyx_r);
3232 __Pyx_INCREF(__pyx_v_objs);
3233 __pyx_r = __pyx_v_objs;
3236 /* "pycocotools/_mask.pyx":137
3237 * # encode mask to RLEs objects
3238 * # list of RLE string can be generated by RLEs member function
3239 * def encode(np.ndarray[np.uint8_t, ndim=3, mode='fortran'] mask): # <<<<<<<<<<<<<<
3240 * h, w, n = mask.shape[0], mask.shape[1], mask.shape[2]
3241 * cdef RLEs Rs = RLEs(n)
3244 /* function exit code */
3246 __Pyx_XDECREF(__pyx_t_4);
3247 __Pyx_XDECREF(__pyx_t_5);
3248 __Pyx_XDECREF(__pyx_t_6);
3249 __Pyx_XDECREF(__pyx_t_7);
3250 { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
3251 __Pyx_PyThreadState_declare
3252 __Pyx_PyThreadState_assign
3253 __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
3254 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_mask.rcbuffer->pybuffer);
3255 __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
3256 __Pyx_AddTraceback("pycocotools._mask.encode", __pyx_clineno, __pyx_lineno, __pyx_filename);
3260 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_mask.rcbuffer->pybuffer);
3262 __Pyx_XDECREF((PyObject *)__pyx_v_Rs);
3263 __Pyx_XDECREF(__pyx_v_objs);
3264 __Pyx_XGIVEREF(__pyx_r);
3265 __Pyx_RefNannyFinishContext();
3269 /* "pycocotools/_mask.pyx":145
3271 * # decode mask from compressed list of RLE string or RLEs object
3272 * def decode(rleObjs): # <<<<<<<<<<<<<<
3273 * cdef RLEs Rs = _frString(rleObjs)
3274 * h, w, n = Rs._R[0].h, Rs._R[0].w, Rs._n
3277 /* Python wrapper */
3278 static PyObject *__pyx_pw_11pycocotools_5_mask_7decode(PyObject *__pyx_self, PyObject *__pyx_v_rleObjs); /*proto*/
3279 static PyMethodDef __pyx_mdef_11pycocotools_5_mask_7decode = {"decode", (PyCFunction)__pyx_pw_11pycocotools_5_mask_7decode, METH_O, 0};
3280 static PyObject *__pyx_pw_11pycocotools_5_mask_7decode(PyObject *__pyx_self, PyObject *__pyx_v_rleObjs) {
3281 PyObject *__pyx_r = 0;
3282 __Pyx_RefNannyDeclarations
3283 __Pyx_RefNannySetupContext("decode (wrapper)", 0);
3284 __pyx_r = __pyx_pf_11pycocotools_5_mask_6decode(__pyx_self, ((PyObject *)__pyx_v_rleObjs));
3286 /* function exit code */
3287 __Pyx_RefNannyFinishContext();
3291 static PyObject *__pyx_pf_11pycocotools_5_mask_6decode(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_rleObjs) {
3292 struct __pyx_obj_11pycocotools_5_mask_RLEs *__pyx_v_Rs = 0;
3296 struct __pyx_obj_11pycocotools_5_mask_Masks *__pyx_v_masks = NULL;
3297 PyObject *__pyx_r = NULL;
3298 __Pyx_RefNannyDeclarations
3299 PyObject *__pyx_t_1 = NULL;
3300 PyObject *__pyx_t_2 = NULL;
3301 PyObject *__pyx_t_3 = NULL;
3302 PyObject *__pyx_t_4 = NULL;
3306 __Pyx_RefNannySetupContext("decode", 0);
3308 /* "pycocotools/_mask.pyx":146
3309 * # decode mask from compressed list of RLE string or RLEs object
3310 * def decode(rleObjs):
3311 * cdef RLEs Rs = _frString(rleObjs) # <<<<<<<<<<<<<<
3312 * h, w, n = Rs._R[0].h, Rs._R[0].w, Rs._n
3313 * masks = Masks(h, w, n)
3315 __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_frString); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 146, __pyx_L1_error)
3316 __Pyx_GOTREF(__pyx_t_2);
3318 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
3319 __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
3320 if (likely(__pyx_t_3)) {
3321 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
3322 __Pyx_INCREF(__pyx_t_3);
3323 __Pyx_INCREF(function);
3324 __Pyx_DECREF_SET(__pyx_t_2, function);
3328 __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_rleObjs); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 146, __pyx_L1_error)
3329 __Pyx_GOTREF(__pyx_t_1);
3331 #if CYTHON_FAST_PYCALL
3332 if (PyFunction_Check(__pyx_t_2)) {
3333 PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_v_rleObjs};
3334 __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 146, __pyx_L1_error)
3335 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
3336 __Pyx_GOTREF(__pyx_t_1);
3339 #if CYTHON_FAST_PYCCALL
3340 if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
3341 PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_v_rleObjs};
3342 __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 146, __pyx_L1_error)
3343 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
3344 __Pyx_GOTREF(__pyx_t_1);
3348 __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 146, __pyx_L1_error)
3349 __Pyx_GOTREF(__pyx_t_4);
3350 __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __pyx_t_3 = NULL;
3351 __Pyx_INCREF(__pyx_v_rleObjs);
3352 __Pyx_GIVEREF(__pyx_v_rleObjs);
3353 PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_rleObjs);
3354 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 146, __pyx_L1_error)
3355 __Pyx_GOTREF(__pyx_t_1);
3356 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3359 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3360 if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_11pycocotools_5_mask_RLEs))))) __PYX_ERR(0, 146, __pyx_L1_error)
3361 __pyx_v_Rs = ((struct __pyx_obj_11pycocotools_5_mask_RLEs *)__pyx_t_1);
3364 /* "pycocotools/_mask.pyx":147
3365 * def decode(rleObjs):
3366 * cdef RLEs Rs = _frString(rleObjs)
3367 * h, w, n = Rs._R[0].h, Rs._R[0].w, Rs._n # <<<<<<<<<<<<<<
3368 * masks = Masks(h, w, n)
3369 * rleDecode(<RLE*>Rs._R, masks._mask, n);
3371 __pyx_t_5 = (__pyx_v_Rs->_R[0]).h;
3372 __pyx_t_6 = (__pyx_v_Rs->_R[0]).w;
3373 __pyx_t_7 = __pyx_v_Rs->_n;
3374 __pyx_v_h = __pyx_t_5;
3375 __pyx_v_w = __pyx_t_6;
3376 __pyx_v_n = __pyx_t_7;
3378 /* "pycocotools/_mask.pyx":148
3379 * cdef RLEs Rs = _frString(rleObjs)
3380 * h, w, n = Rs._R[0].h, Rs._R[0].w, Rs._n
3381 * masks = Masks(h, w, n) # <<<<<<<<<<<<<<
3382 * rleDecode(<RLE*>Rs._R, masks._mask, n);
3383 * return np.array(masks)
3385 __pyx_t_1 = __Pyx_PyInt_From_siz(__pyx_v_h); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 148, __pyx_L1_error)
3386 __Pyx_GOTREF(__pyx_t_1);
3387 __pyx_t_2 = __Pyx_PyInt_From_siz(__pyx_v_w); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 148, __pyx_L1_error)
3388 __Pyx_GOTREF(__pyx_t_2);
3389 __pyx_t_4 = __Pyx_PyInt_From_siz(__pyx_v_n); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 148, __pyx_L1_error)
3390 __Pyx_GOTREF(__pyx_t_4);
3391 __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 148, __pyx_L1_error)
3392 __Pyx_GOTREF(__pyx_t_3);
3393 __Pyx_GIVEREF(__pyx_t_1);
3394 PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1);
3395 __Pyx_GIVEREF(__pyx_t_2);
3396 PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2);
3397 __Pyx_GIVEREF(__pyx_t_4);
3398 PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_4);
3402 __pyx_t_4 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_11pycocotools_5_mask_Masks), __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 148, __pyx_L1_error)
3403 __Pyx_GOTREF(__pyx_t_4);
3404 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3405 __pyx_v_masks = ((struct __pyx_obj_11pycocotools_5_mask_Masks *)__pyx_t_4);
3408 /* "pycocotools/_mask.pyx":149
3409 * h, w, n = Rs._R[0].h, Rs._R[0].w, Rs._n
3410 * masks = Masks(h, w, n)
3411 * rleDecode(<RLE*>Rs._R, masks._mask, n); # <<<<<<<<<<<<<<
3412 * return np.array(masks)
3415 rleDecode(((RLE *)__pyx_v_Rs->_R), __pyx_v_masks->_mask, __pyx_v_n);
3417 /* "pycocotools/_mask.pyx":150
3418 * masks = Masks(h, w, n)
3419 * rleDecode(<RLE*>Rs._R, masks._mask, n);
3420 * return np.array(masks) # <<<<<<<<<<<<<<
3422 * def merge(rleObjs, intersect=0):
3424 __Pyx_XDECREF(__pyx_r);
3425 __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 150, __pyx_L1_error)
3426 __Pyx_GOTREF(__pyx_t_3);
3427 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_array); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 150, __pyx_L1_error)
3428 __Pyx_GOTREF(__pyx_t_2);
3429 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3431 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
3432 __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
3433 if (likely(__pyx_t_3)) {
3434 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
3435 __Pyx_INCREF(__pyx_t_3);
3436 __Pyx_INCREF(function);
3437 __Pyx_DECREF_SET(__pyx_t_2, function);
3441 __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_2, ((PyObject *)__pyx_v_masks)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 150, __pyx_L1_error)
3442 __Pyx_GOTREF(__pyx_t_4);
3444 #if CYTHON_FAST_PYCALL
3445 if (PyFunction_Check(__pyx_t_2)) {
3446 PyObject *__pyx_temp[2] = {__pyx_t_3, ((PyObject *)__pyx_v_masks)};
3447 __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 150, __pyx_L1_error)
3448 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
3449 __Pyx_GOTREF(__pyx_t_4);
3452 #if CYTHON_FAST_PYCCALL
3453 if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
3454 PyObject *__pyx_temp[2] = {__pyx_t_3, ((PyObject *)__pyx_v_masks)};
3455 __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 150, __pyx_L1_error)
3456 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
3457 __Pyx_GOTREF(__pyx_t_4);
3461 __pyx_t_1 = PyTuple_New(1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 150, __pyx_L1_error)
3462 __Pyx_GOTREF(__pyx_t_1);
3463 __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3); __pyx_t_3 = NULL;
3464 __Pyx_INCREF(((PyObject *)__pyx_v_masks));
3465 __Pyx_GIVEREF(((PyObject *)__pyx_v_masks));
3466 PyTuple_SET_ITEM(__pyx_t_1, 0+1, ((PyObject *)__pyx_v_masks));
3467 __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_1, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 150, __pyx_L1_error)
3468 __Pyx_GOTREF(__pyx_t_4);
3469 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3472 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3473 __pyx_r = __pyx_t_4;
3477 /* "pycocotools/_mask.pyx":145
3479 * # decode mask from compressed list of RLE string or RLEs object
3480 * def decode(rleObjs): # <<<<<<<<<<<<<<
3481 * cdef RLEs Rs = _frString(rleObjs)
3482 * h, w, n = Rs._R[0].h, Rs._R[0].w, Rs._n
3485 /* function exit code */
3487 __Pyx_XDECREF(__pyx_t_1);
3488 __Pyx_XDECREF(__pyx_t_2);
3489 __Pyx_XDECREF(__pyx_t_3);
3490 __Pyx_XDECREF(__pyx_t_4);
3491 __Pyx_AddTraceback("pycocotools._mask.decode", __pyx_clineno, __pyx_lineno, __pyx_filename);
3494 __Pyx_XDECREF((PyObject *)__pyx_v_Rs);
3495 __Pyx_XDECREF((PyObject *)__pyx_v_masks);
3496 __Pyx_XGIVEREF(__pyx_r);
3497 __Pyx_RefNannyFinishContext();
3501 /* "pycocotools/_mask.pyx":152
3502 * return np.array(masks)
3504 * def merge(rleObjs, intersect=0): # <<<<<<<<<<<<<<
3505 * cdef RLEs Rs = _frString(rleObjs)
3506 * cdef RLEs R = RLEs(1)
3509 /* Python wrapper */
3510 static PyObject *__pyx_pw_11pycocotools_5_mask_9merge(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
3511 static PyMethodDef __pyx_mdef_11pycocotools_5_mask_9merge = {"merge", (PyCFunction)__pyx_pw_11pycocotools_5_mask_9merge, METH_VARARGS|METH_KEYWORDS, 0};
3512 static PyObject *__pyx_pw_11pycocotools_5_mask_9merge(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
3513 PyObject *__pyx_v_rleObjs = 0;
3514 PyObject *__pyx_v_intersect = 0;
3515 PyObject *__pyx_r = 0;
3516 __Pyx_RefNannyDeclarations
3517 __Pyx_RefNannySetupContext("merge (wrapper)", 0);
3519 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_rleObjs,&__pyx_n_s_intersect,0};
3520 PyObject* values[2] = {0,0};
3521 values[1] = ((PyObject *)__pyx_int_0);
3522 if (unlikely(__pyx_kwds)) {
3524 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
3526 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3527 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3529 default: goto __pyx_L5_argtuple_error;
3531 kw_args = PyDict_Size(__pyx_kwds);
3534 if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_rleObjs)) != 0)) kw_args--;
3535 else goto __pyx_L5_argtuple_error;
3538 PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_intersect);
3539 if (value) { values[1] = value; kw_args--; }
3542 if (unlikely(kw_args > 0)) {
3543 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "merge") < 0)) __PYX_ERR(0, 152, __pyx_L3_error)
3546 switch (PyTuple_GET_SIZE(__pyx_args)) {
3547 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3548 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3550 default: goto __pyx_L5_argtuple_error;
3553 __pyx_v_rleObjs = values[0];
3554 __pyx_v_intersect = values[1];
3556 goto __pyx_L4_argument_unpacking_done;
3557 __pyx_L5_argtuple_error:;
3558 __Pyx_RaiseArgtupleInvalid("merge", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 152, __pyx_L3_error)
3560 __Pyx_AddTraceback("pycocotools._mask.merge", __pyx_clineno, __pyx_lineno, __pyx_filename);
3561 __Pyx_RefNannyFinishContext();
3563 __pyx_L4_argument_unpacking_done:;
3564 __pyx_r = __pyx_pf_11pycocotools_5_mask_8merge(__pyx_self, __pyx_v_rleObjs, __pyx_v_intersect);
3566 /* function exit code */
3567 __Pyx_RefNannyFinishContext();
3571 static PyObject *__pyx_pf_11pycocotools_5_mask_8merge(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_rleObjs, PyObject *__pyx_v_intersect) {
3572 struct __pyx_obj_11pycocotools_5_mask_RLEs *__pyx_v_Rs = 0;
3573 struct __pyx_obj_11pycocotools_5_mask_RLEs *__pyx_v_R = 0;
3574 PyObject *__pyx_v_obj = NULL;
3575 PyObject *__pyx_r = NULL;
3576 __Pyx_RefNannyDeclarations
3577 PyObject *__pyx_t_1 = NULL;
3578 PyObject *__pyx_t_2 = NULL;
3579 PyObject *__pyx_t_3 = NULL;
3580 PyObject *__pyx_t_4 = NULL;
3582 __Pyx_RefNannySetupContext("merge", 0);
3584 /* "pycocotools/_mask.pyx":153
3586 * def merge(rleObjs, intersect=0):
3587 * cdef RLEs Rs = _frString(rleObjs) # <<<<<<<<<<<<<<
3588 * cdef RLEs R = RLEs(1)
3589 * rleMerge(<RLE*>Rs._R, <RLE*> R._R, <siz> Rs._n, intersect)
3591 __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_frString); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 153, __pyx_L1_error)
3592 __Pyx_GOTREF(__pyx_t_2);
3594 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
3595 __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
3596 if (likely(__pyx_t_3)) {
3597 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
3598 __Pyx_INCREF(__pyx_t_3);
3599 __Pyx_INCREF(function);
3600 __Pyx_DECREF_SET(__pyx_t_2, function);
3604 __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_rleObjs); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 153, __pyx_L1_error)
3605 __Pyx_GOTREF(__pyx_t_1);
3607 #if CYTHON_FAST_PYCALL
3608 if (PyFunction_Check(__pyx_t_2)) {
3609 PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_v_rleObjs};
3610 __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 153, __pyx_L1_error)
3611 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
3612 __Pyx_GOTREF(__pyx_t_1);
3615 #if CYTHON_FAST_PYCCALL
3616 if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
3617 PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_v_rleObjs};
3618 __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 153, __pyx_L1_error)
3619 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
3620 __Pyx_GOTREF(__pyx_t_1);
3624 __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 153, __pyx_L1_error)
3625 __Pyx_GOTREF(__pyx_t_4);
3626 __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __pyx_t_3 = NULL;
3627 __Pyx_INCREF(__pyx_v_rleObjs);
3628 __Pyx_GIVEREF(__pyx_v_rleObjs);
3629 PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_rleObjs);
3630 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 153, __pyx_L1_error)
3631 __Pyx_GOTREF(__pyx_t_1);
3632 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3635 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3636 if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_11pycocotools_5_mask_RLEs))))) __PYX_ERR(0, 153, __pyx_L1_error)
3637 __pyx_v_Rs = ((struct __pyx_obj_11pycocotools_5_mask_RLEs *)__pyx_t_1);
3640 /* "pycocotools/_mask.pyx":154
3641 * def merge(rleObjs, intersect=0):
3642 * cdef RLEs Rs = _frString(rleObjs)
3643 * cdef RLEs R = RLEs(1) # <<<<<<<<<<<<<<
3644 * rleMerge(<RLE*>Rs._R, <RLE*> R._R, <siz> Rs._n, intersect)
3645 * obj = _toString(R)[0]
3647 __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_11pycocotools_5_mask_RLEs), __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 154, __pyx_L1_error)
3648 __Pyx_GOTREF(__pyx_t_1);
3649 __pyx_v_R = ((struct __pyx_obj_11pycocotools_5_mask_RLEs *)__pyx_t_1);
3652 /* "pycocotools/_mask.pyx":155
3653 * cdef RLEs Rs = _frString(rleObjs)
3654 * cdef RLEs R = RLEs(1)
3655 * rleMerge(<RLE*>Rs._R, <RLE*> R._R, <siz> Rs._n, intersect) # <<<<<<<<<<<<<<
3656 * obj = _toString(R)[0]
3659 __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_v_intersect); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 155, __pyx_L1_error)
3660 rleMerge(((RLE *)__pyx_v_Rs->_R), ((RLE *)__pyx_v_R->_R), ((siz)__pyx_v_Rs->_n), __pyx_t_5);
3662 /* "pycocotools/_mask.pyx":156
3663 * cdef RLEs R = RLEs(1)
3664 * rleMerge(<RLE*>Rs._R, <RLE*> R._R, <siz> Rs._n, intersect)
3665 * obj = _toString(R)[0] # <<<<<<<<<<<<<<
3669 __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_toString); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 156, __pyx_L1_error)
3670 __Pyx_GOTREF(__pyx_t_2);
3672 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
3673 __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
3674 if (likely(__pyx_t_4)) {
3675 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
3676 __Pyx_INCREF(__pyx_t_4);
3677 __Pyx_INCREF(function);
3678 __Pyx_DECREF_SET(__pyx_t_2, function);
3682 __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, ((PyObject *)__pyx_v_R)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 156, __pyx_L1_error)
3683 __Pyx_GOTREF(__pyx_t_1);
3685 #if CYTHON_FAST_PYCALL
3686 if (PyFunction_Check(__pyx_t_2)) {
3687 PyObject *__pyx_temp[2] = {__pyx_t_4, ((PyObject *)__pyx_v_R)};
3688 __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 156, __pyx_L1_error)
3689 __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
3690 __Pyx_GOTREF(__pyx_t_1);
3693 #if CYTHON_FAST_PYCCALL
3694 if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
3695 PyObject *__pyx_temp[2] = {__pyx_t_4, ((PyObject *)__pyx_v_R)};
3696 __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 156, __pyx_L1_error)
3697 __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
3698 __Pyx_GOTREF(__pyx_t_1);
3702 __pyx_t_3 = PyTuple_New(1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 156, __pyx_L1_error)
3703 __Pyx_GOTREF(__pyx_t_3);
3704 __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4); __pyx_t_4 = NULL;
3705 __Pyx_INCREF(((PyObject *)__pyx_v_R));
3706 __Pyx_GIVEREF(((PyObject *)__pyx_v_R));
3707 PyTuple_SET_ITEM(__pyx_t_3, 0+1, ((PyObject *)__pyx_v_R));
3708 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 156, __pyx_L1_error)
3709 __Pyx_GOTREF(__pyx_t_1);
3710 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3713 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3714 __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 156, __pyx_L1_error)
3715 __Pyx_GOTREF(__pyx_t_2);
3716 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3717 __pyx_v_obj = __pyx_t_2;
3720 /* "pycocotools/_mask.pyx":157
3721 * rleMerge(<RLE*>Rs._R, <RLE*> R._R, <siz> Rs._n, intersect)
3722 * obj = _toString(R)[0]
3723 * return obj # <<<<<<<<<<<<<<
3725 * def area(rleObjs):
3727 __Pyx_XDECREF(__pyx_r);
3728 __Pyx_INCREF(__pyx_v_obj);
3729 __pyx_r = __pyx_v_obj;
3732 /* "pycocotools/_mask.pyx":152
3733 * return np.array(masks)
3735 * def merge(rleObjs, intersect=0): # <<<<<<<<<<<<<<
3736 * cdef RLEs Rs = _frString(rleObjs)
3737 * cdef RLEs R = RLEs(1)
3740 /* function exit code */
3742 __Pyx_XDECREF(__pyx_t_1);
3743 __Pyx_XDECREF(__pyx_t_2);
3744 __Pyx_XDECREF(__pyx_t_3);
3745 __Pyx_XDECREF(__pyx_t_4);
3746 __Pyx_AddTraceback("pycocotools._mask.merge", __pyx_clineno, __pyx_lineno, __pyx_filename);
3749 __Pyx_XDECREF((PyObject *)__pyx_v_Rs);
3750 __Pyx_XDECREF((PyObject *)__pyx_v_R);
3751 __Pyx_XDECREF(__pyx_v_obj);
3752 __Pyx_XGIVEREF(__pyx_r);
3753 __Pyx_RefNannyFinishContext();
3757 /* "pycocotools/_mask.pyx":159
3760 * def area(rleObjs): # <<<<<<<<<<<<<<
3761 * cdef RLEs Rs = _frString(rleObjs)
3762 * cdef uint* _a = <uint*> malloc(Rs._n* sizeof(uint))
3765 /* Python wrapper */
3766 static PyObject *__pyx_pw_11pycocotools_5_mask_11area(PyObject *__pyx_self, PyObject *__pyx_v_rleObjs); /*proto*/
3767 static PyMethodDef __pyx_mdef_11pycocotools_5_mask_11area = {"area", (PyCFunction)__pyx_pw_11pycocotools_5_mask_11area, METH_O, 0};
3768 static PyObject *__pyx_pw_11pycocotools_5_mask_11area(PyObject *__pyx_self, PyObject *__pyx_v_rleObjs) {
3769 PyObject *__pyx_r = 0;
3770 __Pyx_RefNannyDeclarations
3771 __Pyx_RefNannySetupContext("area (wrapper)", 0);
3772 __pyx_r = __pyx_pf_11pycocotools_5_mask_10area(__pyx_self, ((PyObject *)__pyx_v_rleObjs));
3774 /* function exit code */
3775 __Pyx_RefNannyFinishContext();
3779 static PyObject *__pyx_pf_11pycocotools_5_mask_10area(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_rleObjs) {
3780 struct __pyx_obj_11pycocotools_5_mask_RLEs *__pyx_v_Rs = 0;
3782 npy_intp __pyx_v_shape[1];
3783 PyObject *__pyx_v_a = NULL;
3784 PyObject *__pyx_r = NULL;
3785 __Pyx_RefNannyDeclarations
3786 PyObject *__pyx_t_1 = NULL;
3787 PyObject *__pyx_t_2 = NULL;
3788 PyObject *__pyx_t_3 = NULL;
3789 PyObject *__pyx_t_4 = NULL;
3790 PyObject *__pyx_t_5 = NULL;
3791 __Pyx_RefNannySetupContext("area", 0);
3793 /* "pycocotools/_mask.pyx":160
3795 * def area(rleObjs):
3796 * cdef RLEs Rs = _frString(rleObjs) # <<<<<<<<<<<<<<
3797 * cdef uint* _a = <uint*> malloc(Rs._n* sizeof(uint))
3798 * rleArea(Rs._R, Rs._n, _a)
3800 __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_frString); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 160, __pyx_L1_error)
3801 __Pyx_GOTREF(__pyx_t_2);
3803 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
3804 __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
3805 if (likely(__pyx_t_3)) {
3806 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
3807 __Pyx_INCREF(__pyx_t_3);
3808 __Pyx_INCREF(function);
3809 __Pyx_DECREF_SET(__pyx_t_2, function);
3813 __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_rleObjs); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 160, __pyx_L1_error)
3814 __Pyx_GOTREF(__pyx_t_1);
3816 #if CYTHON_FAST_PYCALL
3817 if (PyFunction_Check(__pyx_t_2)) {
3818 PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_v_rleObjs};
3819 __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 160, __pyx_L1_error)
3820 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
3821 __Pyx_GOTREF(__pyx_t_1);
3824 #if CYTHON_FAST_PYCCALL
3825 if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
3826 PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_v_rleObjs};
3827 __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 160, __pyx_L1_error)
3828 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
3829 __Pyx_GOTREF(__pyx_t_1);
3833 __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 160, __pyx_L1_error)
3834 __Pyx_GOTREF(__pyx_t_4);
3835 __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __pyx_t_3 = NULL;
3836 __Pyx_INCREF(__pyx_v_rleObjs);
3837 __Pyx_GIVEREF(__pyx_v_rleObjs);
3838 PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_rleObjs);
3839 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 160, __pyx_L1_error)
3840 __Pyx_GOTREF(__pyx_t_1);
3841 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3844 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3845 if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_11pycocotools_5_mask_RLEs))))) __PYX_ERR(0, 160, __pyx_L1_error)
3846 __pyx_v_Rs = ((struct __pyx_obj_11pycocotools_5_mask_RLEs *)__pyx_t_1);
3849 /* "pycocotools/_mask.pyx":161
3850 * def area(rleObjs):
3851 * cdef RLEs Rs = _frString(rleObjs)
3852 * cdef uint* _a = <uint*> malloc(Rs._n* sizeof(uint)) # <<<<<<<<<<<<<<
3853 * rleArea(Rs._R, Rs._n, _a)
3854 * cdef np.npy_intp shape[1]
3856 __pyx_v__a = ((uint *)malloc((__pyx_v_Rs->_n * (sizeof(unsigned int)))));
3858 /* "pycocotools/_mask.pyx":162
3859 * cdef RLEs Rs = _frString(rleObjs)
3860 * cdef uint* _a = <uint*> malloc(Rs._n* sizeof(uint))
3861 * rleArea(Rs._R, Rs._n, _a) # <<<<<<<<<<<<<<
3862 * cdef np.npy_intp shape[1]
3863 * shape[0] = <np.npy_intp> Rs._n
3865 rleArea(__pyx_v_Rs->_R, __pyx_v_Rs->_n, __pyx_v__a);
3867 /* "pycocotools/_mask.pyx":164
3868 * rleArea(Rs._R, Rs._n, _a)
3869 * cdef np.npy_intp shape[1]
3870 * shape[0] = <np.npy_intp> Rs._n # <<<<<<<<<<<<<<
3871 * a = np.array((Rs._n, ), dtype=np.uint8)
3872 * a = np.PyArray_SimpleNewFromData(1, shape, np.NPY_UINT32, _a)
3874 (__pyx_v_shape[0]) = ((npy_intp)__pyx_v_Rs->_n);
3876 /* "pycocotools/_mask.pyx":165
3877 * cdef np.npy_intp shape[1]
3878 * shape[0] = <np.npy_intp> Rs._n
3879 * a = np.array((Rs._n, ), dtype=np.uint8) # <<<<<<<<<<<<<<
3880 * a = np.PyArray_SimpleNewFromData(1, shape, np.NPY_UINT32, _a)
3881 * PyArray_ENABLEFLAGS(a, np.NPY_OWNDATA)
3883 __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 165, __pyx_L1_error)
3884 __Pyx_GOTREF(__pyx_t_1);
3885 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_array); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 165, __pyx_L1_error)
3886 __Pyx_GOTREF(__pyx_t_2);
3887 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3888 __pyx_t_1 = __Pyx_PyInt_From_siz(__pyx_v_Rs->_n); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 165, __pyx_L1_error)
3889 __Pyx_GOTREF(__pyx_t_1);
3890 __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 165, __pyx_L1_error)
3891 __Pyx_GOTREF(__pyx_t_4);
3892 __Pyx_GIVEREF(__pyx_t_1);
3893 PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1);
3895 __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 165, __pyx_L1_error)
3896 __Pyx_GOTREF(__pyx_t_1);
3897 __Pyx_GIVEREF(__pyx_t_4);
3898 PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4);
3900 __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 165, __pyx_L1_error)
3901 __Pyx_GOTREF(__pyx_t_4);
3902 __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 165, __pyx_L1_error)
3903 __Pyx_GOTREF(__pyx_t_3);
3904 __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_uint8); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 165, __pyx_L1_error)
3905 __Pyx_GOTREF(__pyx_t_5);
3906 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3907 if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_dtype, __pyx_t_5) < 0) __PYX_ERR(0, 165, __pyx_L1_error)
3908 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
3909 __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 165, __pyx_L1_error)
3910 __Pyx_GOTREF(__pyx_t_5);
3911 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3912 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
3913 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
3914 __pyx_v_a = __pyx_t_5;
3917 /* "pycocotools/_mask.pyx":166
3918 * shape[0] = <np.npy_intp> Rs._n
3919 * a = np.array((Rs._n, ), dtype=np.uint8)
3920 * a = np.PyArray_SimpleNewFromData(1, shape, np.NPY_UINT32, _a) # <<<<<<<<<<<<<<
3921 * PyArray_ENABLEFLAGS(a, np.NPY_OWNDATA)
3924 __pyx_t_5 = PyArray_SimpleNewFromData(1, __pyx_v_shape, NPY_UINT32, __pyx_v__a); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 166, __pyx_L1_error)
3925 __Pyx_GOTREF(__pyx_t_5);
3926 __Pyx_DECREF_SET(__pyx_v_a, __pyx_t_5);
3929 /* "pycocotools/_mask.pyx":167
3930 * a = np.array((Rs._n, ), dtype=np.uint8)
3931 * a = np.PyArray_SimpleNewFromData(1, shape, np.NPY_UINT32, _a)
3932 * PyArray_ENABLEFLAGS(a, np.NPY_OWNDATA) # <<<<<<<<<<<<<<
3936 if (!(likely(((__pyx_v_a) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_a, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 167, __pyx_L1_error)
3937 PyArray_ENABLEFLAGS(((PyArrayObject *)__pyx_v_a), NPY_OWNDATA);
3939 /* "pycocotools/_mask.pyx":168
3940 * a = np.PyArray_SimpleNewFromData(1, shape, np.NPY_UINT32, _a)
3941 * PyArray_ENABLEFLAGS(a, np.NPY_OWNDATA)
3942 * return a # <<<<<<<<<<<<<<
3944 * # iou computation. support function overload (RLEs-RLEs and bbox-bbox).
3946 __Pyx_XDECREF(__pyx_r);
3947 __Pyx_INCREF(__pyx_v_a);
3948 __pyx_r = __pyx_v_a;
3951 /* "pycocotools/_mask.pyx":159
3954 * def area(rleObjs): # <<<<<<<<<<<<<<
3955 * cdef RLEs Rs = _frString(rleObjs)
3956 * cdef uint* _a = <uint*> malloc(Rs._n* sizeof(uint))
3959 /* function exit code */
3961 __Pyx_XDECREF(__pyx_t_1);
3962 __Pyx_XDECREF(__pyx_t_2);
3963 __Pyx_XDECREF(__pyx_t_3);
3964 __Pyx_XDECREF(__pyx_t_4);
3965 __Pyx_XDECREF(__pyx_t_5);
3966 __Pyx_AddTraceback("pycocotools._mask.area", __pyx_clineno, __pyx_lineno, __pyx_filename);
3969 __Pyx_XDECREF((PyObject *)__pyx_v_Rs);
3970 __Pyx_XDECREF(__pyx_v_a);
3971 __Pyx_XGIVEREF(__pyx_r);
3972 __Pyx_RefNannyFinishContext();
3976 /* "pycocotools/_mask.pyx":171
3978 * # iou computation. support function overload (RLEs-RLEs and bbox-bbox).
3979 * def iou( dt, gt, pyiscrowd ): # <<<<<<<<<<<<<<
3980 * def _preproc(objs):
3981 * if len(objs) == 0:
3984 /* Python wrapper */
3985 static PyObject *__pyx_pw_11pycocotools_5_mask_13iou(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
3986 static PyMethodDef __pyx_mdef_11pycocotools_5_mask_13iou = {"iou", (PyCFunction)__pyx_pw_11pycocotools_5_mask_13iou, METH_VARARGS|METH_KEYWORDS, 0};
3987 static PyObject *__pyx_pw_11pycocotools_5_mask_13iou(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
3988 PyObject *__pyx_v_dt = 0;
3989 PyObject *__pyx_v_gt = 0;
3990 PyObject *__pyx_v_pyiscrowd = 0;
3991 PyObject *__pyx_r = 0;
3992 __Pyx_RefNannyDeclarations
3993 __Pyx_RefNannySetupContext("iou (wrapper)", 0);
3995 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_dt,&__pyx_n_s_gt,&__pyx_n_s_pyiscrowd,0};
3996 PyObject* values[3] = {0,0,0};
3997 if (unlikely(__pyx_kwds)) {
3999 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
4001 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
4002 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4003 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4005 default: goto __pyx_L5_argtuple_error;
4007 kw_args = PyDict_Size(__pyx_kwds);
4010 if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_dt)) != 0)) kw_args--;
4011 else goto __pyx_L5_argtuple_error;
4013 if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_gt)) != 0)) kw_args--;
4015 __Pyx_RaiseArgtupleInvalid("iou", 1, 3, 3, 1); __PYX_ERR(0, 171, __pyx_L3_error)
4018 if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_pyiscrowd)) != 0)) kw_args--;
4020 __Pyx_RaiseArgtupleInvalid("iou", 1, 3, 3, 2); __PYX_ERR(0, 171, __pyx_L3_error)
4023 if (unlikely(kw_args > 0)) {
4024 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "iou") < 0)) __PYX_ERR(0, 171, __pyx_L3_error)
4026 } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
4027 goto __pyx_L5_argtuple_error;
4029 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
4030 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
4031 values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
4033 __pyx_v_dt = values[0];
4034 __pyx_v_gt = values[1];
4035 __pyx_v_pyiscrowd = values[2];
4037 goto __pyx_L4_argument_unpacking_done;
4038 __pyx_L5_argtuple_error:;
4039 __Pyx_RaiseArgtupleInvalid("iou", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 171, __pyx_L3_error)
4041 __Pyx_AddTraceback("pycocotools._mask.iou", __pyx_clineno, __pyx_lineno, __pyx_filename);
4042 __Pyx_RefNannyFinishContext();
4044 __pyx_L4_argument_unpacking_done:;
4045 __pyx_r = __pyx_pf_11pycocotools_5_mask_12iou(__pyx_self, __pyx_v_dt, __pyx_v_gt, __pyx_v_pyiscrowd);
4047 /* function exit code */
4048 __Pyx_RefNannyFinishContext();
4052 /* "pycocotools/_mask.pyx":172
4053 * # iou computation. support function overload (RLEs-RLEs and bbox-bbox).
4054 * def iou( dt, gt, pyiscrowd ):
4055 * def _preproc(objs): # <<<<<<<<<<<<<<
4056 * if len(objs) == 0:
4060 /* Python wrapper */
4061 static PyObject *__pyx_pw_11pycocotools_5_mask_3iou_1_preproc(PyObject *__pyx_self, PyObject *__pyx_v_objs); /*proto*/
4062 static PyMethodDef __pyx_mdef_11pycocotools_5_mask_3iou_1_preproc = {"_preproc", (PyCFunction)__pyx_pw_11pycocotools_5_mask_3iou_1_preproc, METH_O, 0};
4063 static PyObject *__pyx_pw_11pycocotools_5_mask_3iou_1_preproc(PyObject *__pyx_self, PyObject *__pyx_v_objs) {
4064 PyObject *__pyx_r = 0;
4065 __Pyx_RefNannyDeclarations
4066 __Pyx_RefNannySetupContext("_preproc (wrapper)", 0);
4067 __pyx_r = __pyx_pf_11pycocotools_5_mask_3iou__preproc(__pyx_self, ((PyObject *)__pyx_v_objs));
4069 /* function exit code */
4070 __Pyx_RefNannyFinishContext();
4074 static PyObject *__pyx_pf_11pycocotools_5_mask_3iou__preproc(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_objs) {
4075 PyObject *__pyx_v_isbox = NULL;
4076 PyObject *__pyx_v_isrle = NULL;
4077 PyObject *__pyx_v_obj = NULL;
4078 PyObject *__pyx_r = NULL;
4079 __Pyx_RefNannyDeclarations
4080 Py_ssize_t __pyx_t_1;
4082 PyObject *__pyx_t_3 = NULL;
4083 PyObject *__pyx_t_4 = NULL;
4084 PyObject *__pyx_t_5 = NULL;
4085 PyObject *__pyx_t_6 = NULL;
4086 PyObject *__pyx_t_7 = NULL;
4089 PyObject *__pyx_t_10 = NULL;
4090 PyObject *(*__pyx_t_11)(PyObject *);
4091 PyObject *__pyx_t_12 = NULL;
4092 Py_ssize_t __pyx_t_13;
4093 PyObject *__pyx_t_14 = NULL;
4094 __Pyx_RefNannySetupContext("_preproc", 0);
4095 __Pyx_INCREF(__pyx_v_objs);
4097 /* "pycocotools/_mask.pyx":173
4098 * def iou( dt, gt, pyiscrowd ):
4099 * def _preproc(objs):
4100 * if len(objs) == 0: # <<<<<<<<<<<<<<
4102 * if type(objs) == np.ndarray:
4104 __pyx_t_1 = PyObject_Length(__pyx_v_objs); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(0, 173, __pyx_L1_error)
4105 __pyx_t_2 = ((__pyx_t_1 == 0) != 0);
4108 /* "pycocotools/_mask.pyx":174
4109 * def _preproc(objs):
4110 * if len(objs) == 0:
4111 * return objs # <<<<<<<<<<<<<<
4112 * if type(objs) == np.ndarray:
4113 * if len(objs.shape) == 1:
4115 __Pyx_XDECREF(__pyx_r);
4116 __Pyx_INCREF(__pyx_v_objs);
4117 __pyx_r = __pyx_v_objs;
4120 /* "pycocotools/_mask.pyx":173
4121 * def iou( dt, gt, pyiscrowd ):
4122 * def _preproc(objs):
4123 * if len(objs) == 0: # <<<<<<<<<<<<<<
4125 * if type(objs) == np.ndarray:
4129 /* "pycocotools/_mask.pyx":175
4130 * if len(objs) == 0:
4132 * if type(objs) == np.ndarray: # <<<<<<<<<<<<<<
4133 * if len(objs.shape) == 1:
4134 * objs = objs.reshape((objs[0], 1))
4136 __pyx_t_3 = PyObject_RichCompare(((PyObject *)Py_TYPE(__pyx_v_objs)), ((PyObject *)__pyx_ptype_5numpy_ndarray), Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 175, __pyx_L1_error)
4137 __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 175, __pyx_L1_error)
4138 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4141 /* "pycocotools/_mask.pyx":176
4143 * if type(objs) == np.ndarray:
4144 * if len(objs.shape) == 1: # <<<<<<<<<<<<<<
4145 * objs = objs.reshape((objs[0], 1))
4146 * # check if it's Nx4 bbox
4148 __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_objs, __pyx_n_s_shape); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 176, __pyx_L1_error)
4149 __Pyx_GOTREF(__pyx_t_3);
4150 __pyx_t_1 = PyObject_Length(__pyx_t_3); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(0, 176, __pyx_L1_error)
4151 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4152 __pyx_t_2 = ((__pyx_t_1 == 1) != 0);
4155 /* "pycocotools/_mask.pyx":177
4156 * if type(objs) == np.ndarray:
4157 * if len(objs.shape) == 1:
4158 * objs = objs.reshape((objs[0], 1)) # <<<<<<<<<<<<<<
4159 * # check if it's Nx4 bbox
4160 * if not len(objs.shape) == 2 or not objs.shape[1] == 4:
4162 __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_objs, __pyx_n_s_reshape); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 177, __pyx_L1_error)
4163 __Pyx_GOTREF(__pyx_t_4);
4164 __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_objs, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 177, __pyx_L1_error)
4165 __Pyx_GOTREF(__pyx_t_5);
4166 __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 177, __pyx_L1_error)
4167 __Pyx_GOTREF(__pyx_t_6);
4168 __Pyx_GIVEREF(__pyx_t_5);
4169 PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5);
4170 __Pyx_INCREF(__pyx_int_1);
4171 __Pyx_GIVEREF(__pyx_int_1);
4172 PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_int_1);
4175 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
4176 __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
4177 if (likely(__pyx_t_5)) {
4178 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
4179 __Pyx_INCREF(__pyx_t_5);
4180 __Pyx_INCREF(function);
4181 __Pyx_DECREF_SET(__pyx_t_4, function);
4185 __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 177, __pyx_L1_error)
4186 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
4187 __Pyx_GOTREF(__pyx_t_3);
4189 #if CYTHON_FAST_PYCALL
4190 if (PyFunction_Check(__pyx_t_4)) {
4191 PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_6};
4192 __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 177, __pyx_L1_error)
4193 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
4194 __Pyx_GOTREF(__pyx_t_3);
4195 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
4198 #if CYTHON_FAST_PYCCALL
4199 if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
4200 PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_t_6};
4201 __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 177, __pyx_L1_error)
4202 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
4203 __Pyx_GOTREF(__pyx_t_3);
4204 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
4208 __pyx_t_7 = PyTuple_New(1+1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 177, __pyx_L1_error)
4209 __Pyx_GOTREF(__pyx_t_7);
4210 __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __pyx_t_5 = NULL;
4211 __Pyx_GIVEREF(__pyx_t_6);
4212 PyTuple_SET_ITEM(__pyx_t_7, 0+1, __pyx_t_6);
4214 __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_7, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 177, __pyx_L1_error)
4215 __Pyx_GOTREF(__pyx_t_3);
4216 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
4219 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4220 __Pyx_DECREF_SET(__pyx_v_objs, __pyx_t_3);
4223 /* "pycocotools/_mask.pyx":176
4225 * if type(objs) == np.ndarray:
4226 * if len(objs.shape) == 1: # <<<<<<<<<<<<<<
4227 * objs = objs.reshape((objs[0], 1))
4228 * # check if it's Nx4 bbox
4232 /* "pycocotools/_mask.pyx":179
4233 * objs = objs.reshape((objs[0], 1))
4234 * # check if it's Nx4 bbox
4235 * if not len(objs.shape) == 2 or not objs.shape[1] == 4: # <<<<<<<<<<<<<<
4236 * raise Exception('numpy ndarray input is only for *bounding boxes* and should have Nx4 dimension')
4237 * objs = objs.astype(np.double)
4239 __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_objs, __pyx_n_s_shape); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 179, __pyx_L1_error)
4240 __Pyx_GOTREF(__pyx_t_3);
4241 __pyx_t_1 = PyObject_Length(__pyx_t_3); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(0, 179, __pyx_L1_error)
4242 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4243 __pyx_t_8 = ((!((__pyx_t_1 == 2) != 0)) != 0);
4246 __pyx_t_2 = __pyx_t_8;
4247 goto __pyx_L7_bool_binop_done;
4249 __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_objs, __pyx_n_s_shape); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 179, __pyx_L1_error)
4250 __Pyx_GOTREF(__pyx_t_3);
4251 __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_3, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 179, __pyx_L1_error)
4252 __Pyx_GOTREF(__pyx_t_4);
4253 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4254 __pyx_t_3 = __Pyx_PyInt_EqObjC(__pyx_t_4, __pyx_int_4, 4, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 179, __pyx_L1_error)
4255 __Pyx_GOTREF(__pyx_t_3);
4256 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4257 __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 179, __pyx_L1_error)
4258 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4259 __pyx_t_9 = ((!__pyx_t_8) != 0);
4260 __pyx_t_2 = __pyx_t_9;
4261 __pyx_L7_bool_binop_done:;
4264 /* "pycocotools/_mask.pyx":180
4265 * # check if it's Nx4 bbox
4266 * if not len(objs.shape) == 2 or not objs.shape[1] == 4:
4267 * raise Exception('numpy ndarray input is only for *bounding boxes* and should have Nx4 dimension') # <<<<<<<<<<<<<<
4268 * objs = objs.astype(np.double)
4269 * elif type(objs) == list:
4271 __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])), __pyx_tuple__4, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 180, __pyx_L1_error)
4272 __Pyx_GOTREF(__pyx_t_3);
4273 __Pyx_Raise(__pyx_t_3, 0, 0, 0);
4274 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4275 __PYX_ERR(0, 180, __pyx_L1_error)
4277 /* "pycocotools/_mask.pyx":179
4278 * objs = objs.reshape((objs[0], 1))
4279 * # check if it's Nx4 bbox
4280 * if not len(objs.shape) == 2 or not objs.shape[1] == 4: # <<<<<<<<<<<<<<
4281 * raise Exception('numpy ndarray input is only for *bounding boxes* and should have Nx4 dimension')
4282 * objs = objs.astype(np.double)
4286 /* "pycocotools/_mask.pyx":181
4287 * if not len(objs.shape) == 2 or not objs.shape[1] == 4:
4288 * raise Exception('numpy ndarray input is only for *bounding boxes* and should have Nx4 dimension')
4289 * objs = objs.astype(np.double) # <<<<<<<<<<<<<<
4290 * elif type(objs) == list:
4291 * # check if list is in box format and convert it to np.ndarray
4293 __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_objs, __pyx_n_s_astype); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 181, __pyx_L1_error)
4294 __Pyx_GOTREF(__pyx_t_4);
4295 __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 181, __pyx_L1_error)
4296 __Pyx_GOTREF(__pyx_t_7);
4297 __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_double); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 181, __pyx_L1_error)
4298 __Pyx_GOTREF(__pyx_t_6);
4299 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
4301 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_4))) {
4302 __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_4);
4303 if (likely(__pyx_t_7)) {
4304 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
4305 __Pyx_INCREF(__pyx_t_7);
4306 __Pyx_INCREF(function);
4307 __Pyx_DECREF_SET(__pyx_t_4, function);
4311 __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 181, __pyx_L1_error)
4312 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
4313 __Pyx_GOTREF(__pyx_t_3);
4315 #if CYTHON_FAST_PYCALL
4316 if (PyFunction_Check(__pyx_t_4)) {
4317 PyObject *__pyx_temp[2] = {__pyx_t_7, __pyx_t_6};
4318 __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 181, __pyx_L1_error)
4319 __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
4320 __Pyx_GOTREF(__pyx_t_3);
4321 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
4324 #if CYTHON_FAST_PYCCALL
4325 if (__Pyx_PyFastCFunction_Check(__pyx_t_4)) {
4326 PyObject *__pyx_temp[2] = {__pyx_t_7, __pyx_t_6};
4327 __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_4, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 181, __pyx_L1_error)
4328 __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
4329 __Pyx_GOTREF(__pyx_t_3);
4330 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
4334 __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 181, __pyx_L1_error)
4335 __Pyx_GOTREF(__pyx_t_5);
4336 __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_7); __pyx_t_7 = NULL;
4337 __Pyx_GIVEREF(__pyx_t_6);
4338 PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_t_6);
4340 __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 181, __pyx_L1_error)
4341 __Pyx_GOTREF(__pyx_t_3);
4342 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
4345 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4346 __Pyx_DECREF_SET(__pyx_v_objs, __pyx_t_3);
4349 /* "pycocotools/_mask.pyx":175
4350 * if len(objs) == 0:
4352 * if type(objs) == np.ndarray: # <<<<<<<<<<<<<<
4353 * if len(objs.shape) == 1:
4354 * objs = objs.reshape((objs[0], 1))
4359 /* "pycocotools/_mask.pyx":182
4360 * raise Exception('numpy ndarray input is only for *bounding boxes* and should have Nx4 dimension')
4361 * objs = objs.astype(np.double)
4362 * elif type(objs) == list: # <<<<<<<<<<<<<<
4363 * # check if list is in box format and convert it to np.ndarray
4364 * isbox = np.all(np.array([(len(obj)==4) and ((type(obj)==list) or (type(obj)==np.ndarray)) for obj in objs]))
4366 __pyx_t_3 = PyObject_RichCompare(((PyObject *)Py_TYPE(__pyx_v_objs)), ((PyObject *)(&PyList_Type)), Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 182, __pyx_L1_error)
4367 __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 182, __pyx_L1_error)
4368 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4371 /* "pycocotools/_mask.pyx":184
4372 * elif type(objs) == list:
4373 * # check if list is in box format and convert it to np.ndarray
4374 * isbox = np.all(np.array([(len(obj)==4) and ((type(obj)==list) or (type(obj)==np.ndarray)) for obj in objs])) # <<<<<<<<<<<<<<
4375 * isrle = np.all(np.array([type(obj) == dict for obj in objs]))
4378 __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 184, __pyx_L1_error)
4379 __Pyx_GOTREF(__pyx_t_4);
4380 __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_all); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 184, __pyx_L1_error)
4381 __Pyx_GOTREF(__pyx_t_5);
4382 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4383 __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 184, __pyx_L1_error)
4384 __Pyx_GOTREF(__pyx_t_6);
4385 __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_array); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 184, __pyx_L1_error)
4386 __Pyx_GOTREF(__pyx_t_7);
4387 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
4388 __pyx_t_6 = PyList_New(0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 184, __pyx_L1_error)
4389 __Pyx_GOTREF(__pyx_t_6);
4390 if (likely(PyList_CheckExact(__pyx_v_objs)) || PyTuple_CheckExact(__pyx_v_objs)) {
4391 __pyx_t_10 = __pyx_v_objs; __Pyx_INCREF(__pyx_t_10); __pyx_t_1 = 0;
4394 __pyx_t_1 = -1; __pyx_t_10 = PyObject_GetIter(__pyx_v_objs); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 184, __pyx_L1_error)
4395 __Pyx_GOTREF(__pyx_t_10);
4396 __pyx_t_11 = Py_TYPE(__pyx_t_10)->tp_iternext; if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 184, __pyx_L1_error)
4399 if (likely(!__pyx_t_11)) {
4400 if (likely(PyList_CheckExact(__pyx_t_10))) {
4401 if (__pyx_t_1 >= PyList_GET_SIZE(__pyx_t_10)) break;
4402 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
4403 __pyx_t_12 = PyList_GET_ITEM(__pyx_t_10, __pyx_t_1); __Pyx_INCREF(__pyx_t_12); __pyx_t_1++; if (unlikely(0 < 0)) __PYX_ERR(0, 184, __pyx_L1_error)
4405 __pyx_t_12 = PySequence_ITEM(__pyx_t_10, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 184, __pyx_L1_error)
4406 __Pyx_GOTREF(__pyx_t_12);
4409 if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_10)) break;
4410 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
4411 __pyx_t_12 = PyTuple_GET_ITEM(__pyx_t_10, __pyx_t_1); __Pyx_INCREF(__pyx_t_12); __pyx_t_1++; if (unlikely(0 < 0)) __PYX_ERR(0, 184, __pyx_L1_error)
4413 __pyx_t_12 = PySequence_ITEM(__pyx_t_10, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 184, __pyx_L1_error)
4414 __Pyx_GOTREF(__pyx_t_12);
4418 __pyx_t_12 = __pyx_t_11(__pyx_t_10);
4419 if (unlikely(!__pyx_t_12)) {
4420 PyObject* exc_type = PyErr_Occurred();
4422 if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
4423 else __PYX_ERR(0, 184, __pyx_L1_error)
4427 __Pyx_GOTREF(__pyx_t_12);
4429 __Pyx_XDECREF_SET(__pyx_v_obj, __pyx_t_12);
4431 __pyx_t_13 = PyObject_Length(__pyx_v_obj); if (unlikely(__pyx_t_13 == -1)) __PYX_ERR(0, 184, __pyx_L1_error)
4432 __pyx_t_2 = (__pyx_t_13 == 4);
4435 __pyx_t_14 = __Pyx_PyBool_FromLong(__pyx_t_2); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 184, __pyx_L1_error)
4436 __Pyx_GOTREF(__pyx_t_14);
4437 __pyx_t_12 = __pyx_t_14;
4439 goto __pyx_L11_bool_binop_done;
4441 __pyx_t_14 = PyObject_RichCompare(((PyObject *)Py_TYPE(__pyx_v_obj)), ((PyObject *)(&PyList_Type)), Py_EQ); __Pyx_XGOTREF(__pyx_t_14); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 184, __pyx_L1_error)
4442 __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_14); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 184, __pyx_L1_error)
4444 __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
4446 __Pyx_INCREF(__pyx_t_14);
4447 __pyx_t_12 = __pyx_t_14;
4448 __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
4449 goto __pyx_L11_bool_binop_done;
4451 __pyx_t_14 = PyObject_RichCompare(((PyObject *)Py_TYPE(__pyx_v_obj)), ((PyObject *)__pyx_ptype_5numpy_ndarray), Py_EQ); __Pyx_XGOTREF(__pyx_t_14); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 184, __pyx_L1_error)
4452 __Pyx_INCREF(__pyx_t_14);
4453 __pyx_t_12 = __pyx_t_14;
4454 __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
4455 __pyx_L11_bool_binop_done:;
4456 if (unlikely(__Pyx_ListComp_Append(__pyx_t_6, (PyObject*)__pyx_t_12))) __PYX_ERR(0, 184, __pyx_L1_error)
4457 __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
4459 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
4461 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
4462 __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_7);
4463 if (likely(__pyx_t_10)) {
4464 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
4465 __Pyx_INCREF(__pyx_t_10);
4466 __Pyx_INCREF(function);
4467 __Pyx_DECREF_SET(__pyx_t_7, function);
4471 __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 184, __pyx_L1_error)
4472 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
4473 __Pyx_GOTREF(__pyx_t_4);
4475 #if CYTHON_FAST_PYCALL
4476 if (PyFunction_Check(__pyx_t_7)) {
4477 PyObject *__pyx_temp[2] = {__pyx_t_10, __pyx_t_6};
4478 __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 184, __pyx_L1_error)
4479 __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
4480 __Pyx_GOTREF(__pyx_t_4);
4481 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
4484 #if CYTHON_FAST_PYCCALL
4485 if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) {
4486 PyObject *__pyx_temp[2] = {__pyx_t_10, __pyx_t_6};
4487 __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 184, __pyx_L1_error)
4488 __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
4489 __Pyx_GOTREF(__pyx_t_4);
4490 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
4494 __pyx_t_12 = PyTuple_New(1+1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 184, __pyx_L1_error)
4495 __Pyx_GOTREF(__pyx_t_12);
4496 __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_10); __pyx_t_10 = NULL;
4497 __Pyx_GIVEREF(__pyx_t_6);
4498 PyTuple_SET_ITEM(__pyx_t_12, 0+1, __pyx_t_6);
4500 __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_12, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 184, __pyx_L1_error)
4501 __Pyx_GOTREF(__pyx_t_4);
4502 __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
4505 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
4507 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
4508 __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5);
4509 if (likely(__pyx_t_7)) {
4510 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
4511 __Pyx_INCREF(__pyx_t_7);
4512 __Pyx_INCREF(function);
4513 __Pyx_DECREF_SET(__pyx_t_5, function);
4517 __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 184, __pyx_L1_error)
4518 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4519 __Pyx_GOTREF(__pyx_t_3);
4521 #if CYTHON_FAST_PYCALL
4522 if (PyFunction_Check(__pyx_t_5)) {
4523 PyObject *__pyx_temp[2] = {__pyx_t_7, __pyx_t_4};
4524 __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 184, __pyx_L1_error)
4525 __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
4526 __Pyx_GOTREF(__pyx_t_3);
4527 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4530 #if CYTHON_FAST_PYCCALL
4531 if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
4532 PyObject *__pyx_temp[2] = {__pyx_t_7, __pyx_t_4};
4533 __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 184, __pyx_L1_error)
4534 __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
4535 __Pyx_GOTREF(__pyx_t_3);
4536 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4540 __pyx_t_12 = PyTuple_New(1+1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 184, __pyx_L1_error)
4541 __Pyx_GOTREF(__pyx_t_12);
4542 __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_7); __pyx_t_7 = NULL;
4543 __Pyx_GIVEREF(__pyx_t_4);
4544 PyTuple_SET_ITEM(__pyx_t_12, 0+1, __pyx_t_4);
4546 __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_12, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 184, __pyx_L1_error)
4547 __Pyx_GOTREF(__pyx_t_3);
4548 __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
4551 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
4552 __pyx_v_isbox = __pyx_t_3;
4555 /* "pycocotools/_mask.pyx":185
4556 * # check if list is in box format and convert it to np.ndarray
4557 * isbox = np.all(np.array([(len(obj)==4) and ((type(obj)==list) or (type(obj)==np.ndarray)) for obj in objs]))
4558 * isrle = np.all(np.array([type(obj) == dict for obj in objs])) # <<<<<<<<<<<<<<
4560 * objs = np.array(objs, dtype=np.double)
4562 __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 185, __pyx_L1_error)
4563 __Pyx_GOTREF(__pyx_t_5);
4564 __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_all); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 185, __pyx_L1_error)
4565 __Pyx_GOTREF(__pyx_t_12);
4566 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
4567 __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 185, __pyx_L1_error)
4568 __Pyx_GOTREF(__pyx_t_4);
4569 __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_array); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 185, __pyx_L1_error)
4570 __Pyx_GOTREF(__pyx_t_7);
4571 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4572 __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 185, __pyx_L1_error)
4573 __Pyx_GOTREF(__pyx_t_4);
4574 if (likely(PyList_CheckExact(__pyx_v_objs)) || PyTuple_CheckExact(__pyx_v_objs)) {
4575 __pyx_t_6 = __pyx_v_objs; __Pyx_INCREF(__pyx_t_6); __pyx_t_1 = 0;
4578 __pyx_t_1 = -1; __pyx_t_6 = PyObject_GetIter(__pyx_v_objs); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 185, __pyx_L1_error)
4579 __Pyx_GOTREF(__pyx_t_6);
4580 __pyx_t_11 = Py_TYPE(__pyx_t_6)->tp_iternext; if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 185, __pyx_L1_error)
4583 if (likely(!__pyx_t_11)) {
4584 if (likely(PyList_CheckExact(__pyx_t_6))) {
4585 if (__pyx_t_1 >= PyList_GET_SIZE(__pyx_t_6)) break;
4586 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
4587 __pyx_t_10 = PyList_GET_ITEM(__pyx_t_6, __pyx_t_1); __Pyx_INCREF(__pyx_t_10); __pyx_t_1++; if (unlikely(0 < 0)) __PYX_ERR(0, 185, __pyx_L1_error)
4589 __pyx_t_10 = PySequence_ITEM(__pyx_t_6, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 185, __pyx_L1_error)
4590 __Pyx_GOTREF(__pyx_t_10);
4593 if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_6)) break;
4594 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
4595 __pyx_t_10 = PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_1); __Pyx_INCREF(__pyx_t_10); __pyx_t_1++; if (unlikely(0 < 0)) __PYX_ERR(0, 185, __pyx_L1_error)
4597 __pyx_t_10 = PySequence_ITEM(__pyx_t_6, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 185, __pyx_L1_error)
4598 __Pyx_GOTREF(__pyx_t_10);
4602 __pyx_t_10 = __pyx_t_11(__pyx_t_6);
4603 if (unlikely(!__pyx_t_10)) {
4604 PyObject* exc_type = PyErr_Occurred();
4606 if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
4607 else __PYX_ERR(0, 185, __pyx_L1_error)
4611 __Pyx_GOTREF(__pyx_t_10);
4613 __Pyx_XDECREF_SET(__pyx_v_obj, __pyx_t_10);
4615 __pyx_t_10 = PyObject_RichCompare(((PyObject *)Py_TYPE(__pyx_v_obj)), ((PyObject *)(&PyDict_Type)), Py_EQ); __Pyx_XGOTREF(__pyx_t_10); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 185, __pyx_L1_error)
4616 if (unlikely(__Pyx_ListComp_Append(__pyx_t_4, (PyObject*)__pyx_t_10))) __PYX_ERR(0, 185, __pyx_L1_error)
4617 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
4619 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
4621 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) {
4622 __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_7);
4623 if (likely(__pyx_t_6)) {
4624 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
4625 __Pyx_INCREF(__pyx_t_6);
4626 __Pyx_INCREF(function);
4627 __Pyx_DECREF_SET(__pyx_t_7, function);
4631 __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 185, __pyx_L1_error)
4632 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4633 __Pyx_GOTREF(__pyx_t_5);
4635 #if CYTHON_FAST_PYCALL
4636 if (PyFunction_Check(__pyx_t_7)) {
4637 PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_t_4};
4638 __pyx_t_5 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 185, __pyx_L1_error)
4639 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
4640 __Pyx_GOTREF(__pyx_t_5);
4641 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4644 #if CYTHON_FAST_PYCCALL
4645 if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) {
4646 PyObject *__pyx_temp[2] = {__pyx_t_6, __pyx_t_4};
4647 __pyx_t_5 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 185, __pyx_L1_error)
4648 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
4649 __Pyx_GOTREF(__pyx_t_5);
4650 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4654 __pyx_t_10 = PyTuple_New(1+1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 185, __pyx_L1_error)
4655 __Pyx_GOTREF(__pyx_t_10);
4656 __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_6); __pyx_t_6 = NULL;
4657 __Pyx_GIVEREF(__pyx_t_4);
4658 PyTuple_SET_ITEM(__pyx_t_10, 0+1, __pyx_t_4);
4660 __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_10, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 185, __pyx_L1_error)
4661 __Pyx_GOTREF(__pyx_t_5);
4662 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
4665 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
4667 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_12))) {
4668 __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_12);
4669 if (likely(__pyx_t_7)) {
4670 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_12);
4671 __Pyx_INCREF(__pyx_t_7);
4672 __Pyx_INCREF(function);
4673 __Pyx_DECREF_SET(__pyx_t_12, function);
4677 __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_12, __pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 185, __pyx_L1_error)
4678 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
4679 __Pyx_GOTREF(__pyx_t_3);
4681 #if CYTHON_FAST_PYCALL
4682 if (PyFunction_Check(__pyx_t_12)) {
4683 PyObject *__pyx_temp[2] = {__pyx_t_7, __pyx_t_5};
4684 __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_12, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 185, __pyx_L1_error)
4685 __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
4686 __Pyx_GOTREF(__pyx_t_3);
4687 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
4690 #if CYTHON_FAST_PYCCALL
4691 if (__Pyx_PyFastCFunction_Check(__pyx_t_12)) {
4692 PyObject *__pyx_temp[2] = {__pyx_t_7, __pyx_t_5};
4693 __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_12, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 185, __pyx_L1_error)
4694 __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0;
4695 __Pyx_GOTREF(__pyx_t_3);
4696 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
4700 __pyx_t_10 = PyTuple_New(1+1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 185, __pyx_L1_error)
4701 __Pyx_GOTREF(__pyx_t_10);
4702 __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_7); __pyx_t_7 = NULL;
4703 __Pyx_GIVEREF(__pyx_t_5);
4704 PyTuple_SET_ITEM(__pyx_t_10, 0+1, __pyx_t_5);
4706 __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_12, __pyx_t_10, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 185, __pyx_L1_error)
4707 __Pyx_GOTREF(__pyx_t_3);
4708 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
4711 __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
4712 __pyx_v_isrle = __pyx_t_3;
4715 /* "pycocotools/_mask.pyx":186
4716 * isbox = np.all(np.array([(len(obj)==4) and ((type(obj)==list) or (type(obj)==np.ndarray)) for obj in objs]))
4717 * isrle = np.all(np.array([type(obj) == dict for obj in objs]))
4718 * if isbox: # <<<<<<<<<<<<<<
4719 * objs = np.array(objs, dtype=np.double)
4720 * if len(objs.shape) == 1:
4722 __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_isbox); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 186, __pyx_L1_error)
4725 /* "pycocotools/_mask.pyx":187
4726 * isrle = np.all(np.array([type(obj) == dict for obj in objs]))
4728 * objs = np.array(objs, dtype=np.double) # <<<<<<<<<<<<<<
4729 * if len(objs.shape) == 1:
4730 * objs = objs.reshape((1,objs.shape[0]))
4732 __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 187, __pyx_L1_error)
4733 __Pyx_GOTREF(__pyx_t_3);
4734 __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_array); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 187, __pyx_L1_error)
4735 __Pyx_GOTREF(__pyx_t_12);
4736 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4737 __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 187, __pyx_L1_error)
4738 __Pyx_GOTREF(__pyx_t_3);
4739 __Pyx_INCREF(__pyx_v_objs);
4740 __Pyx_GIVEREF(__pyx_v_objs);
4741 PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_objs);
4742 __pyx_t_10 = PyDict_New(); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 187, __pyx_L1_error)
4743 __Pyx_GOTREF(__pyx_t_10);
4744 __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 187, __pyx_L1_error)
4745 __Pyx_GOTREF(__pyx_t_5);
4746 __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_double); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 187, __pyx_L1_error)
4747 __Pyx_GOTREF(__pyx_t_7);
4748 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
4749 if (PyDict_SetItem(__pyx_t_10, __pyx_n_s_dtype, __pyx_t_7) < 0) __PYX_ERR(0, 187, __pyx_L1_error)
4750 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
4751 __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_12, __pyx_t_3, __pyx_t_10); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 187, __pyx_L1_error)
4752 __Pyx_GOTREF(__pyx_t_7);
4753 __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
4754 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4755 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
4756 __Pyx_DECREF_SET(__pyx_v_objs, __pyx_t_7);
4759 /* "pycocotools/_mask.pyx":188
4761 * objs = np.array(objs, dtype=np.double)
4762 * if len(objs.shape) == 1: # <<<<<<<<<<<<<<
4763 * objs = objs.reshape((1,objs.shape[0]))
4766 __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_v_objs, __pyx_n_s_shape); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 188, __pyx_L1_error)
4767 __Pyx_GOTREF(__pyx_t_7);
4768 __pyx_t_1 = PyObject_Length(__pyx_t_7); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(0, 188, __pyx_L1_error)
4769 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
4770 __pyx_t_2 = ((__pyx_t_1 == 1) != 0);
4773 /* "pycocotools/_mask.pyx":189
4774 * objs = np.array(objs, dtype=np.double)
4775 * if len(objs.shape) == 1:
4776 * objs = objs.reshape((1,objs.shape[0])) # <<<<<<<<<<<<<<
4778 * objs = _frString(objs)
4780 __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_objs, __pyx_n_s_reshape); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 189, __pyx_L1_error)
4781 __Pyx_GOTREF(__pyx_t_10);
4782 __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_objs, __pyx_n_s_shape); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 189, __pyx_L1_error)
4783 __Pyx_GOTREF(__pyx_t_3);
4784 __pyx_t_12 = __Pyx_GetItemInt(__pyx_t_3, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 189, __pyx_L1_error)
4785 __Pyx_GOTREF(__pyx_t_12);
4786 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4787 __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 189, __pyx_L1_error)
4788 __Pyx_GOTREF(__pyx_t_3);
4789 __Pyx_INCREF(__pyx_int_1);
4790 __Pyx_GIVEREF(__pyx_int_1);
4791 PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_int_1);
4792 __Pyx_GIVEREF(__pyx_t_12);
4793 PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_12);
4796 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_10))) {
4797 __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_10);
4798 if (likely(__pyx_t_12)) {
4799 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
4800 __Pyx_INCREF(__pyx_t_12);
4801 __Pyx_INCREF(function);
4802 __Pyx_DECREF_SET(__pyx_t_10, function);
4806 __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_t_10, __pyx_t_3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 189, __pyx_L1_error)
4807 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4808 __Pyx_GOTREF(__pyx_t_7);
4810 #if CYTHON_FAST_PYCALL
4811 if (PyFunction_Check(__pyx_t_10)) {
4812 PyObject *__pyx_temp[2] = {__pyx_t_12, __pyx_t_3};
4813 __pyx_t_7 = __Pyx_PyFunction_FastCall(__pyx_t_10, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 189, __pyx_L1_error)
4814 __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
4815 __Pyx_GOTREF(__pyx_t_7);
4816 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4819 #if CYTHON_FAST_PYCCALL
4820 if (__Pyx_PyFastCFunction_Check(__pyx_t_10)) {
4821 PyObject *__pyx_temp[2] = {__pyx_t_12, __pyx_t_3};
4822 __pyx_t_7 = __Pyx_PyCFunction_FastCall(__pyx_t_10, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 189, __pyx_L1_error)
4823 __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0;
4824 __Pyx_GOTREF(__pyx_t_7);
4825 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4829 __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 189, __pyx_L1_error)
4830 __Pyx_GOTREF(__pyx_t_5);
4831 __Pyx_GIVEREF(__pyx_t_12); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_12); __pyx_t_12 = NULL;
4832 __Pyx_GIVEREF(__pyx_t_3);
4833 PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_t_3);
4835 __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_5, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 189, __pyx_L1_error)
4836 __Pyx_GOTREF(__pyx_t_7);
4837 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
4840 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
4841 __Pyx_DECREF_SET(__pyx_v_objs, __pyx_t_7);
4844 /* "pycocotools/_mask.pyx":188
4846 * objs = np.array(objs, dtype=np.double)
4847 * if len(objs.shape) == 1: # <<<<<<<<<<<<<<
4848 * objs = objs.reshape((1,objs.shape[0]))
4853 /* "pycocotools/_mask.pyx":186
4854 * isbox = np.all(np.array([(len(obj)==4) and ((type(obj)==list) or (type(obj)==np.ndarray)) for obj in objs]))
4855 * isrle = np.all(np.array([type(obj) == dict for obj in objs]))
4856 * if isbox: # <<<<<<<<<<<<<<
4857 * objs = np.array(objs, dtype=np.double)
4858 * if len(objs.shape) == 1:
4863 /* "pycocotools/_mask.pyx":190
4864 * if len(objs.shape) == 1:
4865 * objs = objs.reshape((1,objs.shape[0]))
4866 * elif isrle: # <<<<<<<<<<<<<<
4867 * objs = _frString(objs)
4870 __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_isrle); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 190, __pyx_L1_error)
4873 /* "pycocotools/_mask.pyx":191
4874 * objs = objs.reshape((1,objs.shape[0]))
4876 * objs = _frString(objs) # <<<<<<<<<<<<<<
4878 * raise Exception('list input can be bounding box (Nx4) or RLEs ([RLE])')
4880 __pyx_t_10 = __Pyx_GetModuleGlobalName(__pyx_n_s_frString); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 191, __pyx_L1_error)
4881 __Pyx_GOTREF(__pyx_t_10);
4883 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_10))) {
4884 __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_10);
4885 if (likely(__pyx_t_5)) {
4886 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
4887 __Pyx_INCREF(__pyx_t_5);
4888 __Pyx_INCREF(function);
4889 __Pyx_DECREF_SET(__pyx_t_10, function);
4893 __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_t_10, __pyx_v_objs); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 191, __pyx_L1_error)
4894 __Pyx_GOTREF(__pyx_t_7);
4896 #if CYTHON_FAST_PYCALL
4897 if (PyFunction_Check(__pyx_t_10)) {
4898 PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_v_objs};
4899 __pyx_t_7 = __Pyx_PyFunction_FastCall(__pyx_t_10, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 191, __pyx_L1_error)
4900 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
4901 __Pyx_GOTREF(__pyx_t_7);
4904 #if CYTHON_FAST_PYCCALL
4905 if (__Pyx_PyFastCFunction_Check(__pyx_t_10)) {
4906 PyObject *__pyx_temp[2] = {__pyx_t_5, __pyx_v_objs};
4907 __pyx_t_7 = __Pyx_PyCFunction_FastCall(__pyx_t_10, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 191, __pyx_L1_error)
4908 __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0;
4909 __Pyx_GOTREF(__pyx_t_7);
4913 __pyx_t_3 = PyTuple_New(1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 191, __pyx_L1_error)
4914 __Pyx_GOTREF(__pyx_t_3);
4915 __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5); __pyx_t_5 = NULL;
4916 __Pyx_INCREF(__pyx_v_objs);
4917 __Pyx_GIVEREF(__pyx_v_objs);
4918 PyTuple_SET_ITEM(__pyx_t_3, 0+1, __pyx_v_objs);
4919 __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_3, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 191, __pyx_L1_error)
4920 __Pyx_GOTREF(__pyx_t_7);
4921 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
4924 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
4925 __Pyx_DECREF_SET(__pyx_v_objs, __pyx_t_7);
4928 /* "pycocotools/_mask.pyx":190
4929 * if len(objs.shape) == 1:
4930 * objs = objs.reshape((1,objs.shape[0]))
4931 * elif isrle: # <<<<<<<<<<<<<<
4932 * objs = _frString(objs)
4938 /* "pycocotools/_mask.pyx":193
4939 * objs = _frString(objs)
4941 * raise Exception('list input can be bounding box (Nx4) or RLEs ([RLE])') # <<<<<<<<<<<<<<
4943 * raise Exception('unrecognized type. The following type: RLEs (rle), np.ndarray (box), and list (box) are supported.')
4946 __pyx_t_7 = __Pyx_PyObject_Call(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])), __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 193, __pyx_L1_error)
4947 __Pyx_GOTREF(__pyx_t_7);
4948 __Pyx_Raise(__pyx_t_7, 0, 0, 0);
4949 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
4950 __PYX_ERR(0, 193, __pyx_L1_error)
4954 /* "pycocotools/_mask.pyx":182
4955 * raise Exception('numpy ndarray input is only for *bounding boxes* and should have Nx4 dimension')
4956 * objs = objs.astype(np.double)
4957 * elif type(objs) == list: # <<<<<<<<<<<<<<
4958 * # check if list is in box format and convert it to np.ndarray
4959 * isbox = np.all(np.array([(len(obj)==4) and ((type(obj)==list) or (type(obj)==np.ndarray)) for obj in objs]))
4964 /* "pycocotools/_mask.pyx":195
4965 * raise Exception('list input can be bounding box (Nx4) or RLEs ([RLE])')
4967 * raise Exception('unrecognized type. The following type: RLEs (rle), np.ndarray (box), and list (box) are supported.') # <<<<<<<<<<<<<<
4969 * def _rleIou(RLEs dt, RLEs gt, np.ndarray[np.uint8_t, ndim=1] iscrowd, siz m, siz n, np.ndarray[np.double_t, ndim=1] _iou):
4972 __pyx_t_7 = __Pyx_PyObject_Call(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])), __pyx_tuple__6, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 195, __pyx_L1_error)
4973 __Pyx_GOTREF(__pyx_t_7);
4974 __Pyx_Raise(__pyx_t_7, 0, 0, 0);
4975 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
4976 __PYX_ERR(0, 195, __pyx_L1_error)
4980 /* "pycocotools/_mask.pyx":196
4982 * raise Exception('unrecognized type. The following type: RLEs (rle), np.ndarray (box), and list (box) are supported.')
4983 * return objs # <<<<<<<<<<<<<<
4984 * def _rleIou(RLEs dt, RLEs gt, np.ndarray[np.uint8_t, ndim=1] iscrowd, siz m, siz n, np.ndarray[np.double_t, ndim=1] _iou):
4985 * rleIou( <RLE*> dt._R, <RLE*> gt._R, m, n, <byte*> iscrowd.data, <double*> _iou.data )
4987 __Pyx_XDECREF(__pyx_r);
4988 __Pyx_INCREF(__pyx_v_objs);
4989 __pyx_r = __pyx_v_objs;
4992 /* "pycocotools/_mask.pyx":172
4993 * # iou computation. support function overload (RLEs-RLEs and bbox-bbox).
4994 * def iou( dt, gt, pyiscrowd ):
4995 * def _preproc(objs): # <<<<<<<<<<<<<<
4996 * if len(objs) == 0:
5000 /* function exit code */
5002 __Pyx_XDECREF(__pyx_t_3);
5003 __Pyx_XDECREF(__pyx_t_4);
5004 __Pyx_XDECREF(__pyx_t_5);
5005 __Pyx_XDECREF(__pyx_t_6);
5006 __Pyx_XDECREF(__pyx_t_7);
5007 __Pyx_XDECREF(__pyx_t_10);
5008 __Pyx_XDECREF(__pyx_t_12);
5009 __Pyx_XDECREF(__pyx_t_14);
5010 __Pyx_AddTraceback("pycocotools._mask.iou._preproc", __pyx_clineno, __pyx_lineno, __pyx_filename);
5013 __Pyx_XDECREF(__pyx_v_isbox);
5014 __Pyx_XDECREF(__pyx_v_isrle);
5015 __Pyx_XDECREF(__pyx_v_obj);
5016 __Pyx_XDECREF(__pyx_v_objs);
5017 __Pyx_XGIVEREF(__pyx_r);
5018 __Pyx_RefNannyFinishContext();
5022 /* "pycocotools/_mask.pyx":197
5023 * raise Exception('unrecognized type. The following type: RLEs (rle), np.ndarray (box), and list (box) are supported.')
5025 * def _rleIou(RLEs dt, RLEs gt, np.ndarray[np.uint8_t, ndim=1] iscrowd, siz m, siz n, np.ndarray[np.double_t, ndim=1] _iou): # <<<<<<<<<<<<<<
5026 * rleIou( <RLE*> dt._R, <RLE*> gt._R, m, n, <byte*> iscrowd.data, <double*> _iou.data )
5027 * def _bbIou(np.ndarray[np.double_t, ndim=2] dt, np.ndarray[np.double_t, ndim=2] gt, np.ndarray[np.uint8_t, ndim=1] iscrowd, siz m, siz n, np.ndarray[np.double_t, ndim=1] _iou):
5030 /* Python wrapper */
5031 static PyObject *__pyx_pw_11pycocotools_5_mask_3iou_3_rleIou(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
5032 static PyMethodDef __pyx_mdef_11pycocotools_5_mask_3iou_3_rleIou = {"_rleIou", (PyCFunction)__pyx_pw_11pycocotools_5_mask_3iou_3_rleIou, METH_VARARGS|METH_KEYWORDS, 0};
5033 static PyObject *__pyx_pw_11pycocotools_5_mask_3iou_3_rleIou(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
5034 struct __pyx_obj_11pycocotools_5_mask_RLEs *__pyx_v_dt = 0;
5035 struct __pyx_obj_11pycocotools_5_mask_RLEs *__pyx_v_gt = 0;
5036 PyArrayObject *__pyx_v_iscrowd = 0;
5039 PyArrayObject *__pyx_v__iou = 0;
5040 PyObject *__pyx_r = 0;
5041 __Pyx_RefNannyDeclarations
5042 __Pyx_RefNannySetupContext("_rleIou (wrapper)", 0);
5044 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_dt,&__pyx_n_s_gt,&__pyx_n_s_iscrowd,&__pyx_n_s_m,&__pyx_n_s_n,&__pyx_n_s_iou,0};
5045 PyObject* values[6] = {0,0,0,0,0,0};
5046 if (unlikely(__pyx_kwds)) {
5048 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
5050 case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
5051 case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
5052 case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
5053 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
5054 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5055 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5057 default: goto __pyx_L5_argtuple_error;
5059 kw_args = PyDict_Size(__pyx_kwds);
5062 if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_dt)) != 0)) kw_args--;
5063 else goto __pyx_L5_argtuple_error;
5065 if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_gt)) != 0)) kw_args--;
5067 __Pyx_RaiseArgtupleInvalid("_rleIou", 1, 6, 6, 1); __PYX_ERR(0, 197, __pyx_L3_error)
5070 if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_iscrowd)) != 0)) kw_args--;
5072 __Pyx_RaiseArgtupleInvalid("_rleIou", 1, 6, 6, 2); __PYX_ERR(0, 197, __pyx_L3_error)
5075 if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_m)) != 0)) kw_args--;
5077 __Pyx_RaiseArgtupleInvalid("_rleIou", 1, 6, 6, 3); __PYX_ERR(0, 197, __pyx_L3_error)
5080 if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_n)) != 0)) kw_args--;
5082 __Pyx_RaiseArgtupleInvalid("_rleIou", 1, 6, 6, 4); __PYX_ERR(0, 197, __pyx_L3_error)
5085 if (likely((values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_iou)) != 0)) kw_args--;
5087 __Pyx_RaiseArgtupleInvalid("_rleIou", 1, 6, 6, 5); __PYX_ERR(0, 197, __pyx_L3_error)
5090 if (unlikely(kw_args > 0)) {
5091 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_rleIou") < 0)) __PYX_ERR(0, 197, __pyx_L3_error)
5093 } else if (PyTuple_GET_SIZE(__pyx_args) != 6) {
5094 goto __pyx_L5_argtuple_error;
5096 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5097 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5098 values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
5099 values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
5100 values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
5101 values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
5103 __pyx_v_dt = ((struct __pyx_obj_11pycocotools_5_mask_RLEs *)values[0]);
5104 __pyx_v_gt = ((struct __pyx_obj_11pycocotools_5_mask_RLEs *)values[1]);
5105 __pyx_v_iscrowd = ((PyArrayObject *)values[2]);
5106 __pyx_v_m = __Pyx_PyInt_As_siz(values[3]); if (unlikely((__pyx_v_m == ((siz)-1)) && PyErr_Occurred())) __PYX_ERR(0, 197, __pyx_L3_error)
5107 __pyx_v_n = __Pyx_PyInt_As_siz(values[4]); if (unlikely((__pyx_v_n == ((siz)-1)) && PyErr_Occurred())) __PYX_ERR(0, 197, __pyx_L3_error)
5108 __pyx_v__iou = ((PyArrayObject *)values[5]);
5110 goto __pyx_L4_argument_unpacking_done;
5111 __pyx_L5_argtuple_error:;
5112 __Pyx_RaiseArgtupleInvalid("_rleIou", 1, 6, 6, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 197, __pyx_L3_error)
5114 __Pyx_AddTraceback("pycocotools._mask.iou._rleIou", __pyx_clineno, __pyx_lineno, __pyx_filename);
5115 __Pyx_RefNannyFinishContext();
5117 __pyx_L4_argument_unpacking_done:;
5118 if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dt), __pyx_ptype_11pycocotools_5_mask_RLEs, 1, "dt", 0))) __PYX_ERR(0, 197, __pyx_L1_error)
5119 if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gt), __pyx_ptype_11pycocotools_5_mask_RLEs, 1, "gt", 0))) __PYX_ERR(0, 197, __pyx_L1_error)
5120 if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_iscrowd), __pyx_ptype_5numpy_ndarray, 1, "iscrowd", 0))) __PYX_ERR(0, 197, __pyx_L1_error)
5121 if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v__iou), __pyx_ptype_5numpy_ndarray, 1, "_iou", 0))) __PYX_ERR(0, 197, __pyx_L1_error)
5122 __pyx_r = __pyx_pf_11pycocotools_5_mask_3iou_2_rleIou(__pyx_self, __pyx_v_dt, __pyx_v_gt, __pyx_v_iscrowd, __pyx_v_m, __pyx_v_n, __pyx_v__iou);
5124 /* function exit code */
5129 __Pyx_RefNannyFinishContext();
5133 static PyObject *__pyx_pf_11pycocotools_5_mask_3iou_2_rleIou(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_11pycocotools_5_mask_RLEs *__pyx_v_dt, struct __pyx_obj_11pycocotools_5_mask_RLEs *__pyx_v_gt, PyArrayObject *__pyx_v_iscrowd, siz __pyx_v_m, siz __pyx_v_n, PyArrayObject *__pyx_v__iou) {
5134 __Pyx_LocalBuf_ND __pyx_pybuffernd__iou;
5135 __Pyx_Buffer __pyx_pybuffer__iou;
5136 __Pyx_LocalBuf_ND __pyx_pybuffernd_iscrowd;
5137 __Pyx_Buffer __pyx_pybuffer_iscrowd;
5138 PyObject *__pyx_r = NULL;
5139 __Pyx_RefNannyDeclarations
5140 __Pyx_RefNannySetupContext("_rleIou", 0);
5141 __pyx_pybuffer_iscrowd.pybuffer.buf = NULL;
5142 __pyx_pybuffer_iscrowd.refcount = 0;
5143 __pyx_pybuffernd_iscrowd.data = NULL;
5144 __pyx_pybuffernd_iscrowd.rcbuffer = &__pyx_pybuffer_iscrowd;
5145 __pyx_pybuffer__iou.pybuffer.buf = NULL;
5146 __pyx_pybuffer__iou.refcount = 0;
5147 __pyx_pybuffernd__iou.data = NULL;
5148 __pyx_pybuffernd__iou.rcbuffer = &__pyx_pybuffer__iou;
5150 __Pyx_BufFmt_StackElem __pyx_stack[1];
5151 if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_iscrowd.rcbuffer->pybuffer, (PyObject*)__pyx_v_iscrowd, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint8_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 197, __pyx_L1_error)
5153 __pyx_pybuffernd_iscrowd.diminfo[0].strides = __pyx_pybuffernd_iscrowd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_iscrowd.diminfo[0].shape = __pyx_pybuffernd_iscrowd.rcbuffer->pybuffer.shape[0];
5155 __Pyx_BufFmt_StackElem __pyx_stack[1];
5156 if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd__iou.rcbuffer->pybuffer, (PyObject*)__pyx_v__iou, &__Pyx_TypeInfo_nn___pyx_t_5numpy_double_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 197, __pyx_L1_error)
5158 __pyx_pybuffernd__iou.diminfo[0].strides = __pyx_pybuffernd__iou.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd__iou.diminfo[0].shape = __pyx_pybuffernd__iou.rcbuffer->pybuffer.shape[0];
5160 /* "pycocotools/_mask.pyx":198
5162 * def _rleIou(RLEs dt, RLEs gt, np.ndarray[np.uint8_t, ndim=1] iscrowd, siz m, siz n, np.ndarray[np.double_t, ndim=1] _iou):
5163 * rleIou( <RLE*> dt._R, <RLE*> gt._R, m, n, <byte*> iscrowd.data, <double*> _iou.data ) # <<<<<<<<<<<<<<
5164 * def _bbIou(np.ndarray[np.double_t, ndim=2] dt, np.ndarray[np.double_t, ndim=2] gt, np.ndarray[np.uint8_t, ndim=1] iscrowd, siz m, siz n, np.ndarray[np.double_t, ndim=1] _iou):
5165 * bbIou( <BB> dt.data, <BB> gt.data, m, n, <byte*> iscrowd.data, <double*>_iou.data )
5167 rleIou(((RLE *)__pyx_v_dt->_R), ((RLE *)__pyx_v_gt->_R), __pyx_v_m, __pyx_v_n, ((byte *)__pyx_v_iscrowd->data), ((double *)__pyx_v__iou->data));
5169 /* "pycocotools/_mask.pyx":197
5170 * raise Exception('unrecognized type. The following type: RLEs (rle), np.ndarray (box), and list (box) are supported.')
5172 * def _rleIou(RLEs dt, RLEs gt, np.ndarray[np.uint8_t, ndim=1] iscrowd, siz m, siz n, np.ndarray[np.double_t, ndim=1] _iou): # <<<<<<<<<<<<<<
5173 * rleIou( <RLE*> dt._R, <RLE*> gt._R, m, n, <byte*> iscrowd.data, <double*> _iou.data )
5174 * def _bbIou(np.ndarray[np.double_t, ndim=2] dt, np.ndarray[np.double_t, ndim=2] gt, np.ndarray[np.uint8_t, ndim=1] iscrowd, siz m, siz n, np.ndarray[np.double_t, ndim=1] _iou):
5177 /* function exit code */
5178 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
5181 { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
5182 __Pyx_PyThreadState_declare
5183 __Pyx_PyThreadState_assign
5184 __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
5185 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd__iou.rcbuffer->pybuffer);
5186 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_iscrowd.rcbuffer->pybuffer);
5187 __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
5188 __Pyx_AddTraceback("pycocotools._mask.iou._rleIou", __pyx_clineno, __pyx_lineno, __pyx_filename);
5192 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd__iou.rcbuffer->pybuffer);
5193 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_iscrowd.rcbuffer->pybuffer);
5195 __Pyx_XGIVEREF(__pyx_r);
5196 __Pyx_RefNannyFinishContext();
5200 /* "pycocotools/_mask.pyx":199
5201 * def _rleIou(RLEs dt, RLEs gt, np.ndarray[np.uint8_t, ndim=1] iscrowd, siz m, siz n, np.ndarray[np.double_t, ndim=1] _iou):
5202 * rleIou( <RLE*> dt._R, <RLE*> gt._R, m, n, <byte*> iscrowd.data, <double*> _iou.data )
5203 * def _bbIou(np.ndarray[np.double_t, ndim=2] dt, np.ndarray[np.double_t, ndim=2] gt, np.ndarray[np.uint8_t, ndim=1] iscrowd, siz m, siz n, np.ndarray[np.double_t, ndim=1] _iou): # <<<<<<<<<<<<<<
5204 * bbIou( <BB> dt.data, <BB> gt.data, m, n, <byte*> iscrowd.data, <double*>_iou.data )
5208 /* Python wrapper */
5209 static PyObject *__pyx_pw_11pycocotools_5_mask_3iou_5_bbIou(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
5210 static PyMethodDef __pyx_mdef_11pycocotools_5_mask_3iou_5_bbIou = {"_bbIou", (PyCFunction)__pyx_pw_11pycocotools_5_mask_3iou_5_bbIou, METH_VARARGS|METH_KEYWORDS, 0};
5211 static PyObject *__pyx_pw_11pycocotools_5_mask_3iou_5_bbIou(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
5212 PyArrayObject *__pyx_v_dt = 0;
5213 PyArrayObject *__pyx_v_gt = 0;
5214 PyArrayObject *__pyx_v_iscrowd = 0;
5217 PyArrayObject *__pyx_v__iou = 0;
5218 PyObject *__pyx_r = 0;
5219 __Pyx_RefNannyDeclarations
5220 __Pyx_RefNannySetupContext("_bbIou (wrapper)", 0);
5222 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_dt,&__pyx_n_s_gt,&__pyx_n_s_iscrowd,&__pyx_n_s_m,&__pyx_n_s_n,&__pyx_n_s_iou,0};
5223 PyObject* values[6] = {0,0,0,0,0,0};
5224 if (unlikely(__pyx_kwds)) {
5226 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
5228 case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
5229 case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
5230 case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
5231 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
5232 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5233 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5235 default: goto __pyx_L5_argtuple_error;
5237 kw_args = PyDict_Size(__pyx_kwds);
5240 if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_dt)) != 0)) kw_args--;
5241 else goto __pyx_L5_argtuple_error;
5243 if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_gt)) != 0)) kw_args--;
5245 __Pyx_RaiseArgtupleInvalid("_bbIou", 1, 6, 6, 1); __PYX_ERR(0, 199, __pyx_L3_error)
5248 if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_iscrowd)) != 0)) kw_args--;
5250 __Pyx_RaiseArgtupleInvalid("_bbIou", 1, 6, 6, 2); __PYX_ERR(0, 199, __pyx_L3_error)
5253 if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_m)) != 0)) kw_args--;
5255 __Pyx_RaiseArgtupleInvalid("_bbIou", 1, 6, 6, 3); __PYX_ERR(0, 199, __pyx_L3_error)
5258 if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_n)) != 0)) kw_args--;
5260 __Pyx_RaiseArgtupleInvalid("_bbIou", 1, 6, 6, 4); __PYX_ERR(0, 199, __pyx_L3_error)
5263 if (likely((values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_iou)) != 0)) kw_args--;
5265 __Pyx_RaiseArgtupleInvalid("_bbIou", 1, 6, 6, 5); __PYX_ERR(0, 199, __pyx_L3_error)
5268 if (unlikely(kw_args > 0)) {
5269 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "_bbIou") < 0)) __PYX_ERR(0, 199, __pyx_L3_error)
5271 } else if (PyTuple_GET_SIZE(__pyx_args) != 6) {
5272 goto __pyx_L5_argtuple_error;
5274 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
5275 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
5276 values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
5277 values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
5278 values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
5279 values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
5281 __pyx_v_dt = ((PyArrayObject *)values[0]);
5282 __pyx_v_gt = ((PyArrayObject *)values[1]);
5283 __pyx_v_iscrowd = ((PyArrayObject *)values[2]);
5284 __pyx_v_m = __Pyx_PyInt_As_siz(values[3]); if (unlikely((__pyx_v_m == ((siz)-1)) && PyErr_Occurred())) __PYX_ERR(0, 199, __pyx_L3_error)
5285 __pyx_v_n = __Pyx_PyInt_As_siz(values[4]); if (unlikely((__pyx_v_n == ((siz)-1)) && PyErr_Occurred())) __PYX_ERR(0, 199, __pyx_L3_error)
5286 __pyx_v__iou = ((PyArrayObject *)values[5]);
5288 goto __pyx_L4_argument_unpacking_done;
5289 __pyx_L5_argtuple_error:;
5290 __Pyx_RaiseArgtupleInvalid("_bbIou", 1, 6, 6, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 199, __pyx_L3_error)
5292 __Pyx_AddTraceback("pycocotools._mask.iou._bbIou", __pyx_clineno, __pyx_lineno, __pyx_filename);
5293 __Pyx_RefNannyFinishContext();
5295 __pyx_L4_argument_unpacking_done:;
5296 if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_dt), __pyx_ptype_5numpy_ndarray, 1, "dt", 0))) __PYX_ERR(0, 199, __pyx_L1_error)
5297 if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_gt), __pyx_ptype_5numpy_ndarray, 1, "gt", 0))) __PYX_ERR(0, 199, __pyx_L1_error)
5298 if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_iscrowd), __pyx_ptype_5numpy_ndarray, 1, "iscrowd", 0))) __PYX_ERR(0, 199, __pyx_L1_error)
5299 if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v__iou), __pyx_ptype_5numpy_ndarray, 1, "_iou", 0))) __PYX_ERR(0, 199, __pyx_L1_error)
5300 __pyx_r = __pyx_pf_11pycocotools_5_mask_3iou_4_bbIou(__pyx_self, __pyx_v_dt, __pyx_v_gt, __pyx_v_iscrowd, __pyx_v_m, __pyx_v_n, __pyx_v__iou);
5302 /* function exit code */
5307 __Pyx_RefNannyFinishContext();
5311 static PyObject *__pyx_pf_11pycocotools_5_mask_3iou_4_bbIou(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_dt, PyArrayObject *__pyx_v_gt, PyArrayObject *__pyx_v_iscrowd, siz __pyx_v_m, siz __pyx_v_n, PyArrayObject *__pyx_v__iou) {
5312 __Pyx_LocalBuf_ND __pyx_pybuffernd__iou;
5313 __Pyx_Buffer __pyx_pybuffer__iou;
5314 __Pyx_LocalBuf_ND __pyx_pybuffernd_dt;
5315 __Pyx_Buffer __pyx_pybuffer_dt;
5316 __Pyx_LocalBuf_ND __pyx_pybuffernd_gt;
5317 __Pyx_Buffer __pyx_pybuffer_gt;
5318 __Pyx_LocalBuf_ND __pyx_pybuffernd_iscrowd;
5319 __Pyx_Buffer __pyx_pybuffer_iscrowd;
5320 PyObject *__pyx_r = NULL;
5321 __Pyx_RefNannyDeclarations
5322 __Pyx_RefNannySetupContext("_bbIou", 0);
5323 __pyx_pybuffer_dt.pybuffer.buf = NULL;
5324 __pyx_pybuffer_dt.refcount = 0;
5325 __pyx_pybuffernd_dt.data = NULL;
5326 __pyx_pybuffernd_dt.rcbuffer = &__pyx_pybuffer_dt;
5327 __pyx_pybuffer_gt.pybuffer.buf = NULL;
5328 __pyx_pybuffer_gt.refcount = 0;
5329 __pyx_pybuffernd_gt.data = NULL;
5330 __pyx_pybuffernd_gt.rcbuffer = &__pyx_pybuffer_gt;
5331 __pyx_pybuffer_iscrowd.pybuffer.buf = NULL;
5332 __pyx_pybuffer_iscrowd.refcount = 0;
5333 __pyx_pybuffernd_iscrowd.data = NULL;
5334 __pyx_pybuffernd_iscrowd.rcbuffer = &__pyx_pybuffer_iscrowd;
5335 __pyx_pybuffer__iou.pybuffer.buf = NULL;
5336 __pyx_pybuffer__iou.refcount = 0;
5337 __pyx_pybuffernd__iou.data = NULL;
5338 __pyx_pybuffernd__iou.rcbuffer = &__pyx_pybuffer__iou;
5340 __Pyx_BufFmt_StackElem __pyx_stack[1];
5341 if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_dt.rcbuffer->pybuffer, (PyObject*)__pyx_v_dt, &__Pyx_TypeInfo_nn___pyx_t_5numpy_double_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 199, __pyx_L1_error)
5343 __pyx_pybuffernd_dt.diminfo[0].strides = __pyx_pybuffernd_dt.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_dt.diminfo[0].shape = __pyx_pybuffernd_dt.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_dt.diminfo[1].strides = __pyx_pybuffernd_dt.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_dt.diminfo[1].shape = __pyx_pybuffernd_dt.rcbuffer->pybuffer.shape[1];
5345 __Pyx_BufFmt_StackElem __pyx_stack[1];
5346 if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_gt.rcbuffer->pybuffer, (PyObject*)__pyx_v_gt, &__Pyx_TypeInfo_nn___pyx_t_5numpy_double_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 199, __pyx_L1_error)
5348 __pyx_pybuffernd_gt.diminfo[0].strides = __pyx_pybuffernd_gt.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_gt.diminfo[0].shape = __pyx_pybuffernd_gt.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_gt.diminfo[1].strides = __pyx_pybuffernd_gt.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_gt.diminfo[1].shape = __pyx_pybuffernd_gt.rcbuffer->pybuffer.shape[1];
5350 __Pyx_BufFmt_StackElem __pyx_stack[1];
5351 if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_iscrowd.rcbuffer->pybuffer, (PyObject*)__pyx_v_iscrowd, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint8_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 199, __pyx_L1_error)
5353 __pyx_pybuffernd_iscrowd.diminfo[0].strides = __pyx_pybuffernd_iscrowd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_iscrowd.diminfo[0].shape = __pyx_pybuffernd_iscrowd.rcbuffer->pybuffer.shape[0];
5355 __Pyx_BufFmt_StackElem __pyx_stack[1];
5356 if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd__iou.rcbuffer->pybuffer, (PyObject*)__pyx_v__iou, &__Pyx_TypeInfo_nn___pyx_t_5numpy_double_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) __PYX_ERR(0, 199, __pyx_L1_error)
5358 __pyx_pybuffernd__iou.diminfo[0].strides = __pyx_pybuffernd__iou.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd__iou.diminfo[0].shape = __pyx_pybuffernd__iou.rcbuffer->pybuffer.shape[0];
5360 /* "pycocotools/_mask.pyx":200
5361 * rleIou( <RLE*> dt._R, <RLE*> gt._R, m, n, <byte*> iscrowd.data, <double*> _iou.data )
5362 * def _bbIou(np.ndarray[np.double_t, ndim=2] dt, np.ndarray[np.double_t, ndim=2] gt, np.ndarray[np.uint8_t, ndim=1] iscrowd, siz m, siz n, np.ndarray[np.double_t, ndim=1] _iou):
5363 * bbIou( <BB> dt.data, <BB> gt.data, m, n, <byte*> iscrowd.data, <double*>_iou.data ) # <<<<<<<<<<<<<<
5367 bbIou(((BB)__pyx_v_dt->data), ((BB)__pyx_v_gt->data), __pyx_v_m, __pyx_v_n, ((byte *)__pyx_v_iscrowd->data), ((double *)__pyx_v__iou->data));
5369 /* "pycocotools/_mask.pyx":199
5370 * def _rleIou(RLEs dt, RLEs gt, np.ndarray[np.uint8_t, ndim=1] iscrowd, siz m, siz n, np.ndarray[np.double_t, ndim=1] _iou):
5371 * rleIou( <RLE*> dt._R, <RLE*> gt._R, m, n, <byte*> iscrowd.data, <double*> _iou.data )
5372 * def _bbIou(np.ndarray[np.double_t, ndim=2] dt, np.ndarray[np.double_t, ndim=2] gt, np.ndarray[np.uint8_t, ndim=1] iscrowd, siz m, siz n, np.ndarray[np.double_t, ndim=1] _iou): # <<<<<<<<<<<<<<
5373 * bbIou( <BB> dt.data, <BB> gt.data, m, n, <byte*> iscrowd.data, <double*>_iou.data )
5377 /* function exit code */
5378 __pyx_r = Py_None; __Pyx_INCREF(Py_None);
5381 { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
5382 __Pyx_PyThreadState_declare
5383 __Pyx_PyThreadState_assign
5384 __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
5385 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd__iou.rcbuffer->pybuffer);
5386 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dt.rcbuffer->pybuffer);
5387 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_gt.rcbuffer->pybuffer);
5388 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_iscrowd.rcbuffer->pybuffer);
5389 __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
5390 __Pyx_AddTraceback("pycocotools._mask.iou._bbIou", __pyx_clineno, __pyx_lineno, __pyx_filename);
5394 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd__iou.rcbuffer->pybuffer);
5395 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_dt.rcbuffer->pybuffer);
5396 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_gt.rcbuffer->pybuffer);
5397 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_iscrowd.rcbuffer->pybuffer);
5399 __Pyx_XGIVEREF(__pyx_r);
5400 __Pyx_RefNannyFinishContext();
5404 /* "pycocotools/_mask.pyx":201
5405 * def _bbIou(np.ndarray[np.double_t, ndim=2] dt, np.ndarray[np.double_t, ndim=2] gt, np.ndarray[np.uint8_t, ndim=1] iscrowd, siz m, siz n, np.ndarray[np.double_t, ndim=1] _iou):
5406 * bbIou( <BB> dt.data, <BB> gt.data, m, n, <byte*> iscrowd.data, <double*>_iou.data )
5407 * def _len(obj): # <<<<<<<<<<<<<<
5409 * if type(obj) == RLEs:
5412 /* Python wrapper */
5413 static PyObject *__pyx_pw_11pycocotools_5_mask_3iou_7_len(PyObject *__pyx_self, PyObject *__pyx_v_obj); /*proto*/
5414 static PyMethodDef __pyx_mdef_11pycocotools_5_mask_3iou_7_len = {"_len", (PyCFunction)__pyx_pw_11pycocotools_5_mask_3iou_7_len, METH_O, 0};
5415 static PyObject *__pyx_pw_11pycocotools_5_mask_3iou_7_len(PyObject *__pyx_self, PyObject *__pyx_v_obj) {
5416 PyObject *__pyx_r = 0;
5417 __Pyx_RefNannyDeclarations
5418 __Pyx_RefNannySetupContext("_len (wrapper)", 0);
5419 __pyx_r = __pyx_pf_11pycocotools_5_mask_3iou_6_len(__pyx_self, ((PyObject *)__pyx_v_obj));
5421 /* function exit code */
5422 __Pyx_RefNannyFinishContext();
5426 static PyObject *__pyx_pf_11pycocotools_5_mask_3iou_6_len(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_obj) {
5428 PyObject *__pyx_r = NULL;
5429 __Pyx_RefNannyDeclarations
5430 PyObject *__pyx_t_1 = NULL;
5433 Py_ssize_t __pyx_t_4;
5434 PyObject *__pyx_t_5 = NULL;
5435 __Pyx_RefNannySetupContext("_len", 0);
5437 /* "pycocotools/_mask.pyx":202
5438 * bbIou( <BB> dt.data, <BB> gt.data, m, n, <byte*> iscrowd.data, <double*>_iou.data )
5440 * cdef siz N = 0 # <<<<<<<<<<<<<<
5441 * if type(obj) == RLEs:
5446 /* "pycocotools/_mask.pyx":203
5449 * if type(obj) == RLEs: # <<<<<<<<<<<<<<
5453 __pyx_t_1 = PyObject_RichCompare(((PyObject *)Py_TYPE(__pyx_v_obj)), ((PyObject *)__pyx_ptype_11pycocotools_5_mask_RLEs), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 203, __pyx_L1_error)
5454 __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 203, __pyx_L1_error)
5455 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5458 /* "pycocotools/_mask.pyx":204
5460 * if type(obj) == RLEs:
5461 * N = obj.n # <<<<<<<<<<<<<<
5465 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_obj, __pyx_n_s_n); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 204, __pyx_L1_error)
5466 __Pyx_GOTREF(__pyx_t_1);
5467 __pyx_t_3 = __Pyx_PyInt_As_siz(__pyx_t_1); if (unlikely((__pyx_t_3 == ((siz)-1)) && PyErr_Occurred())) __PYX_ERR(0, 204, __pyx_L1_error)
5468 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5469 __pyx_v_N = __pyx_t_3;
5471 /* "pycocotools/_mask.pyx":203
5474 * if type(obj) == RLEs: # <<<<<<<<<<<<<<
5481 /* "pycocotools/_mask.pyx":205
5482 * if type(obj) == RLEs:
5484 * elif len(obj)==0: # <<<<<<<<<<<<<<
5486 * elif type(obj) == np.ndarray:
5488 __pyx_t_4 = PyObject_Length(__pyx_v_obj); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(0, 205, __pyx_L1_error)
5489 __pyx_t_2 = ((__pyx_t_4 == 0) != 0);
5494 /* "pycocotools/_mask.pyx":207
5497 * elif type(obj) == np.ndarray: # <<<<<<<<<<<<<<
5501 __pyx_t_1 = PyObject_RichCompare(((PyObject *)Py_TYPE(__pyx_v_obj)), ((PyObject *)__pyx_ptype_5numpy_ndarray), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 207, __pyx_L1_error)
5502 __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 207, __pyx_L1_error)
5503 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5506 /* "pycocotools/_mask.pyx":208
5508 * elif type(obj) == np.ndarray:
5509 * N = obj.shape[0] # <<<<<<<<<<<<<<
5511 * # convert iscrowd to numpy array
5513 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_obj, __pyx_n_s_shape); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 208, __pyx_L1_error)
5514 __Pyx_GOTREF(__pyx_t_1);
5515 __pyx_t_5 = __Pyx_GetItemInt(__pyx_t_1, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 208, __pyx_L1_error)
5516 __Pyx_GOTREF(__pyx_t_5);
5517 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5518 __pyx_t_3 = __Pyx_PyInt_As_siz(__pyx_t_5); if (unlikely((__pyx_t_3 == ((siz)-1)) && PyErr_Occurred())) __PYX_ERR(0, 208, __pyx_L1_error)
5519 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
5520 __pyx_v_N = __pyx_t_3;
5522 /* "pycocotools/_mask.pyx":207
5525 * elif type(obj) == np.ndarray: # <<<<<<<<<<<<<<
5532 /* "pycocotools/_mask.pyx":209
5533 * elif type(obj) == np.ndarray:
5535 * return N # <<<<<<<<<<<<<<
5536 * # convert iscrowd to numpy array
5537 * cdef np.ndarray[np.uint8_t, ndim=1] iscrowd = np.array(pyiscrowd, dtype=np.uint8)
5539 __Pyx_XDECREF(__pyx_r);
5540 __pyx_t_5 = __Pyx_PyInt_From_siz(__pyx_v_N); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 209, __pyx_L1_error)
5541 __Pyx_GOTREF(__pyx_t_5);
5542 __pyx_r = __pyx_t_5;
5546 /* "pycocotools/_mask.pyx":201
5547 * def _bbIou(np.ndarray[np.double_t, ndim=2] dt, np.ndarray[np.double_t, ndim=2] gt, np.ndarray[np.uint8_t, ndim=1] iscrowd, siz m, siz n, np.ndarray[np.double_t, ndim=1] _iou):
5548 * bbIou( <BB> dt.data, <BB> gt.data, m, n, <byte*> iscrowd.data, <double*>_iou.data )
5549 * def _len(obj): # <<<<<<<<<<<<<<
5551 * if type(obj) == RLEs:
5554 /* function exit code */
5556 __Pyx_XDECREF(__pyx_t_1);
5557 __Pyx_XDECREF(__pyx_t_5);
5558 __Pyx_AddTraceback("pycocotools._mask.iou._len", __pyx_clineno, __pyx_lineno, __pyx_filename);
5561 __Pyx_XGIVEREF(__pyx_r);
5562 __Pyx_RefNannyFinishContext();
5566 /* "pycocotools/_mask.pyx":171
5568 * # iou computation. support function overload (RLEs-RLEs and bbox-bbox).
5569 * def iou( dt, gt, pyiscrowd ): # <<<<<<<<<<<<<<
5570 * def _preproc(objs):
5571 * if len(objs) == 0:
5574 static PyObject *__pyx_pf_11pycocotools_5_mask_12iou(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_dt, PyObject *__pyx_v_gt, PyObject *__pyx_v_pyiscrowd) {
5575 PyObject *__pyx_v__preproc = 0;
5576 PyObject *__pyx_v__rleIou = 0;
5577 PyObject *__pyx_v__bbIou = 0;
5578 PyObject *__pyx_v__len = 0;
5579 PyArrayObject *__pyx_v_iscrowd = 0;
5582 double *__pyx_v__iou;
5583 npy_intp __pyx_v_shape[1];
5584 PyObject *__pyx_v__iouFun = NULL;
5585 PyObject *__pyx_v_iou = NULL;
5586 __Pyx_LocalBuf_ND __pyx_pybuffernd_iscrowd;
5587 __Pyx_Buffer __pyx_pybuffer_iscrowd;
5588 PyObject *__pyx_r = NULL;
5589 __Pyx_RefNannyDeclarations
5590 PyObject *__pyx_t_1 = NULL;
5591 PyObject *__pyx_t_2 = NULL;
5592 PyObject *__pyx_t_3 = NULL;
5593 PyObject *__pyx_t_4 = NULL;
5594 PyObject *__pyx_t_5 = NULL;
5595 PyArrayObject *__pyx_t_6 = NULL;
5600 PyObject *__pyx_t_11 = NULL;
5601 __Pyx_RefNannySetupContext("iou", 0);
5602 __Pyx_INCREF(__pyx_v_dt);
5603 __Pyx_INCREF(__pyx_v_gt);
5604 __pyx_pybuffer_iscrowd.pybuffer.buf = NULL;
5605 __pyx_pybuffer_iscrowd.refcount = 0;
5606 __pyx_pybuffernd_iscrowd.data = NULL;
5607 __pyx_pybuffernd_iscrowd.rcbuffer = &__pyx_pybuffer_iscrowd;
5609 /* "pycocotools/_mask.pyx":172
5610 * # iou computation. support function overload (RLEs-RLEs and bbox-bbox).
5611 * def iou( dt, gt, pyiscrowd ):
5612 * def _preproc(objs): # <<<<<<<<<<<<<<
5613 * if len(objs) == 0:
5616 __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_11pycocotools_5_mask_3iou_1_preproc, 0, __pyx_n_s_iou_locals__preproc, NULL, __pyx_n_s_pycocotools__mask, __pyx_d, ((PyObject *)__pyx_codeobj__8)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 172, __pyx_L1_error)
5617 __Pyx_GOTREF(__pyx_t_1);
5618 __pyx_v__preproc = __pyx_t_1;
5621 /* "pycocotools/_mask.pyx":197
5622 * raise Exception('unrecognized type. The following type: RLEs (rle), np.ndarray (box), and list (box) are supported.')
5624 * def _rleIou(RLEs dt, RLEs gt, np.ndarray[np.uint8_t, ndim=1] iscrowd, siz m, siz n, np.ndarray[np.double_t, ndim=1] _iou): # <<<<<<<<<<<<<<
5625 * rleIou( <RLE*> dt._R, <RLE*> gt._R, m, n, <byte*> iscrowd.data, <double*> _iou.data )
5626 * def _bbIou(np.ndarray[np.double_t, ndim=2] dt, np.ndarray[np.double_t, ndim=2] gt, np.ndarray[np.uint8_t, ndim=1] iscrowd, siz m, siz n, np.ndarray[np.double_t, ndim=1] _iou):
5628 __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_11pycocotools_5_mask_3iou_3_rleIou, 0, __pyx_n_s_iou_locals__rleIou, NULL, __pyx_n_s_pycocotools__mask, __pyx_d, ((PyObject *)__pyx_codeobj__10)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 197, __pyx_L1_error)
5629 __Pyx_GOTREF(__pyx_t_1);
5630 __pyx_v__rleIou = __pyx_t_1;
5633 /* "pycocotools/_mask.pyx":199
5634 * def _rleIou(RLEs dt, RLEs gt, np.ndarray[np.uint8_t, ndim=1] iscrowd, siz m, siz n, np.ndarray[np.double_t, ndim=1] _iou):
5635 * rleIou( <RLE*> dt._R, <RLE*> gt._R, m, n, <byte*> iscrowd.data, <double*> _iou.data )
5636 * def _bbIou(np.ndarray[np.double_t, ndim=2] dt, np.ndarray[np.double_t, ndim=2] gt, np.ndarray[np.uint8_t, ndim=1] iscrowd, siz m, siz n, np.ndarray[np.double_t, ndim=1] _iou): # <<<<<<<<<<<<<<
5637 * bbIou( <BB> dt.data, <BB> gt.data, m, n, <byte*> iscrowd.data, <double*>_iou.data )
5640 __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_11pycocotools_5_mask_3iou_5_bbIou, 0, __pyx_n_s_iou_locals__bbIou, NULL, __pyx_n_s_pycocotools__mask, __pyx_d, ((PyObject *)__pyx_codeobj__12)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 199, __pyx_L1_error)
5641 __Pyx_GOTREF(__pyx_t_1);
5642 __pyx_v__bbIou = __pyx_t_1;
5645 /* "pycocotools/_mask.pyx":201
5646 * def _bbIou(np.ndarray[np.double_t, ndim=2] dt, np.ndarray[np.double_t, ndim=2] gt, np.ndarray[np.uint8_t, ndim=1] iscrowd, siz m, siz n, np.ndarray[np.double_t, ndim=1] _iou):
5647 * bbIou( <BB> dt.data, <BB> gt.data, m, n, <byte*> iscrowd.data, <double*>_iou.data )
5648 * def _len(obj): # <<<<<<<<<<<<<<
5650 * if type(obj) == RLEs:
5652 __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_11pycocotools_5_mask_3iou_7_len, 0, __pyx_n_s_iou_locals__len, NULL, __pyx_n_s_pycocotools__mask, __pyx_d, ((PyObject *)__pyx_codeobj__14)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 201, __pyx_L1_error)
5653 __Pyx_GOTREF(__pyx_t_1);
5654 __pyx_v__len = __pyx_t_1;
5657 /* "pycocotools/_mask.pyx":211
5659 * # convert iscrowd to numpy array
5660 * cdef np.ndarray[np.uint8_t, ndim=1] iscrowd = np.array(pyiscrowd, dtype=np.uint8) # <<<<<<<<<<<<<<
5661 * # simple type checking
5664 __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 211, __pyx_L1_error)
5665 __Pyx_GOTREF(__pyx_t_1);
5666 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_array); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 211, __pyx_L1_error)
5667 __Pyx_GOTREF(__pyx_t_2);
5668 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5669 __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 211, __pyx_L1_error)
5670 __Pyx_GOTREF(__pyx_t_1);
5671 __Pyx_INCREF(__pyx_v_pyiscrowd);
5672 __Pyx_GIVEREF(__pyx_v_pyiscrowd);
5673 PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_pyiscrowd);
5674 __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 211, __pyx_L1_error)
5675 __Pyx_GOTREF(__pyx_t_3);
5676 __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 211, __pyx_L1_error)
5677 __Pyx_GOTREF(__pyx_t_4);
5678 __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_uint8); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 211, __pyx_L1_error)
5679 __Pyx_GOTREF(__pyx_t_5);
5680 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5681 if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_dtype, __pyx_t_5) < 0) __PYX_ERR(0, 211, __pyx_L1_error)
5682 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
5683 __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 211, __pyx_L1_error)
5684 __Pyx_GOTREF(__pyx_t_5);
5685 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5686 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5687 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5688 if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 211, __pyx_L1_error)
5689 __pyx_t_6 = ((PyArrayObject *)__pyx_t_5);
5691 __Pyx_BufFmt_StackElem __pyx_stack[1];
5692 if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_iscrowd.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint8_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
5693 __pyx_v_iscrowd = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_iscrowd.rcbuffer->pybuffer.buf = NULL;
5694 __PYX_ERR(0, 211, __pyx_L1_error)
5695 } else {__pyx_pybuffernd_iscrowd.diminfo[0].strides = __pyx_pybuffernd_iscrowd.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_iscrowd.diminfo[0].shape = __pyx_pybuffernd_iscrowd.rcbuffer->pybuffer.shape[0];
5699 __pyx_v_iscrowd = ((PyArrayObject *)__pyx_t_5);
5702 /* "pycocotools/_mask.pyx":214
5703 * # simple type checking
5705 * dt = _preproc(dt) # <<<<<<<<<<<<<<
5709 __pyx_t_5 = __pyx_pf_11pycocotools_5_mask_3iou__preproc(__pyx_v__preproc, __pyx_v_dt); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 214, __pyx_L1_error)
5710 __Pyx_GOTREF(__pyx_t_5);
5711 __Pyx_DECREF_SET(__pyx_v_dt, __pyx_t_5);
5714 /* "pycocotools/_mask.pyx":215
5717 * gt = _preproc(gt) # <<<<<<<<<<<<<<
5721 __pyx_t_5 = __pyx_pf_11pycocotools_5_mask_3iou__preproc(__pyx_v__preproc, __pyx_v_gt); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 215, __pyx_L1_error)
5722 __Pyx_GOTREF(__pyx_t_5);
5723 __Pyx_DECREF_SET(__pyx_v_gt, __pyx_t_5);
5726 /* "pycocotools/_mask.pyx":216
5729 * m = _len(dt) # <<<<<<<<<<<<<<
5731 * if m == 0 or n == 0:
5733 __pyx_t_5 = __pyx_pf_11pycocotools_5_mask_3iou_6_len(__pyx_v__len, __pyx_v_dt); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 216, __pyx_L1_error)
5734 __Pyx_GOTREF(__pyx_t_5);
5735 __pyx_t_7 = __Pyx_PyInt_As_siz(__pyx_t_5); if (unlikely((__pyx_t_7 == ((siz)-1)) && PyErr_Occurred())) __PYX_ERR(0, 216, __pyx_L1_error)
5736 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
5737 __pyx_v_m = __pyx_t_7;
5739 /* "pycocotools/_mask.pyx":217
5742 * n = _len(gt) # <<<<<<<<<<<<<<
5743 * if m == 0 or n == 0:
5746 __pyx_t_5 = __pyx_pf_11pycocotools_5_mask_3iou_6_len(__pyx_v__len, __pyx_v_gt); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 217, __pyx_L1_error)
5747 __Pyx_GOTREF(__pyx_t_5);
5748 __pyx_t_7 = __Pyx_PyInt_As_siz(__pyx_t_5); if (unlikely((__pyx_t_7 == ((siz)-1)) && PyErr_Occurred())) __PYX_ERR(0, 217, __pyx_L1_error)
5749 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
5750 __pyx_v_n = __pyx_t_7;
5752 /* "pycocotools/_mask.pyx":218
5755 * if m == 0 or n == 0: # <<<<<<<<<<<<<<
5757 * if not type(dt) == type(gt):
5759 __pyx_t_9 = ((__pyx_v_m == 0) != 0);
5762 __pyx_t_8 = __pyx_t_9;
5763 goto __pyx_L4_bool_binop_done;
5765 __pyx_t_9 = ((__pyx_v_n == 0) != 0);
5766 __pyx_t_8 = __pyx_t_9;
5767 __pyx_L4_bool_binop_done:;
5770 /* "pycocotools/_mask.pyx":219
5772 * if m == 0 or n == 0:
5773 * return [] # <<<<<<<<<<<<<<
5774 * if not type(dt) == type(gt):
5775 * raise Exception('The dt and gt should have the same data type, either RLEs, list or np.ndarray')
5777 __Pyx_XDECREF(__pyx_r);
5778 __pyx_t_5 = PyList_New(0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 219, __pyx_L1_error)
5779 __Pyx_GOTREF(__pyx_t_5);
5780 __pyx_r = __pyx_t_5;
5784 /* "pycocotools/_mask.pyx":218
5787 * if m == 0 or n == 0: # <<<<<<<<<<<<<<
5789 * if not type(dt) == type(gt):
5793 /* "pycocotools/_mask.pyx":220
5794 * if m == 0 or n == 0:
5796 * if not type(dt) == type(gt): # <<<<<<<<<<<<<<
5797 * raise Exception('The dt and gt should have the same data type, either RLEs, list or np.ndarray')
5800 __pyx_t_5 = PyObject_RichCompare(((PyObject *)Py_TYPE(__pyx_v_dt)), ((PyObject *)Py_TYPE(__pyx_v_gt)), Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 220, __pyx_L1_error)
5801 __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 220, __pyx_L1_error)
5802 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
5803 __pyx_t_9 = ((!__pyx_t_8) != 0);
5806 /* "pycocotools/_mask.pyx":221
5808 * if not type(dt) == type(gt):
5809 * raise Exception('The dt and gt should have the same data type, either RLEs, list or np.ndarray') # <<<<<<<<<<<<<<
5811 * # define local variables
5813 __pyx_t_5 = __Pyx_PyObject_Call(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])), __pyx_tuple__15, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 221, __pyx_L1_error)
5814 __Pyx_GOTREF(__pyx_t_5);
5815 __Pyx_Raise(__pyx_t_5, 0, 0, 0);
5816 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
5817 __PYX_ERR(0, 221, __pyx_L1_error)
5819 /* "pycocotools/_mask.pyx":220
5820 * if m == 0 or n == 0:
5822 * if not type(dt) == type(gt): # <<<<<<<<<<<<<<
5823 * raise Exception('The dt and gt should have the same data type, either RLEs, list or np.ndarray')
5828 /* "pycocotools/_mask.pyx":224
5830 * # define local variables
5831 * cdef double* _iou = <double*> 0 # <<<<<<<<<<<<<<
5832 * cdef np.npy_intp shape[1]
5833 * # check type and assign iou function
5835 __pyx_v__iou = ((double *)0);
5837 /* "pycocotools/_mask.pyx":227
5838 * cdef np.npy_intp shape[1]
5839 * # check type and assign iou function
5840 * if type(dt) == RLEs: # <<<<<<<<<<<<<<
5842 * elif type(dt) == np.ndarray:
5844 __pyx_t_5 = PyObject_RichCompare(((PyObject *)Py_TYPE(__pyx_v_dt)), ((PyObject *)__pyx_ptype_11pycocotools_5_mask_RLEs), Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 227, __pyx_L1_error)
5845 __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 227, __pyx_L1_error)
5846 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
5849 /* "pycocotools/_mask.pyx":228
5850 * # check type and assign iou function
5851 * if type(dt) == RLEs:
5852 * _iouFun = _rleIou # <<<<<<<<<<<<<<
5853 * elif type(dt) == np.ndarray:
5856 __Pyx_INCREF(__pyx_v__rleIou);
5857 __pyx_v__iouFun = __pyx_v__rleIou;
5859 /* "pycocotools/_mask.pyx":227
5860 * cdef np.npy_intp shape[1]
5861 * # check type and assign iou function
5862 * if type(dt) == RLEs: # <<<<<<<<<<<<<<
5864 * elif type(dt) == np.ndarray:
5869 /* "pycocotools/_mask.pyx":229
5870 * if type(dt) == RLEs:
5872 * elif type(dt) == np.ndarray: # <<<<<<<<<<<<<<
5876 __pyx_t_5 = PyObject_RichCompare(((PyObject *)Py_TYPE(__pyx_v_dt)), ((PyObject *)__pyx_ptype_5numpy_ndarray), Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 229, __pyx_L1_error)
5877 __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 229, __pyx_L1_error)
5878 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
5881 /* "pycocotools/_mask.pyx":230
5883 * elif type(dt) == np.ndarray:
5884 * _iouFun = _bbIou # <<<<<<<<<<<<<<
5886 * raise Exception('input data type not allowed.')
5888 __Pyx_INCREF(__pyx_v__bbIou);
5889 __pyx_v__iouFun = __pyx_v__bbIou;
5891 /* "pycocotools/_mask.pyx":229
5892 * if type(dt) == RLEs:
5894 * elif type(dt) == np.ndarray: # <<<<<<<<<<<<<<
5901 /* "pycocotools/_mask.pyx":232
5904 * raise Exception('input data type not allowed.') # <<<<<<<<<<<<<<
5905 * _iou = <double*> malloc(m*n* sizeof(double))
5906 * iou = np.zeros((m*n, ), dtype=np.double)
5909 __pyx_t_5 = __Pyx_PyObject_Call(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])), __pyx_tuple__16, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 232, __pyx_L1_error)
5910 __Pyx_GOTREF(__pyx_t_5);
5911 __Pyx_Raise(__pyx_t_5, 0, 0, 0);
5912 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
5913 __PYX_ERR(0, 232, __pyx_L1_error)
5917 /* "pycocotools/_mask.pyx":233
5919 * raise Exception('input data type not allowed.')
5920 * _iou = <double*> malloc(m*n* sizeof(double)) # <<<<<<<<<<<<<<
5921 * iou = np.zeros((m*n, ), dtype=np.double)
5922 * shape[0] = <np.npy_intp> m*n
5924 __pyx_v__iou = ((double *)malloc(((__pyx_v_m * __pyx_v_n) * (sizeof(double)))));
5926 /* "pycocotools/_mask.pyx":234
5927 * raise Exception('input data type not allowed.')
5928 * _iou = <double*> malloc(m*n* sizeof(double))
5929 * iou = np.zeros((m*n, ), dtype=np.double) # <<<<<<<<<<<<<<
5930 * shape[0] = <np.npy_intp> m*n
5931 * iou = np.PyArray_SimpleNewFromData(1, shape, np.NPY_DOUBLE, _iou)
5933 __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 234, __pyx_L1_error)
5934 __Pyx_GOTREF(__pyx_t_5);
5935 __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 234, __pyx_L1_error)
5936 __Pyx_GOTREF(__pyx_t_3);
5937 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
5938 __pyx_t_5 = __Pyx_PyInt_From_siz((__pyx_v_m * __pyx_v_n)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 234, __pyx_L1_error)
5939 __Pyx_GOTREF(__pyx_t_5);
5940 __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 234, __pyx_L1_error)
5941 __Pyx_GOTREF(__pyx_t_1);
5942 __Pyx_GIVEREF(__pyx_t_5);
5943 PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_5);
5945 __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 234, __pyx_L1_error)
5946 __Pyx_GOTREF(__pyx_t_5);
5947 __Pyx_GIVEREF(__pyx_t_1);
5948 PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1);
5950 __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 234, __pyx_L1_error)
5951 __Pyx_GOTREF(__pyx_t_1);
5952 __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 234, __pyx_L1_error)
5953 __Pyx_GOTREF(__pyx_t_2);
5954 __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_double); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 234, __pyx_L1_error)
5955 __Pyx_GOTREF(__pyx_t_4);
5956 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
5957 if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_dtype, __pyx_t_4) < 0) __PYX_ERR(0, 234, __pyx_L1_error)
5958 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
5959 __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 234, __pyx_L1_error)
5960 __Pyx_GOTREF(__pyx_t_4);
5961 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
5962 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
5963 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
5964 __pyx_v_iou = __pyx_t_4;
5967 /* "pycocotools/_mask.pyx":235
5968 * _iou = <double*> malloc(m*n* sizeof(double))
5969 * iou = np.zeros((m*n, ), dtype=np.double)
5970 * shape[0] = <np.npy_intp> m*n # <<<<<<<<<<<<<<
5971 * iou = np.PyArray_SimpleNewFromData(1, shape, np.NPY_DOUBLE, _iou)
5972 * PyArray_ENABLEFLAGS(iou, np.NPY_OWNDATA)
5974 (__pyx_v_shape[0]) = (((npy_intp)__pyx_v_m) * __pyx_v_n);
5976 /* "pycocotools/_mask.pyx":236
5977 * iou = np.zeros((m*n, ), dtype=np.double)
5978 * shape[0] = <np.npy_intp> m*n
5979 * iou = np.PyArray_SimpleNewFromData(1, shape, np.NPY_DOUBLE, _iou) # <<<<<<<<<<<<<<
5980 * PyArray_ENABLEFLAGS(iou, np.NPY_OWNDATA)
5981 * _iouFun(dt, gt, iscrowd, m, n, iou)
5983 __pyx_t_4 = PyArray_SimpleNewFromData(1, __pyx_v_shape, NPY_DOUBLE, __pyx_v__iou); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 236, __pyx_L1_error)
5984 __Pyx_GOTREF(__pyx_t_4);
5985 __Pyx_DECREF_SET(__pyx_v_iou, __pyx_t_4);
5988 /* "pycocotools/_mask.pyx":237
5989 * shape[0] = <np.npy_intp> m*n
5990 * iou = np.PyArray_SimpleNewFromData(1, shape, np.NPY_DOUBLE, _iou)
5991 * PyArray_ENABLEFLAGS(iou, np.NPY_OWNDATA) # <<<<<<<<<<<<<<
5992 * _iouFun(dt, gt, iscrowd, m, n, iou)
5993 * return iou.reshape((m,n), order='F')
5995 if (!(likely(((__pyx_v_iou) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_iou, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 237, __pyx_L1_error)
5996 PyArray_ENABLEFLAGS(((PyArrayObject *)__pyx_v_iou), NPY_OWNDATA);
5998 /* "pycocotools/_mask.pyx":238
5999 * iou = np.PyArray_SimpleNewFromData(1, shape, np.NPY_DOUBLE, _iou)
6000 * PyArray_ENABLEFLAGS(iou, np.NPY_OWNDATA)
6001 * _iouFun(dt, gt, iscrowd, m, n, iou) # <<<<<<<<<<<<<<
6002 * return iou.reshape((m,n), order='F')
6005 __pyx_t_1 = __Pyx_PyInt_From_siz(__pyx_v_m); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 238, __pyx_L1_error)
6006 __Pyx_GOTREF(__pyx_t_1);
6007 __pyx_t_5 = __Pyx_PyInt_From_siz(__pyx_v_n); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 238, __pyx_L1_error)
6008 __Pyx_GOTREF(__pyx_t_5);
6009 __Pyx_INCREF(__pyx_v__iouFun);
6010 __pyx_t_3 = __pyx_v__iouFun; __pyx_t_2 = NULL;
6012 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
6013 __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3);
6014 if (likely(__pyx_t_2)) {
6015 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
6016 __Pyx_INCREF(__pyx_t_2);
6017 __Pyx_INCREF(function);
6018 __Pyx_DECREF_SET(__pyx_t_3, function);
6022 #if CYTHON_FAST_PYCALL
6023 if (PyFunction_Check(__pyx_t_3)) {
6024 PyObject *__pyx_temp[7] = {__pyx_t_2, __pyx_v_dt, __pyx_v_gt, ((PyObject *)__pyx_v_iscrowd), __pyx_t_1, __pyx_t_5, __pyx_v_iou};
6025 __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_10, 6+__pyx_t_10); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 238, __pyx_L1_error)
6026 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
6027 __Pyx_GOTREF(__pyx_t_4);
6028 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6029 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
6032 #if CYTHON_FAST_PYCCALL
6033 if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
6034 PyObject *__pyx_temp[7] = {__pyx_t_2, __pyx_v_dt, __pyx_v_gt, ((PyObject *)__pyx_v_iscrowd), __pyx_t_1, __pyx_t_5, __pyx_v_iou};
6035 __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_10, 6+__pyx_t_10); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 238, __pyx_L1_error)
6036 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
6037 __Pyx_GOTREF(__pyx_t_4);
6038 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6039 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
6043 __pyx_t_11 = PyTuple_New(6+__pyx_t_10); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 238, __pyx_L1_error)
6044 __Pyx_GOTREF(__pyx_t_11);
6046 __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_2); __pyx_t_2 = NULL;
6048 __Pyx_INCREF(__pyx_v_dt);
6049 __Pyx_GIVEREF(__pyx_v_dt);
6050 PyTuple_SET_ITEM(__pyx_t_11, 0+__pyx_t_10, __pyx_v_dt);
6051 __Pyx_INCREF(__pyx_v_gt);
6052 __Pyx_GIVEREF(__pyx_v_gt);
6053 PyTuple_SET_ITEM(__pyx_t_11, 1+__pyx_t_10, __pyx_v_gt);
6054 __Pyx_INCREF(((PyObject *)__pyx_v_iscrowd));
6055 __Pyx_GIVEREF(((PyObject *)__pyx_v_iscrowd));
6056 PyTuple_SET_ITEM(__pyx_t_11, 2+__pyx_t_10, ((PyObject *)__pyx_v_iscrowd));
6057 __Pyx_GIVEREF(__pyx_t_1);
6058 PyTuple_SET_ITEM(__pyx_t_11, 3+__pyx_t_10, __pyx_t_1);
6059 __Pyx_GIVEREF(__pyx_t_5);
6060 PyTuple_SET_ITEM(__pyx_t_11, 4+__pyx_t_10, __pyx_t_5);
6061 __Pyx_INCREF(__pyx_v_iou);
6062 __Pyx_GIVEREF(__pyx_v_iou);
6063 PyTuple_SET_ITEM(__pyx_t_11, 5+__pyx_t_10, __pyx_v_iou);
6066 __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_11, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 238, __pyx_L1_error)
6067 __Pyx_GOTREF(__pyx_t_4);
6068 __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
6070 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6071 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
6073 /* "pycocotools/_mask.pyx":239
6074 * PyArray_ENABLEFLAGS(iou, np.NPY_OWNDATA)
6075 * _iouFun(dt, gt, iscrowd, m, n, iou)
6076 * return iou.reshape((m,n), order='F') # <<<<<<<<<<<<<<
6078 * def toBbox( rleObjs ):
6080 __Pyx_XDECREF(__pyx_r);
6081 __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_iou, __pyx_n_s_reshape); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 239, __pyx_L1_error)
6082 __Pyx_GOTREF(__pyx_t_4);
6083 __pyx_t_3 = __Pyx_PyInt_From_siz(__pyx_v_m); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 239, __pyx_L1_error)
6084 __Pyx_GOTREF(__pyx_t_3);
6085 __pyx_t_11 = __Pyx_PyInt_From_siz(__pyx_v_n); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 239, __pyx_L1_error)
6086 __Pyx_GOTREF(__pyx_t_11);
6087 __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 239, __pyx_L1_error)
6088 __Pyx_GOTREF(__pyx_t_5);
6089 __Pyx_GIVEREF(__pyx_t_3);
6090 PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3);
6091 __Pyx_GIVEREF(__pyx_t_11);
6092 PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_11);
6095 __pyx_t_11 = PyTuple_New(1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 239, __pyx_L1_error)
6096 __Pyx_GOTREF(__pyx_t_11);
6097 __Pyx_GIVEREF(__pyx_t_5);
6098 PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_5);
6100 __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 239, __pyx_L1_error)
6101 __Pyx_GOTREF(__pyx_t_5);
6102 if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_order, __pyx_n_s_F) < 0) __PYX_ERR(0, 239, __pyx_L1_error)
6103 __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_11, __pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 239, __pyx_L1_error)
6104 __Pyx_GOTREF(__pyx_t_3);
6105 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
6106 __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
6107 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
6108 __pyx_r = __pyx_t_3;
6112 /* "pycocotools/_mask.pyx":171
6114 * # iou computation. support function overload (RLEs-RLEs and bbox-bbox).
6115 * def iou( dt, gt, pyiscrowd ): # <<<<<<<<<<<<<<
6116 * def _preproc(objs):
6117 * if len(objs) == 0:
6120 /* function exit code */
6122 __Pyx_XDECREF(__pyx_t_1);
6123 __Pyx_XDECREF(__pyx_t_2);
6124 __Pyx_XDECREF(__pyx_t_3);
6125 __Pyx_XDECREF(__pyx_t_4);
6126 __Pyx_XDECREF(__pyx_t_5);
6127 __Pyx_XDECREF(__pyx_t_11);
6128 { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
6129 __Pyx_PyThreadState_declare
6130 __Pyx_PyThreadState_assign
6131 __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
6132 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_iscrowd.rcbuffer->pybuffer);
6133 __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
6134 __Pyx_AddTraceback("pycocotools._mask.iou", __pyx_clineno, __pyx_lineno, __pyx_filename);
6138 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_iscrowd.rcbuffer->pybuffer);
6140 __Pyx_XDECREF(__pyx_v__preproc);
6141 __Pyx_XDECREF(__pyx_v__rleIou);
6142 __Pyx_XDECREF(__pyx_v__bbIou);
6143 __Pyx_XDECREF(__pyx_v__len);
6144 __Pyx_XDECREF((PyObject *)__pyx_v_iscrowd);
6145 __Pyx_XDECREF(__pyx_v__iouFun);
6146 __Pyx_XDECREF(__pyx_v_iou);
6147 __Pyx_XDECREF(__pyx_v_dt);
6148 __Pyx_XDECREF(__pyx_v_gt);
6149 __Pyx_XGIVEREF(__pyx_r);
6150 __Pyx_RefNannyFinishContext();
6154 /* "pycocotools/_mask.pyx":241
6155 * return iou.reshape((m,n), order='F')
6157 * def toBbox( rleObjs ): # <<<<<<<<<<<<<<
6158 * cdef RLEs Rs = _frString(rleObjs)
6162 /* Python wrapper */
6163 static PyObject *__pyx_pw_11pycocotools_5_mask_15toBbox(PyObject *__pyx_self, PyObject *__pyx_v_rleObjs); /*proto*/
6164 static PyMethodDef __pyx_mdef_11pycocotools_5_mask_15toBbox = {"toBbox", (PyCFunction)__pyx_pw_11pycocotools_5_mask_15toBbox, METH_O, 0};
6165 static PyObject *__pyx_pw_11pycocotools_5_mask_15toBbox(PyObject *__pyx_self, PyObject *__pyx_v_rleObjs) {
6166 PyObject *__pyx_r = 0;
6167 __Pyx_RefNannyDeclarations
6168 __Pyx_RefNannySetupContext("toBbox (wrapper)", 0);
6169 __pyx_r = __pyx_pf_11pycocotools_5_mask_14toBbox(__pyx_self, ((PyObject *)__pyx_v_rleObjs));
6171 /* function exit code */
6172 __Pyx_RefNannyFinishContext();
6176 static PyObject *__pyx_pf_11pycocotools_5_mask_14toBbox(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_rleObjs) {
6177 struct __pyx_obj_11pycocotools_5_mask_RLEs *__pyx_v_Rs = 0;
6180 npy_intp __pyx_v_shape[1];
6181 PyObject *__pyx_v_bb = NULL;
6182 PyObject *__pyx_r = NULL;
6183 __Pyx_RefNannyDeclarations
6184 PyObject *__pyx_t_1 = NULL;
6185 PyObject *__pyx_t_2 = NULL;
6186 PyObject *__pyx_t_3 = NULL;
6187 PyObject *__pyx_t_4 = NULL;
6189 PyObject *__pyx_t_6 = NULL;
6190 __Pyx_RefNannySetupContext("toBbox", 0);
6192 /* "pycocotools/_mask.pyx":242
6194 * def toBbox( rleObjs ):
6195 * cdef RLEs Rs = _frString(rleObjs) # <<<<<<<<<<<<<<
6197 * cdef BB _bb = <BB> malloc(4*n* sizeof(double))
6199 __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_frString); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 242, __pyx_L1_error)
6200 __Pyx_GOTREF(__pyx_t_2);
6202 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
6203 __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
6204 if (likely(__pyx_t_3)) {
6205 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
6206 __Pyx_INCREF(__pyx_t_3);
6207 __Pyx_INCREF(function);
6208 __Pyx_DECREF_SET(__pyx_t_2, function);
6212 __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_rleObjs); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 242, __pyx_L1_error)
6213 __Pyx_GOTREF(__pyx_t_1);
6215 #if CYTHON_FAST_PYCALL
6216 if (PyFunction_Check(__pyx_t_2)) {
6217 PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_v_rleObjs};
6218 __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 242, __pyx_L1_error)
6219 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
6220 __Pyx_GOTREF(__pyx_t_1);
6223 #if CYTHON_FAST_PYCCALL
6224 if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
6225 PyObject *__pyx_temp[2] = {__pyx_t_3, __pyx_v_rleObjs};
6226 __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 242, __pyx_L1_error)
6227 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
6228 __Pyx_GOTREF(__pyx_t_1);
6232 __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 242, __pyx_L1_error)
6233 __Pyx_GOTREF(__pyx_t_4);
6234 __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __pyx_t_3 = NULL;
6235 __Pyx_INCREF(__pyx_v_rleObjs);
6236 __Pyx_GIVEREF(__pyx_v_rleObjs);
6237 PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_rleObjs);
6238 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 242, __pyx_L1_error)
6239 __Pyx_GOTREF(__pyx_t_1);
6240 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
6243 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6244 if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_11pycocotools_5_mask_RLEs))))) __PYX_ERR(0, 242, __pyx_L1_error)
6245 __pyx_v_Rs = ((struct __pyx_obj_11pycocotools_5_mask_RLEs *)__pyx_t_1);
6248 /* "pycocotools/_mask.pyx":243
6249 * def toBbox( rleObjs ):
6250 * cdef RLEs Rs = _frString(rleObjs)
6251 * cdef siz n = Rs.n # <<<<<<<<<<<<<<
6252 * cdef BB _bb = <BB> malloc(4*n* sizeof(double))
6253 * rleToBbox( <const RLE*> Rs._R, _bb, n )
6255 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_Rs), __pyx_n_s_n); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 243, __pyx_L1_error)
6256 __Pyx_GOTREF(__pyx_t_1);
6257 __pyx_t_5 = __Pyx_PyInt_As_siz(__pyx_t_1); if (unlikely((__pyx_t_5 == ((siz)-1)) && PyErr_Occurred())) __PYX_ERR(0, 243, __pyx_L1_error)
6258 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6259 __pyx_v_n = __pyx_t_5;
6261 /* "pycocotools/_mask.pyx":244
6262 * cdef RLEs Rs = _frString(rleObjs)
6264 * cdef BB _bb = <BB> malloc(4*n* sizeof(double)) # <<<<<<<<<<<<<<
6265 * rleToBbox( <const RLE*> Rs._R, _bb, n )
6266 * cdef np.npy_intp shape[1]
6268 __pyx_v__bb = ((BB)malloc(((4 * __pyx_v_n) * (sizeof(double)))));
6270 /* "pycocotools/_mask.pyx":245
6272 * cdef BB _bb = <BB> malloc(4*n* sizeof(double))
6273 * rleToBbox( <const RLE*> Rs._R, _bb, n ) # <<<<<<<<<<<<<<
6274 * cdef np.npy_intp shape[1]
6275 * shape[0] = <np.npy_intp> 4*n
6277 rleToBbox(((RLE const *)__pyx_v_Rs->_R), __pyx_v__bb, __pyx_v_n);
6279 /* "pycocotools/_mask.pyx":247
6280 * rleToBbox( <const RLE*> Rs._R, _bb, n )
6281 * cdef np.npy_intp shape[1]
6282 * shape[0] = <np.npy_intp> 4*n # <<<<<<<<<<<<<<
6283 * bb = np.array((1,4*n), dtype=np.double)
6284 * bb = np.PyArray_SimpleNewFromData(1, shape, np.NPY_DOUBLE, _bb).reshape((n, 4))
6286 (__pyx_v_shape[0]) = (((npy_intp)4) * __pyx_v_n);
6288 /* "pycocotools/_mask.pyx":248
6289 * cdef np.npy_intp shape[1]
6290 * shape[0] = <np.npy_intp> 4*n
6291 * bb = np.array((1,4*n), dtype=np.double) # <<<<<<<<<<<<<<
6292 * bb = np.PyArray_SimpleNewFromData(1, shape, np.NPY_DOUBLE, _bb).reshape((n, 4))
6293 * PyArray_ENABLEFLAGS(bb, np.NPY_OWNDATA)
6295 __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 248, __pyx_L1_error)
6296 __Pyx_GOTREF(__pyx_t_1);
6297 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_array); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 248, __pyx_L1_error)
6298 __Pyx_GOTREF(__pyx_t_2);
6299 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6300 __pyx_t_1 = __Pyx_PyInt_From_siz((4 * __pyx_v_n)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 248, __pyx_L1_error)
6301 __Pyx_GOTREF(__pyx_t_1);
6302 __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 248, __pyx_L1_error)
6303 __Pyx_GOTREF(__pyx_t_4);
6304 __Pyx_INCREF(__pyx_int_1);
6305 __Pyx_GIVEREF(__pyx_int_1);
6306 PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_int_1);
6307 __Pyx_GIVEREF(__pyx_t_1);
6308 PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1);
6310 __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 248, __pyx_L1_error)
6311 __Pyx_GOTREF(__pyx_t_1);
6312 __Pyx_GIVEREF(__pyx_t_4);
6313 PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4);
6315 __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 248, __pyx_L1_error)
6316 __Pyx_GOTREF(__pyx_t_4);
6317 __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 248, __pyx_L1_error)
6318 __Pyx_GOTREF(__pyx_t_3);
6319 __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_double); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 248, __pyx_L1_error)
6320 __Pyx_GOTREF(__pyx_t_6);
6321 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6322 if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_dtype, __pyx_t_6) < 0) __PYX_ERR(0, 248, __pyx_L1_error)
6323 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
6324 __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 248, __pyx_L1_error)
6325 __Pyx_GOTREF(__pyx_t_6);
6326 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6327 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6328 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
6329 __pyx_v_bb = __pyx_t_6;
6332 /* "pycocotools/_mask.pyx":249
6333 * shape[0] = <np.npy_intp> 4*n
6334 * bb = np.array((1,4*n), dtype=np.double)
6335 * bb = np.PyArray_SimpleNewFromData(1, shape, np.NPY_DOUBLE, _bb).reshape((n, 4)) # <<<<<<<<<<<<<<
6336 * PyArray_ENABLEFLAGS(bb, np.NPY_OWNDATA)
6339 __pyx_t_4 = PyArray_SimpleNewFromData(1, __pyx_v_shape, NPY_DOUBLE, __pyx_v__bb); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 249, __pyx_L1_error)
6340 __Pyx_GOTREF(__pyx_t_4);
6341 __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_reshape); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 249, __pyx_L1_error)
6342 __Pyx_GOTREF(__pyx_t_1);
6343 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
6344 __pyx_t_4 = __Pyx_PyInt_From_siz(__pyx_v_n); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 249, __pyx_L1_error)
6345 __Pyx_GOTREF(__pyx_t_4);
6346 __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 249, __pyx_L1_error)
6347 __Pyx_GOTREF(__pyx_t_2);
6348 __Pyx_GIVEREF(__pyx_t_4);
6349 PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_4);
6350 __Pyx_INCREF(__pyx_int_4);
6351 __Pyx_GIVEREF(__pyx_int_4);
6352 PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_int_4);
6355 if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) {
6356 __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1);
6357 if (likely(__pyx_t_4)) {
6358 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
6359 __Pyx_INCREF(__pyx_t_4);
6360 __Pyx_INCREF(function);
6361 __Pyx_DECREF_SET(__pyx_t_1, function);
6365 __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 249, __pyx_L1_error)
6366 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6367 __Pyx_GOTREF(__pyx_t_6);
6369 #if CYTHON_FAST_PYCALL
6370 if (PyFunction_Check(__pyx_t_1)) {
6371 PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_t_2};
6372 __pyx_t_6 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 249, __pyx_L1_error)
6373 __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
6374 __Pyx_GOTREF(__pyx_t_6);
6375 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6378 #if CYTHON_FAST_PYCCALL
6379 if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
6380 PyObject *__pyx_temp[2] = {__pyx_t_4, __pyx_t_2};
6381 __pyx_t_6 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 249, __pyx_L1_error)
6382 __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
6383 __Pyx_GOTREF(__pyx_t_6);
6384 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6388 __pyx_t_3 = PyTuple_New(1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 249, __pyx_L1_error)
6389 __Pyx_GOTREF(__pyx_t_3);
6390 __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4); __pyx_t_4 = NULL;
6391 __Pyx_GIVEREF(__pyx_t_2);
6392 PyTuple_SET_ITEM(__pyx_t_3, 0+1, __pyx_t_2);
6394 __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_3, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 249, __pyx_L1_error)
6395 __Pyx_GOTREF(__pyx_t_6);
6396 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6399 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6400 __Pyx_DECREF_SET(__pyx_v_bb, __pyx_t_6);
6403 /* "pycocotools/_mask.pyx":250
6404 * bb = np.array((1,4*n), dtype=np.double)
6405 * bb = np.PyArray_SimpleNewFromData(1, shape, np.NPY_DOUBLE, _bb).reshape((n, 4))
6406 * PyArray_ENABLEFLAGS(bb, np.NPY_OWNDATA) # <<<<<<<<<<<<<<
6410 if (!(likely(((__pyx_v_bb) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_bb, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 250, __pyx_L1_error)
6411 PyArray_ENABLEFLAGS(((PyArrayObject *)__pyx_v_bb), NPY_OWNDATA);
6413 /* "pycocotools/_mask.pyx":251
6414 * bb = np.PyArray_SimpleNewFromData(1, shape, np.NPY_DOUBLE, _bb).reshape((n, 4))
6415 * PyArray_ENABLEFLAGS(bb, np.NPY_OWNDATA)
6416 * return bb # <<<<<<<<<<<<<<
6418 * def frBbox(np.ndarray[np.double_t, ndim=2] bb, siz h, siz w ):
6420 __Pyx_XDECREF(__pyx_r);
6421 __Pyx_INCREF(__pyx_v_bb);
6422 __pyx_r = __pyx_v_bb;
6425 /* "pycocotools/_mask.pyx":241
6426 * return iou.reshape((m,n), order='F')
6428 * def toBbox( rleObjs ): # <<<<<<<<<<<<<<
6429 * cdef RLEs Rs = _frString(rleObjs)
6433 /* function exit code */
6435 __Pyx_XDECREF(__pyx_t_1);
6436 __Pyx_XDECREF(__pyx_t_2);
6437 __Pyx_XDECREF(__pyx_t_3);
6438 __Pyx_XDECREF(__pyx_t_4);
6439 __Pyx_XDECREF(__pyx_t_6);
6440 __Pyx_AddTraceback("pycocotools._mask.toBbox", __pyx_clineno, __pyx_lineno, __pyx_filename);
6443 __Pyx_XDECREF((PyObject *)__pyx_v_Rs);
6444 __Pyx_XDECREF(__pyx_v_bb);
6445 __Pyx_XGIVEREF(__pyx_r);
6446 __Pyx_RefNannyFinishContext();
6450 /* "pycocotools/_mask.pyx":253
6453 * def frBbox(np.ndarray[np.double_t, ndim=2] bb, siz h, siz w ): # <<<<<<<<<<<<<<
6454 * cdef siz n = bb.shape[0]
6458 /* Python wrapper */
6459 static PyObject *__pyx_pw_11pycocotools_5_mask_17frBbox(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
6460 static PyMethodDef __pyx_mdef_11pycocotools_5_mask_17frBbox = {"frBbox", (PyCFunction)__pyx_pw_11pycocotools_5_mask_17frBbox, METH_VARARGS|METH_KEYWORDS, 0};
6461 static PyObject *__pyx_pw_11pycocotools_5_mask_17frBbox(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
6462 PyArrayObject *__pyx_v_bb = 0;
6465 PyObject *__pyx_r = 0;
6466 __Pyx_RefNannyDeclarations
6467 __Pyx_RefNannySetupContext("frBbox (wrapper)", 0);
6469 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_bb,&__pyx_n_s_h,&__pyx_n_s_w,0};
6470 PyObject* values[3] = {0,0,0};
6471 if (unlikely(__pyx_kwds)) {
6473 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
6475 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
6476 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
6477 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
6479 default: goto __pyx_L5_argtuple_error;
6481 kw_args = PyDict_Size(__pyx_kwds);
6484 if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_bb)) != 0)) kw_args--;
6485 else goto __pyx_L5_argtuple_error;
6487 if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_h)) != 0)) kw_args--;
6489 __Pyx_RaiseArgtupleInvalid("frBbox", 1, 3, 3, 1); __PYX_ERR(0, 253, __pyx_L3_error)
6492 if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_w)) != 0)) kw_args--;
6494 __Pyx_RaiseArgtupleInvalid("frBbox", 1, 3, 3, 2); __PYX_ERR(0, 253, __pyx_L3_error)
6497 if (unlikely(kw_args > 0)) {
6498 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "frBbox") < 0)) __PYX_ERR(0, 253, __pyx_L3_error)
6500 } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
6501 goto __pyx_L5_argtuple_error;
6503 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
6504 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
6505 values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
6507 __pyx_v_bb = ((PyArrayObject *)values[0]);
6508 __pyx_v_h = __Pyx_PyInt_As_siz(values[1]); if (unlikely((__pyx_v_h == ((siz)-1)) && PyErr_Occurred())) __PYX_ERR(0, 253, __pyx_L3_error)
6509 __pyx_v_w = __Pyx_PyInt_As_siz(values[2]); if (unlikely((__pyx_v_w == ((siz)-1)) && PyErr_Occurred())) __PYX_ERR(0, 253, __pyx_L3_error)
6511 goto __pyx_L4_argument_unpacking_done;
6512 __pyx_L5_argtuple_error:;
6513 __Pyx_RaiseArgtupleInvalid("frBbox", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 253, __pyx_L3_error)
6515 __Pyx_AddTraceback("pycocotools._mask.frBbox", __pyx_clineno, __pyx_lineno, __pyx_filename);
6516 __Pyx_RefNannyFinishContext();
6518 __pyx_L4_argument_unpacking_done:;
6519 if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_bb), __pyx_ptype_5numpy_ndarray, 1, "bb", 0))) __PYX_ERR(0, 253, __pyx_L1_error)
6520 __pyx_r = __pyx_pf_11pycocotools_5_mask_16frBbox(__pyx_self, __pyx_v_bb, __pyx_v_h, __pyx_v_w);
6522 /* function exit code */
6527 __Pyx_RefNannyFinishContext();
6531 static PyObject *__pyx_pf_11pycocotools_5_mask_16frBbox(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_bb, siz __pyx_v_h, siz __pyx_v_w) {
6533 struct __pyx_obj_11pycocotools_5_mask_RLEs *__pyx_v_Rs = NULL;
6534 PyObject *__pyx_v_objs = NULL;
6535 __Pyx_LocalBuf_ND __pyx_pybuffernd_bb;
6536 __Pyx_Buffer __pyx_pybuffer_bb;
6537 PyObject *__pyx_r = NULL;
6538 __Pyx_RefNannyDeclarations
6539 PyObject *__pyx_t_1 = NULL;
6540 PyObject *__pyx_t_2 = NULL;
6541 PyObject *__pyx_t_3 = NULL;
6542 PyObject *__pyx_t_4 = NULL;
6543 __Pyx_RefNannySetupContext("frBbox", 0);
6544 __pyx_pybuffer_bb.pybuffer.buf = NULL;
6545 __pyx_pybuffer_bb.refcount = 0;
6546 __pyx_pybuffernd_bb.data = NULL;
6547 __pyx_pybuffernd_bb.rcbuffer = &__pyx_pybuffer_bb;
6549 __Pyx_BufFmt_StackElem __pyx_stack[1];
6550 if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_bb.rcbuffer->pybuffer, (PyObject*)__pyx_v_bb, &__Pyx_TypeInfo_nn___pyx_t_5numpy_double_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) __PYX_ERR(0, 253, __pyx_L1_error)
6552 __pyx_pybuffernd_bb.diminfo[0].strides = __pyx_pybuffernd_bb.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_bb.diminfo[0].shape = __pyx_pybuffernd_bb.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_bb.diminfo[1].strides = __pyx_pybuffernd_bb.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_bb.diminfo[1].shape = __pyx_pybuffernd_bb.rcbuffer->pybuffer.shape[1];
6554 /* "pycocotools/_mask.pyx":254
6556 * def frBbox(np.ndarray[np.double_t, ndim=2] bb, siz h, siz w ):
6557 * cdef siz n = bb.shape[0] # <<<<<<<<<<<<<<
6559 * rleFrBbox( <RLE*> Rs._R, <const BB> bb.data, h, w, n )
6561 __pyx_v_n = (__pyx_v_bb->dimensions[0]);
6563 /* "pycocotools/_mask.pyx":255
6564 * def frBbox(np.ndarray[np.double_t, ndim=2] bb, siz h, siz w ):
6565 * cdef siz n = bb.shape[0]
6566 * Rs = RLEs(n) # <<<<<<<<<<<<<<
6567 * rleFrBbox( <RLE*> Rs._R, <const BB> bb.data, h, w, n )
6568 * objs = _toString(Rs)
6570 __pyx_t_1 = __Pyx_PyInt_From_siz(__pyx_v_n); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 255, __pyx_L1_error)
6571 __Pyx_GOTREF(__pyx_t_1);
6572 __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 255, __pyx_L1_error)
6573 __Pyx_GOTREF(__pyx_t_2);
6574 __Pyx_GIVEREF(__pyx_t_1);
6575 PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1);
6577 __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_11pycocotools_5_mask_RLEs), __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 255, __pyx_L1_error)
6578 __Pyx_GOTREF(__pyx_t_1);
6579 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6580 __pyx_v_Rs = ((struct __pyx_obj_11pycocotools_5_mask_RLEs *)__pyx_t_1);
6583 /* "pycocotools/_mask.pyx":256
6584 * cdef siz n = bb.shape[0]
6586 * rleFrBbox( <RLE*> Rs._R, <const BB> bb.data, h, w, n ) # <<<<<<<<<<<<<<
6587 * objs = _toString(Rs)
6590 rleFrBbox(((RLE *)__pyx_v_Rs->_R), ((BB const )__pyx_v_bb->data), __pyx_v_h, __pyx_v_w, __pyx_v_n);
6592 /* "pycocotools/_mask.pyx":257
6594 * rleFrBbox( <RLE*> Rs._R, <const BB> bb.data, h, w, n )
6595 * objs = _toString(Rs) # <<<<<<<<<<<<<<
6599 __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_toString); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 257, __pyx_L1_error)
6600 __Pyx_GOTREF(__pyx_t_2);
6602 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) {
6603 __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
6604 if (likely(__pyx_t_3)) {
6605 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
6606 __Pyx_INCREF(__pyx_t_3);
6607 __Pyx_INCREF(function);
6608 __Pyx_DECREF_SET(__pyx_t_2, function);
6612 __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, ((PyObject *)__pyx_v_Rs)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 257, __pyx_L1_error)
6613 __Pyx_GOTREF(__pyx_t_1);
6615 #if CYTHON_FAST_PYCALL
6616 if (PyFunction_Check(__pyx_t_2)) {
6617 PyObject *__pyx_temp[2] = {__pyx_t_3, ((PyObject *)__pyx_v_Rs)};
6618 __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 257, __pyx_L1_error)
6619 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
6620 __Pyx_GOTREF(__pyx_t_1);
6623 #if CYTHON_FAST_PYCCALL
6624 if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) {
6625 PyObject *__pyx_temp[2] = {__pyx_t_3, ((PyObject *)__pyx_v_Rs)};
6626 __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 257, __pyx_L1_error)
6627 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
6628 __Pyx_GOTREF(__pyx_t_1);
6632 __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 257, __pyx_L1_error)
6633 __Pyx_GOTREF(__pyx_t_4);
6634 __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __pyx_t_3 = NULL;
6635 __Pyx_INCREF(((PyObject *)__pyx_v_Rs));
6636 __Pyx_GIVEREF(((PyObject *)__pyx_v_Rs));
6637 PyTuple_SET_ITEM(__pyx_t_4, 0+1, ((PyObject *)__pyx_v_Rs));
6638 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 257, __pyx_L1_error)
6639 __Pyx_GOTREF(__pyx_t_1);
6640 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
6643 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6644 __pyx_v_objs = __pyx_t_1;
6647 /* "pycocotools/_mask.pyx":258
6648 * rleFrBbox( <RLE*> Rs._R, <const BB> bb.data, h, w, n )
6649 * objs = _toString(Rs)
6650 * return objs # <<<<<<<<<<<<<<
6652 * def frPoly( poly, siz h, siz w ):
6654 __Pyx_XDECREF(__pyx_r);
6655 __Pyx_INCREF(__pyx_v_objs);
6656 __pyx_r = __pyx_v_objs;
6659 /* "pycocotools/_mask.pyx":253
6662 * def frBbox(np.ndarray[np.double_t, ndim=2] bb, siz h, siz w ): # <<<<<<<<<<<<<<
6663 * cdef siz n = bb.shape[0]
6667 /* function exit code */
6669 __Pyx_XDECREF(__pyx_t_1);
6670 __Pyx_XDECREF(__pyx_t_2);
6671 __Pyx_XDECREF(__pyx_t_3);
6672 __Pyx_XDECREF(__pyx_t_4);
6673 { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
6674 __Pyx_PyThreadState_declare
6675 __Pyx_PyThreadState_assign
6676 __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
6677 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_bb.rcbuffer->pybuffer);
6678 __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
6679 __Pyx_AddTraceback("pycocotools._mask.frBbox", __pyx_clineno, __pyx_lineno, __pyx_filename);
6683 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_bb.rcbuffer->pybuffer);
6685 __Pyx_XDECREF((PyObject *)__pyx_v_Rs);
6686 __Pyx_XDECREF(__pyx_v_objs);
6687 __Pyx_XGIVEREF(__pyx_r);
6688 __Pyx_RefNannyFinishContext();
6692 /* "pycocotools/_mask.pyx":260
6695 * def frPoly( poly, siz h, siz w ): # <<<<<<<<<<<<<<
6696 * cdef np.ndarray[np.double_t, ndim=1] np_poly
6700 /* Python wrapper */
6701 static PyObject *__pyx_pw_11pycocotools_5_mask_19frPoly(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
6702 static PyMethodDef __pyx_mdef_11pycocotools_5_mask_19frPoly = {"frPoly", (PyCFunction)__pyx_pw_11pycocotools_5_mask_19frPoly, METH_VARARGS|METH_KEYWORDS, 0};
6703 static PyObject *__pyx_pw_11pycocotools_5_mask_19frPoly(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
6704 PyObject *__pyx_v_poly = 0;
6707 PyObject *__pyx_r = 0;
6708 __Pyx_RefNannyDeclarations
6709 __Pyx_RefNannySetupContext("frPoly (wrapper)", 0);
6711 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_poly,&__pyx_n_s_h,&__pyx_n_s_w,0};
6712 PyObject* values[3] = {0,0,0};
6713 if (unlikely(__pyx_kwds)) {
6715 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
6717 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
6718 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
6719 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
6721 default: goto __pyx_L5_argtuple_error;
6723 kw_args = PyDict_Size(__pyx_kwds);
6726 if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_poly)) != 0)) kw_args--;
6727 else goto __pyx_L5_argtuple_error;
6729 if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_h)) != 0)) kw_args--;
6731 __Pyx_RaiseArgtupleInvalid("frPoly", 1, 3, 3, 1); __PYX_ERR(0, 260, __pyx_L3_error)
6734 if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_w)) != 0)) kw_args--;
6736 __Pyx_RaiseArgtupleInvalid("frPoly", 1, 3, 3, 2); __PYX_ERR(0, 260, __pyx_L3_error)
6739 if (unlikely(kw_args > 0)) {
6740 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "frPoly") < 0)) __PYX_ERR(0, 260, __pyx_L3_error)
6742 } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
6743 goto __pyx_L5_argtuple_error;
6745 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
6746 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
6747 values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
6749 __pyx_v_poly = values[0];
6750 __pyx_v_h = __Pyx_PyInt_As_siz(values[1]); if (unlikely((__pyx_v_h == ((siz)-1)) && PyErr_Occurred())) __PYX_ERR(0, 260, __pyx_L3_error)
6751 __pyx_v_w = __Pyx_PyInt_As_siz(values[2]); if (unlikely((__pyx_v_w == ((siz)-1)) && PyErr_Occurred())) __PYX_ERR(0, 260, __pyx_L3_error)
6753 goto __pyx_L4_argument_unpacking_done;
6754 __pyx_L5_argtuple_error:;
6755 __Pyx_RaiseArgtupleInvalid("frPoly", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 260, __pyx_L3_error)
6757 __Pyx_AddTraceback("pycocotools._mask.frPoly", __pyx_clineno, __pyx_lineno, __pyx_filename);
6758 __Pyx_RefNannyFinishContext();
6760 __pyx_L4_argument_unpacking_done:;
6761 __pyx_r = __pyx_pf_11pycocotools_5_mask_18frPoly(__pyx_self, __pyx_v_poly, __pyx_v_h, __pyx_v_w);
6763 /* function exit code */
6764 __Pyx_RefNannyFinishContext();
6768 static PyObject *__pyx_pf_11pycocotools_5_mask_18frPoly(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_poly, siz __pyx_v_h, siz __pyx_v_w) {
6769 PyArrayObject *__pyx_v_np_poly = 0;
6770 Py_ssize_t __pyx_v_n;
6771 struct __pyx_obj_11pycocotools_5_mask_RLEs *__pyx_v_Rs = NULL;
6772 PyObject *__pyx_v_i = NULL;
6773 PyObject *__pyx_v_p = NULL;
6774 PyObject *__pyx_v_objs = NULL;
6775 __Pyx_LocalBuf_ND __pyx_pybuffernd_np_poly;
6776 __Pyx_Buffer __pyx_pybuffer_np_poly;
6777 PyObject *__pyx_r = NULL;
6778 __Pyx_RefNannyDeclarations
6779 Py_ssize_t __pyx_t_1;
6780 PyObject *__pyx_t_2 = NULL;
6781 PyObject *__pyx_t_3 = NULL;
6782 PyObject *(*__pyx_t_4)(PyObject *);
6783 PyObject *__pyx_t_5 = NULL;
6784 PyObject *__pyx_t_6 = NULL;
6785 PyObject *__pyx_t_7 = NULL;
6786 PyObject *__pyx_t_8 = NULL;
6787 PyObject *__pyx_t_9 = NULL;
6788 PyArrayObject *__pyx_t_10 = NULL;
6790 PyObject *__pyx_t_12 = NULL;
6791 PyObject *__pyx_t_13 = NULL;
6792 PyObject *__pyx_t_14 = NULL;
6793 Py_ssize_t __pyx_t_15;
6794 Py_ssize_t __pyx_t_16;
6795 __Pyx_RefNannySetupContext("frPoly", 0);
6796 __pyx_pybuffer_np_poly.pybuffer.buf = NULL;
6797 __pyx_pybuffer_np_poly.refcount = 0;
6798 __pyx_pybuffernd_np_poly.data = NULL;
6799 __pyx_pybuffernd_np_poly.rcbuffer = &__pyx_pybuffer_np_poly;
6801 /* "pycocotools/_mask.pyx":262
6802 * def frPoly( poly, siz h, siz w ):
6803 * cdef np.ndarray[np.double_t, ndim=1] np_poly
6804 * n = len(poly) # <<<<<<<<<<<<<<
6806 * for i, p in enumerate(poly):
6808 __pyx_t_1 = PyObject_Length(__pyx_v_poly); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(0, 262, __pyx_L1_error)
6809 __pyx_v_n = __pyx_t_1;
6811 /* "pycocotools/_mask.pyx":263
6812 * cdef np.ndarray[np.double_t, ndim=1] np_poly
6814 * Rs = RLEs(n) # <<<<<<<<<<<<<<
6815 * for i, p in enumerate(poly):
6816 * np_poly = np.array(p, dtype=np.double, order='F')
6818 __pyx_t_2 = PyInt_FromSsize_t(__pyx_v_n); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 263, __pyx_L1_error)
6819 __Pyx_GOTREF(__pyx_t_2);
6820 __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 263, __pyx_L1_error)
6821 __Pyx_GOTREF(__pyx_t_3);
6822 __Pyx_GIVEREF(__pyx_t_2);
6823 PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
6825 __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_11pycocotools_5_mask_RLEs), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 263, __pyx_L1_error)
6826 __Pyx_GOTREF(__pyx_t_2);
6827 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6828 __pyx_v_Rs = ((struct __pyx_obj_11pycocotools_5_mask_RLEs *)__pyx_t_2);
6831 /* "pycocotools/_mask.pyx":264
6834 * for i, p in enumerate(poly): # <<<<<<<<<<<<<<
6835 * np_poly = np.array(p, dtype=np.double, order='F')
6836 * rleFrPoly( <RLE*>&Rs._R[i], <const double*> np_poly.data, int(len(p)/2), h, w )
6838 __Pyx_INCREF(__pyx_int_0);
6839 __pyx_t_2 = __pyx_int_0;
6840 if (likely(PyList_CheckExact(__pyx_v_poly)) || PyTuple_CheckExact(__pyx_v_poly)) {
6841 __pyx_t_3 = __pyx_v_poly; __Pyx_INCREF(__pyx_t_3); __pyx_t_1 = 0;
6844 __pyx_t_1 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_poly); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 264, __pyx_L1_error)
6845 __Pyx_GOTREF(__pyx_t_3);
6846 __pyx_t_4 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 264, __pyx_L1_error)
6849 if (likely(!__pyx_t_4)) {
6850 if (likely(PyList_CheckExact(__pyx_t_3))) {
6851 if (__pyx_t_1 >= PyList_GET_SIZE(__pyx_t_3)) break;
6852 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
6853 __pyx_t_5 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_1); __Pyx_INCREF(__pyx_t_5); __pyx_t_1++; if (unlikely(0 < 0)) __PYX_ERR(0, 264, __pyx_L1_error)
6855 __pyx_t_5 = PySequence_ITEM(__pyx_t_3, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 264, __pyx_L1_error)
6856 __Pyx_GOTREF(__pyx_t_5);
6859 if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
6860 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
6861 __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_1); __Pyx_INCREF(__pyx_t_5); __pyx_t_1++; if (unlikely(0 < 0)) __PYX_ERR(0, 264, __pyx_L1_error)
6863 __pyx_t_5 = PySequence_ITEM(__pyx_t_3, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 264, __pyx_L1_error)
6864 __Pyx_GOTREF(__pyx_t_5);
6868 __pyx_t_5 = __pyx_t_4(__pyx_t_3);
6869 if (unlikely(!__pyx_t_5)) {
6870 PyObject* exc_type = PyErr_Occurred();
6872 if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
6873 else __PYX_ERR(0, 264, __pyx_L1_error)
6877 __Pyx_GOTREF(__pyx_t_5);
6879 __Pyx_XDECREF_SET(__pyx_v_p, __pyx_t_5);
6881 __Pyx_INCREF(__pyx_t_2);
6882 __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_2);
6883 __pyx_t_5 = __Pyx_PyInt_AddObjC(__pyx_t_2, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 264, __pyx_L1_error)
6884 __Pyx_GOTREF(__pyx_t_5);
6885 __Pyx_DECREF(__pyx_t_2);
6886 __pyx_t_2 = __pyx_t_5;
6889 /* "pycocotools/_mask.pyx":265
6891 * for i, p in enumerate(poly):
6892 * np_poly = np.array(p, dtype=np.double, order='F') # <<<<<<<<<<<<<<
6893 * rleFrPoly( <RLE*>&Rs._R[i], <const double*> np_poly.data, int(len(p)/2), h, w )
6894 * objs = _toString(Rs)
6896 __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 265, __pyx_L1_error)
6897 __Pyx_GOTREF(__pyx_t_5);
6898 __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_array); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 265, __pyx_L1_error)
6899 __Pyx_GOTREF(__pyx_t_6);
6900 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
6901 __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 265, __pyx_L1_error)
6902 __Pyx_GOTREF(__pyx_t_5);
6903 __Pyx_INCREF(__pyx_v_p);
6904 __Pyx_GIVEREF(__pyx_v_p);
6905 PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_p);
6906 __pyx_t_7 = PyDict_New(); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 265, __pyx_L1_error)
6907 __Pyx_GOTREF(__pyx_t_7);
6908 __pyx_t_8 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 265, __pyx_L1_error)
6909 __Pyx_GOTREF(__pyx_t_8);
6910 __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_8, __pyx_n_s_double); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 265, __pyx_L1_error)
6911 __Pyx_GOTREF(__pyx_t_9);
6912 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
6913 if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_dtype, __pyx_t_9) < 0) __PYX_ERR(0, 265, __pyx_L1_error)
6914 __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
6915 if (PyDict_SetItem(__pyx_t_7, __pyx_n_s_order, __pyx_n_s_F) < 0) __PYX_ERR(0, 265, __pyx_L1_error)
6916 __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_5, __pyx_t_7); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 265, __pyx_L1_error)
6917 __Pyx_GOTREF(__pyx_t_9);
6918 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
6919 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
6920 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
6921 if (!(likely(((__pyx_t_9) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_9, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 265, __pyx_L1_error)
6922 __pyx_t_10 = ((PyArrayObject *)__pyx_t_9);
6924 __Pyx_BufFmt_StackElem __pyx_stack[1];
6925 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_np_poly.rcbuffer->pybuffer);
6926 __pyx_t_11 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_np_poly.rcbuffer->pybuffer, (PyObject*)__pyx_t_10, &__Pyx_TypeInfo_nn___pyx_t_5numpy_double_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
6927 if (unlikely(__pyx_t_11 < 0)) {
6928 PyErr_Fetch(&__pyx_t_12, &__pyx_t_13, &__pyx_t_14);
6929 if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_np_poly.rcbuffer->pybuffer, (PyObject*)__pyx_v_np_poly, &__Pyx_TypeInfo_nn___pyx_t_5numpy_double_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
6930 Py_XDECREF(__pyx_t_12); Py_XDECREF(__pyx_t_13); Py_XDECREF(__pyx_t_14);
6931 __Pyx_RaiseBufferFallbackError();
6933 PyErr_Restore(__pyx_t_12, __pyx_t_13, __pyx_t_14);
6936 __pyx_pybuffernd_np_poly.diminfo[0].strides = __pyx_pybuffernd_np_poly.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_np_poly.diminfo[0].shape = __pyx_pybuffernd_np_poly.rcbuffer->pybuffer.shape[0];
6937 if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(0, 265, __pyx_L1_error)
6940 __Pyx_XDECREF_SET(__pyx_v_np_poly, ((PyArrayObject *)__pyx_t_9));
6943 /* "pycocotools/_mask.pyx":266
6944 * for i, p in enumerate(poly):
6945 * np_poly = np.array(p, dtype=np.double, order='F')
6946 * rleFrPoly( <RLE*>&Rs._R[i], <const double*> np_poly.data, int(len(p)/2), h, w ) # <<<<<<<<<<<<<<
6947 * objs = _toString(Rs)
6950 __pyx_t_15 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_15 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 266, __pyx_L1_error)
6951 __pyx_t_16 = PyObject_Length(__pyx_v_p); if (unlikely(__pyx_t_16 == -1)) __PYX_ERR(0, 266, __pyx_L1_error)
6952 rleFrPoly(((RLE *)(&(__pyx_v_Rs->_R[__pyx_t_15]))), ((double const *)__pyx_v_np_poly->data), ((siz)__Pyx_div_Py_ssize_t(__pyx_t_16, 2)), __pyx_v_h, __pyx_v_w);
6954 /* "pycocotools/_mask.pyx":264
6957 * for i, p in enumerate(poly): # <<<<<<<<<<<<<<
6958 * np_poly = np.array(p, dtype=np.double, order='F')
6959 * rleFrPoly( <RLE*>&Rs._R[i], <const double*> np_poly.data, int(len(p)/2), h, w )
6962 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6963 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6965 /* "pycocotools/_mask.pyx":267
6966 * np_poly = np.array(p, dtype=np.double, order='F')
6967 * rleFrPoly( <RLE*>&Rs._R[i], <const double*> np_poly.data, int(len(p)/2), h, w )
6968 * objs = _toString(Rs) # <<<<<<<<<<<<<<
6972 __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_toString); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 267, __pyx_L1_error)
6973 __Pyx_GOTREF(__pyx_t_3);
6975 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
6976 __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_3);
6977 if (likely(__pyx_t_9)) {
6978 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
6979 __Pyx_INCREF(__pyx_t_9);
6980 __Pyx_INCREF(function);
6981 __Pyx_DECREF_SET(__pyx_t_3, function);
6985 __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, ((PyObject *)__pyx_v_Rs)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 267, __pyx_L1_error)
6986 __Pyx_GOTREF(__pyx_t_2);
6988 #if CYTHON_FAST_PYCALL
6989 if (PyFunction_Check(__pyx_t_3)) {
6990 PyObject *__pyx_temp[2] = {__pyx_t_9, ((PyObject *)__pyx_v_Rs)};
6991 __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 267, __pyx_L1_error)
6992 __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
6993 __Pyx_GOTREF(__pyx_t_2);
6996 #if CYTHON_FAST_PYCCALL
6997 if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
6998 PyObject *__pyx_temp[2] = {__pyx_t_9, ((PyObject *)__pyx_v_Rs)};
6999 __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 267, __pyx_L1_error)
7000 __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0;
7001 __Pyx_GOTREF(__pyx_t_2);
7005 __pyx_t_7 = PyTuple_New(1+1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 267, __pyx_L1_error)
7006 __Pyx_GOTREF(__pyx_t_7);
7007 __Pyx_GIVEREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_9); __pyx_t_9 = NULL;
7008 __Pyx_INCREF(((PyObject *)__pyx_v_Rs));
7009 __Pyx_GIVEREF(((PyObject *)__pyx_v_Rs));
7010 PyTuple_SET_ITEM(__pyx_t_7, 0+1, ((PyObject *)__pyx_v_Rs));
7011 __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_7, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 267, __pyx_L1_error)
7012 __Pyx_GOTREF(__pyx_t_2);
7013 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
7016 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7017 __pyx_v_objs = __pyx_t_2;
7020 /* "pycocotools/_mask.pyx":268
7021 * rleFrPoly( <RLE*>&Rs._R[i], <const double*> np_poly.data, int(len(p)/2), h, w )
7022 * objs = _toString(Rs)
7023 * return objs # <<<<<<<<<<<<<<
7025 * def frUncompressedRLE(ucRles, siz h, siz w):
7027 __Pyx_XDECREF(__pyx_r);
7028 __Pyx_INCREF(__pyx_v_objs);
7029 __pyx_r = __pyx_v_objs;
7032 /* "pycocotools/_mask.pyx":260
7035 * def frPoly( poly, siz h, siz w ): # <<<<<<<<<<<<<<
7036 * cdef np.ndarray[np.double_t, ndim=1] np_poly
7040 /* function exit code */
7042 __Pyx_XDECREF(__pyx_t_2);
7043 __Pyx_XDECREF(__pyx_t_3);
7044 __Pyx_XDECREF(__pyx_t_5);
7045 __Pyx_XDECREF(__pyx_t_6);
7046 __Pyx_XDECREF(__pyx_t_7);
7047 __Pyx_XDECREF(__pyx_t_8);
7048 __Pyx_XDECREF(__pyx_t_9);
7049 { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
7050 __Pyx_PyThreadState_declare
7051 __Pyx_PyThreadState_assign
7052 __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
7053 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_np_poly.rcbuffer->pybuffer);
7054 __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
7055 __Pyx_AddTraceback("pycocotools._mask.frPoly", __pyx_clineno, __pyx_lineno, __pyx_filename);
7059 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_np_poly.rcbuffer->pybuffer);
7061 __Pyx_XDECREF((PyObject *)__pyx_v_np_poly);
7062 __Pyx_XDECREF((PyObject *)__pyx_v_Rs);
7063 __Pyx_XDECREF(__pyx_v_i);
7064 __Pyx_XDECREF(__pyx_v_p);
7065 __Pyx_XDECREF(__pyx_v_objs);
7066 __Pyx_XGIVEREF(__pyx_r);
7067 __Pyx_RefNannyFinishContext();
7071 /* "pycocotools/_mask.pyx":270
7074 * def frUncompressedRLE(ucRles, siz h, siz w): # <<<<<<<<<<<<<<
7075 * cdef np.ndarray[np.uint32_t, ndim=1] cnts
7079 /* Python wrapper */
7080 static PyObject *__pyx_pw_11pycocotools_5_mask_21frUncompressedRLE(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
7081 static PyMethodDef __pyx_mdef_11pycocotools_5_mask_21frUncompressedRLE = {"frUncompressedRLE", (PyCFunction)__pyx_pw_11pycocotools_5_mask_21frUncompressedRLE, METH_VARARGS|METH_KEYWORDS, 0};
7082 static PyObject *__pyx_pw_11pycocotools_5_mask_21frUncompressedRLE(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
7083 PyObject *__pyx_v_ucRles = 0;
7084 CYTHON_UNUSED siz __pyx_v_h;
7085 CYTHON_UNUSED siz __pyx_v_w;
7086 PyObject *__pyx_r = 0;
7087 __Pyx_RefNannyDeclarations
7088 __Pyx_RefNannySetupContext("frUncompressedRLE (wrapper)", 0);
7090 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_ucRles,&__pyx_n_s_h,&__pyx_n_s_w,0};
7091 PyObject* values[3] = {0,0,0};
7092 if (unlikely(__pyx_kwds)) {
7094 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
7096 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
7097 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
7098 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
7100 default: goto __pyx_L5_argtuple_error;
7102 kw_args = PyDict_Size(__pyx_kwds);
7105 if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_ucRles)) != 0)) kw_args--;
7106 else goto __pyx_L5_argtuple_error;
7108 if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_h)) != 0)) kw_args--;
7110 __Pyx_RaiseArgtupleInvalid("frUncompressedRLE", 1, 3, 3, 1); __PYX_ERR(0, 270, __pyx_L3_error)
7113 if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_w)) != 0)) kw_args--;
7115 __Pyx_RaiseArgtupleInvalid("frUncompressedRLE", 1, 3, 3, 2); __PYX_ERR(0, 270, __pyx_L3_error)
7118 if (unlikely(kw_args > 0)) {
7119 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "frUncompressedRLE") < 0)) __PYX_ERR(0, 270, __pyx_L3_error)
7121 } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
7122 goto __pyx_L5_argtuple_error;
7124 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
7125 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
7126 values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
7128 __pyx_v_ucRles = values[0];
7129 __pyx_v_h = __Pyx_PyInt_As_siz(values[1]); if (unlikely((__pyx_v_h == ((siz)-1)) && PyErr_Occurred())) __PYX_ERR(0, 270, __pyx_L3_error)
7130 __pyx_v_w = __Pyx_PyInt_As_siz(values[2]); if (unlikely((__pyx_v_w == ((siz)-1)) && PyErr_Occurred())) __PYX_ERR(0, 270, __pyx_L3_error)
7132 goto __pyx_L4_argument_unpacking_done;
7133 __pyx_L5_argtuple_error:;
7134 __Pyx_RaiseArgtupleInvalid("frUncompressedRLE", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 270, __pyx_L3_error)
7136 __Pyx_AddTraceback("pycocotools._mask.frUncompressedRLE", __pyx_clineno, __pyx_lineno, __pyx_filename);
7137 __Pyx_RefNannyFinishContext();
7139 __pyx_L4_argument_unpacking_done:;
7140 __pyx_r = __pyx_pf_11pycocotools_5_mask_20frUncompressedRLE(__pyx_self, __pyx_v_ucRles, __pyx_v_h, __pyx_v_w);
7142 /* function exit code */
7143 __Pyx_RefNannyFinishContext();
7147 static PyObject *__pyx_pf_11pycocotools_5_mask_20frUncompressedRLE(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_ucRles, CYTHON_UNUSED siz __pyx_v_h, CYTHON_UNUSED siz __pyx_v_w) {
7148 PyArrayObject *__pyx_v_cnts = 0;
7151 Py_ssize_t __pyx_v_n;
7152 PyObject *__pyx_v_objs = NULL;
7153 Py_ssize_t __pyx_v_i;
7154 struct __pyx_obj_11pycocotools_5_mask_RLEs *__pyx_v_Rs = NULL;
7155 Py_ssize_t __pyx_v_j;
7156 __Pyx_LocalBuf_ND __pyx_pybuffernd_cnts;
7157 __Pyx_Buffer __pyx_pybuffer_cnts;
7158 PyObject *__pyx_r = NULL;
7159 __Pyx_RefNannyDeclarations
7160 Py_ssize_t __pyx_t_1;
7161 PyObject *__pyx_t_2 = NULL;
7162 Py_ssize_t __pyx_t_3;
7163 PyObject *__pyx_t_4 = NULL;
7164 PyObject *__pyx_t_5 = NULL;
7165 PyObject *__pyx_t_6 = NULL;
7166 PyObject *__pyx_t_7 = NULL;
7167 PyArrayObject *__pyx_t_8 = NULL;
7169 PyObject *__pyx_t_10 = NULL;
7170 PyObject *__pyx_t_11 = NULL;
7171 PyObject *__pyx_t_12 = NULL;
7172 Py_ssize_t __pyx_t_13;
7173 Py_ssize_t __pyx_t_14;
7174 Py_ssize_t __pyx_t_15;
7178 __Pyx_RefNannySetupContext("frUncompressedRLE", 0);
7179 __pyx_pybuffer_cnts.pybuffer.buf = NULL;
7180 __pyx_pybuffer_cnts.refcount = 0;
7181 __pyx_pybuffernd_cnts.data = NULL;
7182 __pyx_pybuffernd_cnts.rcbuffer = &__pyx_pybuffer_cnts;
7184 /* "pycocotools/_mask.pyx":274
7187 * n = len(ucRles) # <<<<<<<<<<<<<<
7189 * for i in range(n):
7191 __pyx_t_1 = PyObject_Length(__pyx_v_ucRles); if (unlikely(__pyx_t_1 == -1)) __PYX_ERR(0, 274, __pyx_L1_error)
7192 __pyx_v_n = __pyx_t_1;
7194 /* "pycocotools/_mask.pyx":275
7197 * objs = [] # <<<<<<<<<<<<<<
7198 * for i in range(n):
7201 __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 275, __pyx_L1_error)
7202 __Pyx_GOTREF(__pyx_t_2);
7203 __pyx_v_objs = ((PyObject*)__pyx_t_2);
7206 /* "pycocotools/_mask.pyx":276
7209 * for i in range(n): # <<<<<<<<<<<<<<
7211 * cnts = np.array(ucRles[i]['counts'], dtype=np.uint32)
7213 __pyx_t_1 = __pyx_v_n;
7214 for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_1; __pyx_t_3+=1) {
7215 __pyx_v_i = __pyx_t_3;
7217 /* "pycocotools/_mask.pyx":277
7219 * for i in range(n):
7220 * Rs = RLEs(1) # <<<<<<<<<<<<<<
7221 * cnts = np.array(ucRles[i]['counts'], dtype=np.uint32)
7222 * # time for malloc can be saved here but it's fine
7224 __pyx_t_2 = __Pyx_PyObject_Call(((PyObject *)__pyx_ptype_11pycocotools_5_mask_RLEs), __pyx_tuple__17, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 277, __pyx_L1_error)
7225 __Pyx_GOTREF(__pyx_t_2);
7226 __Pyx_XDECREF_SET(__pyx_v_Rs, ((struct __pyx_obj_11pycocotools_5_mask_RLEs *)__pyx_t_2));
7229 /* "pycocotools/_mask.pyx":278
7230 * for i in range(n):
7232 * cnts = np.array(ucRles[i]['counts'], dtype=np.uint32) # <<<<<<<<<<<<<<
7233 * # time for malloc can be saved here but it's fine
7234 * data = <uint*> malloc(len(cnts)* sizeof(uint))
7236 __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 278, __pyx_L1_error)
7237 __Pyx_GOTREF(__pyx_t_2);
7238 __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_array); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 278, __pyx_L1_error)
7239 __Pyx_GOTREF(__pyx_t_4);
7240 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7241 __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_ucRles, __pyx_v_i, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 1, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 278, __pyx_L1_error)
7242 __Pyx_GOTREF(__pyx_t_2);
7243 __pyx_t_5 = PyObject_GetItem(__pyx_t_2, __pyx_n_s_counts); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 278, __pyx_L1_error)
7244 __Pyx_GOTREF(__pyx_t_5);
7245 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7246 __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 278, __pyx_L1_error)
7247 __Pyx_GOTREF(__pyx_t_2);
7248 __Pyx_GIVEREF(__pyx_t_5);
7249 PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_5);
7251 __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 278, __pyx_L1_error)
7252 __Pyx_GOTREF(__pyx_t_5);
7253 __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 278, __pyx_L1_error)
7254 __Pyx_GOTREF(__pyx_t_6);
7255 __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_uint32); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 278, __pyx_L1_error)
7256 __Pyx_GOTREF(__pyx_t_7);
7257 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
7258 if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_dtype, __pyx_t_7) < 0) __PYX_ERR(0, 278, __pyx_L1_error)
7259 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
7260 __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_2, __pyx_t_5); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 278, __pyx_L1_error)
7261 __Pyx_GOTREF(__pyx_t_7);
7262 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
7263 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
7264 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
7265 if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_5numpy_ndarray))))) __PYX_ERR(0, 278, __pyx_L1_error)
7266 __pyx_t_8 = ((PyArrayObject *)__pyx_t_7);
7268 __Pyx_BufFmt_StackElem __pyx_stack[1];
7269 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_cnts.rcbuffer->pybuffer);
7270 __pyx_t_9 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_cnts.rcbuffer->pybuffer, (PyObject*)__pyx_t_8, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack);
7271 if (unlikely(__pyx_t_9 < 0)) {
7272 PyErr_Fetch(&__pyx_t_10, &__pyx_t_11, &__pyx_t_12);
7273 if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_cnts.rcbuffer->pybuffer, (PyObject*)__pyx_v_cnts, &__Pyx_TypeInfo_nn___pyx_t_5numpy_uint32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {
7274 Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_11); Py_XDECREF(__pyx_t_12);
7275 __Pyx_RaiseBufferFallbackError();
7277 PyErr_Restore(__pyx_t_10, __pyx_t_11, __pyx_t_12);
7280 __pyx_pybuffernd_cnts.diminfo[0].strides = __pyx_pybuffernd_cnts.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_cnts.diminfo[0].shape = __pyx_pybuffernd_cnts.rcbuffer->pybuffer.shape[0];
7281 if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 278, __pyx_L1_error)
7284 __Pyx_XDECREF_SET(__pyx_v_cnts, ((PyArrayObject *)__pyx_t_7));
7287 /* "pycocotools/_mask.pyx":280
7288 * cnts = np.array(ucRles[i]['counts'], dtype=np.uint32)
7289 * # time for malloc can be saved here but it's fine
7290 * data = <uint*> malloc(len(cnts)* sizeof(uint)) # <<<<<<<<<<<<<<
7291 * for j in range(len(cnts)):
7292 * data[j] = <uint> cnts[j]
7294 __pyx_t_13 = PyObject_Length(((PyObject *)__pyx_v_cnts)); if (unlikely(__pyx_t_13 == -1)) __PYX_ERR(0, 280, __pyx_L1_error)
7295 __pyx_v_data = ((uint *)malloc((__pyx_t_13 * (sizeof(unsigned int)))));
7297 /* "pycocotools/_mask.pyx":281
7298 * # time for malloc can be saved here but it's fine
7299 * data = <uint*> malloc(len(cnts)* sizeof(uint))
7300 * for j in range(len(cnts)): # <<<<<<<<<<<<<<
7301 * data[j] = <uint> cnts[j]
7302 * R = RLE(ucRles[i]['size'][0], ucRles[i]['size'][1], len(cnts), <uint*> data)
7304 __pyx_t_13 = PyObject_Length(((PyObject *)__pyx_v_cnts)); if (unlikely(__pyx_t_13 == -1)) __PYX_ERR(0, 281, __pyx_L1_error)
7305 for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_13; __pyx_t_14+=1) {
7306 __pyx_v_j = __pyx_t_14;
7308 /* "pycocotools/_mask.pyx":282
7309 * data = <uint*> malloc(len(cnts)* sizeof(uint))
7310 * for j in range(len(cnts)):
7311 * data[j] = <uint> cnts[j] # <<<<<<<<<<<<<<
7312 * R = RLE(ucRles[i]['size'][0], ucRles[i]['size'][1], len(cnts), <uint*> data)
7315 __pyx_t_15 = __pyx_v_j;
7317 if (__pyx_t_15 < 0) {
7318 __pyx_t_15 += __pyx_pybuffernd_cnts.diminfo[0].shape;
7319 if (unlikely(__pyx_t_15 < 0)) __pyx_t_9 = 0;
7320 } else if (unlikely(__pyx_t_15 >= __pyx_pybuffernd_cnts.diminfo[0].shape)) __pyx_t_9 = 0;
7321 if (unlikely(__pyx_t_9 != -1)) {
7322 __Pyx_RaiseBufferIndexError(__pyx_t_9);
7323 __PYX_ERR(0, 282, __pyx_L1_error)
7325 (__pyx_v_data[__pyx_v_j]) = ((uint)(*__Pyx_BufPtrStrided1d(__pyx_t_5numpy_uint32_t *, __pyx_pybuffernd_cnts.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_cnts.diminfo[0].strides)));
7328 /* "pycocotools/_mask.pyx":283
7329 * for j in range(len(cnts)):
7330 * data[j] = <uint> cnts[j]
7331 * R = RLE(ucRles[i]['size'][0], ucRles[i]['size'][1], len(cnts), <uint*> data) # <<<<<<<<<<<<<<
7333 * objs.append(_toString(Rs)[0])
7335 __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_ucRles, __pyx_v_i, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 1, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 283, __pyx_L1_error)
7336 __Pyx_GOTREF(__pyx_t_7);
7337 __pyx_t_5 = PyObject_GetItem(__pyx_t_7, __pyx_n_s_size); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 283, __pyx_L1_error)
7338 __Pyx_GOTREF(__pyx_t_5);
7339 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
7340 __pyx_t_7 = __Pyx_GetItemInt(__pyx_t_5, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 283, __pyx_L1_error)
7341 __Pyx_GOTREF(__pyx_t_7);
7342 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
7343 __pyx_t_17 = __Pyx_PyInt_As_siz(__pyx_t_7); if (unlikely((__pyx_t_17 == ((siz)-1)) && PyErr_Occurred())) __PYX_ERR(0, 283, __pyx_L1_error)
7344 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
7345 __pyx_t_16.h = __pyx_t_17;
7346 __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_ucRles, __pyx_v_i, Py_ssize_t, 1, PyInt_FromSsize_t, 0, 1, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 283, __pyx_L1_error)
7347 __Pyx_GOTREF(__pyx_t_7);
7348 __pyx_t_5 = PyObject_GetItem(__pyx_t_7, __pyx_n_s_size); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 283, __pyx_L1_error)
7349 __Pyx_GOTREF(__pyx_t_5);
7350 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
7351 __pyx_t_7 = __Pyx_GetItemInt(__pyx_t_5, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 283, __pyx_L1_error)
7352 __Pyx_GOTREF(__pyx_t_7);
7353 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
7354 __pyx_t_17 = __Pyx_PyInt_As_siz(__pyx_t_7); if (unlikely((__pyx_t_17 == ((siz)-1)) && PyErr_Occurred())) __PYX_ERR(0, 283, __pyx_L1_error)
7355 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
7356 __pyx_t_16.w = __pyx_t_17;
7357 __pyx_t_13 = PyObject_Length(((PyObject *)__pyx_v_cnts)); if (unlikely(__pyx_t_13 == -1)) __PYX_ERR(0, 283, __pyx_L1_error)
7358 __pyx_t_16.m = __pyx_t_13;
7359 __pyx_t_16.cnts = ((uint *)__pyx_v_data);
7360 __pyx_v_R = __pyx_t_16;
7362 /* "pycocotools/_mask.pyx":284
7363 * data[j] = <uint> cnts[j]
7364 * R = RLE(ucRles[i]['size'][0], ucRles[i]['size'][1], len(cnts), <uint*> data)
7365 * Rs._R[0] = R # <<<<<<<<<<<<<<
7366 * objs.append(_toString(Rs)[0])
7369 (__pyx_v_Rs->_R[0]) = __pyx_v_R;
7371 /* "pycocotools/_mask.pyx":285
7372 * R = RLE(ucRles[i]['size'][0], ucRles[i]['size'][1], len(cnts), <uint*> data)
7374 * objs.append(_toString(Rs)[0]) # <<<<<<<<<<<<<<
7378 __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_toString); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 285, __pyx_L1_error)
7379 __Pyx_GOTREF(__pyx_t_5);
7381 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) {
7382 __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_5);
7383 if (likely(__pyx_t_2)) {
7384 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
7385 __Pyx_INCREF(__pyx_t_2);
7386 __Pyx_INCREF(function);
7387 __Pyx_DECREF_SET(__pyx_t_5, function);
7391 __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_t_5, ((PyObject *)__pyx_v_Rs)); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 285, __pyx_L1_error)
7392 __Pyx_GOTREF(__pyx_t_7);
7394 #if CYTHON_FAST_PYCALL
7395 if (PyFunction_Check(__pyx_t_5)) {
7396 PyObject *__pyx_temp[2] = {__pyx_t_2, ((PyObject *)__pyx_v_Rs)};
7397 __pyx_t_7 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 285, __pyx_L1_error)
7398 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
7399 __Pyx_GOTREF(__pyx_t_7);
7402 #if CYTHON_FAST_PYCCALL
7403 if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) {
7404 PyObject *__pyx_temp[2] = {__pyx_t_2, ((PyObject *)__pyx_v_Rs)};
7405 __pyx_t_7 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-1, 1+1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 285, __pyx_L1_error)
7406 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
7407 __Pyx_GOTREF(__pyx_t_7);
7411 __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 285, __pyx_L1_error)
7412 __Pyx_GOTREF(__pyx_t_4);
7413 __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); __pyx_t_2 = NULL;
7414 __Pyx_INCREF(((PyObject *)__pyx_v_Rs));
7415 __Pyx_GIVEREF(((PyObject *)__pyx_v_Rs));
7416 PyTuple_SET_ITEM(__pyx_t_4, 0+1, ((PyObject *)__pyx_v_Rs));
7417 __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_4, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 285, __pyx_L1_error)
7418 __Pyx_GOTREF(__pyx_t_7);
7419 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
7422 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
7423 __pyx_t_5 = __Pyx_GetItemInt(__pyx_t_7, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 285, __pyx_L1_error)
7424 __Pyx_GOTREF(__pyx_t_5);
7425 __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
7426 __pyx_t_18 = __Pyx_PyList_Append(__pyx_v_objs, __pyx_t_5); if (unlikely(__pyx_t_18 == -1)) __PYX_ERR(0, 285, __pyx_L1_error)
7427 __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
7430 /* "pycocotools/_mask.pyx":286
7432 * objs.append(_toString(Rs)[0])
7433 * return objs # <<<<<<<<<<<<<<
7435 * def frPyObjects(pyobj, h, w):
7437 __Pyx_XDECREF(__pyx_r);
7438 __Pyx_INCREF(__pyx_v_objs);
7439 __pyx_r = __pyx_v_objs;
7442 /* "pycocotools/_mask.pyx":270
7445 * def frUncompressedRLE(ucRles, siz h, siz w): # <<<<<<<<<<<<<<
7446 * cdef np.ndarray[np.uint32_t, ndim=1] cnts
7450 /* function exit code */
7452 __Pyx_XDECREF(__pyx_t_2);
7453 __Pyx_XDECREF(__pyx_t_4);
7454 __Pyx_XDECREF(__pyx_t_5);
7455 __Pyx_XDECREF(__pyx_t_6);
7456 __Pyx_XDECREF(__pyx_t_7);
7457 { PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
7458 __Pyx_PyThreadState_declare
7459 __Pyx_PyThreadState_assign
7460 __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
7461 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_cnts.rcbuffer->pybuffer);
7462 __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);}
7463 __Pyx_AddTraceback("pycocotools._mask.frUncompressedRLE", __pyx_clineno, __pyx_lineno, __pyx_filename);
7467 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_cnts.rcbuffer->pybuffer);
7469 __Pyx_XDECREF((PyObject *)__pyx_v_cnts);
7470 __Pyx_XDECREF(__pyx_v_objs);
7471 __Pyx_XDECREF((PyObject *)__pyx_v_Rs);
7472 __Pyx_XGIVEREF(__pyx_r);
7473 __Pyx_RefNannyFinishContext();
7477 /* "pycocotools/_mask.pyx":288
7480 * def frPyObjects(pyobj, h, w): # <<<<<<<<<<<<<<
7481 * # encode rle from a list of python objects
7482 * if type(pyobj) == np.ndarray:
7485 /* Python wrapper */
7486 static PyObject *__pyx_pw_11pycocotools_5_mask_23frPyObjects(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
7487 static PyMethodDef __pyx_mdef_11pycocotools_5_mask_23frPyObjects = {"frPyObjects", (PyCFunction)__pyx_pw_11pycocotools_5_mask_23frPyObjects, METH_VARARGS|METH_KEYWORDS, 0};
7488 static PyObject *__pyx_pw_11pycocotools_5_mask_23frPyObjects(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
7489 PyObject *__pyx_v_pyobj = 0;
7490 PyObject *__pyx_v_h = 0;
7491 PyObject *__pyx_v_w = 0;
7492 PyObject *__pyx_r = 0;
7493 __Pyx_RefNannyDeclarations
7494 __Pyx_RefNannySetupContext("frPyObjects (wrapper)", 0);
7496 static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyobj,&__pyx_n_s_h,&__pyx_n_s_w,0};
7497 PyObject* values[3] = {0,0,0};
7498 if (unlikely(__pyx_kwds)) {
7500 const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
7502 case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
7503 case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
7504 case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
7506 default: goto __pyx_L5_argtuple_error;
7508 kw_args = PyDict_Size(__pyx_kwds);
7511 if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_pyobj)) != 0)) kw_args--;
7512 else goto __pyx_L5_argtuple_error;
7514 if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_h)) != 0)) kw_args--;
7516 __Pyx_RaiseArgtupleInvalid("frPyObjects", 1, 3, 3, 1); __PYX_ERR(0, 288, __pyx_L3_error)
7519 if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_w)) != 0)) kw_args--;
7521 __Pyx_RaiseArgtupleInvalid("frPyObjects", 1, 3, 3, 2); __PYX_ERR(0, 288, __pyx_L3_error)
7524 if (unlikely(kw_args > 0)) {
7525 if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "frPyObjects") < 0)) __PYX_ERR(0, 288, __pyx_L3_error)
7527 } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
7528 goto __pyx_L5_argtuple_error;
7530 values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
7531 values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
7532 values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
7534 __pyx_v_pyobj = values[0];
7535 __pyx_v_h = values[1];
7536 __pyx_v_w = values[2];
7538 goto __pyx_L4_argument_unpacking_done;
7539 __pyx_L5_argtuple_error:;
7540 __Pyx_RaiseArgtupleInvalid("frPyObjects", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 288, __pyx_L3_error)
7542 __Pyx_AddTraceback("pycocotools._mask.frPyObjects", __pyx_clineno, __pyx_lineno, __pyx_filename);
7543 __Pyx_RefNannyFinishContext();
7545 __pyx_L4_argument_unpacking_done:;
7546 __pyx_r = __pyx_pf_11pycocotools_5_mask_22frPyObjects(__pyx_self, __pyx_v_pyobj, __pyx_v_h, __pyx_v_w);
7548 /* function exit code */
7549 __Pyx_RefNannyFinishContext();
7553 static PyObject *__pyx_pf_11pycocotools_5_mask_22frPyObjects(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_pyobj, PyObject *__pyx_v_h, PyObject *__pyx_v_w) {
7554 PyObject *__pyx_v_objs = NULL;
7555 PyObject *__pyx_r = NULL;
7556 __Pyx_RefNannyDeclarations
7557 PyObject *__pyx_t_1 = NULL;
7559 PyObject *__pyx_t_3 = NULL;
7560 PyObject *__pyx_t_4 = NULL;
7562 PyObject *__pyx_t_6 = NULL;
7564 Py_ssize_t __pyx_t_8;
7566 PyObject *__pyx_t_10 = NULL;
7567 __Pyx_RefNannySetupContext("frPyObjects", 0);
7569 /* "pycocotools/_mask.pyx":290
7570 * def frPyObjects(pyobj, h, w):
7571 * # encode rle from a list of python objects
7572 * if type(pyobj) == np.ndarray: # <<<<<<<<<<<<<<
7573 * objs = frBbox(pyobj, h, w)
7574 * elif type(pyobj) == list and len(pyobj[0]) == 4:
7576 __pyx_t_1 = PyObject_RichCompare(((PyObject *)Py_TYPE(__pyx_v_pyobj)), ((PyObject *)__pyx_ptype_5numpy_ndarray), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 290, __pyx_L1_error)
7577 __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 290, __pyx_L1_error)
7578 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7581 /* "pycocotools/_mask.pyx":291
7582 * # encode rle from a list of python objects
7583 * if type(pyobj) == np.ndarray:
7584 * objs = frBbox(pyobj, h, w) # <<<<<<<<<<<<<<
7585 * elif type(pyobj) == list and len(pyobj[0]) == 4:
7586 * objs = frBbox(pyobj, h, w)
7588 __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_frBbox); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 291, __pyx_L1_error)
7589 __Pyx_GOTREF(__pyx_t_3);
7592 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
7593 __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
7594 if (likely(__pyx_t_4)) {
7595 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
7596 __Pyx_INCREF(__pyx_t_4);
7597 __Pyx_INCREF(function);
7598 __Pyx_DECREF_SET(__pyx_t_3, function);
7602 #if CYTHON_FAST_PYCALL
7603 if (PyFunction_Check(__pyx_t_3)) {
7604 PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_v_pyobj, __pyx_v_h, __pyx_v_w};
7605 __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 291, __pyx_L1_error)
7606 __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
7607 __Pyx_GOTREF(__pyx_t_1);
7610 #if CYTHON_FAST_PYCCALL
7611 if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
7612 PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_v_pyobj, __pyx_v_h, __pyx_v_w};
7613 __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 291, __pyx_L1_error)
7614 __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
7615 __Pyx_GOTREF(__pyx_t_1);
7619 __pyx_t_6 = PyTuple_New(3+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 291, __pyx_L1_error)
7620 __Pyx_GOTREF(__pyx_t_6);
7622 __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL;
7624 __Pyx_INCREF(__pyx_v_pyobj);
7625 __Pyx_GIVEREF(__pyx_v_pyobj);
7626 PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_v_pyobj);
7627 __Pyx_INCREF(__pyx_v_h);
7628 __Pyx_GIVEREF(__pyx_v_h);
7629 PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, __pyx_v_h);
7630 __Pyx_INCREF(__pyx_v_w);
7631 __Pyx_GIVEREF(__pyx_v_w);
7632 PyTuple_SET_ITEM(__pyx_t_6, 2+__pyx_t_5, __pyx_v_w);
7633 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 291, __pyx_L1_error)
7634 __Pyx_GOTREF(__pyx_t_1);
7635 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
7637 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7638 __pyx_v_objs = __pyx_t_1;
7641 /* "pycocotools/_mask.pyx":290
7642 * def frPyObjects(pyobj, h, w):
7643 * # encode rle from a list of python objects
7644 * if type(pyobj) == np.ndarray: # <<<<<<<<<<<<<<
7645 * objs = frBbox(pyobj, h, w)
7646 * elif type(pyobj) == list and len(pyobj[0]) == 4:
7651 /* "pycocotools/_mask.pyx":292
7652 * if type(pyobj) == np.ndarray:
7653 * objs = frBbox(pyobj, h, w)
7654 * elif type(pyobj) == list and len(pyobj[0]) == 4: # <<<<<<<<<<<<<<
7655 * objs = frBbox(pyobj, h, w)
7656 * elif type(pyobj) == list and len(pyobj[0]) > 4:
7658 __pyx_t_1 = PyObject_RichCompare(((PyObject *)Py_TYPE(__pyx_v_pyobj)), ((PyObject *)(&PyList_Type)), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 292, __pyx_L1_error)
7659 __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 292, __pyx_L1_error)
7660 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7663 __pyx_t_2 = __pyx_t_7;
7664 goto __pyx_L4_bool_binop_done;
7666 __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_pyobj, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 292, __pyx_L1_error)
7667 __Pyx_GOTREF(__pyx_t_1);
7668 __pyx_t_8 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_8 == -1)) __PYX_ERR(0, 292, __pyx_L1_error)
7669 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7670 __pyx_t_7 = ((__pyx_t_8 == 4) != 0);
7671 __pyx_t_2 = __pyx_t_7;
7672 __pyx_L4_bool_binop_done:;
7675 /* "pycocotools/_mask.pyx":293
7676 * objs = frBbox(pyobj, h, w)
7677 * elif type(pyobj) == list and len(pyobj[0]) == 4:
7678 * objs = frBbox(pyobj, h, w) # <<<<<<<<<<<<<<
7679 * elif type(pyobj) == list and len(pyobj[0]) > 4:
7680 * objs = frPoly(pyobj, h, w)
7682 __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_frBbox); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 293, __pyx_L1_error)
7683 __Pyx_GOTREF(__pyx_t_3);
7686 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
7687 __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_3);
7688 if (likely(__pyx_t_6)) {
7689 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
7690 __Pyx_INCREF(__pyx_t_6);
7691 __Pyx_INCREF(function);
7692 __Pyx_DECREF_SET(__pyx_t_3, function);
7696 #if CYTHON_FAST_PYCALL
7697 if (PyFunction_Check(__pyx_t_3)) {
7698 PyObject *__pyx_temp[4] = {__pyx_t_6, __pyx_v_pyobj, __pyx_v_h, __pyx_v_w};
7699 __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 293, __pyx_L1_error)
7700 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
7701 __Pyx_GOTREF(__pyx_t_1);
7704 #if CYTHON_FAST_PYCCALL
7705 if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
7706 PyObject *__pyx_temp[4] = {__pyx_t_6, __pyx_v_pyobj, __pyx_v_h, __pyx_v_w};
7707 __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 293, __pyx_L1_error)
7708 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
7709 __Pyx_GOTREF(__pyx_t_1);
7713 __pyx_t_4 = PyTuple_New(3+__pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 293, __pyx_L1_error)
7714 __Pyx_GOTREF(__pyx_t_4);
7716 __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_6); __pyx_t_6 = NULL;
7718 __Pyx_INCREF(__pyx_v_pyobj);
7719 __Pyx_GIVEREF(__pyx_v_pyobj);
7720 PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_5, __pyx_v_pyobj);
7721 __Pyx_INCREF(__pyx_v_h);
7722 __Pyx_GIVEREF(__pyx_v_h);
7723 PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_5, __pyx_v_h);
7724 __Pyx_INCREF(__pyx_v_w);
7725 __Pyx_GIVEREF(__pyx_v_w);
7726 PyTuple_SET_ITEM(__pyx_t_4, 2+__pyx_t_5, __pyx_v_w);
7727 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 293, __pyx_L1_error)
7728 __Pyx_GOTREF(__pyx_t_1);
7729 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
7731 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7732 __pyx_v_objs = __pyx_t_1;
7735 /* "pycocotools/_mask.pyx":292
7736 * if type(pyobj) == np.ndarray:
7737 * objs = frBbox(pyobj, h, w)
7738 * elif type(pyobj) == list and len(pyobj[0]) == 4: # <<<<<<<<<<<<<<
7739 * objs = frBbox(pyobj, h, w)
7740 * elif type(pyobj) == list and len(pyobj[0]) > 4:
7745 /* "pycocotools/_mask.pyx":294
7746 * elif type(pyobj) == list and len(pyobj[0]) == 4:
7747 * objs = frBbox(pyobj, h, w)
7748 * elif type(pyobj) == list and len(pyobj[0]) > 4: # <<<<<<<<<<<<<<
7749 * objs = frPoly(pyobj, h, w)
7750 * elif type(pyobj) == list and type(pyobj[0]) == dict \
7752 __pyx_t_1 = PyObject_RichCompare(((PyObject *)Py_TYPE(__pyx_v_pyobj)), ((PyObject *)(&PyList_Type)), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 294, __pyx_L1_error)
7753 __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 294, __pyx_L1_error)
7754 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7757 __pyx_t_2 = __pyx_t_7;
7758 goto __pyx_L6_bool_binop_done;
7760 __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_pyobj, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 294, __pyx_L1_error)
7761 __Pyx_GOTREF(__pyx_t_1);
7762 __pyx_t_8 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_8 == -1)) __PYX_ERR(0, 294, __pyx_L1_error)
7763 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7764 __pyx_t_7 = ((__pyx_t_8 > 4) != 0);
7765 __pyx_t_2 = __pyx_t_7;
7766 __pyx_L6_bool_binop_done:;
7769 /* "pycocotools/_mask.pyx":295
7770 * objs = frBbox(pyobj, h, w)
7771 * elif type(pyobj) == list and len(pyobj[0]) > 4:
7772 * objs = frPoly(pyobj, h, w) # <<<<<<<<<<<<<<
7773 * elif type(pyobj) == list and type(pyobj[0]) == dict \
7774 * and 'counts' in pyobj[0] and 'size' in pyobj[0]:
7776 __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_frPoly); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 295, __pyx_L1_error)
7777 __Pyx_GOTREF(__pyx_t_3);
7780 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
7781 __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
7782 if (likely(__pyx_t_4)) {
7783 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
7784 __Pyx_INCREF(__pyx_t_4);
7785 __Pyx_INCREF(function);
7786 __Pyx_DECREF_SET(__pyx_t_3, function);
7790 #if CYTHON_FAST_PYCALL
7791 if (PyFunction_Check(__pyx_t_3)) {
7792 PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_v_pyobj, __pyx_v_h, __pyx_v_w};
7793 __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 295, __pyx_L1_error)
7794 __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
7795 __Pyx_GOTREF(__pyx_t_1);
7798 #if CYTHON_FAST_PYCCALL
7799 if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
7800 PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_v_pyobj, __pyx_v_h, __pyx_v_w};
7801 __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 295, __pyx_L1_error)
7802 __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
7803 __Pyx_GOTREF(__pyx_t_1);
7807 __pyx_t_6 = PyTuple_New(3+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 295, __pyx_L1_error)
7808 __Pyx_GOTREF(__pyx_t_6);
7810 __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL;
7812 __Pyx_INCREF(__pyx_v_pyobj);
7813 __Pyx_GIVEREF(__pyx_v_pyobj);
7814 PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_v_pyobj);
7815 __Pyx_INCREF(__pyx_v_h);
7816 __Pyx_GIVEREF(__pyx_v_h);
7817 PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, __pyx_v_h);
7818 __Pyx_INCREF(__pyx_v_w);
7819 __Pyx_GIVEREF(__pyx_v_w);
7820 PyTuple_SET_ITEM(__pyx_t_6, 2+__pyx_t_5, __pyx_v_w);
7821 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 295, __pyx_L1_error)
7822 __Pyx_GOTREF(__pyx_t_1);
7823 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
7825 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7826 __pyx_v_objs = __pyx_t_1;
7829 /* "pycocotools/_mask.pyx":294
7830 * elif type(pyobj) == list and len(pyobj[0]) == 4:
7831 * objs = frBbox(pyobj, h, w)
7832 * elif type(pyobj) == list and len(pyobj[0]) > 4: # <<<<<<<<<<<<<<
7833 * objs = frPoly(pyobj, h, w)
7834 * elif type(pyobj) == list and type(pyobj[0]) == dict \
7839 /* "pycocotools/_mask.pyx":296
7840 * elif type(pyobj) == list and len(pyobj[0]) > 4:
7841 * objs = frPoly(pyobj, h, w)
7842 * elif type(pyobj) == list and type(pyobj[0]) == dict \ # <<<<<<<<<<<<<<
7843 * and 'counts' in pyobj[0] and 'size' in pyobj[0]:
7844 * objs = frUncompressedRLE(pyobj, h, w)
7846 __pyx_t_1 = PyObject_RichCompare(((PyObject *)Py_TYPE(__pyx_v_pyobj)), ((PyObject *)(&PyList_Type)), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 296, __pyx_L1_error)
7847 __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 296, __pyx_L1_error)
7848 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7851 __pyx_t_2 = __pyx_t_7;
7852 goto __pyx_L8_bool_binop_done;
7855 /* "pycocotools/_mask.pyx":297
7856 * objs = frPoly(pyobj, h, w)
7857 * elif type(pyobj) == list and type(pyobj[0]) == dict \
7858 * and 'counts' in pyobj[0] and 'size' in pyobj[0]: # <<<<<<<<<<<<<<
7859 * objs = frUncompressedRLE(pyobj, h, w)
7860 * # encode rle from single python object
7862 __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_pyobj, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 296, __pyx_L1_error)
7863 __Pyx_GOTREF(__pyx_t_1);
7865 /* "pycocotools/_mask.pyx":296
7866 * elif type(pyobj) == list and len(pyobj[0]) > 4:
7867 * objs = frPoly(pyobj, h, w)
7868 * elif type(pyobj) == list and type(pyobj[0]) == dict \ # <<<<<<<<<<<<<<
7869 * and 'counts' in pyobj[0] and 'size' in pyobj[0]:
7870 * objs = frUncompressedRLE(pyobj, h, w)
7872 __pyx_t_3 = PyObject_RichCompare(((PyObject *)Py_TYPE(__pyx_t_1)), ((PyObject *)(&PyDict_Type)), Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 296, __pyx_L1_error)
7873 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7874 __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 296, __pyx_L1_error)
7875 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7878 __pyx_t_2 = __pyx_t_7;
7879 goto __pyx_L8_bool_binop_done;
7882 /* "pycocotools/_mask.pyx":297
7883 * objs = frPoly(pyobj, h, w)
7884 * elif type(pyobj) == list and type(pyobj[0]) == dict \
7885 * and 'counts' in pyobj[0] and 'size' in pyobj[0]: # <<<<<<<<<<<<<<
7886 * objs = frUncompressedRLE(pyobj, h, w)
7887 * # encode rle from single python object
7889 __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_pyobj, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 297, __pyx_L1_error)
7890 __Pyx_GOTREF(__pyx_t_3);
7891 __pyx_t_7 = (__Pyx_PySequence_ContainsTF(__pyx_n_s_counts, __pyx_t_3, Py_EQ)); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 297, __pyx_L1_error)
7892 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7893 __pyx_t_9 = (__pyx_t_7 != 0);
7896 __pyx_t_2 = __pyx_t_9;
7897 goto __pyx_L8_bool_binop_done;
7899 __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_pyobj, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 297, __pyx_L1_error)
7900 __Pyx_GOTREF(__pyx_t_3);
7901 __pyx_t_9 = (__Pyx_PySequence_ContainsTF(__pyx_n_s_size, __pyx_t_3, Py_EQ)); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 297, __pyx_L1_error)
7902 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7903 __pyx_t_7 = (__pyx_t_9 != 0);
7904 __pyx_t_2 = __pyx_t_7;
7905 __pyx_L8_bool_binop_done:;
7907 /* "pycocotools/_mask.pyx":296
7908 * elif type(pyobj) == list and len(pyobj[0]) > 4:
7909 * objs = frPoly(pyobj, h, w)
7910 * elif type(pyobj) == list and type(pyobj[0]) == dict \ # <<<<<<<<<<<<<<
7911 * and 'counts' in pyobj[0] and 'size' in pyobj[0]:
7912 * objs = frUncompressedRLE(pyobj, h, w)
7916 /* "pycocotools/_mask.pyx":298
7917 * elif type(pyobj) == list and type(pyobj[0]) == dict \
7918 * and 'counts' in pyobj[0] and 'size' in pyobj[0]:
7919 * objs = frUncompressedRLE(pyobj, h, w) # <<<<<<<<<<<<<<
7920 * # encode rle from single python object
7921 * elif type(pyobj) == list and len(pyobj) == 4:
7923 __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_frUncompressedRLE); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 298, __pyx_L1_error)
7924 __Pyx_GOTREF(__pyx_t_1);
7927 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
7928 __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_1);
7929 if (likely(__pyx_t_6)) {
7930 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
7931 __Pyx_INCREF(__pyx_t_6);
7932 __Pyx_INCREF(function);
7933 __Pyx_DECREF_SET(__pyx_t_1, function);
7937 #if CYTHON_FAST_PYCALL
7938 if (PyFunction_Check(__pyx_t_1)) {
7939 PyObject *__pyx_temp[4] = {__pyx_t_6, __pyx_v_pyobj, __pyx_v_h, __pyx_v_w};
7940 __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 298, __pyx_L1_error)
7941 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
7942 __Pyx_GOTREF(__pyx_t_3);
7945 #if CYTHON_FAST_PYCCALL
7946 if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
7947 PyObject *__pyx_temp[4] = {__pyx_t_6, __pyx_v_pyobj, __pyx_v_h, __pyx_v_w};
7948 __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 298, __pyx_L1_error)
7949 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
7950 __Pyx_GOTREF(__pyx_t_3);
7954 __pyx_t_4 = PyTuple_New(3+__pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 298, __pyx_L1_error)
7955 __Pyx_GOTREF(__pyx_t_4);
7957 __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_6); __pyx_t_6 = NULL;
7959 __Pyx_INCREF(__pyx_v_pyobj);
7960 __Pyx_GIVEREF(__pyx_v_pyobj);
7961 PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_5, __pyx_v_pyobj);
7962 __Pyx_INCREF(__pyx_v_h);
7963 __Pyx_GIVEREF(__pyx_v_h);
7964 PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_5, __pyx_v_h);
7965 __Pyx_INCREF(__pyx_v_w);
7966 __Pyx_GIVEREF(__pyx_v_w);
7967 PyTuple_SET_ITEM(__pyx_t_4, 2+__pyx_t_5, __pyx_v_w);
7968 __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 298, __pyx_L1_error)
7969 __Pyx_GOTREF(__pyx_t_3);
7970 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
7972 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7973 __pyx_v_objs = __pyx_t_3;
7976 /* "pycocotools/_mask.pyx":296
7977 * elif type(pyobj) == list and len(pyobj[0]) > 4:
7978 * objs = frPoly(pyobj, h, w)
7979 * elif type(pyobj) == list and type(pyobj[0]) == dict \ # <<<<<<<<<<<<<<
7980 * and 'counts' in pyobj[0] and 'size' in pyobj[0]:
7981 * objs = frUncompressedRLE(pyobj, h, w)
7986 /* "pycocotools/_mask.pyx":300
7987 * objs = frUncompressedRLE(pyobj, h, w)
7988 * # encode rle from single python object
7989 * elif type(pyobj) == list and len(pyobj) == 4: # <<<<<<<<<<<<<<
7990 * objs = frBbox([pyobj], h, w)[0]
7991 * elif type(pyobj) == list and len(pyobj) > 4:
7993 __pyx_t_3 = PyObject_RichCompare(((PyObject *)Py_TYPE(__pyx_v_pyobj)), ((PyObject *)(&PyList_Type)), Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 300, __pyx_L1_error)
7994 __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 300, __pyx_L1_error)
7995 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7998 __pyx_t_2 = __pyx_t_7;
7999 goto __pyx_L12_bool_binop_done;
8001 __pyx_t_8 = PyObject_Length(__pyx_v_pyobj); if (unlikely(__pyx_t_8 == -1)) __PYX_ERR(0, 300, __pyx_L1_error)
8002 __pyx_t_7 = ((__pyx_t_8 == 4) != 0);
8003 __pyx_t_2 = __pyx_t_7;
8004 __pyx_L12_bool_binop_done:;
8007 /* "pycocotools/_mask.pyx":301
8008 * # encode rle from single python object
8009 * elif type(pyobj) == list and len(pyobj) == 4:
8010 * objs = frBbox([pyobj], h, w)[0] # <<<<<<<<<<<<<<
8011 * elif type(pyobj) == list and len(pyobj) > 4:
8012 * objs = frPoly([pyobj], h, w)[0]
8014 __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_frBbox); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 301, __pyx_L1_error)
8015 __Pyx_GOTREF(__pyx_t_1);
8016 __pyx_t_4 = PyList_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 301, __pyx_L1_error)
8017 __Pyx_GOTREF(__pyx_t_4);
8018 __Pyx_INCREF(__pyx_v_pyobj);
8019 __Pyx_GIVEREF(__pyx_v_pyobj);
8020 PyList_SET_ITEM(__pyx_t_4, 0, __pyx_v_pyobj);
8023 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
8024 __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_1);
8025 if (likely(__pyx_t_6)) {
8026 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
8027 __Pyx_INCREF(__pyx_t_6);
8028 __Pyx_INCREF(function);
8029 __Pyx_DECREF_SET(__pyx_t_1, function);
8033 #if CYTHON_FAST_PYCALL
8034 if (PyFunction_Check(__pyx_t_1)) {
8035 PyObject *__pyx_temp[4] = {__pyx_t_6, __pyx_t_4, __pyx_v_h, __pyx_v_w};
8036 __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 301, __pyx_L1_error)
8037 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
8038 __Pyx_GOTREF(__pyx_t_3);
8039 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
8042 #if CYTHON_FAST_PYCCALL
8043 if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
8044 PyObject *__pyx_temp[4] = {__pyx_t_6, __pyx_t_4, __pyx_v_h, __pyx_v_w};
8045 __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 301, __pyx_L1_error)
8046 __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0;
8047 __Pyx_GOTREF(__pyx_t_3);
8048 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
8052 __pyx_t_10 = PyTuple_New(3+__pyx_t_5); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 301, __pyx_L1_error)
8053 __Pyx_GOTREF(__pyx_t_10);
8055 __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_6); __pyx_t_6 = NULL;
8057 __Pyx_GIVEREF(__pyx_t_4);
8058 PyTuple_SET_ITEM(__pyx_t_10, 0+__pyx_t_5, __pyx_t_4);
8059 __Pyx_INCREF(__pyx_v_h);
8060 __Pyx_GIVEREF(__pyx_v_h);
8061 PyTuple_SET_ITEM(__pyx_t_10, 1+__pyx_t_5, __pyx_v_h);
8062 __Pyx_INCREF(__pyx_v_w);
8063 __Pyx_GIVEREF(__pyx_v_w);
8064 PyTuple_SET_ITEM(__pyx_t_10, 2+__pyx_t_5, __pyx_v_w);
8066 __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_10, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 301, __pyx_L1_error)
8067 __Pyx_GOTREF(__pyx_t_3);
8068 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
8070 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8071 __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_3, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 301, __pyx_L1_error)
8072 __Pyx_GOTREF(__pyx_t_1);
8073 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
8074 __pyx_v_objs = __pyx_t_1;
8077 /* "pycocotools/_mask.pyx":300
8078 * objs = frUncompressedRLE(pyobj, h, w)
8079 * # encode rle from single python object
8080 * elif type(pyobj) == list and len(pyobj) == 4: # <<<<<<<<<<<<<<
8081 * objs = frBbox([pyobj], h, w)[0]
8082 * elif type(pyobj) == list and len(pyobj) > 4:
8087 /* "pycocotools/_mask.pyx":302
8088 * elif type(pyobj) == list and len(pyobj) == 4:
8089 * objs = frBbox([pyobj], h, w)[0]
8090 * elif type(pyobj) == list and len(pyobj) > 4: # <<<<<<<<<<<<<<
8091 * objs = frPoly([pyobj], h, w)[0]
8092 * elif type(pyobj) == dict and 'counts' in pyobj and 'size' in pyobj:
8094 __pyx_t_1 = PyObject_RichCompare(((PyObject *)Py_TYPE(__pyx_v_pyobj)), ((PyObject *)(&PyList_Type)), Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 302, __pyx_L1_error)
8095 __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 302, __pyx_L1_error)
8096 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8099 __pyx_t_2 = __pyx_t_7;
8100 goto __pyx_L14_bool_binop_done;
8102 __pyx_t_8 = PyObject_Length(__pyx_v_pyobj); if (unlikely(__pyx_t_8 == -1)) __PYX_ERR(0, 302, __pyx_L1_error)
8103 __pyx_t_7 = ((__pyx_t_8 > 4) != 0);
8104 __pyx_t_2 = __pyx_t_7;
8105 __pyx_L14_bool_binop_done:;
8108 /* "pycocotools/_mask.pyx":303
8109 * objs = frBbox([pyobj], h, w)[0]
8110 * elif type(pyobj) == list and len(pyobj) > 4:
8111 * objs = frPoly([pyobj], h, w)[0] # <<<<<<<<<<<<<<
8112 * elif type(pyobj) == dict and 'counts' in pyobj and 'size' in pyobj:
8113 * objs = frUncompressedRLE([pyobj], h, w)[0]
8115 __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_frPoly); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 303, __pyx_L1_error)
8116 __Pyx_GOTREF(__pyx_t_3);
8117 __pyx_t_10 = PyList_New(1); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 303, __pyx_L1_error)
8118 __Pyx_GOTREF(__pyx_t_10);
8119 __Pyx_INCREF(__pyx_v_pyobj);
8120 __Pyx_GIVEREF(__pyx_v_pyobj);
8121 PyList_SET_ITEM(__pyx_t_10, 0, __pyx_v_pyobj);
8124 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) {
8125 __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
8126 if (likely(__pyx_t_4)) {
8127 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
8128 __Pyx_INCREF(__pyx_t_4);
8129 __Pyx_INCREF(function);
8130 __Pyx_DECREF_SET(__pyx_t_3, function);
8134 #if CYTHON_FAST_PYCALL
8135 if (PyFunction_Check(__pyx_t_3)) {
8136 PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_t_10, __pyx_v_h, __pyx_v_w};
8137 __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 303, __pyx_L1_error)
8138 __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
8139 __Pyx_GOTREF(__pyx_t_1);
8140 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
8143 #if CYTHON_FAST_PYCCALL
8144 if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) {
8145 PyObject *__pyx_temp[4] = {__pyx_t_4, __pyx_t_10, __pyx_v_h, __pyx_v_w};
8146 __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 303, __pyx_L1_error)
8147 __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0;
8148 __Pyx_GOTREF(__pyx_t_1);
8149 __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
8153 __pyx_t_6 = PyTuple_New(3+__pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 303, __pyx_L1_error)
8154 __Pyx_GOTREF(__pyx_t_6);
8156 __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL;
8158 __Pyx_GIVEREF(__pyx_t_10);
8159 PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_5, __pyx_t_10);
8160 __Pyx_INCREF(__pyx_v_h);
8161 __Pyx_GIVEREF(__pyx_v_h);
8162 PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_5, __pyx_v_h);
8163 __Pyx_INCREF(__pyx_v_w);
8164 __Pyx_GIVEREF(__pyx_v_w);
8165 PyTuple_SET_ITEM(__pyx_t_6, 2+__pyx_t_5, __pyx_v_w);
8167 __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 303, __pyx_L1_error)
8168 __Pyx_GOTREF(__pyx_t_1);
8169 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
8171 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
8172 __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_1, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 303, __pyx_L1_error)
8173 __Pyx_GOTREF(__pyx_t_3);
8174 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8175 __pyx_v_objs = __pyx_t_3;
8178 /* "pycocotools/_mask.pyx":302
8179 * elif type(pyobj) == list and len(pyobj) == 4:
8180 * objs = frBbox([pyobj], h, w)[0]
8181 * elif type(pyobj) == list and len(pyobj) > 4: # <<<<<<<<<<<<<<
8182 * objs = frPoly([pyobj], h, w)[0]
8183 * elif type(pyobj) == dict and 'counts' in pyobj and 'size' in pyobj:
8188 /* "pycocotools/_mask.pyx":304
8189 * elif type(pyobj) == list and len(pyobj) > 4:
8190 * objs = frPoly([pyobj], h, w)[0]
8191 * elif type(pyobj) == dict and 'counts' in pyobj and 'size' in pyobj: # <<<<<<<<<<<<<<
8192 * objs = frUncompressedRLE([pyobj], h, w)[0]
8195 __pyx_t_3 = PyObject_RichCompare(((PyObject *)Py_TYPE(__pyx_v_pyobj)), ((PyObject *)(&PyDict_Type)), Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 304, __pyx_L1_error)
8196 __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 304, __pyx_L1_error)
8197 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
8200 __pyx_t_2 = __pyx_t_7;
8201 goto __pyx_L16_bool_binop_done;
8203 __pyx_t_7 = (__Pyx_PySequence_ContainsTF(__pyx_n_s_counts, __pyx_v_pyobj, Py_EQ)); if (unlikely(__pyx_t_7 < 0)) __PYX_ERR(0, 304, __pyx_L1_error)
8204 __pyx_t_9 = (__pyx_t_7 != 0);
8207 __pyx_t_2 = __pyx_t_9;
8208 goto __pyx_L16_bool_binop_done;
8210 __pyx_t_9 = (__Pyx_PySequence_ContainsTF(__pyx_n_s_size, __pyx_v_pyobj, Py_EQ)); if (unlikely(__pyx_t_9 < 0)) __PYX_ERR(0, 304, __pyx_L1_error)
8211 __pyx_t_7 = (__pyx_t_9 != 0);
8212 __pyx_t_2 = __pyx_t_7;
8213 __pyx_L16_bool_binop_done:;
8216 /* "pycocotools/_mask.pyx":305
8217 * objs = frPoly([pyobj], h, w)[0]
8218 * elif type(pyobj) == dict and 'counts' in pyobj and 'size' in pyobj:
8219 * objs = frUncompressedRLE([pyobj], h, w)[0] # <<<<<<<<<<<<<<
8221 * raise Exception('input type is not supported.')
8223 __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_frUncompressedRLE); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 305, __pyx_L1_error)
8224 __Pyx_GOTREF(__pyx_t_1);
8225 __pyx_t_6 = PyList_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 305, __pyx_L1_error)
8226 __Pyx_GOTREF(__pyx_t_6);
8227 __Pyx_INCREF(__pyx_v_pyobj);
8228 __Pyx_GIVEREF(__pyx_v_pyobj);
8229 PyList_SET_ITEM(__pyx_t_6, 0, __pyx_v_pyobj);
8232 if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) {
8233 __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_1);
8234 if (likely(__pyx_t_10)) {
8235 PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
8236 __Pyx_INCREF(__pyx_t_10);
8237 __Pyx_INCREF(function);
8238 __Pyx_DECREF_SET(__pyx_t_1, function);
8242 #if CYTHON_FAST_PYCALL
8243 if (PyFunction_Check(__pyx_t_1)) {
8244 PyObject *__pyx_temp[4] = {__pyx_t_10, __pyx_t_6, __pyx_v_h, __pyx_v_w};
8245 __pyx_t_3 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 305, __pyx_L1_error)
8246 __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
8247 __Pyx_GOTREF(__pyx_t_3);
8248 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
8251 #if CYTHON_FAST_PYCCALL
8252 if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) {
8253 PyObject *__pyx_temp[4] = {__pyx_t_10, __pyx_t_6, __pyx_v_h, __pyx_v_w};
8254 __pyx_t_3 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_5, 3+__pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 305, __pyx_L1_error)
8255 __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0;
8256 __Pyx_GOTREF(__pyx_t_3);
8257 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
8261 __pyx_t_4 = PyTuple_New(3+__pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 305, __pyx_L1_error)
8262 __Pyx_GOTREF(__pyx_t_4);
8264 __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_10); __pyx_t_10 = NULL;
8266 __Pyx_GIVEREF(__pyx_t_6);
8267 PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_5, __pyx_t_6);
8268 __Pyx_INCREF(__pyx_v_h);
8269 __Pyx_GIVEREF(__pyx_v_h);
8270 PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_5, __pyx_v_h);
8271 __Pyx_INCREF(__pyx_v_w);
8272 __Pyx_GIVEREF(__pyx_v_w);
8273 PyTuple_SET_ITEM(__pyx_t_4, 2+__pyx_t_5, __pyx_v_w);
8275 __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 305, __pyx_L1_error)
8276 __Pyx_GOTREF(__pyx_t_3);
8277 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
8279 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8280 __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_3, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 305, __pyx_L1_error)
8281 __Pyx_GOTREF(__pyx_t_1);
8282 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
8283 __pyx_v_objs = __pyx_t_1;
8286 /* "pycocotools/_mask.pyx":304
8287 * elif type(pyobj) == list and len(pyobj) > 4:
8288 * objs = frPoly([pyobj], h, w)[0]
8289 * elif type(pyobj) == dict and 'counts' in pyobj and 'size' in pyobj: # <<<<<<<<<<<<<<
8290 * objs = frUncompressedRLE([pyobj], h, w)[0]
8296 /* "pycocotools/_mask.pyx":307
8297 * objs = frUncompressedRLE([pyobj], h, w)[0]
8299 * raise Exception('input type is not supported.') # <<<<<<<<<<<<<<
8303 __pyx_t_1 = __Pyx_PyObject_Call(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])), __pyx_tuple__18, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 307, __pyx_L1_error)
8304 __Pyx_GOTREF(__pyx_t_1);
8305 __Pyx_Raise(__pyx_t_1, 0, 0, 0);
8306 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
8307 __PYX_ERR(0, 307, __pyx_L1_error)
8311 /* "pycocotools/_mask.pyx":308
8313 * raise Exception('input type is not supported.')
8314 * return objs # <<<<<<<<<<<<<<
8316 __Pyx_XDECREF(__pyx_r);
8317 __Pyx_INCREF(__pyx_v_objs);
8318 __pyx_r = __pyx_v_objs;
8321 /* "pycocotools/_mask.pyx":288
8324 * def frPyObjects(pyobj, h, w): # <<<<<<<<<<<<<<
8325 * # encode rle from a list of python objects
8326 * if type(pyobj) == np.ndarray:
8329 /* function exit code */
8331 __Pyx_XDECREF(__pyx_t_1);
8332 __Pyx_XDECREF(__pyx_t_3);
8333 __Pyx_XDECREF(__pyx_t_4);
8334 __Pyx_XDECREF(__pyx_t_6);
8335 __Pyx_XDECREF(__pyx_t_10);
8336 __Pyx_AddTraceback("pycocotools._mask.frPyObjects", __pyx_clineno, __pyx_lineno, __pyx_filename);
8339 __Pyx_XDECREF(__pyx_v_objs);
8340 __Pyx_XGIVEREF(__pyx_r);
8341 __Pyx_RefNannyFinishContext();
8345 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":197
8346 * # experimental exception made for __getbuffer__ and __releasebuffer__
8347 * # -- the details of this may change.
8348 * def __getbuffer__(ndarray self, Py_buffer* info, int flags): # <<<<<<<<<<<<<<
8349 * # This implementation of getbuffer is geared towards Cython
8350 * # requirements, and does not yet fullfill the PEP.
8353 /* Python wrapper */
8354 static CYTHON_UNUSED int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/
8355 static CYTHON_UNUSED int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
8357 __Pyx_RefNannyDeclarations
8358 __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0);
8359 __pyx_r = __pyx_pf_5numpy_7ndarray___getbuffer__(((PyArrayObject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags));
8361 /* function exit code */
8362 __Pyx_RefNannyFinishContext();
8366 static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) {
8367 int __pyx_v_copy_shape;
8370 int __pyx_v_endian_detector;
8371 int __pyx_v_little_endian;
8374 PyArray_Descr *__pyx_v_descr = 0;
8376 int __pyx_v_hasfields;
8378 __Pyx_RefNannyDeclarations
8381 PyObject *__pyx_t_3 = NULL;
8384 PyObject *__pyx_t_6 = NULL;
8386 __Pyx_RefNannySetupContext("__getbuffer__", 0);
8387 if (__pyx_v_info != NULL) {
8388 __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None);
8389 __Pyx_GIVEREF(__pyx_v_info->obj);
8392 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":203
8395 * if info == NULL: return # <<<<<<<<<<<<<<
8397 * cdef int copy_shape, i, ndim
8399 __pyx_t_1 = ((__pyx_v_info == NULL) != 0);
8405 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":206
8407 * cdef int copy_shape, i, ndim
8408 * cdef int endian_detector = 1 # <<<<<<<<<<<<<<
8409 * cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)
8412 __pyx_v_endian_detector = 1;
8414 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":207
8415 * cdef int copy_shape, i, ndim
8416 * cdef int endian_detector = 1
8417 * cdef bint little_endian = ((<char*>&endian_detector)[0] != 0) # <<<<<<<<<<<<<<
8419 * ndim = PyArray_NDIM(self)
8421 __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0);
8423 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":209
8424 * cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)
8426 * ndim = PyArray_NDIM(self) # <<<<<<<<<<<<<<
8428 * if sizeof(npy_intp) != sizeof(Py_ssize_t):
8430 __pyx_v_ndim = PyArray_NDIM(__pyx_v_self);
8432 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":211
8433 * ndim = PyArray_NDIM(self)
8435 * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<<
8439 __pyx_t_1 = (((sizeof(npy_intp)) != (sizeof(Py_ssize_t))) != 0);
8442 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":212
8444 * if sizeof(npy_intp) != sizeof(Py_ssize_t):
8445 * copy_shape = 1 # <<<<<<<<<<<<<<
8449 __pyx_v_copy_shape = 1;
8451 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":211
8452 * ndim = PyArray_NDIM(self)
8454 * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<<
8461 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":214
8464 * copy_shape = 0 # <<<<<<<<<<<<<<
8466 * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
8469 __pyx_v_copy_shape = 0;
8473 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":216
8476 * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) # <<<<<<<<<<<<<<
8477 * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)):
8478 * raise ValueError(u"ndarray is not C contiguous")
8480 __pyx_t_2 = (((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS) != 0);
8483 __pyx_t_1 = __pyx_t_2;
8484 goto __pyx_L6_bool_binop_done;
8487 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":217
8489 * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
8490 * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): # <<<<<<<<<<<<<<
8491 * raise ValueError(u"ndarray is not C contiguous")
8494 __pyx_t_2 = ((!(PyArray_CHKFLAGS(__pyx_v_self, NPY_C_CONTIGUOUS) != 0)) != 0);
8495 __pyx_t_1 = __pyx_t_2;
8496 __pyx_L6_bool_binop_done:;
8498 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":216
8501 * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) # <<<<<<<<<<<<<<
8502 * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)):
8503 * raise ValueError(u"ndarray is not C contiguous")
8507 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":218
8508 * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
8509 * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)):
8510 * raise ValueError(u"ndarray is not C contiguous") # <<<<<<<<<<<<<<
8512 * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
8514 __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__19, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 218, __pyx_L1_error)
8515 __Pyx_GOTREF(__pyx_t_3);
8516 __Pyx_Raise(__pyx_t_3, 0, 0, 0);
8517 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
8518 __PYX_ERR(1, 218, __pyx_L1_error)
8520 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":216
8523 * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) # <<<<<<<<<<<<<<
8524 * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)):
8525 * raise ValueError(u"ndarray is not C contiguous")
8529 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":220
8530 * raise ValueError(u"ndarray is not C contiguous")
8532 * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) # <<<<<<<<<<<<<<
8533 * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)):
8534 * raise ValueError(u"ndarray is not Fortran contiguous")
8536 __pyx_t_2 = (((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS) != 0);
8539 __pyx_t_1 = __pyx_t_2;
8540 goto __pyx_L9_bool_binop_done;
8543 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":221
8545 * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
8546 * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): # <<<<<<<<<<<<<<
8547 * raise ValueError(u"ndarray is not Fortran contiguous")
8550 __pyx_t_2 = ((!(PyArray_CHKFLAGS(__pyx_v_self, NPY_F_CONTIGUOUS) != 0)) != 0);
8551 __pyx_t_1 = __pyx_t_2;
8552 __pyx_L9_bool_binop_done:;
8554 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":220
8555 * raise ValueError(u"ndarray is not C contiguous")
8557 * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) # <<<<<<<<<<<<<<
8558 * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)):
8559 * raise ValueError(u"ndarray is not Fortran contiguous")
8563 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":222
8564 * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
8565 * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)):
8566 * raise ValueError(u"ndarray is not Fortran contiguous") # <<<<<<<<<<<<<<
8568 * info.buf = PyArray_DATA(self)
8570 __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__20, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 222, __pyx_L1_error)
8571 __Pyx_GOTREF(__pyx_t_3);
8572 __Pyx_Raise(__pyx_t_3, 0, 0, 0);
8573 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
8574 __PYX_ERR(1, 222, __pyx_L1_error)
8576 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":220
8577 * raise ValueError(u"ndarray is not C contiguous")
8579 * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) # <<<<<<<<<<<<<<
8580 * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)):
8581 * raise ValueError(u"ndarray is not Fortran contiguous")
8585 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":224
8586 * raise ValueError(u"ndarray is not Fortran contiguous")
8588 * info.buf = PyArray_DATA(self) # <<<<<<<<<<<<<<
8592 __pyx_v_info->buf = PyArray_DATA(__pyx_v_self);
8594 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":225
8596 * info.buf = PyArray_DATA(self)
8597 * info.ndim = ndim # <<<<<<<<<<<<<<
8599 * # Allocate new buffer for strides and shape info.
8601 __pyx_v_info->ndim = __pyx_v_ndim;
8603 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":226
8604 * info.buf = PyArray_DATA(self)
8606 * if copy_shape: # <<<<<<<<<<<<<<
8607 * # Allocate new buffer for strides and shape info.
8608 * # This is allocated as one block, strides first.
8610 __pyx_t_1 = (__pyx_v_copy_shape != 0);
8613 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":229
8614 * # Allocate new buffer for strides and shape info.
8615 * # This is allocated as one block, strides first.
8616 * info.strides = <Py_ssize_t*>stdlib.malloc(sizeof(Py_ssize_t) * <size_t>ndim * 2) # <<<<<<<<<<<<<<
8617 * info.shape = info.strides + ndim
8618 * for i in range(ndim):
8620 __pyx_v_info->strides = ((Py_ssize_t *)malloc((((sizeof(Py_ssize_t)) * ((size_t)__pyx_v_ndim)) * 2)));
8622 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":230
8623 * # This is allocated as one block, strides first.
8624 * info.strides = <Py_ssize_t*>stdlib.malloc(sizeof(Py_ssize_t) * <size_t>ndim * 2)
8625 * info.shape = info.strides + ndim # <<<<<<<<<<<<<<
8626 * for i in range(ndim):
8627 * info.strides[i] = PyArray_STRIDES(self)[i]
8629 __pyx_v_info->shape = (__pyx_v_info->strides + __pyx_v_ndim);
8631 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":231
8632 * info.strides = <Py_ssize_t*>stdlib.malloc(sizeof(Py_ssize_t) * <size_t>ndim * 2)
8633 * info.shape = info.strides + ndim
8634 * for i in range(ndim): # <<<<<<<<<<<<<<
8635 * info.strides[i] = PyArray_STRIDES(self)[i]
8636 * info.shape[i] = PyArray_DIMS(self)[i]
8638 __pyx_t_4 = __pyx_v_ndim;
8639 for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) {
8640 __pyx_v_i = __pyx_t_5;
8642 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":232
8643 * info.shape = info.strides + ndim
8644 * for i in range(ndim):
8645 * info.strides[i] = PyArray_STRIDES(self)[i] # <<<<<<<<<<<<<<
8646 * info.shape[i] = PyArray_DIMS(self)[i]
8649 (__pyx_v_info->strides[__pyx_v_i]) = (PyArray_STRIDES(__pyx_v_self)[__pyx_v_i]);
8651 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":233
8652 * for i in range(ndim):
8653 * info.strides[i] = PyArray_STRIDES(self)[i]
8654 * info.shape[i] = PyArray_DIMS(self)[i] # <<<<<<<<<<<<<<
8656 * info.strides = <Py_ssize_t*>PyArray_STRIDES(self)
8658 (__pyx_v_info->shape[__pyx_v_i]) = (PyArray_DIMS(__pyx_v_self)[__pyx_v_i]);
8661 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":226
8662 * info.buf = PyArray_DATA(self)
8664 * if copy_shape: # <<<<<<<<<<<<<<
8665 * # Allocate new buffer for strides and shape info.
8666 * # This is allocated as one block, strides first.
8671 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":235
8672 * info.shape[i] = PyArray_DIMS(self)[i]
8674 * info.strides = <Py_ssize_t*>PyArray_STRIDES(self) # <<<<<<<<<<<<<<
8675 * info.shape = <Py_ssize_t*>PyArray_DIMS(self)
8676 * info.suboffsets = NULL
8679 __pyx_v_info->strides = ((Py_ssize_t *)PyArray_STRIDES(__pyx_v_self));
8681 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":236
8683 * info.strides = <Py_ssize_t*>PyArray_STRIDES(self)
8684 * info.shape = <Py_ssize_t*>PyArray_DIMS(self) # <<<<<<<<<<<<<<
8685 * info.suboffsets = NULL
8686 * info.itemsize = PyArray_ITEMSIZE(self)
8688 __pyx_v_info->shape = ((Py_ssize_t *)PyArray_DIMS(__pyx_v_self));
8692 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":237
8693 * info.strides = <Py_ssize_t*>PyArray_STRIDES(self)
8694 * info.shape = <Py_ssize_t*>PyArray_DIMS(self)
8695 * info.suboffsets = NULL # <<<<<<<<<<<<<<
8696 * info.itemsize = PyArray_ITEMSIZE(self)
8697 * info.readonly = not PyArray_ISWRITEABLE(self)
8699 __pyx_v_info->suboffsets = NULL;
8701 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":238
8702 * info.shape = <Py_ssize_t*>PyArray_DIMS(self)
8703 * info.suboffsets = NULL
8704 * info.itemsize = PyArray_ITEMSIZE(self) # <<<<<<<<<<<<<<
8705 * info.readonly = not PyArray_ISWRITEABLE(self)
8708 __pyx_v_info->itemsize = PyArray_ITEMSIZE(__pyx_v_self);
8710 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":239
8711 * info.suboffsets = NULL
8712 * info.itemsize = PyArray_ITEMSIZE(self)
8713 * info.readonly = not PyArray_ISWRITEABLE(self) # <<<<<<<<<<<<<<
8717 __pyx_v_info->readonly = (!(PyArray_ISWRITEABLE(__pyx_v_self) != 0));
8719 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":242
8722 * cdef char* f = NULL # <<<<<<<<<<<<<<
8723 * cdef dtype descr = self.descr
8728 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":243
8730 * cdef char* f = NULL
8731 * cdef dtype descr = self.descr # <<<<<<<<<<<<<<
8735 __pyx_t_3 = ((PyObject *)__pyx_v_self->descr);
8736 __Pyx_INCREF(__pyx_t_3);
8737 __pyx_v_descr = ((PyArray_Descr *)__pyx_t_3);
8740 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":246
8743 * cdef bint hasfields = PyDataType_HASFIELDS(descr) # <<<<<<<<<<<<<<
8745 * if not hasfields and not copy_shape:
8747 __pyx_v_hasfields = PyDataType_HASFIELDS(__pyx_v_descr);
8749 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":248
8750 * cdef bint hasfields = PyDataType_HASFIELDS(descr)
8752 * if not hasfields and not copy_shape: # <<<<<<<<<<<<<<
8753 * # do not call releasebuffer
8756 __pyx_t_2 = ((!(__pyx_v_hasfields != 0)) != 0);
8759 __pyx_t_1 = __pyx_t_2;
8760 goto __pyx_L15_bool_binop_done;
8762 __pyx_t_2 = ((!(__pyx_v_copy_shape != 0)) != 0);
8763 __pyx_t_1 = __pyx_t_2;
8764 __pyx_L15_bool_binop_done:;
8767 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":250
8768 * if not hasfields and not copy_shape:
8769 * # do not call releasebuffer
8770 * info.obj = None # <<<<<<<<<<<<<<
8772 * # need to call releasebuffer
8774 __Pyx_INCREF(Py_None);
8775 __Pyx_GIVEREF(Py_None);
8776 __Pyx_GOTREF(__pyx_v_info->obj);
8777 __Pyx_DECREF(__pyx_v_info->obj);
8778 __pyx_v_info->obj = Py_None;
8780 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":248
8781 * cdef bint hasfields = PyDataType_HASFIELDS(descr)
8783 * if not hasfields and not copy_shape: # <<<<<<<<<<<<<<
8784 * # do not call releasebuffer
8790 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":253
8792 * # need to call releasebuffer
8793 * info.obj = self # <<<<<<<<<<<<<<
8798 __Pyx_INCREF(((PyObject *)__pyx_v_self));
8799 __Pyx_GIVEREF(((PyObject *)__pyx_v_self));
8800 __Pyx_GOTREF(__pyx_v_info->obj);
8801 __Pyx_DECREF(__pyx_v_info->obj);
8802 __pyx_v_info->obj = ((PyObject *)__pyx_v_self);
8806 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":255
8809 * if not hasfields: # <<<<<<<<<<<<<<
8810 * t = descr.type_num
8811 * if ((descr.byteorder == c'>' and little_endian) or
8813 __pyx_t_1 = ((!(__pyx_v_hasfields != 0)) != 0);
8816 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":256
8819 * t = descr.type_num # <<<<<<<<<<<<<<
8820 * if ((descr.byteorder == c'>' and little_endian) or
8821 * (descr.byteorder == c'<' and not little_endian)):
8823 __pyx_t_4 = __pyx_v_descr->type_num;
8824 __pyx_v_t = __pyx_t_4;
8826 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":257
8828 * t = descr.type_num
8829 * if ((descr.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<<
8830 * (descr.byteorder == c'<' and not little_endian)):
8831 * raise ValueError(u"Non-native byte order not supported")
8833 __pyx_t_2 = ((__pyx_v_descr->byteorder == '>') != 0);
8835 goto __pyx_L20_next_or;
8838 __pyx_t_2 = (__pyx_v_little_endian != 0);
8841 __pyx_t_1 = __pyx_t_2;
8842 goto __pyx_L19_bool_binop_done;
8846 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":258
8847 * t = descr.type_num
8848 * if ((descr.byteorder == c'>' and little_endian) or
8849 * (descr.byteorder == c'<' and not little_endian)): # <<<<<<<<<<<<<<
8850 * raise ValueError(u"Non-native byte order not supported")
8851 * if t == NPY_BYTE: f = "b"
8853 __pyx_t_2 = ((__pyx_v_descr->byteorder == '<') != 0);
8856 __pyx_t_1 = __pyx_t_2;
8857 goto __pyx_L19_bool_binop_done;
8859 __pyx_t_2 = ((!(__pyx_v_little_endian != 0)) != 0);
8860 __pyx_t_1 = __pyx_t_2;
8861 __pyx_L19_bool_binop_done:;
8863 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":257
8865 * t = descr.type_num
8866 * if ((descr.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<<
8867 * (descr.byteorder == c'<' and not little_endian)):
8868 * raise ValueError(u"Non-native byte order not supported")
8872 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":259
8873 * if ((descr.byteorder == c'>' and little_endian) or
8874 * (descr.byteorder == c'<' and not little_endian)):
8875 * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<<
8876 * if t == NPY_BYTE: f = "b"
8877 * elif t == NPY_UBYTE: f = "B"
8879 __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__21, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 259, __pyx_L1_error)
8880 __Pyx_GOTREF(__pyx_t_3);
8881 __Pyx_Raise(__pyx_t_3, 0, 0, 0);
8882 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
8883 __PYX_ERR(1, 259, __pyx_L1_error)
8885 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":257
8887 * t = descr.type_num
8888 * if ((descr.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<<
8889 * (descr.byteorder == c'<' and not little_endian)):
8890 * raise ValueError(u"Non-native byte order not supported")
8894 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":260
8895 * (descr.byteorder == c'<' and not little_endian)):
8896 * raise ValueError(u"Non-native byte order not supported")
8897 * if t == NPY_BYTE: f = "b" # <<<<<<<<<<<<<<
8898 * elif t == NPY_UBYTE: f = "B"
8899 * elif t == NPY_SHORT: f = "h"
8901 switch (__pyx_v_t) {
8903 __pyx_v_f = ((char *)"b");
8906 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":261
8907 * raise ValueError(u"Non-native byte order not supported")
8908 * if t == NPY_BYTE: f = "b"
8909 * elif t == NPY_UBYTE: f = "B" # <<<<<<<<<<<<<<
8910 * elif t == NPY_SHORT: f = "h"
8911 * elif t == NPY_USHORT: f = "H"
8914 __pyx_v_f = ((char *)"B");
8917 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":262
8918 * if t == NPY_BYTE: f = "b"
8919 * elif t == NPY_UBYTE: f = "B"
8920 * elif t == NPY_SHORT: f = "h" # <<<<<<<<<<<<<<
8921 * elif t == NPY_USHORT: f = "H"
8922 * elif t == NPY_INT: f = "i"
8925 __pyx_v_f = ((char *)"h");
8928 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":263
8929 * elif t == NPY_UBYTE: f = "B"
8930 * elif t == NPY_SHORT: f = "h"
8931 * elif t == NPY_USHORT: f = "H" # <<<<<<<<<<<<<<
8932 * elif t == NPY_INT: f = "i"
8933 * elif t == NPY_UINT: f = "I"
8936 __pyx_v_f = ((char *)"H");
8939 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":264
8940 * elif t == NPY_SHORT: f = "h"
8941 * elif t == NPY_USHORT: f = "H"
8942 * elif t == NPY_INT: f = "i" # <<<<<<<<<<<<<<
8943 * elif t == NPY_UINT: f = "I"
8944 * elif t == NPY_LONG: f = "l"
8947 __pyx_v_f = ((char *)"i");
8950 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":265
8951 * elif t == NPY_USHORT: f = "H"
8952 * elif t == NPY_INT: f = "i"
8953 * elif t == NPY_UINT: f = "I" # <<<<<<<<<<<<<<
8954 * elif t == NPY_LONG: f = "l"
8955 * elif t == NPY_ULONG: f = "L"
8958 __pyx_v_f = ((char *)"I");
8961 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":266
8962 * elif t == NPY_INT: f = "i"
8963 * elif t == NPY_UINT: f = "I"
8964 * elif t == NPY_LONG: f = "l" # <<<<<<<<<<<<<<
8965 * elif t == NPY_ULONG: f = "L"
8966 * elif t == NPY_LONGLONG: f = "q"
8969 __pyx_v_f = ((char *)"l");
8972 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":267
8973 * elif t == NPY_UINT: f = "I"
8974 * elif t == NPY_LONG: f = "l"
8975 * elif t == NPY_ULONG: f = "L" # <<<<<<<<<<<<<<
8976 * elif t == NPY_LONGLONG: f = "q"
8977 * elif t == NPY_ULONGLONG: f = "Q"
8980 __pyx_v_f = ((char *)"L");
8983 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":268
8984 * elif t == NPY_LONG: f = "l"
8985 * elif t == NPY_ULONG: f = "L"
8986 * elif t == NPY_LONGLONG: f = "q" # <<<<<<<<<<<<<<
8987 * elif t == NPY_ULONGLONG: f = "Q"
8988 * elif t == NPY_FLOAT: f = "f"
8991 __pyx_v_f = ((char *)"q");
8994 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":269
8995 * elif t == NPY_ULONG: f = "L"
8996 * elif t == NPY_LONGLONG: f = "q"
8997 * elif t == NPY_ULONGLONG: f = "Q" # <<<<<<<<<<<<<<
8998 * elif t == NPY_FLOAT: f = "f"
8999 * elif t == NPY_DOUBLE: f = "d"
9002 __pyx_v_f = ((char *)"Q");
9005 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":270
9006 * elif t == NPY_LONGLONG: f = "q"
9007 * elif t == NPY_ULONGLONG: f = "Q"
9008 * elif t == NPY_FLOAT: f = "f" # <<<<<<<<<<<<<<
9009 * elif t == NPY_DOUBLE: f = "d"
9010 * elif t == NPY_LONGDOUBLE: f = "g"
9013 __pyx_v_f = ((char *)"f");
9016 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":271
9017 * elif t == NPY_ULONGLONG: f = "Q"
9018 * elif t == NPY_FLOAT: f = "f"
9019 * elif t == NPY_DOUBLE: f = "d" # <<<<<<<<<<<<<<
9020 * elif t == NPY_LONGDOUBLE: f = "g"
9021 * elif t == NPY_CFLOAT: f = "Zf"
9024 __pyx_v_f = ((char *)"d");
9027 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":272
9028 * elif t == NPY_FLOAT: f = "f"
9029 * elif t == NPY_DOUBLE: f = "d"
9030 * elif t == NPY_LONGDOUBLE: f = "g" # <<<<<<<<<<<<<<
9031 * elif t == NPY_CFLOAT: f = "Zf"
9032 * elif t == NPY_CDOUBLE: f = "Zd"
9034 case NPY_LONGDOUBLE:
9035 __pyx_v_f = ((char *)"g");
9038 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":273
9039 * elif t == NPY_DOUBLE: f = "d"
9040 * elif t == NPY_LONGDOUBLE: f = "g"
9041 * elif t == NPY_CFLOAT: f = "Zf" # <<<<<<<<<<<<<<
9042 * elif t == NPY_CDOUBLE: f = "Zd"
9043 * elif t == NPY_CLONGDOUBLE: f = "Zg"
9046 __pyx_v_f = ((char *)"Zf");
9049 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":274
9050 * elif t == NPY_LONGDOUBLE: f = "g"
9051 * elif t == NPY_CFLOAT: f = "Zf"
9052 * elif t == NPY_CDOUBLE: f = "Zd" # <<<<<<<<<<<<<<
9053 * elif t == NPY_CLONGDOUBLE: f = "Zg"
9054 * elif t == NPY_OBJECT: f = "O"
9057 __pyx_v_f = ((char *)"Zd");
9060 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":275
9061 * elif t == NPY_CFLOAT: f = "Zf"
9062 * elif t == NPY_CDOUBLE: f = "Zd"
9063 * elif t == NPY_CLONGDOUBLE: f = "Zg" # <<<<<<<<<<<<<<
9064 * elif t == NPY_OBJECT: f = "O"
9067 case NPY_CLONGDOUBLE:
9068 __pyx_v_f = ((char *)"Zg");
9071 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":276
9072 * elif t == NPY_CDOUBLE: f = "Zd"
9073 * elif t == NPY_CLONGDOUBLE: f = "Zg"
9074 * elif t == NPY_OBJECT: f = "O" # <<<<<<<<<<<<<<
9076 * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
9079 __pyx_v_f = ((char *)"O");
9083 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":278
9084 * elif t == NPY_OBJECT: f = "O"
9086 * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<<
9090 __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_t); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 278, __pyx_L1_error)
9091 __Pyx_GOTREF(__pyx_t_3);
9092 __pyx_t_6 = PyUnicode_Format(__pyx_kp_u_unknown_dtype_code_in_numpy_pxd, __pyx_t_3); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 278, __pyx_L1_error)
9093 __Pyx_GOTREF(__pyx_t_6);
9094 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9095 __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 278, __pyx_L1_error)
9096 __Pyx_GOTREF(__pyx_t_3);
9097 __Pyx_GIVEREF(__pyx_t_6);
9098 PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_6);
9100 __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 278, __pyx_L1_error)
9101 __Pyx_GOTREF(__pyx_t_6);
9102 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9103 __Pyx_Raise(__pyx_t_6, 0, 0, 0);
9104 __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
9105 __PYX_ERR(1, 278, __pyx_L1_error)
9109 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":279
9111 * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
9112 * info.format = f # <<<<<<<<<<<<<<
9116 __pyx_v_info->format = __pyx_v_f;
9118 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":280
9119 * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
9121 * return # <<<<<<<<<<<<<<
9123 * info.format = <char*>stdlib.malloc(_buffer_format_string_len)
9128 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":255
9131 * if not hasfields: # <<<<<<<<<<<<<<
9132 * t = descr.type_num
9133 * if ((descr.byteorder == c'>' and little_endian) or
9137 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":282
9140 * info.format = <char*>stdlib.malloc(_buffer_format_string_len) # <<<<<<<<<<<<<<
9141 * info.format[0] = c'^' # Native data types, manual alignment
9145 __pyx_v_info->format = ((char *)malloc(0xFF));
9147 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":283
9149 * info.format = <char*>stdlib.malloc(_buffer_format_string_len)
9150 * info.format[0] = c'^' # Native data types, manual alignment # <<<<<<<<<<<<<<
9152 * f = _util_dtypestring(descr, info.format + 1,
9154 (__pyx_v_info->format[0]) = '^';
9156 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":284
9157 * info.format = <char*>stdlib.malloc(_buffer_format_string_len)
9158 * info.format[0] = c'^' # Native data types, manual alignment
9159 * offset = 0 # <<<<<<<<<<<<<<
9160 * f = _util_dtypestring(descr, info.format + 1,
9161 * info.format + _buffer_format_string_len,
9165 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":285
9166 * info.format[0] = c'^' # Native data types, manual alignment
9168 * f = _util_dtypestring(descr, info.format + 1, # <<<<<<<<<<<<<<
9169 * info.format + _buffer_format_string_len,
9172 __pyx_t_7 = __pyx_f_5numpy__util_dtypestring(__pyx_v_descr, (__pyx_v_info->format + 1), (__pyx_v_info->format + 0xFF), (&__pyx_v_offset)); if (unlikely(__pyx_t_7 == NULL)) __PYX_ERR(1, 285, __pyx_L1_error)
9173 __pyx_v_f = __pyx_t_7;
9175 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":288
9176 * info.format + _buffer_format_string_len,
9178 * f[0] = c'\0' # Terminate format string # <<<<<<<<<<<<<<
9180 * def __releasebuffer__(ndarray self, Py_buffer* info):
9182 (__pyx_v_f[0]) = '\x00';
9185 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":197
9186 * # experimental exception made for __getbuffer__ and __releasebuffer__
9187 * # -- the details of this may change.
9188 * def __getbuffer__(ndarray self, Py_buffer* info, int flags): # <<<<<<<<<<<<<<
9189 * # This implementation of getbuffer is geared towards Cython
9190 * # requirements, and does not yet fullfill the PEP.
9193 /* function exit code */
9197 __Pyx_XDECREF(__pyx_t_3);
9198 __Pyx_XDECREF(__pyx_t_6);
9199 __Pyx_AddTraceback("numpy.ndarray.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename);
9201 if (__pyx_v_info != NULL && __pyx_v_info->obj != NULL) {
9202 __Pyx_GOTREF(__pyx_v_info->obj);
9203 __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = NULL;
9207 if (__pyx_v_info != NULL && __pyx_v_info->obj == Py_None) {
9208 __Pyx_GOTREF(Py_None);
9209 __Pyx_DECREF(Py_None); __pyx_v_info->obj = NULL;
9212 __Pyx_XDECREF((PyObject *)__pyx_v_descr);
9213 __Pyx_RefNannyFinishContext();
9217 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":290
9218 * f[0] = c'\0' # Terminate format string
9220 * def __releasebuffer__(ndarray self, Py_buffer* info): # <<<<<<<<<<<<<<
9221 * if PyArray_HASFIELDS(self):
9222 * stdlib.free(info.format)
9225 /* Python wrapper */
9226 static CYTHON_UNUSED void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/
9227 static CYTHON_UNUSED void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) {
9228 __Pyx_RefNannyDeclarations
9229 __Pyx_RefNannySetupContext("__releasebuffer__ (wrapper)", 0);
9230 __pyx_pf_5numpy_7ndarray_2__releasebuffer__(((PyArrayObject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info));
9232 /* function exit code */
9233 __Pyx_RefNannyFinishContext();
9236 static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info) {
9237 __Pyx_RefNannyDeclarations
9239 __Pyx_RefNannySetupContext("__releasebuffer__", 0);
9241 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":291
9243 * def __releasebuffer__(ndarray self, Py_buffer* info):
9244 * if PyArray_HASFIELDS(self): # <<<<<<<<<<<<<<
9245 * stdlib.free(info.format)
9246 * if sizeof(npy_intp) != sizeof(Py_ssize_t):
9248 __pyx_t_1 = (PyArray_HASFIELDS(__pyx_v_self) != 0);
9251 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":292
9252 * def __releasebuffer__(ndarray self, Py_buffer* info):
9253 * if PyArray_HASFIELDS(self):
9254 * stdlib.free(info.format) # <<<<<<<<<<<<<<
9255 * if sizeof(npy_intp) != sizeof(Py_ssize_t):
9256 * stdlib.free(info.strides)
9258 free(__pyx_v_info->format);
9260 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":291
9262 * def __releasebuffer__(ndarray self, Py_buffer* info):
9263 * if PyArray_HASFIELDS(self): # <<<<<<<<<<<<<<
9264 * stdlib.free(info.format)
9265 * if sizeof(npy_intp) != sizeof(Py_ssize_t):
9269 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":293
9270 * if PyArray_HASFIELDS(self):
9271 * stdlib.free(info.format)
9272 * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<<
9273 * stdlib.free(info.strides)
9274 * # info.shape was stored after info.strides in the same block
9276 __pyx_t_1 = (((sizeof(npy_intp)) != (sizeof(Py_ssize_t))) != 0);
9279 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":294
9280 * stdlib.free(info.format)
9281 * if sizeof(npy_intp) != sizeof(Py_ssize_t):
9282 * stdlib.free(info.strides) # <<<<<<<<<<<<<<
9283 * # info.shape was stored after info.strides in the same block
9286 free(__pyx_v_info->strides);
9288 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":293
9289 * if PyArray_HASFIELDS(self):
9290 * stdlib.free(info.format)
9291 * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<<
9292 * stdlib.free(info.strides)
9293 * # info.shape was stored after info.strides in the same block
9297 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":290
9298 * f[0] = c'\0' # Terminate format string
9300 * def __releasebuffer__(ndarray self, Py_buffer* info): # <<<<<<<<<<<<<<
9301 * if PyArray_HASFIELDS(self):
9302 * stdlib.free(info.format)
9305 /* function exit code */
9306 __Pyx_RefNannyFinishContext();
9309 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":770
9310 * ctypedef npy_cdouble complex_t
9312 * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<<
9313 * return PyArray_MultiIterNew(1, <void*>a)
9317 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__pyx_v_a) {
9318 PyObject *__pyx_r = NULL;
9319 __Pyx_RefNannyDeclarations
9320 PyObject *__pyx_t_1 = NULL;
9321 __Pyx_RefNannySetupContext("PyArray_MultiIterNew1", 0);
9323 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":771
9325 * cdef inline object PyArray_MultiIterNew1(a):
9326 * return PyArray_MultiIterNew(1, <void*>a) # <<<<<<<<<<<<<<
9328 * cdef inline object PyArray_MultiIterNew2(a, b):
9330 __Pyx_XDECREF(__pyx_r);
9331 __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 771, __pyx_L1_error)
9332 __Pyx_GOTREF(__pyx_t_1);
9333 __pyx_r = __pyx_t_1;
9337 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":770
9338 * ctypedef npy_cdouble complex_t
9340 * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<<
9341 * return PyArray_MultiIterNew(1, <void*>a)
9345 /* function exit code */
9347 __Pyx_XDECREF(__pyx_t_1);
9348 __Pyx_AddTraceback("numpy.PyArray_MultiIterNew1", __pyx_clineno, __pyx_lineno, __pyx_filename);
9351 __Pyx_XGIVEREF(__pyx_r);
9352 __Pyx_RefNannyFinishContext();
9356 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":773
9357 * return PyArray_MultiIterNew(1, <void*>a)
9359 * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<<
9360 * return PyArray_MultiIterNew(2, <void*>a, <void*>b)
9364 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__pyx_v_a, PyObject *__pyx_v_b) {
9365 PyObject *__pyx_r = NULL;
9366 __Pyx_RefNannyDeclarations
9367 PyObject *__pyx_t_1 = NULL;
9368 __Pyx_RefNannySetupContext("PyArray_MultiIterNew2", 0);
9370 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":774
9372 * cdef inline object PyArray_MultiIterNew2(a, b):
9373 * return PyArray_MultiIterNew(2, <void*>a, <void*>b) # <<<<<<<<<<<<<<
9375 * cdef inline object PyArray_MultiIterNew3(a, b, c):
9377 __Pyx_XDECREF(__pyx_r);
9378 __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 774, __pyx_L1_error)
9379 __Pyx_GOTREF(__pyx_t_1);
9380 __pyx_r = __pyx_t_1;
9384 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":773
9385 * return PyArray_MultiIterNew(1, <void*>a)
9387 * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<<
9388 * return PyArray_MultiIterNew(2, <void*>a, <void*>b)
9392 /* function exit code */
9394 __Pyx_XDECREF(__pyx_t_1);
9395 __Pyx_AddTraceback("numpy.PyArray_MultiIterNew2", __pyx_clineno, __pyx_lineno, __pyx_filename);
9398 __Pyx_XGIVEREF(__pyx_r);
9399 __Pyx_RefNannyFinishContext();
9403 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":776
9404 * return PyArray_MultiIterNew(2, <void*>a, <void*>b)
9406 * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<<
9407 * return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
9411 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c) {
9412 PyObject *__pyx_r = NULL;
9413 __Pyx_RefNannyDeclarations
9414 PyObject *__pyx_t_1 = NULL;
9415 __Pyx_RefNannySetupContext("PyArray_MultiIterNew3", 0);
9417 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":777
9419 * cdef inline object PyArray_MultiIterNew3(a, b, c):
9420 * return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c) # <<<<<<<<<<<<<<
9422 * cdef inline object PyArray_MultiIterNew4(a, b, c, d):
9424 __Pyx_XDECREF(__pyx_r);
9425 __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 777, __pyx_L1_error)
9426 __Pyx_GOTREF(__pyx_t_1);
9427 __pyx_r = __pyx_t_1;
9431 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":776
9432 * return PyArray_MultiIterNew(2, <void*>a, <void*>b)
9434 * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<<
9435 * return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
9439 /* function exit code */
9441 __Pyx_XDECREF(__pyx_t_1);
9442 __Pyx_AddTraceback("numpy.PyArray_MultiIterNew3", __pyx_clineno, __pyx_lineno, __pyx_filename);
9445 __Pyx_XGIVEREF(__pyx_r);
9446 __Pyx_RefNannyFinishContext();
9450 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":779
9451 * return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
9453 * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<<
9454 * return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
9458 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d) {
9459 PyObject *__pyx_r = NULL;
9460 __Pyx_RefNannyDeclarations
9461 PyObject *__pyx_t_1 = NULL;
9462 __Pyx_RefNannySetupContext("PyArray_MultiIterNew4", 0);
9464 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":780
9466 * cdef inline object PyArray_MultiIterNew4(a, b, c, d):
9467 * return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d) # <<<<<<<<<<<<<<
9469 * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):
9471 __Pyx_XDECREF(__pyx_r);
9472 __pyx_t_1 = PyArray_MultiIterNew(4, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 780, __pyx_L1_error)
9473 __Pyx_GOTREF(__pyx_t_1);
9474 __pyx_r = __pyx_t_1;
9478 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":779
9479 * return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
9481 * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<<
9482 * return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
9486 /* function exit code */
9488 __Pyx_XDECREF(__pyx_t_1);
9489 __Pyx_AddTraceback("numpy.PyArray_MultiIterNew4", __pyx_clineno, __pyx_lineno, __pyx_filename);
9492 __Pyx_XGIVEREF(__pyx_r);
9493 __Pyx_RefNannyFinishContext();
9497 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":782
9498 * return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
9500 * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<<
9501 * return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
9505 static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d, PyObject *__pyx_v_e) {
9506 PyObject *__pyx_r = NULL;
9507 __Pyx_RefNannyDeclarations
9508 PyObject *__pyx_t_1 = NULL;
9509 __Pyx_RefNannySetupContext("PyArray_MultiIterNew5", 0);
9511 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":783
9513 * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):
9514 * return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e) # <<<<<<<<<<<<<<
9516 * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL:
9518 __Pyx_XDECREF(__pyx_r);
9519 __pyx_t_1 = PyArray_MultiIterNew(5, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d), ((void *)__pyx_v_e)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 783, __pyx_L1_error)
9520 __Pyx_GOTREF(__pyx_t_1);
9521 __pyx_r = __pyx_t_1;
9525 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":782
9526 * return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
9528 * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<<
9529 * return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
9533 /* function exit code */
9535 __Pyx_XDECREF(__pyx_t_1);
9536 __Pyx_AddTraceback("numpy.PyArray_MultiIterNew5", __pyx_clineno, __pyx_lineno, __pyx_filename);
9539 __Pyx_XGIVEREF(__pyx_r);
9540 __Pyx_RefNannyFinishContext();
9544 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":785
9545 * return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
9547 * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: # <<<<<<<<<<<<<<
9548 * # Recursive utility function used in __getbuffer__ to get format
9549 * # string. The new location in the format string is returned.
9552 static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx_v_descr, char *__pyx_v_f, char *__pyx_v_end, int *__pyx_v_offset) {
9553 PyArray_Descr *__pyx_v_child = 0;
9554 int __pyx_v_endian_detector;
9555 int __pyx_v_little_endian;
9556 PyObject *__pyx_v_fields = 0;
9557 PyObject *__pyx_v_childname = NULL;
9558 PyObject *__pyx_v_new_offset = NULL;
9559 PyObject *__pyx_v_t = NULL;
9561 __Pyx_RefNannyDeclarations
9562 PyObject *__pyx_t_1 = NULL;
9563 Py_ssize_t __pyx_t_2;
9564 PyObject *__pyx_t_3 = NULL;
9565 PyObject *__pyx_t_4 = NULL;
9571 __Pyx_RefNannySetupContext("_util_dtypestring", 0);
9573 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":790
9576 * cdef int endian_detector = 1 # <<<<<<<<<<<<<<
9577 * cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)
9580 __pyx_v_endian_detector = 1;
9582 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":791
9584 * cdef int endian_detector = 1
9585 * cdef bint little_endian = ((<char*>&endian_detector)[0] != 0) # <<<<<<<<<<<<<<
9589 __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0);
9591 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":794
9594 * for childname in descr.names: # <<<<<<<<<<<<<<
9595 * fields = descr.fields[childname]
9596 * child, new_offset = fields
9598 if (unlikely(__pyx_v_descr->names == Py_None)) {
9599 PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
9600 __PYX_ERR(1, 794, __pyx_L1_error)
9602 __pyx_t_1 = __pyx_v_descr->names; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
9604 if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
9605 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
9606 __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(1, 794, __pyx_L1_error)
9608 __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 794, __pyx_L1_error)
9609 __Pyx_GOTREF(__pyx_t_3);
9611 __Pyx_XDECREF_SET(__pyx_v_childname, __pyx_t_3);
9614 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":795
9616 * for childname in descr.names:
9617 * fields = descr.fields[childname] # <<<<<<<<<<<<<<
9618 * child, new_offset = fields
9621 if (unlikely(__pyx_v_descr->fields == Py_None)) {
9622 PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable");
9623 __PYX_ERR(1, 795, __pyx_L1_error)
9625 __pyx_t_3 = __Pyx_PyDict_GetItem(__pyx_v_descr->fields, __pyx_v_childname); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 795, __pyx_L1_error)
9626 __Pyx_GOTREF(__pyx_t_3);
9627 if (!(likely(PyTuple_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_t_3)->tp_name), 0))) __PYX_ERR(1, 795, __pyx_L1_error)
9628 __Pyx_XDECREF_SET(__pyx_v_fields, ((PyObject*)__pyx_t_3));
9631 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":796
9632 * for childname in descr.names:
9633 * fields = descr.fields[childname]
9634 * child, new_offset = fields # <<<<<<<<<<<<<<
9636 * if (end - f) - <int>(new_offset - offset[0]) < 15:
9638 if (likely(__pyx_v_fields != Py_None)) {
9639 PyObject* sequence = __pyx_v_fields;
9640 #if !CYTHON_COMPILING_IN_PYPY
9641 Py_ssize_t size = Py_SIZE(sequence);
9643 Py_ssize_t size = PySequence_Size(sequence);
9645 if (unlikely(size != 2)) {
9646 if (size > 2) __Pyx_RaiseTooManyValuesError(2);
9647 else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
9648 __PYX_ERR(1, 796, __pyx_L1_error)
9650 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
9651 __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0);
9652 __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1);
9653 __Pyx_INCREF(__pyx_t_3);
9654 __Pyx_INCREF(__pyx_t_4);
9656 __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 796, __pyx_L1_error)
9657 __Pyx_GOTREF(__pyx_t_3);
9658 __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 796, __pyx_L1_error)
9659 __Pyx_GOTREF(__pyx_t_4);
9662 __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(1, 796, __pyx_L1_error)
9664 if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_dtype))))) __PYX_ERR(1, 796, __pyx_L1_error)
9665 __Pyx_XDECREF_SET(__pyx_v_child, ((PyArray_Descr *)__pyx_t_3));
9667 __Pyx_XDECREF_SET(__pyx_v_new_offset, __pyx_t_4);
9670 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":798
9671 * child, new_offset = fields
9673 * if (end - f) - <int>(new_offset - offset[0]) < 15: # <<<<<<<<<<<<<<
9674 * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
9677 __pyx_t_4 = __Pyx_PyInt_From_int((__pyx_v_offset[0])); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 798, __pyx_L1_error)
9678 __Pyx_GOTREF(__pyx_t_4);
9679 __pyx_t_3 = PyNumber_Subtract(__pyx_v_new_offset, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 798, __pyx_L1_error)
9680 __Pyx_GOTREF(__pyx_t_3);
9681 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
9682 __pyx_t_5 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 798, __pyx_L1_error)
9683 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9684 __pyx_t_6 = ((((__pyx_v_end - __pyx_v_f) - ((int)__pyx_t_5)) < 15) != 0);
9687 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":799
9689 * if (end - f) - <int>(new_offset - offset[0]) < 15:
9690 * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<<
9692 * if ((child.byteorder == c'>' and little_endian) or
9694 __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__22, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 799, __pyx_L1_error)
9695 __Pyx_GOTREF(__pyx_t_3);
9696 __Pyx_Raise(__pyx_t_3, 0, 0, 0);
9697 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9698 __PYX_ERR(1, 799, __pyx_L1_error)
9700 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":798
9701 * child, new_offset = fields
9703 * if (end - f) - <int>(new_offset - offset[0]) < 15: # <<<<<<<<<<<<<<
9704 * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
9709 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":801
9710 * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
9712 * if ((child.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<<
9713 * (child.byteorder == c'<' and not little_endian)):
9714 * raise ValueError(u"Non-native byte order not supported")
9716 __pyx_t_7 = ((__pyx_v_child->byteorder == '>') != 0);
9718 goto __pyx_L8_next_or;
9721 __pyx_t_7 = (__pyx_v_little_endian != 0);
9724 __pyx_t_6 = __pyx_t_7;
9725 goto __pyx_L7_bool_binop_done;
9729 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":802
9731 * if ((child.byteorder == c'>' and little_endian) or
9732 * (child.byteorder == c'<' and not little_endian)): # <<<<<<<<<<<<<<
9733 * raise ValueError(u"Non-native byte order not supported")
9734 * # One could encode it in the format string and have Cython
9736 __pyx_t_7 = ((__pyx_v_child->byteorder == '<') != 0);
9739 __pyx_t_6 = __pyx_t_7;
9740 goto __pyx_L7_bool_binop_done;
9742 __pyx_t_7 = ((!(__pyx_v_little_endian != 0)) != 0);
9743 __pyx_t_6 = __pyx_t_7;
9744 __pyx_L7_bool_binop_done:;
9746 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":801
9747 * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
9749 * if ((child.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<<
9750 * (child.byteorder == c'<' and not little_endian)):
9751 * raise ValueError(u"Non-native byte order not supported")
9755 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":803
9756 * if ((child.byteorder == c'>' and little_endian) or
9757 * (child.byteorder == c'<' and not little_endian)):
9758 * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<<
9759 * # One could encode it in the format string and have Cython
9760 * # complain instead, BUT: < and > in format strings also imply
9762 __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__23, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 803, __pyx_L1_error)
9763 __Pyx_GOTREF(__pyx_t_3);
9764 __Pyx_Raise(__pyx_t_3, 0, 0, 0);
9765 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9766 __PYX_ERR(1, 803, __pyx_L1_error)
9768 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":801
9769 * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
9771 * if ((child.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<<
9772 * (child.byteorder == c'<' and not little_endian)):
9773 * raise ValueError(u"Non-native byte order not supported")
9777 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":813
9779 * # Output padding bytes
9780 * while offset[0] < new_offset: # <<<<<<<<<<<<<<
9781 * f[0] = 120 # "x"; pad byte
9785 __pyx_t_3 = __Pyx_PyInt_From_int((__pyx_v_offset[0])); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 813, __pyx_L1_error)
9786 __Pyx_GOTREF(__pyx_t_3);
9787 __pyx_t_4 = PyObject_RichCompare(__pyx_t_3, __pyx_v_new_offset, Py_LT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 813, __pyx_L1_error)
9788 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9789 __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 813, __pyx_L1_error)
9790 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
9791 if (!__pyx_t_6) break;
9793 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":814
9794 * # Output padding bytes
9795 * while offset[0] < new_offset:
9796 * f[0] = 120 # "x"; pad byte # <<<<<<<<<<<<<<
9800 (__pyx_v_f[0]) = 0x78;
9802 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":815
9803 * while offset[0] < new_offset:
9804 * f[0] = 120 # "x"; pad byte
9805 * f += 1 # <<<<<<<<<<<<<<
9809 __pyx_v_f = (__pyx_v_f + 1);
9811 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":816
9812 * f[0] = 120 # "x"; pad byte
9814 * offset[0] += 1 # <<<<<<<<<<<<<<
9816 * offset[0] += child.itemsize
9819 (__pyx_v_offset[__pyx_t_8]) = ((__pyx_v_offset[__pyx_t_8]) + 1);
9822 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":818
9825 * offset[0] += child.itemsize # <<<<<<<<<<<<<<
9827 * if not PyDataType_HASFIELDS(child):
9830 (__pyx_v_offset[__pyx_t_8]) = ((__pyx_v_offset[__pyx_t_8]) + __pyx_v_child->elsize);
9832 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":820
9833 * offset[0] += child.itemsize
9835 * if not PyDataType_HASFIELDS(child): # <<<<<<<<<<<<<<
9836 * t = child.type_num
9839 __pyx_t_6 = ((!(PyDataType_HASFIELDS(__pyx_v_child) != 0)) != 0);
9842 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":821
9844 * if not PyDataType_HASFIELDS(child):
9845 * t = child.type_num # <<<<<<<<<<<<<<
9847 * raise RuntimeError(u"Format string allocated too short.")
9849 __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_child->type_num); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 821, __pyx_L1_error)
9850 __Pyx_GOTREF(__pyx_t_4);
9851 __Pyx_XDECREF_SET(__pyx_v_t, __pyx_t_4);
9854 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":822
9855 * if not PyDataType_HASFIELDS(child):
9856 * t = child.type_num
9857 * if end - f < 5: # <<<<<<<<<<<<<<
9858 * raise RuntimeError(u"Format string allocated too short.")
9861 __pyx_t_6 = (((__pyx_v_end - __pyx_v_f) < 5) != 0);
9864 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":823
9865 * t = child.type_num
9867 * raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<<
9869 * # Until ticket #99 is fixed, use integers to avoid warnings
9871 __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__24, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 823, __pyx_L1_error)
9872 __Pyx_GOTREF(__pyx_t_4);
9873 __Pyx_Raise(__pyx_t_4, 0, 0, 0);
9874 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
9875 __PYX_ERR(1, 823, __pyx_L1_error)
9877 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":822
9878 * if not PyDataType_HASFIELDS(child):
9879 * t = child.type_num
9880 * if end - f < 5: # <<<<<<<<<<<<<<
9881 * raise RuntimeError(u"Format string allocated too short.")
9886 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":826
9888 * # Until ticket #99 is fixed, use integers to avoid warnings
9889 * if t == NPY_BYTE: f[0] = 98 #"b" # <<<<<<<<<<<<<<
9890 * elif t == NPY_UBYTE: f[0] = 66 #"B"
9891 * elif t == NPY_SHORT: f[0] = 104 #"h"
9893 __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_BYTE); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 826, __pyx_L1_error)
9894 __Pyx_GOTREF(__pyx_t_4);
9895 __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 826, __pyx_L1_error)
9896 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
9897 __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 826, __pyx_L1_error)
9898 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9900 (__pyx_v_f[0]) = 98;
9904 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":827
9905 * # Until ticket #99 is fixed, use integers to avoid warnings
9906 * if t == NPY_BYTE: f[0] = 98 #"b"
9907 * elif t == NPY_UBYTE: f[0] = 66 #"B" # <<<<<<<<<<<<<<
9908 * elif t == NPY_SHORT: f[0] = 104 #"h"
9909 * elif t == NPY_USHORT: f[0] = 72 #"H"
9911 __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_UBYTE); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 827, __pyx_L1_error)
9912 __Pyx_GOTREF(__pyx_t_3);
9913 __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 827, __pyx_L1_error)
9914 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9915 __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 827, __pyx_L1_error)
9916 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
9918 (__pyx_v_f[0]) = 66;
9922 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":828
9923 * if t == NPY_BYTE: f[0] = 98 #"b"
9924 * elif t == NPY_UBYTE: f[0] = 66 #"B"
9925 * elif t == NPY_SHORT: f[0] = 104 #"h" # <<<<<<<<<<<<<<
9926 * elif t == NPY_USHORT: f[0] = 72 #"H"
9927 * elif t == NPY_INT: f[0] = 105 #"i"
9929 __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_SHORT); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 828, __pyx_L1_error)
9930 __Pyx_GOTREF(__pyx_t_4);
9931 __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 828, __pyx_L1_error)
9932 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
9933 __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 828, __pyx_L1_error)
9934 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9936 (__pyx_v_f[0]) = 0x68;
9940 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":829
9941 * elif t == NPY_UBYTE: f[0] = 66 #"B"
9942 * elif t == NPY_SHORT: f[0] = 104 #"h"
9943 * elif t == NPY_USHORT: f[0] = 72 #"H" # <<<<<<<<<<<<<<
9944 * elif t == NPY_INT: f[0] = 105 #"i"
9945 * elif t == NPY_UINT: f[0] = 73 #"I"
9947 __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_USHORT); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 829, __pyx_L1_error)
9948 __Pyx_GOTREF(__pyx_t_3);
9949 __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 829, __pyx_L1_error)
9950 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9951 __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 829, __pyx_L1_error)
9952 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
9954 (__pyx_v_f[0]) = 72;
9958 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":830
9959 * elif t == NPY_SHORT: f[0] = 104 #"h"
9960 * elif t == NPY_USHORT: f[0] = 72 #"H"
9961 * elif t == NPY_INT: f[0] = 105 #"i" # <<<<<<<<<<<<<<
9962 * elif t == NPY_UINT: f[0] = 73 #"I"
9963 * elif t == NPY_LONG: f[0] = 108 #"l"
9965 __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_INT); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 830, __pyx_L1_error)
9966 __Pyx_GOTREF(__pyx_t_4);
9967 __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 830, __pyx_L1_error)
9968 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
9969 __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 830, __pyx_L1_error)
9970 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9972 (__pyx_v_f[0]) = 0x69;
9976 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":831
9977 * elif t == NPY_USHORT: f[0] = 72 #"H"
9978 * elif t == NPY_INT: f[0] = 105 #"i"
9979 * elif t == NPY_UINT: f[0] = 73 #"I" # <<<<<<<<<<<<<<
9980 * elif t == NPY_LONG: f[0] = 108 #"l"
9981 * elif t == NPY_ULONG: f[0] = 76 #"L"
9983 __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_UINT); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 831, __pyx_L1_error)
9984 __Pyx_GOTREF(__pyx_t_3);
9985 __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 831, __pyx_L1_error)
9986 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
9987 __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 831, __pyx_L1_error)
9988 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
9990 (__pyx_v_f[0]) = 73;
9994 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":832
9995 * elif t == NPY_INT: f[0] = 105 #"i"
9996 * elif t == NPY_UINT: f[0] = 73 #"I"
9997 * elif t == NPY_LONG: f[0] = 108 #"l" # <<<<<<<<<<<<<<
9998 * elif t == NPY_ULONG: f[0] = 76 #"L"
9999 * elif t == NPY_LONGLONG: f[0] = 113 #"q"
10001 __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_LONG); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 832, __pyx_L1_error)
10002 __Pyx_GOTREF(__pyx_t_4);
10003 __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 832, __pyx_L1_error)
10004 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
10005 __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 832, __pyx_L1_error)
10006 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10008 (__pyx_v_f[0]) = 0x6C;
10012 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":833
10013 * elif t == NPY_UINT: f[0] = 73 #"I"
10014 * elif t == NPY_LONG: f[0] = 108 #"l"
10015 * elif t == NPY_ULONG: f[0] = 76 #"L" # <<<<<<<<<<<<<<
10016 * elif t == NPY_LONGLONG: f[0] = 113 #"q"
10017 * elif t == NPY_ULONGLONG: f[0] = 81 #"Q"
10019 __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_ULONG); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 833, __pyx_L1_error)
10020 __Pyx_GOTREF(__pyx_t_3);
10021 __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 833, __pyx_L1_error)
10022 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10023 __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 833, __pyx_L1_error)
10024 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
10026 (__pyx_v_f[0]) = 76;
10030 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":834
10031 * elif t == NPY_LONG: f[0] = 108 #"l"
10032 * elif t == NPY_ULONG: f[0] = 76 #"L"
10033 * elif t == NPY_LONGLONG: f[0] = 113 #"q" # <<<<<<<<<<<<<<
10034 * elif t == NPY_ULONGLONG: f[0] = 81 #"Q"
10035 * elif t == NPY_FLOAT: f[0] = 102 #"f"
10037 __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_LONGLONG); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 834, __pyx_L1_error)
10038 __Pyx_GOTREF(__pyx_t_4);
10039 __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 834, __pyx_L1_error)
10040 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
10041 __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 834, __pyx_L1_error)
10042 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10044 (__pyx_v_f[0]) = 0x71;
10048 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":835
10049 * elif t == NPY_ULONG: f[0] = 76 #"L"
10050 * elif t == NPY_LONGLONG: f[0] = 113 #"q"
10051 * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" # <<<<<<<<<<<<<<
10052 * elif t == NPY_FLOAT: f[0] = 102 #"f"
10053 * elif t == NPY_DOUBLE: f[0] = 100 #"d"
10055 __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_ULONGLONG); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 835, __pyx_L1_error)
10056 __Pyx_GOTREF(__pyx_t_3);
10057 __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 835, __pyx_L1_error)
10058 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10059 __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 835, __pyx_L1_error)
10060 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
10062 (__pyx_v_f[0]) = 81;
10066 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":836
10067 * elif t == NPY_LONGLONG: f[0] = 113 #"q"
10068 * elif t == NPY_ULONGLONG: f[0] = 81 #"Q"
10069 * elif t == NPY_FLOAT: f[0] = 102 #"f" # <<<<<<<<<<<<<<
10070 * elif t == NPY_DOUBLE: f[0] = 100 #"d"
10071 * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g"
10073 __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_FLOAT); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 836, __pyx_L1_error)
10074 __Pyx_GOTREF(__pyx_t_4);
10075 __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 836, __pyx_L1_error)
10076 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
10077 __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 836, __pyx_L1_error)
10078 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10080 (__pyx_v_f[0]) = 0x66;
10084 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":837
10085 * elif t == NPY_ULONGLONG: f[0] = 81 #"Q"
10086 * elif t == NPY_FLOAT: f[0] = 102 #"f"
10087 * elif t == NPY_DOUBLE: f[0] = 100 #"d" # <<<<<<<<<<<<<<
10088 * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g"
10089 * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf
10091 __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_DOUBLE); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 837, __pyx_L1_error)
10092 __Pyx_GOTREF(__pyx_t_3);
10093 __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 837, __pyx_L1_error)
10094 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10095 __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 837, __pyx_L1_error)
10096 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
10098 (__pyx_v_f[0]) = 0x64;
10102 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":838
10103 * elif t == NPY_FLOAT: f[0] = 102 #"f"
10104 * elif t == NPY_DOUBLE: f[0] = 100 #"d"
10105 * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" # <<<<<<<<<<<<<<
10106 * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf
10107 * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd
10109 __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_LONGDOUBLE); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 838, __pyx_L1_error)
10110 __Pyx_GOTREF(__pyx_t_4);
10111 __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 838, __pyx_L1_error)
10112 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
10113 __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 838, __pyx_L1_error)
10114 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10116 (__pyx_v_f[0]) = 0x67;
10120 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":839
10121 * elif t == NPY_DOUBLE: f[0] = 100 #"d"
10122 * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g"
10123 * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf # <<<<<<<<<<<<<<
10124 * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd
10125 * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg
10127 __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_CFLOAT); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 839, __pyx_L1_error)
10128 __Pyx_GOTREF(__pyx_t_3);
10129 __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 839, __pyx_L1_error)
10130 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10131 __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 839, __pyx_L1_error)
10132 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
10134 (__pyx_v_f[0]) = 90;
10135 (__pyx_v_f[1]) = 0x66;
10136 __pyx_v_f = (__pyx_v_f + 1);
10140 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":840
10141 * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g"
10142 * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf
10143 * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd # <<<<<<<<<<<<<<
10144 * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg
10145 * elif t == NPY_OBJECT: f[0] = 79 #"O"
10147 __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_CDOUBLE); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 840, __pyx_L1_error)
10148 __Pyx_GOTREF(__pyx_t_4);
10149 __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 840, __pyx_L1_error)
10150 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
10151 __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 840, __pyx_L1_error)
10152 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10154 (__pyx_v_f[0]) = 90;
10155 (__pyx_v_f[1]) = 0x64;
10156 __pyx_v_f = (__pyx_v_f + 1);
10160 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":841
10161 * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf
10162 * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd
10163 * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg # <<<<<<<<<<<<<<
10164 * elif t == NPY_OBJECT: f[0] = 79 #"O"
10167 __pyx_t_3 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_CLONGDOUBLE); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 841, __pyx_L1_error)
10168 __Pyx_GOTREF(__pyx_t_3);
10169 __pyx_t_4 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 841, __pyx_L1_error)
10170 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10171 __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 841, __pyx_L1_error)
10172 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
10174 (__pyx_v_f[0]) = 90;
10175 (__pyx_v_f[1]) = 0x67;
10176 __pyx_v_f = (__pyx_v_f + 1);
10180 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":842
10181 * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd
10182 * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg
10183 * elif t == NPY_OBJECT: f[0] = 79 #"O" # <<<<<<<<<<<<<<
10185 * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
10187 __pyx_t_4 = __Pyx_PyInt_From_enum__NPY_TYPES(NPY_OBJECT); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 842, __pyx_L1_error)
10188 __Pyx_GOTREF(__pyx_t_4);
10189 __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_4, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 842, __pyx_L1_error)
10190 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
10191 __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) __PYX_ERR(1, 842, __pyx_L1_error)
10192 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10194 (__pyx_v_f[0]) = 79;
10198 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":844
10199 * elif t == NPY_OBJECT: f[0] = 79 #"O"
10201 * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<<
10206 __pyx_t_3 = PyUnicode_Format(__pyx_kp_u_unknown_dtype_code_in_numpy_pxd, __pyx_v_t); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 844, __pyx_L1_error)
10207 __Pyx_GOTREF(__pyx_t_3);
10208 __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 844, __pyx_L1_error)
10209 __Pyx_GOTREF(__pyx_t_4);
10210 __Pyx_GIVEREF(__pyx_t_3);
10211 PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3);
10213 __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 844, __pyx_L1_error)
10214 __Pyx_GOTREF(__pyx_t_3);
10215 __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
10216 __Pyx_Raise(__pyx_t_3, 0, 0, 0);
10217 __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
10218 __PYX_ERR(1, 844, __pyx_L1_error)
10222 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":845
10224 * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
10225 * f += 1 # <<<<<<<<<<<<<<
10227 * # Cython ignores struct boundary information ("T{...}"),
10229 __pyx_v_f = (__pyx_v_f + 1);
10231 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":820
10232 * offset[0] += child.itemsize
10234 * if not PyDataType_HASFIELDS(child): # <<<<<<<<<<<<<<
10235 * t = child.type_num
10241 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":849
10242 * # Cython ignores struct boundary information ("T{...}"),
10243 * # so don't output it
10244 * f = _util_dtypestring(child, f, end, offset) # <<<<<<<<<<<<<<
10249 __pyx_t_9 = __pyx_f_5numpy__util_dtypestring(__pyx_v_child, __pyx_v_f, __pyx_v_end, __pyx_v_offset); if (unlikely(__pyx_t_9 == NULL)) __PYX_ERR(1, 849, __pyx_L1_error)
10250 __pyx_v_f = __pyx_t_9;
10254 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":794
10255 * cdef tuple fields
10257 * for childname in descr.names: # <<<<<<<<<<<<<<
10258 * fields = descr.fields[childname]
10259 * child, new_offset = fields
10262 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10264 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":850
10265 * # so don't output it
10266 * f = _util_dtypestring(child, f, end, offset)
10267 * return f # <<<<<<<<<<<<<<
10271 __pyx_r = __pyx_v_f;
10274 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":785
10275 * return PyArray_MultiIterNew(5, <void*>a, <void*>b, <void*>c, <void*> d, <void*> e)
10277 * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: # <<<<<<<<<<<<<<
10278 * # Recursive utility function used in __getbuffer__ to get format
10279 * # string. The new location in the format string is returned.
10282 /* function exit code */
10284 __Pyx_XDECREF(__pyx_t_1);
10285 __Pyx_XDECREF(__pyx_t_3);
10286 __Pyx_XDECREF(__pyx_t_4);
10287 __Pyx_AddTraceback("numpy._util_dtypestring", __pyx_clineno, __pyx_lineno, __pyx_filename);
10290 __Pyx_XDECREF((PyObject *)__pyx_v_child);
10291 __Pyx_XDECREF(__pyx_v_fields);
10292 __Pyx_XDECREF(__pyx_v_childname);
10293 __Pyx_XDECREF(__pyx_v_new_offset);
10294 __Pyx_XDECREF(__pyx_v_t);
10295 __Pyx_RefNannyFinishContext();
10299 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":966
10302 * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<<
10303 * cdef PyObject* baseptr
10307 static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_arr, PyObject *__pyx_v_base) {
10308 PyObject *__pyx_v_baseptr;
10309 __Pyx_RefNannyDeclarations
10312 __Pyx_RefNannySetupContext("set_array_base", 0);
10314 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":968
10315 * cdef inline void set_array_base(ndarray arr, object base):
10316 * cdef PyObject* baseptr
10317 * if base is None: # <<<<<<<<<<<<<<
10321 __pyx_t_1 = (__pyx_v_base == Py_None);
10322 __pyx_t_2 = (__pyx_t_1 != 0);
10325 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":969
10326 * cdef PyObject* baseptr
10328 * baseptr = NULL # <<<<<<<<<<<<<<
10330 * Py_INCREF(base) # important to do this before decref below!
10332 __pyx_v_baseptr = NULL;
10334 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":968
10335 * cdef inline void set_array_base(ndarray arr, object base):
10336 * cdef PyObject* baseptr
10337 * if base is None: # <<<<<<<<<<<<<<
10344 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":971
10347 * Py_INCREF(base) # important to do this before decref below! # <<<<<<<<<<<<<<
10348 * baseptr = <PyObject*>base
10349 * Py_XDECREF(arr.base)
10352 Py_INCREF(__pyx_v_base);
10354 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":972
10356 * Py_INCREF(base) # important to do this before decref below!
10357 * baseptr = <PyObject*>base # <<<<<<<<<<<<<<
10358 * Py_XDECREF(arr.base)
10359 * arr.base = baseptr
10361 __pyx_v_baseptr = ((PyObject *)__pyx_v_base);
10365 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":973
10366 * Py_INCREF(base) # important to do this before decref below!
10367 * baseptr = <PyObject*>base
10368 * Py_XDECREF(arr.base) # <<<<<<<<<<<<<<
10369 * arr.base = baseptr
10372 Py_XDECREF(__pyx_v_arr->base);
10374 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":974
10375 * baseptr = <PyObject*>base
10376 * Py_XDECREF(arr.base)
10377 * arr.base = baseptr # <<<<<<<<<<<<<<
10379 * cdef inline object get_array_base(ndarray arr):
10381 __pyx_v_arr->base = __pyx_v_baseptr;
10383 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":966
10386 * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<<
10387 * cdef PyObject* baseptr
10391 /* function exit code */
10392 __Pyx_RefNannyFinishContext();
10395 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":976
10396 * arr.base = baseptr
10398 * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<<
10399 * if arr.base is NULL:
10403 static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__pyx_v_arr) {
10404 PyObject *__pyx_r = NULL;
10405 __Pyx_RefNannyDeclarations
10407 __Pyx_RefNannySetupContext("get_array_base", 0);
10409 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":977
10411 * cdef inline object get_array_base(ndarray arr):
10412 * if arr.base is NULL: # <<<<<<<<<<<<<<
10416 __pyx_t_1 = ((__pyx_v_arr->base == NULL) != 0);
10419 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":978
10420 * cdef inline object get_array_base(ndarray arr):
10421 * if arr.base is NULL:
10422 * return None # <<<<<<<<<<<<<<
10424 * return <object>arr.base
10426 __Pyx_XDECREF(__pyx_r);
10427 __Pyx_INCREF(Py_None);
10431 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":977
10433 * cdef inline object get_array_base(ndarray arr):
10434 * if arr.base is NULL: # <<<<<<<<<<<<<<
10440 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":980
10443 * return <object>arr.base # <<<<<<<<<<<<<<
10448 __Pyx_XDECREF(__pyx_r);
10449 __Pyx_INCREF(((PyObject *)__pyx_v_arr->base));
10450 __pyx_r = ((PyObject *)__pyx_v_arr->base);
10454 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":976
10455 * arr.base = baseptr
10457 * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<<
10458 * if arr.base is NULL:
10462 /* function exit code */
10464 __Pyx_XGIVEREF(__pyx_r);
10465 __Pyx_RefNannyFinishContext();
10469 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":985
10470 * # Versions of the import_* functions which are more suitable for
10472 * cdef inline int import_array() except -1: # <<<<<<<<<<<<<<
10477 static CYTHON_INLINE int __pyx_f_5numpy_import_array(void) {
10479 __Pyx_RefNannyDeclarations
10480 PyObject *__pyx_t_1 = NULL;
10481 PyObject *__pyx_t_2 = NULL;
10482 PyObject *__pyx_t_3 = NULL;
10484 PyObject *__pyx_t_5 = NULL;
10485 PyObject *__pyx_t_6 = NULL;
10486 PyObject *__pyx_t_7 = NULL;
10487 PyObject *__pyx_t_8 = NULL;
10488 __Pyx_RefNannySetupContext("import_array", 0);
10490 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":986
10492 * cdef inline int import_array() except -1:
10493 * try: # <<<<<<<<<<<<<<
10495 * except Exception:
10498 __Pyx_PyThreadState_declare
10499 __Pyx_PyThreadState_assign
10500 __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
10501 __Pyx_XGOTREF(__pyx_t_1);
10502 __Pyx_XGOTREF(__pyx_t_2);
10503 __Pyx_XGOTREF(__pyx_t_3);
10506 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":987
10507 * cdef inline int import_array() except -1:
10509 * _import_array() # <<<<<<<<<<<<<<
10510 * except Exception:
10511 * raise ImportError("numpy.core.multiarray failed to import")
10513 __pyx_t_4 = _import_array(); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(1, 987, __pyx_L3_error)
10515 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":986
10517 * cdef inline int import_array() except -1:
10518 * try: # <<<<<<<<<<<<<<
10520 * except Exception:
10523 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
10524 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
10525 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
10526 goto __pyx_L10_try_end;
10528 __Pyx_PyThreadState_assign
10530 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":988
10533 * except Exception: # <<<<<<<<<<<<<<
10534 * raise ImportError("numpy.core.multiarray failed to import")
10537 __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
10539 __Pyx_AddTraceback("numpy.import_array", __pyx_clineno, __pyx_lineno, __pyx_filename);
10540 if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 988, __pyx_L5_except_error)
10541 __Pyx_GOTREF(__pyx_t_5);
10542 __Pyx_GOTREF(__pyx_t_6);
10543 __Pyx_GOTREF(__pyx_t_7);
10545 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":989
10547 * except Exception:
10548 * raise ImportError("numpy.core.multiarray failed to import") # <<<<<<<<<<<<<<
10550 * cdef inline int import_umath() except -1:
10552 __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__25, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 989, __pyx_L5_except_error)
10553 __Pyx_GOTREF(__pyx_t_8);
10554 __Pyx_Raise(__pyx_t_8, 0, 0, 0);
10555 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
10556 __PYX_ERR(1, 989, __pyx_L5_except_error)
10558 goto __pyx_L5_except_error;
10559 __pyx_L5_except_error:;
10561 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":986
10563 * cdef inline int import_array() except -1:
10564 * try: # <<<<<<<<<<<<<<
10566 * except Exception:
10568 __Pyx_PyThreadState_assign
10569 __Pyx_XGIVEREF(__pyx_t_1);
10570 __Pyx_XGIVEREF(__pyx_t_2);
10571 __Pyx_XGIVEREF(__pyx_t_3);
10572 __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
10573 goto __pyx_L1_error;
10574 __pyx_L10_try_end:;
10577 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":985
10578 * # Versions of the import_* functions which are more suitable for
10580 * cdef inline int import_array() except -1: # <<<<<<<<<<<<<<
10585 /* function exit code */
10589 __Pyx_XDECREF(__pyx_t_5);
10590 __Pyx_XDECREF(__pyx_t_6);
10591 __Pyx_XDECREF(__pyx_t_7);
10592 __Pyx_XDECREF(__pyx_t_8);
10593 __Pyx_AddTraceback("numpy.import_array", __pyx_clineno, __pyx_lineno, __pyx_filename);
10596 __Pyx_RefNannyFinishContext();
10600 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":991
10601 * raise ImportError("numpy.core.multiarray failed to import")
10603 * cdef inline int import_umath() except -1: # <<<<<<<<<<<<<<
10608 static CYTHON_INLINE int __pyx_f_5numpy_import_umath(void) {
10610 __Pyx_RefNannyDeclarations
10611 PyObject *__pyx_t_1 = NULL;
10612 PyObject *__pyx_t_2 = NULL;
10613 PyObject *__pyx_t_3 = NULL;
10615 PyObject *__pyx_t_5 = NULL;
10616 PyObject *__pyx_t_6 = NULL;
10617 PyObject *__pyx_t_7 = NULL;
10618 PyObject *__pyx_t_8 = NULL;
10619 __Pyx_RefNannySetupContext("import_umath", 0);
10621 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":992
10623 * cdef inline int import_umath() except -1:
10624 * try: # <<<<<<<<<<<<<<
10626 * except Exception:
10629 __Pyx_PyThreadState_declare
10630 __Pyx_PyThreadState_assign
10631 __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
10632 __Pyx_XGOTREF(__pyx_t_1);
10633 __Pyx_XGOTREF(__pyx_t_2);
10634 __Pyx_XGOTREF(__pyx_t_3);
10637 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":993
10638 * cdef inline int import_umath() except -1:
10640 * _import_umath() # <<<<<<<<<<<<<<
10641 * except Exception:
10642 * raise ImportError("numpy.core.umath failed to import")
10644 __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(1, 993, __pyx_L3_error)
10646 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":992
10648 * cdef inline int import_umath() except -1:
10649 * try: # <<<<<<<<<<<<<<
10651 * except Exception:
10654 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
10655 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
10656 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
10657 goto __pyx_L10_try_end;
10659 __Pyx_PyThreadState_assign
10661 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":994
10664 * except Exception: # <<<<<<<<<<<<<<
10665 * raise ImportError("numpy.core.umath failed to import")
10668 __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
10670 __Pyx_AddTraceback("numpy.import_umath", __pyx_clineno, __pyx_lineno, __pyx_filename);
10671 if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 994, __pyx_L5_except_error)
10672 __Pyx_GOTREF(__pyx_t_5);
10673 __Pyx_GOTREF(__pyx_t_6);
10674 __Pyx_GOTREF(__pyx_t_7);
10676 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":995
10678 * except Exception:
10679 * raise ImportError("numpy.core.umath failed to import") # <<<<<<<<<<<<<<
10681 * cdef inline int import_ufunc() except -1:
10683 __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__26, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 995, __pyx_L5_except_error)
10684 __Pyx_GOTREF(__pyx_t_8);
10685 __Pyx_Raise(__pyx_t_8, 0, 0, 0);
10686 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
10687 __PYX_ERR(1, 995, __pyx_L5_except_error)
10689 goto __pyx_L5_except_error;
10690 __pyx_L5_except_error:;
10692 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":992
10694 * cdef inline int import_umath() except -1:
10695 * try: # <<<<<<<<<<<<<<
10697 * except Exception:
10699 __Pyx_PyThreadState_assign
10700 __Pyx_XGIVEREF(__pyx_t_1);
10701 __Pyx_XGIVEREF(__pyx_t_2);
10702 __Pyx_XGIVEREF(__pyx_t_3);
10703 __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
10704 goto __pyx_L1_error;
10705 __pyx_L10_try_end:;
10708 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":991
10709 * raise ImportError("numpy.core.multiarray failed to import")
10711 * cdef inline int import_umath() except -1: # <<<<<<<<<<<<<<
10716 /* function exit code */
10720 __Pyx_XDECREF(__pyx_t_5);
10721 __Pyx_XDECREF(__pyx_t_6);
10722 __Pyx_XDECREF(__pyx_t_7);
10723 __Pyx_XDECREF(__pyx_t_8);
10724 __Pyx_AddTraceback("numpy.import_umath", __pyx_clineno, __pyx_lineno, __pyx_filename);
10727 __Pyx_RefNannyFinishContext();
10731 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":997
10732 * raise ImportError("numpy.core.umath failed to import")
10734 * cdef inline int import_ufunc() except -1: # <<<<<<<<<<<<<<
10739 static CYTHON_INLINE int __pyx_f_5numpy_import_ufunc(void) {
10741 __Pyx_RefNannyDeclarations
10742 PyObject *__pyx_t_1 = NULL;
10743 PyObject *__pyx_t_2 = NULL;
10744 PyObject *__pyx_t_3 = NULL;
10746 PyObject *__pyx_t_5 = NULL;
10747 PyObject *__pyx_t_6 = NULL;
10748 PyObject *__pyx_t_7 = NULL;
10749 PyObject *__pyx_t_8 = NULL;
10750 __Pyx_RefNannySetupContext("import_ufunc", 0);
10752 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":998
10754 * cdef inline int import_ufunc() except -1:
10755 * try: # <<<<<<<<<<<<<<
10757 * except Exception:
10760 __Pyx_PyThreadState_declare
10761 __Pyx_PyThreadState_assign
10762 __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3);
10763 __Pyx_XGOTREF(__pyx_t_1);
10764 __Pyx_XGOTREF(__pyx_t_2);
10765 __Pyx_XGOTREF(__pyx_t_3);
10768 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":999
10769 * cdef inline int import_ufunc() except -1:
10771 * _import_umath() # <<<<<<<<<<<<<<
10772 * except Exception:
10773 * raise ImportError("numpy.core.umath failed to import")
10775 __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(1, 999, __pyx_L3_error)
10777 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":998
10779 * cdef inline int import_ufunc() except -1:
10780 * try: # <<<<<<<<<<<<<<
10782 * except Exception:
10785 __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0;
10786 __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0;
10787 __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0;
10788 goto __pyx_L10_try_end;
10790 __Pyx_PyThreadState_assign
10792 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1000
10795 * except Exception: # <<<<<<<<<<<<<<
10796 * raise ImportError("numpy.core.umath failed to import")
10798 __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
10800 __Pyx_AddTraceback("numpy.import_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename);
10801 if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(1, 1000, __pyx_L5_except_error)
10802 __Pyx_GOTREF(__pyx_t_5);
10803 __Pyx_GOTREF(__pyx_t_6);
10804 __Pyx_GOTREF(__pyx_t_7);
10806 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1001
10808 * except Exception:
10809 * raise ImportError("numpy.core.umath failed to import") # <<<<<<<<<<<<<<
10811 __pyx_t_8 = __Pyx_PyObject_Call(__pyx_builtin_ImportError, __pyx_tuple__27, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 1001, __pyx_L5_except_error)
10812 __Pyx_GOTREF(__pyx_t_8);
10813 __Pyx_Raise(__pyx_t_8, 0, 0, 0);
10814 __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
10815 __PYX_ERR(1, 1001, __pyx_L5_except_error)
10817 goto __pyx_L5_except_error;
10818 __pyx_L5_except_error:;
10820 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":998
10822 * cdef inline int import_ufunc() except -1:
10823 * try: # <<<<<<<<<<<<<<
10825 * except Exception:
10827 __Pyx_PyThreadState_assign
10828 __Pyx_XGIVEREF(__pyx_t_1);
10829 __Pyx_XGIVEREF(__pyx_t_2);
10830 __Pyx_XGIVEREF(__pyx_t_3);
10831 __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3);
10832 goto __pyx_L1_error;
10833 __pyx_L10_try_end:;
10836 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":997
10837 * raise ImportError("numpy.core.umath failed to import")
10839 * cdef inline int import_ufunc() except -1: # <<<<<<<<<<<<<<
10844 /* function exit code */
10848 __Pyx_XDECREF(__pyx_t_5);
10849 __Pyx_XDECREF(__pyx_t_6);
10850 __Pyx_XDECREF(__pyx_t_7);
10851 __Pyx_XDECREF(__pyx_t_8);
10852 __Pyx_AddTraceback("numpy.import_ufunc", __pyx_clineno, __pyx_lineno, __pyx_filename);
10855 __Pyx_RefNannyFinishContext();
10859 static PyObject *__pyx_tp_new_11pycocotools_5_mask_RLEs(PyTypeObject *t, PyObject *a, PyObject *k) {
10861 if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
10862 o = (*t->tp_alloc)(t, 0);
10864 o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
10866 if (unlikely(!o)) return 0;
10867 if (unlikely(__pyx_pw_11pycocotools_5_mask_4RLEs_1__cinit__(o, a, k) < 0)) goto bad;
10870 Py_DECREF(o); o = 0;
10874 static void __pyx_tp_dealloc_11pycocotools_5_mask_RLEs(PyObject *o) {
10875 #if PY_VERSION_HEX >= 0x030400a1
10876 if (unlikely(Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
10877 if (PyObject_CallFinalizerFromDealloc(o)) return;
10881 PyObject *etype, *eval, *etb;
10882 PyErr_Fetch(&etype, &eval, &etb);
10884 __pyx_pw_11pycocotools_5_mask_4RLEs_3__dealloc__(o);
10886 PyErr_Restore(etype, eval, etb);
10888 (*Py_TYPE(o)->tp_free)(o);
10891 static PyObject *__pyx_tp_getattro_11pycocotools_5_mask_RLEs(PyObject *o, PyObject *n) {
10892 PyObject *v = PyObject_GenericGetAttr(o, n);
10893 if (!v && PyErr_ExceptionMatches(PyExc_AttributeError)) {
10895 v = __pyx_pw_11pycocotools_5_mask_4RLEs_5__getattr__(o, n);
10900 static PyMethodDef __pyx_methods_11pycocotools_5_mask_RLEs[] = {
10901 {"__getattr__", (PyCFunction)__pyx_pw_11pycocotools_5_mask_4RLEs_5__getattr__, METH_O|METH_COEXIST, 0},
10905 static PyTypeObject __pyx_type_11pycocotools_5_mask_RLEs = {
10906 PyVarObject_HEAD_INIT(0, 0)
10907 "pycocotools._mask.RLEs", /*tp_name*/
10908 sizeof(struct __pyx_obj_11pycocotools_5_mask_RLEs), /*tp_basicsize*/
10910 __pyx_tp_dealloc_11pycocotools_5_mask_RLEs, /*tp_dealloc*/
10914 #if PY_MAJOR_VERSION < 3
10917 #if PY_MAJOR_VERSION >= 3
10921 0, /*tp_as_number*/
10922 0, /*tp_as_sequence*/
10923 0, /*tp_as_mapping*/
10927 __pyx_tp_getattro_11pycocotools_5_mask_RLEs, /*tp_getattro*/
10929 0, /*tp_as_buffer*/
10930 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
10934 0, /*tp_richcompare*/
10935 0, /*tp_weaklistoffset*/
10938 __pyx_methods_11pycocotools_5_mask_RLEs, /*tp_methods*/
10943 0, /*tp_descr_get*/
10944 0, /*tp_descr_set*/
10945 0, /*tp_dictoffset*/
10948 __pyx_tp_new_11pycocotools_5_mask_RLEs, /*tp_new*/
10954 0, /*tp_subclasses*/
10957 0, /*tp_version_tag*/
10958 #if PY_VERSION_HEX >= 0x030400a1
10963 static PyObject *__pyx_tp_new_11pycocotools_5_mask_Masks(PyTypeObject *t, PyObject *a, PyObject *k) {
10965 if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
10966 o = (*t->tp_alloc)(t, 0);
10968 o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
10970 if (unlikely(!o)) return 0;
10971 if (unlikely(__pyx_pw_11pycocotools_5_mask_5Masks_1__cinit__(o, a, k) < 0)) goto bad;
10974 Py_DECREF(o); o = 0;
10978 static void __pyx_tp_dealloc_11pycocotools_5_mask_Masks(PyObject *o) {
10979 #if PY_VERSION_HEX >= 0x030400a1
10980 if (unlikely(Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) {
10981 if (PyObject_CallFinalizerFromDealloc(o)) return;
10984 (*Py_TYPE(o)->tp_free)(o);
10987 static PyMethodDef __pyx_methods_11pycocotools_5_mask_Masks[] = {
10988 {"__array__", (PyCFunction)__pyx_pw_11pycocotools_5_mask_5Masks_3__array__, METH_NOARGS, 0},
10992 static PyTypeObject __pyx_type_11pycocotools_5_mask_Masks = {
10993 PyVarObject_HEAD_INIT(0, 0)
10994 "pycocotools._mask.Masks", /*tp_name*/
10995 sizeof(struct __pyx_obj_11pycocotools_5_mask_Masks), /*tp_basicsize*/
10997 __pyx_tp_dealloc_11pycocotools_5_mask_Masks, /*tp_dealloc*/
11001 #if PY_MAJOR_VERSION < 3
11004 #if PY_MAJOR_VERSION >= 3
11008 0, /*tp_as_number*/
11009 0, /*tp_as_sequence*/
11010 0, /*tp_as_mapping*/
11016 0, /*tp_as_buffer*/
11017 Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/
11021 0, /*tp_richcompare*/
11022 0, /*tp_weaklistoffset*/
11025 __pyx_methods_11pycocotools_5_mask_Masks, /*tp_methods*/
11030 0, /*tp_descr_get*/
11031 0, /*tp_descr_set*/
11032 0, /*tp_dictoffset*/
11035 __pyx_tp_new_11pycocotools_5_mask_Masks, /*tp_new*/
11041 0, /*tp_subclasses*/
11044 0, /*tp_version_tag*/
11045 #if PY_VERSION_HEX >= 0x030400a1
11050 static PyMethodDef __pyx_methods[] = {
11054 #if PY_MAJOR_VERSION >= 3
11055 static struct PyModuleDef __pyx_moduledef = {
11056 #if PY_VERSION_HEX < 0x03020000
11057 { PyObject_HEAD_INIT(NULL) NULL, 0, NULL },
11059 PyModuleDef_HEAD_INIT,
11064 __pyx_methods /* m_methods */,
11065 NULL, /* m_reload */
11066 NULL, /* m_traverse */
11067 NULL, /* m_clear */
11072 static __Pyx_StringTabEntry __pyx_string_tab[] = {
11073 {&__pyx_n_s_AttributeError, __pyx_k_AttributeError, sizeof(__pyx_k_AttributeError), 0, 0, 1, 1},
11074 {&__pyx_n_s_F, __pyx_k_F, sizeof(__pyx_k_F), 0, 0, 1, 1},
11075 {&__pyx_kp_u_Format_string_allocated_too_shor, __pyx_k_Format_string_allocated_too_shor, sizeof(__pyx_k_Format_string_allocated_too_shor), 0, 1, 0, 0},
11076 {&__pyx_kp_u_Format_string_allocated_too_shor_2, __pyx_k_Format_string_allocated_too_shor_2, sizeof(__pyx_k_Format_string_allocated_too_shor_2), 0, 1, 0, 0},
11077 {&__pyx_n_s_ImportError, __pyx_k_ImportError, sizeof(__pyx_k_ImportError), 0, 0, 1, 1},
11078 {&__pyx_n_s_N, __pyx_k_N, sizeof(__pyx_k_N), 0, 0, 1, 1},
11079 {&__pyx_kp_u_Non_native_byte_order_not_suppor, __pyx_k_Non_native_byte_order_not_suppor, sizeof(__pyx_k_Non_native_byte_order_not_suppor), 0, 1, 0, 0},
11080 {&__pyx_n_s_PYTHON_VERSION, __pyx_k_PYTHON_VERSION, sizeof(__pyx_k_PYTHON_VERSION), 0, 0, 1, 1},
11081 {&__pyx_kp_s_Python_version_must_be_2_or_3, __pyx_k_Python_version_must_be_2_or_3, sizeof(__pyx_k_Python_version_must_be_2_or_3), 0, 0, 1, 0},
11082 {&__pyx_n_s_R, __pyx_k_R, sizeof(__pyx_k_R), 0, 0, 1, 1},
11083 {&__pyx_n_s_Rs, __pyx_k_Rs, sizeof(__pyx_k_Rs), 0, 0, 1, 1},
11084 {&__pyx_n_s_RuntimeError, __pyx_k_RuntimeError, sizeof(__pyx_k_RuntimeError), 0, 0, 1, 1},
11085 {&__pyx_kp_s_The_dt_and_gt_should_have_the_sa, __pyx_k_The_dt_and_gt_should_have_the_sa, sizeof(__pyx_k_The_dt_and_gt_should_have_the_sa), 0, 0, 1, 0},
11086 {&__pyx_n_s_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 0, 0, 1, 1},
11087 {&__pyx_n_s_a, __pyx_k_a, sizeof(__pyx_k_a), 0, 0, 1, 1},
11088 {&__pyx_n_s_a_2, __pyx_k_a_2, sizeof(__pyx_k_a_2), 0, 0, 1, 1},
11089 {&__pyx_n_s_all, __pyx_k_all, sizeof(__pyx_k_all), 0, 0, 1, 1},
11090 {&__pyx_n_s_area, __pyx_k_area, sizeof(__pyx_k_area), 0, 0, 1, 1},
11091 {&__pyx_n_s_array, __pyx_k_array, sizeof(__pyx_k_array), 0, 0, 1, 1},
11092 {&__pyx_n_s_astype, __pyx_k_astype, sizeof(__pyx_k_astype), 0, 0, 1, 1},
11093 {&__pyx_n_s_author, __pyx_k_author, sizeof(__pyx_k_author), 0, 0, 1, 1},
11094 {&__pyx_n_s_bb, __pyx_k_bb, sizeof(__pyx_k_bb), 0, 0, 1, 1},
11095 {&__pyx_n_s_bbIou, __pyx_k_bbIou, sizeof(__pyx_k_bbIou), 0, 0, 1, 1},
11096 {&__pyx_n_s_bb_2, __pyx_k_bb_2, sizeof(__pyx_k_bb_2), 0, 0, 1, 1},
11097 {&__pyx_n_s_c_string, __pyx_k_c_string, sizeof(__pyx_k_c_string), 0, 0, 1, 1},
11098 {&__pyx_n_s_cnts, __pyx_k_cnts, sizeof(__pyx_k_cnts), 0, 0, 1, 1},
11099 {&__pyx_n_s_counts, __pyx_k_counts, sizeof(__pyx_k_counts), 0, 0, 1, 1},
11100 {&__pyx_n_s_data, __pyx_k_data, sizeof(__pyx_k_data), 0, 0, 1, 1},
11101 {&__pyx_n_s_decode, __pyx_k_decode, sizeof(__pyx_k_decode), 0, 0, 1, 1},
11102 {&__pyx_n_s_double, __pyx_k_double, sizeof(__pyx_k_double), 0, 0, 1, 1},
11103 {&__pyx_n_s_dt, __pyx_k_dt, sizeof(__pyx_k_dt), 0, 0, 1, 1},
11104 {&__pyx_n_s_dtype, __pyx_k_dtype, sizeof(__pyx_k_dtype), 0, 0, 1, 1},
11105 {&__pyx_n_s_encode, __pyx_k_encode, sizeof(__pyx_k_encode), 0, 0, 1, 1},
11106 {&__pyx_n_s_enumerate, __pyx_k_enumerate, sizeof(__pyx_k_enumerate), 0, 0, 1, 1},
11107 {&__pyx_n_s_frBbox, __pyx_k_frBbox, sizeof(__pyx_k_frBbox), 0, 0, 1, 1},
11108 {&__pyx_n_s_frPoly, __pyx_k_frPoly, sizeof(__pyx_k_frPoly), 0, 0, 1, 1},
11109 {&__pyx_n_s_frPyObjects, __pyx_k_frPyObjects, sizeof(__pyx_k_frPyObjects), 0, 0, 1, 1},
11110 {&__pyx_n_s_frString, __pyx_k_frString, sizeof(__pyx_k_frString), 0, 0, 1, 1},
11111 {&__pyx_n_s_frUncompressedRLE, __pyx_k_frUncompressedRLE, sizeof(__pyx_k_frUncompressedRLE), 0, 0, 1, 1},
11112 {&__pyx_n_s_gt, __pyx_k_gt, sizeof(__pyx_k_gt), 0, 0, 1, 1},
11113 {&__pyx_n_s_h, __pyx_k_h, sizeof(__pyx_k_h), 0, 0, 1, 1},
11114 {&__pyx_kp_s_home_yjr_PycharmProjects_Faster, __pyx_k_home_yjr_PycharmProjects_Faster, sizeof(__pyx_k_home_yjr_PycharmProjects_Faster), 0, 0, 1, 0},
11115 {&__pyx_n_s_i, __pyx_k_i, sizeof(__pyx_k_i), 0, 0, 1, 1},
11116 {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1},
11117 {&__pyx_kp_s_input_data_type_not_allowed, __pyx_k_input_data_type_not_allowed, sizeof(__pyx_k_input_data_type_not_allowed), 0, 0, 1, 0},
11118 {&__pyx_kp_s_input_type_is_not_supported, __pyx_k_input_type_is_not_supported, sizeof(__pyx_k_input_type_is_not_supported), 0, 0, 1, 0},
11119 {&__pyx_n_s_intersect, __pyx_k_intersect, sizeof(__pyx_k_intersect), 0, 0, 1, 1},
11120 {&__pyx_n_s_iou, __pyx_k_iou, sizeof(__pyx_k_iou), 0, 0, 1, 1},
11121 {&__pyx_n_s_iouFun, __pyx_k_iouFun, sizeof(__pyx_k_iouFun), 0, 0, 1, 1},
11122 {&__pyx_n_s_iou_2, __pyx_k_iou_2, sizeof(__pyx_k_iou_2), 0, 0, 1, 1},
11123 {&__pyx_n_s_iou_locals__bbIou, __pyx_k_iou_locals__bbIou, sizeof(__pyx_k_iou_locals__bbIou), 0, 0, 1, 1},
11124 {&__pyx_n_s_iou_locals__len, __pyx_k_iou_locals__len, sizeof(__pyx_k_iou_locals__len), 0, 0, 1, 1},
11125 {&__pyx_n_s_iou_locals__preproc, __pyx_k_iou_locals__preproc, sizeof(__pyx_k_iou_locals__preproc), 0, 0, 1, 1},
11126 {&__pyx_n_s_iou_locals__rleIou, __pyx_k_iou_locals__rleIou, sizeof(__pyx_k_iou_locals__rleIou), 0, 0, 1, 1},
11127 {&__pyx_n_s_isbox, __pyx_k_isbox, sizeof(__pyx_k_isbox), 0, 0, 1, 1},
11128 {&__pyx_n_s_iscrowd, __pyx_k_iscrowd, sizeof(__pyx_k_iscrowd), 0, 0, 1, 1},
11129 {&__pyx_n_s_isrle, __pyx_k_isrle, sizeof(__pyx_k_isrle), 0, 0, 1, 1},
11130 {&__pyx_n_s_j, __pyx_k_j, sizeof(__pyx_k_j), 0, 0, 1, 1},
11131 {&__pyx_n_s_len, __pyx_k_len, sizeof(__pyx_k_len), 0, 0, 1, 1},
11132 {&__pyx_kp_s_list_input_can_be_bounding_box_N, __pyx_k_list_input_can_be_bounding_box_N, sizeof(__pyx_k_list_input_can_be_bounding_box_N), 0, 0, 1, 0},
11133 {&__pyx_n_s_m, __pyx_k_m, sizeof(__pyx_k_m), 0, 0, 1, 1},
11134 {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1},
11135 {&__pyx_n_s_mask, __pyx_k_mask, sizeof(__pyx_k_mask), 0, 0, 1, 1},
11136 {&__pyx_n_s_masks, __pyx_k_masks, sizeof(__pyx_k_masks), 0, 0, 1, 1},
11137 {&__pyx_n_s_merge, __pyx_k_merge, sizeof(__pyx_k_merge), 0, 0, 1, 1},
11138 {&__pyx_n_s_n, __pyx_k_n, sizeof(__pyx_k_n), 0, 0, 1, 1},
11139 {&__pyx_kp_u_ndarray_is_not_C_contiguous, __pyx_k_ndarray_is_not_C_contiguous, sizeof(__pyx_k_ndarray_is_not_C_contiguous), 0, 1, 0, 0},
11140 {&__pyx_kp_u_ndarray_is_not_Fortran_contiguou, __pyx_k_ndarray_is_not_Fortran_contiguou, sizeof(__pyx_k_ndarray_is_not_Fortran_contiguou), 0, 1, 0, 0},
11141 {&__pyx_n_s_np, __pyx_k_np, sizeof(__pyx_k_np), 0, 0, 1, 1},
11142 {&__pyx_n_s_np_poly, __pyx_k_np_poly, sizeof(__pyx_k_np_poly), 0, 0, 1, 1},
11143 {&__pyx_n_s_numpy, __pyx_k_numpy, sizeof(__pyx_k_numpy), 0, 0, 1, 1},
11144 {&__pyx_kp_s_numpy_core_multiarray_failed_to, __pyx_k_numpy_core_multiarray_failed_to, sizeof(__pyx_k_numpy_core_multiarray_failed_to), 0, 0, 1, 0},
11145 {&__pyx_kp_s_numpy_core_umath_failed_to_impor, __pyx_k_numpy_core_umath_failed_to_impor, sizeof(__pyx_k_numpy_core_umath_failed_to_impor), 0, 0, 1, 0},
11146 {&__pyx_kp_s_numpy_ndarray_input_is_only_for, __pyx_k_numpy_ndarray_input_is_only_for, sizeof(__pyx_k_numpy_ndarray_input_is_only_for), 0, 0, 1, 0},
11147 {&__pyx_n_s_obj, __pyx_k_obj, sizeof(__pyx_k_obj), 0, 0, 1, 1},
11148 {&__pyx_n_s_objs, __pyx_k_objs, sizeof(__pyx_k_objs), 0, 0, 1, 1},
11149 {&__pyx_n_s_order, __pyx_k_order, sizeof(__pyx_k_order), 0, 0, 1, 1},
11150 {&__pyx_n_s_p, __pyx_k_p, sizeof(__pyx_k_p), 0, 0, 1, 1},
11151 {&__pyx_n_s_poly, __pyx_k_poly, sizeof(__pyx_k_poly), 0, 0, 1, 1},
11152 {&__pyx_n_s_preproc, __pyx_k_preproc, sizeof(__pyx_k_preproc), 0, 0, 1, 1},
11153 {&__pyx_n_s_py_string, __pyx_k_py_string, sizeof(__pyx_k_py_string), 0, 0, 1, 1},
11154 {&__pyx_n_s_pycocotools__mask, __pyx_k_pycocotools__mask, sizeof(__pyx_k_pycocotools__mask), 0, 0, 1, 1},
11155 {&__pyx_n_s_pyiscrowd, __pyx_k_pyiscrowd, sizeof(__pyx_k_pyiscrowd), 0, 0, 1, 1},
11156 {&__pyx_n_s_pyobj, __pyx_k_pyobj, sizeof(__pyx_k_pyobj), 0, 0, 1, 1},
11157 {&__pyx_n_s_range, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1},
11158 {&__pyx_n_s_reshape, __pyx_k_reshape, sizeof(__pyx_k_reshape), 0, 0, 1, 1},
11159 {&__pyx_n_s_rleIou, __pyx_k_rleIou, sizeof(__pyx_k_rleIou), 0, 0, 1, 1},
11160 {&__pyx_n_s_rleObjs, __pyx_k_rleObjs, sizeof(__pyx_k_rleObjs), 0, 0, 1, 1},
11161 {&__pyx_n_s_shape, __pyx_k_shape, sizeof(__pyx_k_shape), 0, 0, 1, 1},
11162 {&__pyx_n_s_size, __pyx_k_size, sizeof(__pyx_k_size), 0, 0, 1, 1},
11163 {&__pyx_n_s_sys, __pyx_k_sys, sizeof(__pyx_k_sys), 0, 0, 1, 1},
11164 {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1},
11165 {&__pyx_n_s_toBbox, __pyx_k_toBbox, sizeof(__pyx_k_toBbox), 0, 0, 1, 1},
11166 {&__pyx_n_s_toString, __pyx_k_toString, sizeof(__pyx_k_toString), 0, 0, 1, 1},
11167 {&__pyx_n_s_tsungyi, __pyx_k_tsungyi, sizeof(__pyx_k_tsungyi), 0, 0, 1, 1},
11168 {&__pyx_n_s_ucRles, __pyx_k_ucRles, sizeof(__pyx_k_ucRles), 0, 0, 1, 1},
11169 {&__pyx_n_s_uint32, __pyx_k_uint32, sizeof(__pyx_k_uint32), 0, 0, 1, 1},
11170 {&__pyx_n_s_uint8, __pyx_k_uint8, sizeof(__pyx_k_uint8), 0, 0, 1, 1},
11171 {&__pyx_kp_u_unknown_dtype_code_in_numpy_pxd, __pyx_k_unknown_dtype_code_in_numpy_pxd, sizeof(__pyx_k_unknown_dtype_code_in_numpy_pxd), 0, 1, 0, 0},
11172 {&__pyx_kp_s_unrecognized_type_The_following, __pyx_k_unrecognized_type_The_following, sizeof(__pyx_k_unrecognized_type_The_following), 0, 0, 1, 0},
11173 {&__pyx_n_s_utf8, __pyx_k_utf8, sizeof(__pyx_k_utf8), 0, 0, 1, 1},
11174 {&__pyx_n_s_version_info, __pyx_k_version_info, sizeof(__pyx_k_version_info), 0, 0, 1, 1},
11175 {&__pyx_n_s_w, __pyx_k_w, sizeof(__pyx_k_w), 0, 0, 1, 1},
11176 {&__pyx_n_s_zeros, __pyx_k_zeros, sizeof(__pyx_k_zeros), 0, 0, 1, 1},
11177 {0, 0, 0, 0, 0, 0, 0}
11179 static int __Pyx_InitCachedBuiltins(void) {
11180 __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 67, __pyx_L1_error)
11181 __pyx_builtin_AttributeError = __Pyx_GetBuiltinName(__pyx_n_s_AttributeError); if (!__pyx_builtin_AttributeError) __PYX_ERR(0, 73, __pyx_L1_error)
11182 __pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_n_s_enumerate); if (!__pyx_builtin_enumerate) __PYX_ERR(0, 124, __pyx_L1_error)
11183 __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(1, 218, __pyx_L1_error)
11184 __pyx_builtin_RuntimeError = __Pyx_GetBuiltinName(__pyx_n_s_RuntimeError); if (!__pyx_builtin_RuntimeError) __PYX_ERR(1, 799, __pyx_L1_error)
11185 __pyx_builtin_ImportError = __Pyx_GetBuiltinName(__pyx_n_s_ImportError); if (!__pyx_builtin_ImportError) __PYX_ERR(1, 989, __pyx_L1_error)
11191 static int __Pyx_InitCachedConstants(void) {
11192 __Pyx_RefNannyDeclarations
11193 __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);
11195 /* "pycocotools/_mask.pyx":126
11196 * for i, obj in enumerate(rleObjs):
11197 * if PYTHON_VERSION == 2:
11198 * py_string = str(obj['counts']).encode('utf8') # <<<<<<<<<<<<<<
11199 * elif PYTHON_VERSION == 3:
11200 * py_string = str.encode(obj['counts']) if type(obj['counts']) == str else obj['counts']
11202 __pyx_tuple_ = PyTuple_Pack(1, __pyx_n_s_utf8); if (unlikely(!__pyx_tuple_)) __PYX_ERR(0, 126, __pyx_L1_error)
11203 __Pyx_GOTREF(__pyx_tuple_);
11204 __Pyx_GIVEREF(__pyx_tuple_);
11206 /* "pycocotools/_mask.pyx":130
11207 * py_string = str.encode(obj['counts']) if type(obj['counts']) == str else obj['counts']
11209 * raise Exception('Python version must be 2 or 3') # <<<<<<<<<<<<<<
11210 * c_string = py_string
11211 * rleFrString( <RLE*> &Rs._R[i], <char*> c_string, obj['size'][0], obj['size'][1] )
11213 __pyx_tuple__2 = PyTuple_Pack(1, __pyx_kp_s_Python_version_must_be_2_or_3); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(0, 130, __pyx_L1_error)
11214 __Pyx_GOTREF(__pyx_tuple__2);
11215 __Pyx_GIVEREF(__pyx_tuple__2);
11217 /* "pycocotools/_mask.pyx":154
11218 * def merge(rleObjs, intersect=0):
11219 * cdef RLEs Rs = _frString(rleObjs)
11220 * cdef RLEs R = RLEs(1) # <<<<<<<<<<<<<<
11221 * rleMerge(<RLE*>Rs._R, <RLE*> R._R, <siz> Rs._n, intersect)
11222 * obj = _toString(R)[0]
11224 __pyx_tuple__3 = PyTuple_Pack(1, __pyx_int_1); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(0, 154, __pyx_L1_error)
11225 __Pyx_GOTREF(__pyx_tuple__3);
11226 __Pyx_GIVEREF(__pyx_tuple__3);
11228 /* "pycocotools/_mask.pyx":180
11229 * # check if it's Nx4 bbox
11230 * if not len(objs.shape) == 2 or not objs.shape[1] == 4:
11231 * raise Exception('numpy ndarray input is only for *bounding boxes* and should have Nx4 dimension') # <<<<<<<<<<<<<<
11232 * objs = objs.astype(np.double)
11233 * elif type(objs) == list:
11235 __pyx_tuple__4 = PyTuple_Pack(1, __pyx_kp_s_numpy_ndarray_input_is_only_for); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(0, 180, __pyx_L1_error)
11236 __Pyx_GOTREF(__pyx_tuple__4);
11237 __Pyx_GIVEREF(__pyx_tuple__4);
11239 /* "pycocotools/_mask.pyx":193
11240 * objs = _frString(objs)
11242 * raise Exception('list input can be bounding box (Nx4) or RLEs ([RLE])') # <<<<<<<<<<<<<<
11244 * raise Exception('unrecognized type. The following type: RLEs (rle), np.ndarray (box), and list (box) are supported.')
11246 __pyx_tuple__5 = PyTuple_Pack(1, __pyx_kp_s_list_input_can_be_bounding_box_N); if (unlikely(!__pyx_tuple__5)) __PYX_ERR(0, 193, __pyx_L1_error)
11247 __Pyx_GOTREF(__pyx_tuple__5);
11248 __Pyx_GIVEREF(__pyx_tuple__5);
11250 /* "pycocotools/_mask.pyx":195
11251 * raise Exception('list input can be bounding box (Nx4) or RLEs ([RLE])')
11253 * raise Exception('unrecognized type. The following type: RLEs (rle), np.ndarray (box), and list (box) are supported.') # <<<<<<<<<<<<<<
11255 * def _rleIou(RLEs dt, RLEs gt, np.ndarray[np.uint8_t, ndim=1] iscrowd, siz m, siz n, np.ndarray[np.double_t, ndim=1] _iou):
11257 __pyx_tuple__6 = PyTuple_Pack(1, __pyx_kp_s_unrecognized_type_The_following); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(0, 195, __pyx_L1_error)
11258 __Pyx_GOTREF(__pyx_tuple__6);
11259 __Pyx_GIVEREF(__pyx_tuple__6);
11261 /* "pycocotools/_mask.pyx":172
11262 * # iou computation. support function overload (RLEs-RLEs and bbox-bbox).
11263 * def iou( dt, gt, pyiscrowd ):
11264 * def _preproc(objs): # <<<<<<<<<<<<<<
11265 * if len(objs) == 0:
11268 __pyx_tuple__7 = PyTuple_Pack(4, __pyx_n_s_objs, __pyx_n_s_isbox, __pyx_n_s_isrle, __pyx_n_s_obj); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(0, 172, __pyx_L1_error)
11269 __Pyx_GOTREF(__pyx_tuple__7);
11270 __Pyx_GIVEREF(__pyx_tuple__7);
11271 __pyx_codeobj__8 = (PyObject*)__Pyx_PyCode_New(1, 0, 4, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__7, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_yjr_PycharmProjects_Faster, __pyx_n_s_preproc, 172, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__8)) __PYX_ERR(0, 172, __pyx_L1_error)
11273 /* "pycocotools/_mask.pyx":197
11274 * raise Exception('unrecognized type. The following type: RLEs (rle), np.ndarray (box), and list (box) are supported.')
11276 * def _rleIou(RLEs dt, RLEs gt, np.ndarray[np.uint8_t, ndim=1] iscrowd, siz m, siz n, np.ndarray[np.double_t, ndim=1] _iou): # <<<<<<<<<<<<<<
11277 * rleIou( <RLE*> dt._R, <RLE*> gt._R, m, n, <byte*> iscrowd.data, <double*> _iou.data )
11278 * def _bbIou(np.ndarray[np.double_t, ndim=2] dt, np.ndarray[np.double_t, ndim=2] gt, np.ndarray[np.uint8_t, ndim=1] iscrowd, siz m, siz n, np.ndarray[np.double_t, ndim=1] _iou):
11280 __pyx_tuple__9 = PyTuple_Pack(6, __pyx_n_s_dt, __pyx_n_s_gt, __pyx_n_s_iscrowd, __pyx_n_s_m, __pyx_n_s_n, __pyx_n_s_iou); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(0, 197, __pyx_L1_error)
11281 __Pyx_GOTREF(__pyx_tuple__9);
11282 __Pyx_GIVEREF(__pyx_tuple__9);
11283 __pyx_codeobj__10 = (PyObject*)__Pyx_PyCode_New(6, 0, 6, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__9, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_yjr_PycharmProjects_Faster, __pyx_n_s_rleIou, 197, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__10)) __PYX_ERR(0, 197, __pyx_L1_error)
11285 /* "pycocotools/_mask.pyx":199
11286 * def _rleIou(RLEs dt, RLEs gt, np.ndarray[np.uint8_t, ndim=1] iscrowd, siz m, siz n, np.ndarray[np.double_t, ndim=1] _iou):
11287 * rleIou( <RLE*> dt._R, <RLE*> gt._R, m, n, <byte*> iscrowd.data, <double*> _iou.data )
11288 * def _bbIou(np.ndarray[np.double_t, ndim=2] dt, np.ndarray[np.double_t, ndim=2] gt, np.ndarray[np.uint8_t, ndim=1] iscrowd, siz m, siz n, np.ndarray[np.double_t, ndim=1] _iou): # <<<<<<<<<<<<<<
11289 * bbIou( <BB> dt.data, <BB> gt.data, m, n, <byte*> iscrowd.data, <double*>_iou.data )
11292 __pyx_tuple__11 = PyTuple_Pack(6, __pyx_n_s_dt, __pyx_n_s_gt, __pyx_n_s_iscrowd, __pyx_n_s_m, __pyx_n_s_n, __pyx_n_s_iou); if (unlikely(!__pyx_tuple__11)) __PYX_ERR(0, 199, __pyx_L1_error)
11293 __Pyx_GOTREF(__pyx_tuple__11);
11294 __Pyx_GIVEREF(__pyx_tuple__11);
11295 __pyx_codeobj__12 = (PyObject*)__Pyx_PyCode_New(6, 0, 6, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__11, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_yjr_PycharmProjects_Faster, __pyx_n_s_bbIou, 199, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__12)) __PYX_ERR(0, 199, __pyx_L1_error)
11297 /* "pycocotools/_mask.pyx":201
11298 * def _bbIou(np.ndarray[np.double_t, ndim=2] dt, np.ndarray[np.double_t, ndim=2] gt, np.ndarray[np.uint8_t, ndim=1] iscrowd, siz m, siz n, np.ndarray[np.double_t, ndim=1] _iou):
11299 * bbIou( <BB> dt.data, <BB> gt.data, m, n, <byte*> iscrowd.data, <double*>_iou.data )
11300 * def _len(obj): # <<<<<<<<<<<<<<
11302 * if type(obj) == RLEs:
11304 __pyx_tuple__13 = PyTuple_Pack(2, __pyx_n_s_obj, __pyx_n_s_N); if (unlikely(!__pyx_tuple__13)) __PYX_ERR(0, 201, __pyx_L1_error)
11305 __Pyx_GOTREF(__pyx_tuple__13);
11306 __Pyx_GIVEREF(__pyx_tuple__13);
11307 __pyx_codeobj__14 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__13, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_yjr_PycharmProjects_Faster, __pyx_n_s_len, 201, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__14)) __PYX_ERR(0, 201, __pyx_L1_error)
11309 /* "pycocotools/_mask.pyx":221
11311 * if not type(dt) == type(gt):
11312 * raise Exception('The dt and gt should have the same data type, either RLEs, list or np.ndarray') # <<<<<<<<<<<<<<
11314 * # define local variables
11316 __pyx_tuple__15 = PyTuple_Pack(1, __pyx_kp_s_The_dt_and_gt_should_have_the_sa); if (unlikely(!__pyx_tuple__15)) __PYX_ERR(0, 221, __pyx_L1_error)
11317 __Pyx_GOTREF(__pyx_tuple__15);
11318 __Pyx_GIVEREF(__pyx_tuple__15);
11320 /* "pycocotools/_mask.pyx":232
11323 * raise Exception('input data type not allowed.') # <<<<<<<<<<<<<<
11324 * _iou = <double*> malloc(m*n* sizeof(double))
11325 * iou = np.zeros((m*n, ), dtype=np.double)
11327 __pyx_tuple__16 = PyTuple_Pack(1, __pyx_kp_s_input_data_type_not_allowed); if (unlikely(!__pyx_tuple__16)) __PYX_ERR(0, 232, __pyx_L1_error)
11328 __Pyx_GOTREF(__pyx_tuple__16);
11329 __Pyx_GIVEREF(__pyx_tuple__16);
11331 /* "pycocotools/_mask.pyx":277
11333 * for i in range(n):
11334 * Rs = RLEs(1) # <<<<<<<<<<<<<<
11335 * cnts = np.array(ucRles[i]['counts'], dtype=np.uint32)
11336 * # time for malloc can be saved here but it's fine
11338 __pyx_tuple__17 = PyTuple_Pack(1, __pyx_int_1); if (unlikely(!__pyx_tuple__17)) __PYX_ERR(0, 277, __pyx_L1_error)
11339 __Pyx_GOTREF(__pyx_tuple__17);
11340 __Pyx_GIVEREF(__pyx_tuple__17);
11342 /* "pycocotools/_mask.pyx":307
11343 * objs = frUncompressedRLE([pyobj], h, w)[0]
11345 * raise Exception('input type is not supported.') # <<<<<<<<<<<<<<
11348 __pyx_tuple__18 = PyTuple_Pack(1, __pyx_kp_s_input_type_is_not_supported); if (unlikely(!__pyx_tuple__18)) __PYX_ERR(0, 307, __pyx_L1_error)
11349 __Pyx_GOTREF(__pyx_tuple__18);
11350 __Pyx_GIVEREF(__pyx_tuple__18);
11352 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":218
11353 * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
11354 * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)):
11355 * raise ValueError(u"ndarray is not C contiguous") # <<<<<<<<<<<<<<
11357 * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
11359 __pyx_tuple__19 = PyTuple_Pack(1, __pyx_kp_u_ndarray_is_not_C_contiguous); if (unlikely(!__pyx_tuple__19)) __PYX_ERR(1, 218, __pyx_L1_error)
11360 __Pyx_GOTREF(__pyx_tuple__19);
11361 __Pyx_GIVEREF(__pyx_tuple__19);
11363 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":222
11364 * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
11365 * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)):
11366 * raise ValueError(u"ndarray is not Fortran contiguous") # <<<<<<<<<<<<<<
11368 * info.buf = PyArray_DATA(self)
11370 __pyx_tuple__20 = PyTuple_Pack(1, __pyx_kp_u_ndarray_is_not_Fortran_contiguou); if (unlikely(!__pyx_tuple__20)) __PYX_ERR(1, 222, __pyx_L1_error)
11371 __Pyx_GOTREF(__pyx_tuple__20);
11372 __Pyx_GIVEREF(__pyx_tuple__20);
11374 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":259
11375 * if ((descr.byteorder == c'>' and little_endian) or
11376 * (descr.byteorder == c'<' and not little_endian)):
11377 * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<<
11378 * if t == NPY_BYTE: f = "b"
11379 * elif t == NPY_UBYTE: f = "B"
11381 __pyx_tuple__21 = PyTuple_Pack(1, __pyx_kp_u_Non_native_byte_order_not_suppor); if (unlikely(!__pyx_tuple__21)) __PYX_ERR(1, 259, __pyx_L1_error)
11382 __Pyx_GOTREF(__pyx_tuple__21);
11383 __Pyx_GIVEREF(__pyx_tuple__21);
11385 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":799
11387 * if (end - f) - <int>(new_offset - offset[0]) < 15:
11388 * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<<
11390 * if ((child.byteorder == c'>' and little_endian) or
11392 __pyx_tuple__22 = PyTuple_Pack(1, __pyx_kp_u_Format_string_allocated_too_shor); if (unlikely(!__pyx_tuple__22)) __PYX_ERR(1, 799, __pyx_L1_error)
11393 __Pyx_GOTREF(__pyx_tuple__22);
11394 __Pyx_GIVEREF(__pyx_tuple__22);
11396 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":803
11397 * if ((child.byteorder == c'>' and little_endian) or
11398 * (child.byteorder == c'<' and not little_endian)):
11399 * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<<
11400 * # One could encode it in the format string and have Cython
11401 * # complain instead, BUT: < and > in format strings also imply
11403 __pyx_tuple__23 = PyTuple_Pack(1, __pyx_kp_u_Non_native_byte_order_not_suppor); if (unlikely(!__pyx_tuple__23)) __PYX_ERR(1, 803, __pyx_L1_error)
11404 __Pyx_GOTREF(__pyx_tuple__23);
11405 __Pyx_GIVEREF(__pyx_tuple__23);
11407 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":823
11408 * t = child.type_num
11410 * raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<<
11412 * # Until ticket #99 is fixed, use integers to avoid warnings
11414 __pyx_tuple__24 = PyTuple_Pack(1, __pyx_kp_u_Format_string_allocated_too_shor_2); if (unlikely(!__pyx_tuple__24)) __PYX_ERR(1, 823, __pyx_L1_error)
11415 __Pyx_GOTREF(__pyx_tuple__24);
11416 __Pyx_GIVEREF(__pyx_tuple__24);
11418 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":989
11420 * except Exception:
11421 * raise ImportError("numpy.core.multiarray failed to import") # <<<<<<<<<<<<<<
11423 * cdef inline int import_umath() except -1:
11425 __pyx_tuple__25 = PyTuple_Pack(1, __pyx_kp_s_numpy_core_multiarray_failed_to); if (unlikely(!__pyx_tuple__25)) __PYX_ERR(1, 989, __pyx_L1_error)
11426 __Pyx_GOTREF(__pyx_tuple__25);
11427 __Pyx_GIVEREF(__pyx_tuple__25);
11429 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":995
11431 * except Exception:
11432 * raise ImportError("numpy.core.umath failed to import") # <<<<<<<<<<<<<<
11434 * cdef inline int import_ufunc() except -1:
11436 __pyx_tuple__26 = PyTuple_Pack(1, __pyx_kp_s_numpy_core_umath_failed_to_impor); if (unlikely(!__pyx_tuple__26)) __PYX_ERR(1, 995, __pyx_L1_error)
11437 __Pyx_GOTREF(__pyx_tuple__26);
11438 __Pyx_GIVEREF(__pyx_tuple__26);
11440 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1001
11442 * except Exception:
11443 * raise ImportError("numpy.core.umath failed to import") # <<<<<<<<<<<<<<
11445 __pyx_tuple__27 = PyTuple_Pack(1, __pyx_kp_s_numpy_core_umath_failed_to_impor); if (unlikely(!__pyx_tuple__27)) __PYX_ERR(1, 1001, __pyx_L1_error)
11446 __Pyx_GOTREF(__pyx_tuple__27);
11447 __Pyx_GIVEREF(__pyx_tuple__27);
11449 /* "pycocotools/_mask.pyx":103
11451 * # internal conversion from Python RLEs object to compressed RLE format
11452 * def _toString(RLEs Rs): # <<<<<<<<<<<<<<
11453 * cdef siz n = Rs.n
11454 * cdef bytes py_string
11456 __pyx_tuple__28 = PyTuple_Pack(6, __pyx_n_s_Rs, __pyx_n_s_n, __pyx_n_s_py_string, __pyx_n_s_c_string, __pyx_n_s_objs, __pyx_n_s_i); if (unlikely(!__pyx_tuple__28)) __PYX_ERR(0, 103, __pyx_L1_error)
11457 __Pyx_GOTREF(__pyx_tuple__28);
11458 __Pyx_GIVEREF(__pyx_tuple__28);
11459 __pyx_codeobj__29 = (PyObject*)__Pyx_PyCode_New(1, 0, 6, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__28, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_yjr_PycharmProjects_Faster, __pyx_n_s_toString, 103, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__29)) __PYX_ERR(0, 103, __pyx_L1_error)
11461 /* "pycocotools/_mask.pyx":119
11463 * # internal conversion from compressed RLE format to Python RLEs object
11464 * def _frString(rleObjs): # <<<<<<<<<<<<<<
11465 * cdef siz n = len(rleObjs)
11468 __pyx_tuple__30 = PyTuple_Pack(7, __pyx_n_s_rleObjs, __pyx_n_s_n, __pyx_n_s_Rs, __pyx_n_s_py_string, __pyx_n_s_c_string, __pyx_n_s_i, __pyx_n_s_obj); if (unlikely(!__pyx_tuple__30)) __PYX_ERR(0, 119, __pyx_L1_error)
11469 __Pyx_GOTREF(__pyx_tuple__30);
11470 __Pyx_GIVEREF(__pyx_tuple__30);
11471 __pyx_codeobj__31 = (PyObject*)__Pyx_PyCode_New(1, 0, 7, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__30, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_yjr_PycharmProjects_Faster, __pyx_n_s_frString, 119, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__31)) __PYX_ERR(0, 119, __pyx_L1_error)
11473 /* "pycocotools/_mask.pyx":137
11474 * # encode mask to RLEs objects
11475 * # list of RLE string can be generated by RLEs member function
11476 * def encode(np.ndarray[np.uint8_t, ndim=3, mode='fortran'] mask): # <<<<<<<<<<<<<<
11477 * h, w, n = mask.shape[0], mask.shape[1], mask.shape[2]
11478 * cdef RLEs Rs = RLEs(n)
11480 __pyx_tuple__32 = PyTuple_Pack(6, __pyx_n_s_mask, __pyx_n_s_h, __pyx_n_s_w, __pyx_n_s_n, __pyx_n_s_Rs, __pyx_n_s_objs); if (unlikely(!__pyx_tuple__32)) __PYX_ERR(0, 137, __pyx_L1_error)
11481 __Pyx_GOTREF(__pyx_tuple__32);
11482 __Pyx_GIVEREF(__pyx_tuple__32);
11483 __pyx_codeobj__33 = (PyObject*)__Pyx_PyCode_New(1, 0, 6, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__32, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_yjr_PycharmProjects_Faster, __pyx_n_s_encode, 137, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__33)) __PYX_ERR(0, 137, __pyx_L1_error)
11485 /* "pycocotools/_mask.pyx":145
11487 * # decode mask from compressed list of RLE string or RLEs object
11488 * def decode(rleObjs): # <<<<<<<<<<<<<<
11489 * cdef RLEs Rs = _frString(rleObjs)
11490 * h, w, n = Rs._R[0].h, Rs._R[0].w, Rs._n
11492 __pyx_tuple__34 = PyTuple_Pack(6, __pyx_n_s_rleObjs, __pyx_n_s_Rs, __pyx_n_s_h, __pyx_n_s_w, __pyx_n_s_n, __pyx_n_s_masks); if (unlikely(!__pyx_tuple__34)) __PYX_ERR(0, 145, __pyx_L1_error)
11493 __Pyx_GOTREF(__pyx_tuple__34);
11494 __Pyx_GIVEREF(__pyx_tuple__34);
11495 __pyx_codeobj__35 = (PyObject*)__Pyx_PyCode_New(1, 0, 6, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__34, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_yjr_PycharmProjects_Faster, __pyx_n_s_decode, 145, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__35)) __PYX_ERR(0, 145, __pyx_L1_error)
11497 /* "pycocotools/_mask.pyx":152
11498 * return np.array(masks)
11500 * def merge(rleObjs, intersect=0): # <<<<<<<<<<<<<<
11501 * cdef RLEs Rs = _frString(rleObjs)
11502 * cdef RLEs R = RLEs(1)
11504 __pyx_tuple__36 = PyTuple_Pack(5, __pyx_n_s_rleObjs, __pyx_n_s_intersect, __pyx_n_s_Rs, __pyx_n_s_R, __pyx_n_s_obj); if (unlikely(!__pyx_tuple__36)) __PYX_ERR(0, 152, __pyx_L1_error)
11505 __Pyx_GOTREF(__pyx_tuple__36);
11506 __Pyx_GIVEREF(__pyx_tuple__36);
11507 __pyx_codeobj__37 = (PyObject*)__Pyx_PyCode_New(2, 0, 5, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__36, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_yjr_PycharmProjects_Faster, __pyx_n_s_merge, 152, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__37)) __PYX_ERR(0, 152, __pyx_L1_error)
11509 /* "pycocotools/_mask.pyx":159
11512 * def area(rleObjs): # <<<<<<<<<<<<<<
11513 * cdef RLEs Rs = _frString(rleObjs)
11514 * cdef uint* _a = <uint*> malloc(Rs._n* sizeof(uint))
11516 __pyx_tuple__38 = PyTuple_Pack(5, __pyx_n_s_rleObjs, __pyx_n_s_Rs, __pyx_n_s_a, __pyx_n_s_shape, __pyx_n_s_a_2); if (unlikely(!__pyx_tuple__38)) __PYX_ERR(0, 159, __pyx_L1_error)
11517 __Pyx_GOTREF(__pyx_tuple__38);
11518 __Pyx_GIVEREF(__pyx_tuple__38);
11519 __pyx_codeobj__39 = (PyObject*)__Pyx_PyCode_New(1, 0, 5, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__38, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_yjr_PycharmProjects_Faster, __pyx_n_s_area, 159, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__39)) __PYX_ERR(0, 159, __pyx_L1_error)
11521 /* "pycocotools/_mask.pyx":171
11523 * # iou computation. support function overload (RLEs-RLEs and bbox-bbox).
11524 * def iou( dt, gt, pyiscrowd ): # <<<<<<<<<<<<<<
11525 * def _preproc(objs):
11526 * if len(objs) == 0:
11528 __pyx_tuple__40 = PyTuple_Pack(18, __pyx_n_s_dt, __pyx_n_s_gt, __pyx_n_s_pyiscrowd, __pyx_n_s_preproc, __pyx_n_s_preproc, __pyx_n_s_rleIou, __pyx_n_s_rleIou, __pyx_n_s_bbIou, __pyx_n_s_bbIou, __pyx_n_s_len, __pyx_n_s_len, __pyx_n_s_iscrowd, __pyx_n_s_m, __pyx_n_s_n, __pyx_n_s_iou, __pyx_n_s_shape, __pyx_n_s_iouFun, __pyx_n_s_iou_2); if (unlikely(!__pyx_tuple__40)) __PYX_ERR(0, 171, __pyx_L1_error)
11529 __Pyx_GOTREF(__pyx_tuple__40);
11530 __Pyx_GIVEREF(__pyx_tuple__40);
11531 __pyx_codeobj__41 = (PyObject*)__Pyx_PyCode_New(3, 0, 18, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__40, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_yjr_PycharmProjects_Faster, __pyx_n_s_iou_2, 171, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__41)) __PYX_ERR(0, 171, __pyx_L1_error)
11533 /* "pycocotools/_mask.pyx":241
11534 * return iou.reshape((m,n), order='F')
11536 * def toBbox( rleObjs ): # <<<<<<<<<<<<<<
11537 * cdef RLEs Rs = _frString(rleObjs)
11538 * cdef siz n = Rs.n
11540 __pyx_tuple__42 = PyTuple_Pack(6, __pyx_n_s_rleObjs, __pyx_n_s_Rs, __pyx_n_s_n, __pyx_n_s_bb_2, __pyx_n_s_shape, __pyx_n_s_bb); if (unlikely(!__pyx_tuple__42)) __PYX_ERR(0, 241, __pyx_L1_error)
11541 __Pyx_GOTREF(__pyx_tuple__42);
11542 __Pyx_GIVEREF(__pyx_tuple__42);
11543 __pyx_codeobj__43 = (PyObject*)__Pyx_PyCode_New(1, 0, 6, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__42, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_yjr_PycharmProjects_Faster, __pyx_n_s_toBbox, 241, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__43)) __PYX_ERR(0, 241, __pyx_L1_error)
11545 /* "pycocotools/_mask.pyx":253
11548 * def frBbox(np.ndarray[np.double_t, ndim=2] bb, siz h, siz w ): # <<<<<<<<<<<<<<
11549 * cdef siz n = bb.shape[0]
11552 __pyx_tuple__44 = PyTuple_Pack(6, __pyx_n_s_bb, __pyx_n_s_h, __pyx_n_s_w, __pyx_n_s_n, __pyx_n_s_Rs, __pyx_n_s_objs); if (unlikely(!__pyx_tuple__44)) __PYX_ERR(0, 253, __pyx_L1_error)
11553 __Pyx_GOTREF(__pyx_tuple__44);
11554 __Pyx_GIVEREF(__pyx_tuple__44);
11555 __pyx_codeobj__45 = (PyObject*)__Pyx_PyCode_New(3, 0, 6, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__44, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_yjr_PycharmProjects_Faster, __pyx_n_s_frBbox, 253, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__45)) __PYX_ERR(0, 253, __pyx_L1_error)
11557 /* "pycocotools/_mask.pyx":260
11560 * def frPoly( poly, siz h, siz w ): # <<<<<<<<<<<<<<
11561 * cdef np.ndarray[np.double_t, ndim=1] np_poly
11564 __pyx_tuple__46 = PyTuple_Pack(9, __pyx_n_s_poly, __pyx_n_s_h, __pyx_n_s_w, __pyx_n_s_np_poly, __pyx_n_s_n, __pyx_n_s_Rs, __pyx_n_s_i, __pyx_n_s_p, __pyx_n_s_objs); if (unlikely(!__pyx_tuple__46)) __PYX_ERR(0, 260, __pyx_L1_error)
11565 __Pyx_GOTREF(__pyx_tuple__46);
11566 __Pyx_GIVEREF(__pyx_tuple__46);
11567 __pyx_codeobj__47 = (PyObject*)__Pyx_PyCode_New(3, 0, 9, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__46, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_yjr_PycharmProjects_Faster, __pyx_n_s_frPoly, 260, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__47)) __PYX_ERR(0, 260, __pyx_L1_error)
11569 /* "pycocotools/_mask.pyx":270
11572 * def frUncompressedRLE(ucRles, siz h, siz w): # <<<<<<<<<<<<<<
11573 * cdef np.ndarray[np.uint32_t, ndim=1] cnts
11576 __pyx_tuple__48 = PyTuple_Pack(11, __pyx_n_s_ucRles, __pyx_n_s_h, __pyx_n_s_w, __pyx_n_s_cnts, __pyx_n_s_R, __pyx_n_s_data, __pyx_n_s_n, __pyx_n_s_objs, __pyx_n_s_i, __pyx_n_s_Rs, __pyx_n_s_j); if (unlikely(!__pyx_tuple__48)) __PYX_ERR(0, 270, __pyx_L1_error)
11577 __Pyx_GOTREF(__pyx_tuple__48);
11578 __Pyx_GIVEREF(__pyx_tuple__48);
11579 __pyx_codeobj__49 = (PyObject*)__Pyx_PyCode_New(3, 0, 11, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__48, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_yjr_PycharmProjects_Faster, __pyx_n_s_frUncompressedRLE, 270, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__49)) __PYX_ERR(0, 270, __pyx_L1_error)
11581 /* "pycocotools/_mask.pyx":288
11584 * def frPyObjects(pyobj, h, w): # <<<<<<<<<<<<<<
11585 * # encode rle from a list of python objects
11586 * if type(pyobj) == np.ndarray:
11588 __pyx_tuple__50 = PyTuple_Pack(4, __pyx_n_s_pyobj, __pyx_n_s_h, __pyx_n_s_w, __pyx_n_s_objs); if (unlikely(!__pyx_tuple__50)) __PYX_ERR(0, 288, __pyx_L1_error)
11589 __Pyx_GOTREF(__pyx_tuple__50);
11590 __Pyx_GIVEREF(__pyx_tuple__50);
11591 __pyx_codeobj__51 = (PyObject*)__Pyx_PyCode_New(3, 0, 4, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__50, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_home_yjr_PycharmProjects_Faster, __pyx_n_s_frPyObjects, 288, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__51)) __PYX_ERR(0, 288, __pyx_L1_error)
11592 __Pyx_RefNannyFinishContext();
11595 __Pyx_RefNannyFinishContext();
11599 static int __Pyx_InitGlobals(void) {
11600 if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
11601 __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) __PYX_ERR(0, 1, __pyx_L1_error)
11602 __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) __PYX_ERR(0, 1, __pyx_L1_error)
11603 __pyx_int_2 = PyInt_FromLong(2); if (unlikely(!__pyx_int_2)) __PYX_ERR(0, 1, __pyx_L1_error)
11604 __pyx_int_3 = PyInt_FromLong(3); if (unlikely(!__pyx_int_3)) __PYX_ERR(0, 1, __pyx_L1_error)
11605 __pyx_int_4 = PyInt_FromLong(4); if (unlikely(!__pyx_int_4)) __PYX_ERR(0, 1, __pyx_L1_error)
11611 #if PY_MAJOR_VERSION < 3
11612 PyMODINIT_FUNC init_mask(void); /*proto*/
11613 PyMODINIT_FUNC init_mask(void)
11615 PyMODINIT_FUNC PyInit__mask(void); /*proto*/
11616 PyMODINIT_FUNC PyInit__mask(void)
11619 PyObject *__pyx_t_1 = NULL;
11620 PyObject *__pyx_t_2 = NULL;
11622 __Pyx_RefNannyDeclarations
11623 #if CYTHON_REFNANNY
11624 __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
11625 if (!__Pyx_RefNanny) {
11627 __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
11628 if (!__Pyx_RefNanny)
11629 Py_FatalError("failed to import 'refnanny' module");
11632 __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit__mask(void)", 0);
11633 if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
11634 __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error)
11635 __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error)
11636 __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error)
11637 #ifdef __Pyx_CyFunction_USED
11638 if (__pyx_CyFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
11640 #ifdef __Pyx_FusedFunction_USED
11641 if (__pyx_FusedFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
11643 #ifdef __Pyx_Coroutine_USED
11644 if (__pyx_Coroutine_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
11646 #ifdef __Pyx_Generator_USED
11647 if (__pyx_Generator_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
11649 #ifdef __Pyx_StopAsyncIteration_USED
11650 if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
11652 /*--- Library function declarations ---*/
11653 /*--- Threads initialization code ---*/
11654 #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS
11655 #ifdef WITH_THREAD /* Python build with threading support? */
11656 PyEval_InitThreads();
11659 /*--- Module creation code ---*/
11660 #if PY_MAJOR_VERSION < 3
11661 __pyx_m = Py_InitModule4("_mask", __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m);
11663 __pyx_m = PyModule_Create(&__pyx_moduledef);
11665 if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error)
11666 __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error)
11667 Py_INCREF(__pyx_d);
11668 __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error)
11669 #if CYTHON_COMPILING_IN_PYPY
11670 Py_INCREF(__pyx_b);
11672 if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error);
11673 /*--- Initialize various global constants etc. ---*/
11674 if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
11675 #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
11676 if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
11678 if (__pyx_module_is_main_pycocotools___mask) {
11679 if (PyObject_SetAttrString(__pyx_m, "__name__", __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
11681 #if PY_MAJOR_VERSION >= 3
11683 PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error)
11684 if (!PyDict_GetItemString(modules, "pycocotools._mask")) {
11685 if (unlikely(PyDict_SetItemString(modules, "pycocotools._mask", __pyx_m) < 0)) __PYX_ERR(0, 1, __pyx_L1_error)
11689 /*--- Builtin init code ---*/
11690 if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
11691 /*--- Constants init code ---*/
11692 if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
11693 /*--- Global init code ---*/
11694 /*--- Variable export code ---*/
11695 /*--- Function export code ---*/
11696 /*--- Type init code ---*/
11697 if (PyType_Ready(&__pyx_type_11pycocotools_5_mask_RLEs) < 0) __PYX_ERR(0, 56, __pyx_L1_error)
11698 __pyx_type_11pycocotools_5_mask_RLEs.tp_print = 0;
11699 if (PyObject_SetAttrString(__pyx_m, "RLEs", (PyObject *)&__pyx_type_11pycocotools_5_mask_RLEs) < 0) __PYX_ERR(0, 56, __pyx_L1_error)
11700 __pyx_ptype_11pycocotools_5_mask_RLEs = &__pyx_type_11pycocotools_5_mask_RLEs;
11701 if (PyType_Ready(&__pyx_type_11pycocotools_5_mask_Masks) < 0) __PYX_ERR(0, 77, __pyx_L1_error)
11702 __pyx_type_11pycocotools_5_mask_Masks.tp_print = 0;
11703 if (PyObject_SetAttrString(__pyx_m, "Masks", (PyObject *)&__pyx_type_11pycocotools_5_mask_Masks) < 0) __PYX_ERR(0, 77, __pyx_L1_error)
11704 __pyx_ptype_11pycocotools_5_mask_Masks = &__pyx_type_11pycocotools_5_mask_Masks;
11705 /*--- Type import code ---*/
11706 __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "type",
11707 #if CYTHON_COMPILING_IN_PYPY
11708 sizeof(PyTypeObject),
11710 sizeof(PyHeapTypeObject),
11712 0); if (unlikely(!__pyx_ptype_7cpython_4type_type)) __PYX_ERR(2, 9, __pyx_L1_error)
11713 __pyx_ptype_5numpy_dtype = __Pyx_ImportType("numpy", "dtype", sizeof(PyArray_Descr), 0); if (unlikely(!__pyx_ptype_5numpy_dtype)) __PYX_ERR(1, 155, __pyx_L1_error)
11714 __pyx_ptype_5numpy_flatiter = __Pyx_ImportType("numpy", "flatiter", sizeof(PyArrayIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_flatiter)) __PYX_ERR(1, 168, __pyx_L1_error)
11715 __pyx_ptype_5numpy_broadcast = __Pyx_ImportType("numpy", "broadcast", sizeof(PyArrayMultiIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_broadcast)) __PYX_ERR(1, 172, __pyx_L1_error)
11716 __pyx_ptype_5numpy_ndarray = __Pyx_ImportType("numpy", "ndarray", sizeof(PyArrayObject), 0); if (unlikely(!__pyx_ptype_5numpy_ndarray)) __PYX_ERR(1, 181, __pyx_L1_error)
11717 __pyx_ptype_5numpy_ufunc = __Pyx_ImportType("numpy", "ufunc", sizeof(PyUFuncObject), 0); if (unlikely(!__pyx_ptype_5numpy_ufunc)) __PYX_ERR(1, 861, __pyx_L1_error)
11718 /*--- Variable import code ---*/
11719 /*--- Function import code ---*/
11720 /*--- Execution code ---*/
11721 #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED)
11722 if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
11725 /* "pycocotools/_mask.pyx":11
11726 * #**************************************************************************
11728 * __author__ = 'tsungyi' # <<<<<<<<<<<<<<
11732 if (PyDict_SetItem(__pyx_d, __pyx_n_s_author, __pyx_n_s_tsungyi) < 0) __PYX_ERR(0, 11, __pyx_L1_error)
11734 /* "pycocotools/_mask.pyx":13
11735 * __author__ = 'tsungyi'
11737 * import sys # <<<<<<<<<<<<<<
11738 * PYTHON_VERSION = sys.version_info[0]
11741 __pyx_t_1 = __Pyx_Import(__pyx_n_s_sys, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 13, __pyx_L1_error)
11742 __Pyx_GOTREF(__pyx_t_1);
11743 if (PyDict_SetItem(__pyx_d, __pyx_n_s_sys, __pyx_t_1) < 0) __PYX_ERR(0, 13, __pyx_L1_error)
11744 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11746 /* "pycocotools/_mask.pyx":14
11749 * PYTHON_VERSION = sys.version_info[0] # <<<<<<<<<<<<<<
11751 * # import both Python-level and C-level symbols of Numpy
11753 __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_sys); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 14, __pyx_L1_error)
11754 __Pyx_GOTREF(__pyx_t_1);
11755 __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_version_info); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 14, __pyx_L1_error)
11756 __Pyx_GOTREF(__pyx_t_2);
11757 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11758 __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_2, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 14, __pyx_L1_error)
11759 __Pyx_GOTREF(__pyx_t_1);
11760 __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
11761 if (PyDict_SetItem(__pyx_d, __pyx_n_s_PYTHON_VERSION, __pyx_t_1) < 0) __PYX_ERR(0, 14, __pyx_L1_error)
11762 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11764 /* "pycocotools/_mask.pyx":18
11765 * # import both Python-level and C-level symbols of Numpy
11766 * # the API uses Numpy to interface C and Python
11767 * import numpy as np # <<<<<<<<<<<<<<
11768 * cimport numpy as np
11769 * from libc.stdlib cimport malloc, free
11771 __pyx_t_1 = __Pyx_Import(__pyx_n_s_numpy, 0, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 18, __pyx_L1_error)
11772 __Pyx_GOTREF(__pyx_t_1);
11773 if (PyDict_SetItem(__pyx_d, __pyx_n_s_np, __pyx_t_1) < 0) __PYX_ERR(0, 18, __pyx_L1_error)
11774 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11776 /* "pycocotools/_mask.pyx":23
11778 * # intialized Numpy. must do.
11779 * np.import_array() # <<<<<<<<<<<<<<
11781 * # import numpy C function
11783 __pyx_t_3 = __pyx_f_5numpy_import_array(); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(0, 23, __pyx_L1_error)
11785 /* "pycocotools/_mask.pyx":103
11787 * # internal conversion from Python RLEs object to compressed RLE format
11788 * def _toString(RLEs Rs): # <<<<<<<<<<<<<<
11789 * cdef siz n = Rs.n
11790 * cdef bytes py_string
11792 __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_11pycocotools_5_mask_1_toString, NULL, __pyx_n_s_pycocotools__mask); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 103, __pyx_L1_error)
11793 __Pyx_GOTREF(__pyx_t_1);
11794 if (PyDict_SetItem(__pyx_d, __pyx_n_s_toString, __pyx_t_1) < 0) __PYX_ERR(0, 103, __pyx_L1_error)
11795 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11797 /* "pycocotools/_mask.pyx":119
11799 * # internal conversion from compressed RLE format to Python RLEs object
11800 * def _frString(rleObjs): # <<<<<<<<<<<<<<
11801 * cdef siz n = len(rleObjs)
11804 __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_11pycocotools_5_mask_3_frString, NULL, __pyx_n_s_pycocotools__mask); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 119, __pyx_L1_error)
11805 __Pyx_GOTREF(__pyx_t_1);
11806 if (PyDict_SetItem(__pyx_d, __pyx_n_s_frString, __pyx_t_1) < 0) __PYX_ERR(0, 119, __pyx_L1_error)
11807 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11809 /* "pycocotools/_mask.pyx":137
11810 * # encode mask to RLEs objects
11811 * # list of RLE string can be generated by RLEs member function
11812 * def encode(np.ndarray[np.uint8_t, ndim=3, mode='fortran'] mask): # <<<<<<<<<<<<<<
11813 * h, w, n = mask.shape[0], mask.shape[1], mask.shape[2]
11814 * cdef RLEs Rs = RLEs(n)
11816 __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_11pycocotools_5_mask_5encode, NULL, __pyx_n_s_pycocotools__mask); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 137, __pyx_L1_error)
11817 __Pyx_GOTREF(__pyx_t_1);
11818 if (PyDict_SetItem(__pyx_d, __pyx_n_s_encode, __pyx_t_1) < 0) __PYX_ERR(0, 137, __pyx_L1_error)
11819 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11821 /* "pycocotools/_mask.pyx":145
11823 * # decode mask from compressed list of RLE string or RLEs object
11824 * def decode(rleObjs): # <<<<<<<<<<<<<<
11825 * cdef RLEs Rs = _frString(rleObjs)
11826 * h, w, n = Rs._R[0].h, Rs._R[0].w, Rs._n
11828 __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_11pycocotools_5_mask_7decode, NULL, __pyx_n_s_pycocotools__mask); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 145, __pyx_L1_error)
11829 __Pyx_GOTREF(__pyx_t_1);
11830 if (PyDict_SetItem(__pyx_d, __pyx_n_s_decode, __pyx_t_1) < 0) __PYX_ERR(0, 145, __pyx_L1_error)
11831 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11833 /* "pycocotools/_mask.pyx":152
11834 * return np.array(masks)
11836 * def merge(rleObjs, intersect=0): # <<<<<<<<<<<<<<
11837 * cdef RLEs Rs = _frString(rleObjs)
11838 * cdef RLEs R = RLEs(1)
11840 __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_11pycocotools_5_mask_9merge, NULL, __pyx_n_s_pycocotools__mask); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 152, __pyx_L1_error)
11841 __Pyx_GOTREF(__pyx_t_1);
11842 if (PyDict_SetItem(__pyx_d, __pyx_n_s_merge, __pyx_t_1) < 0) __PYX_ERR(0, 152, __pyx_L1_error)
11843 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11845 /* "pycocotools/_mask.pyx":159
11848 * def area(rleObjs): # <<<<<<<<<<<<<<
11849 * cdef RLEs Rs = _frString(rleObjs)
11850 * cdef uint* _a = <uint*> malloc(Rs._n* sizeof(uint))
11852 __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_11pycocotools_5_mask_11area, NULL, __pyx_n_s_pycocotools__mask); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 159, __pyx_L1_error)
11853 __Pyx_GOTREF(__pyx_t_1);
11854 if (PyDict_SetItem(__pyx_d, __pyx_n_s_area, __pyx_t_1) < 0) __PYX_ERR(0, 159, __pyx_L1_error)
11855 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11857 /* "pycocotools/_mask.pyx":171
11859 * # iou computation. support function overload (RLEs-RLEs and bbox-bbox).
11860 * def iou( dt, gt, pyiscrowd ): # <<<<<<<<<<<<<<
11861 * def _preproc(objs):
11862 * if len(objs) == 0:
11864 __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_11pycocotools_5_mask_13iou, NULL, __pyx_n_s_pycocotools__mask); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 171, __pyx_L1_error)
11865 __Pyx_GOTREF(__pyx_t_1);
11866 if (PyDict_SetItem(__pyx_d, __pyx_n_s_iou_2, __pyx_t_1) < 0) __PYX_ERR(0, 171, __pyx_L1_error)
11867 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11869 /* "pycocotools/_mask.pyx":241
11870 * return iou.reshape((m,n), order='F')
11872 * def toBbox( rleObjs ): # <<<<<<<<<<<<<<
11873 * cdef RLEs Rs = _frString(rleObjs)
11874 * cdef siz n = Rs.n
11876 __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_11pycocotools_5_mask_15toBbox, NULL, __pyx_n_s_pycocotools__mask); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 241, __pyx_L1_error)
11877 __Pyx_GOTREF(__pyx_t_1);
11878 if (PyDict_SetItem(__pyx_d, __pyx_n_s_toBbox, __pyx_t_1) < 0) __PYX_ERR(0, 241, __pyx_L1_error)
11879 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11881 /* "pycocotools/_mask.pyx":253
11884 * def frBbox(np.ndarray[np.double_t, ndim=2] bb, siz h, siz w ): # <<<<<<<<<<<<<<
11885 * cdef siz n = bb.shape[0]
11888 __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_11pycocotools_5_mask_17frBbox, NULL, __pyx_n_s_pycocotools__mask); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 253, __pyx_L1_error)
11889 __Pyx_GOTREF(__pyx_t_1);
11890 if (PyDict_SetItem(__pyx_d, __pyx_n_s_frBbox, __pyx_t_1) < 0) __PYX_ERR(0, 253, __pyx_L1_error)
11891 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11893 /* "pycocotools/_mask.pyx":260
11896 * def frPoly( poly, siz h, siz w ): # <<<<<<<<<<<<<<
11897 * cdef np.ndarray[np.double_t, ndim=1] np_poly
11900 __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_11pycocotools_5_mask_19frPoly, NULL, __pyx_n_s_pycocotools__mask); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 260, __pyx_L1_error)
11901 __Pyx_GOTREF(__pyx_t_1);
11902 if (PyDict_SetItem(__pyx_d, __pyx_n_s_frPoly, __pyx_t_1) < 0) __PYX_ERR(0, 260, __pyx_L1_error)
11903 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11905 /* "pycocotools/_mask.pyx":270
11908 * def frUncompressedRLE(ucRles, siz h, siz w): # <<<<<<<<<<<<<<
11909 * cdef np.ndarray[np.uint32_t, ndim=1] cnts
11912 __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_11pycocotools_5_mask_21frUncompressedRLE, NULL, __pyx_n_s_pycocotools__mask); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 270, __pyx_L1_error)
11913 __Pyx_GOTREF(__pyx_t_1);
11914 if (PyDict_SetItem(__pyx_d, __pyx_n_s_frUncompressedRLE, __pyx_t_1) < 0) __PYX_ERR(0, 270, __pyx_L1_error)
11915 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11917 /* "pycocotools/_mask.pyx":288
11920 * def frPyObjects(pyobj, h, w): # <<<<<<<<<<<<<<
11921 * # encode rle from a list of python objects
11922 * if type(pyobj) == np.ndarray:
11924 __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_11pycocotools_5_mask_23frPyObjects, NULL, __pyx_n_s_pycocotools__mask); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 288, __pyx_L1_error)
11925 __Pyx_GOTREF(__pyx_t_1);
11926 if (PyDict_SetItem(__pyx_d, __pyx_n_s_frPyObjects, __pyx_t_1) < 0) __PYX_ERR(0, 288, __pyx_L1_error)
11927 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11929 /* "pycocotools/_mask.pyx":1
11930 * # distutils: language = c # <<<<<<<<<<<<<<
11931 * # distutils: sources = ../common/maskApi.c
11934 __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error)
11935 __Pyx_GOTREF(__pyx_t_1);
11936 if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_1) < 0) __PYX_ERR(0, 1, __pyx_L1_error)
11937 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
11939 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":997
11940 * raise ImportError("numpy.core.umath failed to import")
11942 * cdef inline int import_ufunc() except -1: # <<<<<<<<<<<<<<
11947 /*--- Wrapped vars code ---*/
11951 __Pyx_XDECREF(__pyx_t_1);
11952 __Pyx_XDECREF(__pyx_t_2);
11955 __Pyx_AddTraceback("init pycocotools._mask", __pyx_clineno, __pyx_lineno, __pyx_filename);
11957 Py_DECREF(__pyx_m); __pyx_m = 0;
11958 } else if (!PyErr_Occurred()) {
11959 PyErr_SetString(PyExc_ImportError, "init pycocotools._mask");
11962 __Pyx_RefNannyFinishContext();
11963 #if PY_MAJOR_VERSION < 3
11970 /* --- Runtime support code --- */
11972 #if CYTHON_REFNANNY
11973 static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
11974 PyObject *m = NULL, *p = NULL;
11976 m = PyImport_ImportModule((char *)modname);
11978 p = PyObject_GetAttrString(m, (char *)"RefNannyAPI");
11980 r = PyLong_AsVoidPtr(p);
11984 return (__Pyx_RefNannyAPIStruct *)r;
11988 /* GetBuiltinName */
11989 static PyObject *__Pyx_GetBuiltinName(PyObject *name) {
11990 PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name);
11991 if (unlikely(!result)) {
11992 PyErr_Format(PyExc_NameError,
11993 #if PY_MAJOR_VERSION >= 3
11994 "name '%U' is not defined", name);
11996 "name '%.200s' is not defined", PyString_AS_STRING(name));
12002 /* RaiseDoubleKeywords */
12003 static void __Pyx_RaiseDoubleKeywordsError(
12004 const char* func_name,
12007 PyErr_Format(PyExc_TypeError,
12008 #if PY_MAJOR_VERSION >= 3
12009 "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
12011 "%s() got multiple values for keyword argument '%s'", func_name,
12012 PyString_AsString(kw_name));
12016 /* ParseKeywords */
12017 static int __Pyx_ParseOptionalKeywords(
12019 PyObject **argnames[],
12021 PyObject *values[],
12022 Py_ssize_t num_pos_args,
12023 const char* function_name)
12025 PyObject *key = 0, *value = 0;
12026 Py_ssize_t pos = 0;
12028 PyObject*** first_kw_arg = argnames + num_pos_args;
12029 while (PyDict_Next(kwds, &pos, &key, &value)) {
12030 name = first_kw_arg;
12031 while (*name && (**name != key)) name++;
12033 values[name-argnames] = value;
12036 name = first_kw_arg;
12037 #if PY_MAJOR_VERSION < 3
12038 if (likely(PyString_CheckExact(key)) || likely(PyString_Check(key))) {
12040 if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key))
12041 && _PyString_Eq(**name, key)) {
12042 values[name-argnames] = value;
12047 if (*name) continue;
12049 PyObject*** argname = argnames;
12050 while (argname != first_kw_arg) {
12051 if ((**argname == key) || (
12052 (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key))
12053 && _PyString_Eq(**argname, key))) {
12054 goto arg_passed_twice;
12061 if (likely(PyUnicode_Check(key))) {
12063 int cmp = (**name == key) ? 0 :
12064 #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
12065 (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 :
12067 PyUnicode_Compare(**name, key);
12068 if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
12070 values[name-argnames] = value;
12075 if (*name) continue;
12077 PyObject*** argname = argnames;
12078 while (argname != first_kw_arg) {
12079 int cmp = (**argname == key) ? 0 :
12080 #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3
12081 (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 :
12083 PyUnicode_Compare(**argname, key);
12084 if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
12085 if (cmp == 0) goto arg_passed_twice;
12090 goto invalid_keyword_type;
12092 if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
12094 goto invalid_keyword;
12099 __Pyx_RaiseDoubleKeywordsError(function_name, key);
12101 invalid_keyword_type:
12102 PyErr_Format(PyExc_TypeError,
12103 "%.200s() keywords must be strings", function_name);
12106 PyErr_Format(PyExc_TypeError,
12107 #if PY_MAJOR_VERSION < 3
12108 "%.200s() got an unexpected keyword argument '%.200s'",
12109 function_name, PyString_AsString(key));
12111 "%s() got an unexpected keyword argument '%U'",
12112 function_name, key);
12118 /* RaiseArgTupleInvalid */
12119 static void __Pyx_RaiseArgtupleInvalid(
12120 const char* func_name,
12122 Py_ssize_t num_min,
12123 Py_ssize_t num_max,
12124 Py_ssize_t num_found)
12126 Py_ssize_t num_expected;
12127 const char *more_or_less;
12128 if (num_found < num_min) {
12129 num_expected = num_min;
12130 more_or_less = "at least";
12132 num_expected = num_max;
12133 more_or_less = "at most";
12136 more_or_less = "exactly";
12138 PyErr_Format(PyExc_TypeError,
12139 "%.200s() takes %.8s %" CYTHON_FORMAT_SSIZE_T "d positional argument%.1s (%" CYTHON_FORMAT_SSIZE_T "d given)",
12140 func_name, more_or_less, num_expected,
12141 (num_expected == 1) ? "" : "s", num_found);
12145 static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals) {
12146 #if CYTHON_COMPILING_IN_PYPY
12147 return PyObject_RichCompareBool(s1, s2, equals);
12150 return (equals == Py_EQ);
12151 } else if (PyBytes_CheckExact(s1) & PyBytes_CheckExact(s2)) {
12152 const char *ps1, *ps2;
12153 Py_ssize_t length = PyBytes_GET_SIZE(s1);
12154 if (length != PyBytes_GET_SIZE(s2))
12155 return (equals == Py_NE);
12156 ps1 = PyBytes_AS_STRING(s1);
12157 ps2 = PyBytes_AS_STRING(s2);
12158 if (ps1[0] != ps2[0]) {
12159 return (equals == Py_NE);
12160 } else if (length == 1) {
12161 return (equals == Py_EQ);
12163 int result = memcmp(ps1, ps2, (size_t)length);
12164 return (equals == Py_EQ) ? (result == 0) : (result != 0);
12166 } else if ((s1 == Py_None) & PyBytes_CheckExact(s2)) {
12167 return (equals == Py_NE);
12168 } else if ((s2 == Py_None) & PyBytes_CheckExact(s1)) {
12169 return (equals == Py_NE);
12172 PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
12175 result = __Pyx_PyObject_IsTrue(py_result);
12176 Py_DECREF(py_result);
12182 /* UnicodeEquals */
12183 static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals) {
12184 #if CYTHON_COMPILING_IN_PYPY
12185 return PyObject_RichCompareBool(s1, s2, equals);
12187 #if PY_MAJOR_VERSION < 3
12188 PyObject* owned_ref = NULL;
12190 int s1_is_unicode, s2_is_unicode;
12194 s1_is_unicode = PyUnicode_CheckExact(s1);
12195 s2_is_unicode = PyUnicode_CheckExact(s2);
12196 #if PY_MAJOR_VERSION < 3
12197 if ((s1_is_unicode & (!s2_is_unicode)) && PyString_CheckExact(s2)) {
12198 owned_ref = PyUnicode_FromObject(s2);
12199 if (unlikely(!owned_ref))
12203 } else if ((s2_is_unicode & (!s1_is_unicode)) && PyString_CheckExact(s1)) {
12204 owned_ref = PyUnicode_FromObject(s1);
12205 if (unlikely(!owned_ref))
12209 } else if (((!s2_is_unicode) & (!s1_is_unicode))) {
12210 return __Pyx_PyBytes_Equals(s1, s2, equals);
12213 if (s1_is_unicode & s2_is_unicode) {
12216 void *data1, *data2;
12217 if (unlikely(__Pyx_PyUnicode_READY(s1) < 0) || unlikely(__Pyx_PyUnicode_READY(s2) < 0))
12219 length = __Pyx_PyUnicode_GET_LENGTH(s1);
12220 if (length != __Pyx_PyUnicode_GET_LENGTH(s2)) {
12223 kind = __Pyx_PyUnicode_KIND(s1);
12224 if (kind != __Pyx_PyUnicode_KIND(s2)) {
12227 data1 = __Pyx_PyUnicode_DATA(s1);
12228 data2 = __Pyx_PyUnicode_DATA(s2);
12229 if (__Pyx_PyUnicode_READ(kind, data1, 0) != __Pyx_PyUnicode_READ(kind, data2, 0)) {
12231 } else if (length == 1) {
12234 int result = memcmp(data1, data2, (size_t)(length * kind));
12235 #if PY_MAJOR_VERSION < 3
12236 Py_XDECREF(owned_ref);
12238 return (equals == Py_EQ) ? (result == 0) : (result != 0);
12240 } else if ((s1 == Py_None) & s2_is_unicode) {
12242 } else if ((s2 == Py_None) & s1_is_unicode) {
12246 PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
12249 result = __Pyx_PyObject_IsTrue(py_result);
12250 Py_DECREF(py_result);
12254 #if PY_MAJOR_VERSION < 3
12255 Py_XDECREF(owned_ref);
12257 return (equals == Py_EQ);
12259 #if PY_MAJOR_VERSION < 3
12260 Py_XDECREF(owned_ref);
12262 return (equals == Py_NE);
12267 #if CYTHON_COMPILING_IN_CPYTHON
12268 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
12270 ternaryfunc call = func->ob_type->tp_call;
12271 if (unlikely(!call))
12272 return PyObject_Call(func, arg, kw);
12273 if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
12275 result = (*call)(func, arg, kw);
12276 Py_LeaveRecursiveCall();
12277 if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
12280 "NULL result without error in PyObject_Call");
12286 /* PyErrFetchRestore */
12287 #if CYTHON_FAST_THREAD_STATE
12288 static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
12289 PyObject *tmp_type, *tmp_value, *tmp_tb;
12290 tmp_type = tstate->curexc_type;
12291 tmp_value = tstate->curexc_value;
12292 tmp_tb = tstate->curexc_traceback;
12293 tstate->curexc_type = type;
12294 tstate->curexc_value = value;
12295 tstate->curexc_traceback = tb;
12296 Py_XDECREF(tmp_type);
12297 Py_XDECREF(tmp_value);
12298 Py_XDECREF(tmp_tb);
12300 static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
12301 *type = tstate->curexc_type;
12302 *value = tstate->curexc_value;
12303 *tb = tstate->curexc_traceback;
12304 tstate->curexc_type = 0;
12305 tstate->curexc_value = 0;
12306 tstate->curexc_traceback = 0;
12310 /* RaiseException */
12311 #if PY_MAJOR_VERSION < 3
12312 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb,
12313 CYTHON_UNUSED PyObject *cause) {
12314 __Pyx_PyThreadState_declare
12316 if (!value || value == Py_None)
12320 if (!tb || tb == Py_None)
12324 if (!PyTraceBack_Check(tb)) {
12325 PyErr_SetString(PyExc_TypeError,
12326 "raise: arg 3 must be a traceback or None");
12330 if (PyType_Check(type)) {
12331 #if CYTHON_COMPILING_IN_PYPY
12333 Py_INCREF(Py_None);
12337 PyErr_NormalizeException(&type, &value, &tb);
12340 PyErr_SetString(PyExc_TypeError,
12341 "instance exception may not have a separate value");
12345 type = (PyObject*) Py_TYPE(type);
12347 if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
12348 PyErr_SetString(PyExc_TypeError,
12349 "raise: exception class must be a subclass of BaseException");
12353 __Pyx_PyThreadState_assign
12354 __Pyx_ErrRestore(type, value, tb);
12363 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
12364 PyObject* owned_instance = NULL;
12365 if (tb == Py_None) {
12367 } else if (tb && !PyTraceBack_Check(tb)) {
12368 PyErr_SetString(PyExc_TypeError,
12369 "raise: arg 3 must be a traceback or None");
12372 if (value == Py_None)
12374 if (PyExceptionInstance_Check(type)) {
12376 PyErr_SetString(PyExc_TypeError,
12377 "instance exception may not have a separate value");
12381 type = (PyObject*) Py_TYPE(value);
12382 } else if (PyExceptionClass_Check(type)) {
12383 PyObject *instance_class = NULL;
12384 if (value && PyExceptionInstance_Check(value)) {
12385 instance_class = (PyObject*) Py_TYPE(value);
12386 if (instance_class != type) {
12387 int is_subclass = PyObject_IsSubclass(instance_class, type);
12388 if (!is_subclass) {
12389 instance_class = NULL;
12390 } else if (unlikely(is_subclass == -1)) {
12393 type = instance_class;
12397 if (!instance_class) {
12400 args = PyTuple_New(0);
12401 else if (PyTuple_Check(value)) {
12405 args = PyTuple_Pack(1, value);
12408 owned_instance = PyObject_Call(type, args, NULL);
12410 if (!owned_instance)
12412 value = owned_instance;
12413 if (!PyExceptionInstance_Check(value)) {
12414 PyErr_Format(PyExc_TypeError,
12415 "calling %R should have returned an instance of "
12416 "BaseException, not %R",
12417 type, Py_TYPE(value));
12422 PyErr_SetString(PyExc_TypeError,
12423 "raise: exception class must be a subclass of BaseException");
12426 #if PY_VERSION_HEX >= 0x03030000
12429 if (cause && cause != Py_None) {
12431 PyObject *fixed_cause;
12432 if (cause == Py_None) {
12433 fixed_cause = NULL;
12434 } else if (PyExceptionClass_Check(cause)) {
12435 fixed_cause = PyObject_CallObject(cause, NULL);
12436 if (fixed_cause == NULL)
12438 } else if (PyExceptionInstance_Check(cause)) {
12439 fixed_cause = cause;
12440 Py_INCREF(fixed_cause);
12442 PyErr_SetString(PyExc_TypeError,
12443 "exception causes must derive from "
12447 PyException_SetCause(value, fixed_cause);
12449 PyErr_SetObject(type, value);
12451 #if CYTHON_COMPILING_IN_PYPY
12452 PyObject *tmp_type, *tmp_value, *tmp_tb;
12453 PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb);
12455 PyErr_Restore(tmp_type, tmp_value, tb);
12456 Py_XDECREF(tmp_tb);
12458 PyThreadState *tstate = PyThreadState_GET();
12459 PyObject* tmp_tb = tstate->curexc_traceback;
12460 if (tb != tmp_tb) {
12462 tstate->curexc_traceback = tb;
12463 Py_XDECREF(tmp_tb);
12468 Py_XDECREF(owned_instance);
12474 static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) {
12475 if (unlikely(!type)) {
12476 PyErr_SetString(PyExc_SystemError, "Missing type object");
12479 if (likely(PyObject_TypeCheck(obj, type)))
12481 PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s",
12482 Py_TYPE(obj)->tp_name, type->tp_name);
12487 static void __Pyx_RaiseArgumentTypeInvalid(const char* name, PyObject *obj, PyTypeObject *type) {
12488 PyErr_Format(PyExc_TypeError,
12489 "Argument '%.200s' has incorrect type (expected %.200s, got %.200s)",
12490 name, type->tp_name, Py_TYPE(obj)->tp_name);
12492 static CYTHON_INLINE int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed,
12493 const char *name, int exact)
12495 if (unlikely(!type)) {
12496 PyErr_SetString(PyExc_SystemError, "Missing type object");
12499 if (none_allowed && obj == Py_None) return 1;
12501 if (likely(Py_TYPE(obj) == type)) return 1;
12502 #if PY_MAJOR_VERSION == 2
12503 else if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj))) return 1;
12507 if (likely(PyObject_TypeCheck(obj, type))) return 1;
12509 __Pyx_RaiseArgumentTypeInvalid(name, obj, type);
12514 #if !CYTHON_COMPILING_IN_PYPY
12515 static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, CYTHON_UNUSED int inplace) {
12516 #if PY_MAJOR_VERSION < 3
12517 if (likely(PyInt_CheckExact(op1))) {
12518 const long b = intval;
12520 long a = PyInt_AS_LONG(op1);
12521 x = (long)((unsigned long)a + b);
12522 if (likely((x^a) >= 0 || (x^b) >= 0))
12523 return PyInt_FromLong(x);
12524 return PyLong_Type.tp_as_number->nb_add(op1, op2);
12527 #if CYTHON_USE_PYLONG_INTERNALS
12528 if (likely(PyLong_CheckExact(op1))) {
12529 const long b = intval;
12531 #ifdef HAVE_LONG_LONG
12532 const PY_LONG_LONG llb = intval;
12533 PY_LONG_LONG lla, llx;
12535 const digit* digits = ((PyLongObject*)op1)->ob_digit;
12536 const Py_ssize_t size = Py_SIZE(op1);
12537 if (likely(__Pyx_sst_abs(size) <= 1)) {
12538 a = likely(size) ? digits[0] : 0;
12539 if (size == -1) a = -a;
12543 if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
12544 a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
12546 #ifdef HAVE_LONG_LONG
12547 } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
12548 lla = -(PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
12553 if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
12554 a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
12556 #ifdef HAVE_LONG_LONG
12557 } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) {
12558 lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
12563 if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
12564 a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
12566 #ifdef HAVE_LONG_LONG
12567 } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
12568 lla = -(PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
12573 if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
12574 a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
12576 #ifdef HAVE_LONG_LONG
12577 } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) {
12578 lla = (PY_LONG_LONG) (((((((unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
12583 if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
12584 a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
12586 #ifdef HAVE_LONG_LONG
12587 } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
12588 lla = -(PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
12593 if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
12594 a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
12596 #ifdef HAVE_LONG_LONG
12597 } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) {
12598 lla = (PY_LONG_LONG) (((((((((unsigned PY_LONG_LONG)digits[3]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[2]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0]));
12602 default: return PyLong_Type.tp_as_number->nb_add(op1, op2);
12606 return PyLong_FromLong(x);
12607 #ifdef HAVE_LONG_LONG
12610 return PyLong_FromLongLong(llx);
12616 if (PyFloat_CheckExact(op1)) {
12617 const long b = intval;
12618 double a = PyFloat_AS_DOUBLE(op1);
12620 PyFPE_START_PROTECT("add", return NULL)
12621 result = ((double)a) + (double)b;
12622 PyFPE_END_PROTECT(result)
12623 return PyFloat_FromDouble(result);
12625 return (inplace ? PyNumber_InPlaceAdd : PyNumber_Add)(op1, op2);
12630 #if !CYTHON_COMPILING_IN_PYPY
12631 static PyObject* __Pyx_PyInt_EqObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, CYTHON_UNUSED int inplace) {
12635 #if PY_MAJOR_VERSION < 3
12636 if (likely(PyInt_CheckExact(op1))) {
12637 const long b = intval;
12638 long a = PyInt_AS_LONG(op1);
12646 #if CYTHON_USE_PYLONG_INTERNALS
12647 if (likely(PyLong_CheckExact(op1))) {
12648 const long b = intval;
12650 const digit* digits = ((PyLongObject*)op1)->ob_digit;
12651 const Py_ssize_t size = Py_SIZE(op1);
12652 if (likely(__Pyx_sst_abs(size) <= 1)) {
12653 a = likely(size) ? digits[0] : 0;
12654 if (size == -1) a = -a;
12658 if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
12659 a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
12663 if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
12664 a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
12668 if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
12669 a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
12673 if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
12674 a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
12678 if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
12679 a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
12683 if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
12684 a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
12687 #if PyLong_SHIFT < 30 && PyLong_SHIFT != 15
12688 default: return PyLong_Type.tp_richcompare(op1, op2, Py_EQ);
12690 default: Py_RETURN_FALSE;
12701 if (PyFloat_CheckExact(op1)) {
12702 const long b = intval;
12703 double a = PyFloat_AS_DOUBLE(op1);
12704 if ((double)a == (double)b) {
12710 return PyObject_RichCompare(op1, op2, Py_EQ);
12714 /* GetModuleGlobalName */
12715 static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name) {
12717 #if !CYTHON_AVOID_BORROWED_REFS
12718 result = PyDict_GetItem(__pyx_d, name);
12719 if (likely(result)) {
12723 result = PyObject_GetItem(__pyx_d, name);
12727 result = __Pyx_GetBuiltinName(name);
12732 /* PyCFunctionFastCall */
12733 #if CYTHON_FAST_PYCCALL
12734 static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, PyObject **args, Py_ssize_t nargs) {
12735 PyCFunctionObject *func = (PyCFunctionObject*)func_obj;
12736 PyCFunction meth = PyCFunction_GET_FUNCTION(func);
12737 PyObject *self = PyCFunction_GET_SELF(func);
12738 assert(PyCFunction_Check(func));
12739 assert(METH_FASTCALL == (PyCFunction_GET_FLAGS(func) & ~(METH_CLASS | METH_STATIC | METH_COEXIST)));
12740 assert(nargs >= 0);
12741 assert(nargs == 0 || args != NULL);
12742 /* _PyCFunction_FastCallDict() must not be called with an exception set,
12743 because it may clear it (directly or indirectly) and so the
12744 caller loses its exception */
12745 assert(!PyErr_Occurred());
12746 return (*((__Pyx_PyCFunctionFast)meth)) (self, args, nargs, NULL);
12748 #endif // CYTHON_FAST_PYCCALL
12750 /* PyFunctionFastCall */
12751 #if CYTHON_FAST_PYCALL
12752 #include "frameobject.h"
12753 static PyObject* __Pyx_PyFunction_FastCallNoKw(PyCodeObject *co, PyObject **args, Py_ssize_t na,
12754 PyObject *globals) {
12756 PyThreadState *tstate = PyThreadState_GET();
12757 PyObject **fastlocals;
12760 assert(globals != NULL);
12761 /* XXX Perhaps we should create a specialized
12762 PyFrame_New() that doesn't take locals, but does
12763 take builtins without sanity checking them.
12765 assert(tstate != NULL);
12766 f = PyFrame_New(tstate, co, globals, NULL);
12770 fastlocals = f->f_localsplus;
12771 for (i = 0; i < na; i++) {
12773 fastlocals[i] = *args++;
12775 result = PyEval_EvalFrameEx(f,0);
12776 ++tstate->recursion_depth;
12778 --tstate->recursion_depth;
12781 #if 1 || PY_VERSION_HEX < 0x030600B1
12782 static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, int nargs, PyObject *kwargs) {
12783 PyCodeObject *co = (PyCodeObject *)PyFunction_GET_CODE(func);
12784 PyObject *globals = PyFunction_GET_GLOBALS(func);
12785 PyObject *argdefs = PyFunction_GET_DEFAULTS(func);
12787 #if PY_MAJOR_VERSION >= 3
12790 PyObject *kwtuple, **k;
12795 assert(kwargs == NULL || PyDict_Check(kwargs));
12796 nk = kwargs ? PyDict_Size(kwargs) : 0;
12797 if (Py_EnterRecursiveCall((char*)" while calling a Python object")) {
12801 #if PY_MAJOR_VERSION >= 3
12802 co->co_kwonlyargcount == 0 &&
12804 likely(kwargs == NULL || nk == 0) &&
12805 co->co_flags == (CO_OPTIMIZED | CO_NEWLOCALS | CO_NOFREE)) {
12806 if (argdefs == NULL && co->co_argcount == nargs) {
12807 result = __Pyx_PyFunction_FastCallNoKw(co, args, nargs, globals);
12810 else if (nargs == 0 && argdefs != NULL
12811 && co->co_argcount == Py_SIZE(argdefs)) {
12812 /* function called with no arguments, but all parameters have
12813 a default value: use default values as arguments .*/
12814 args = &PyTuple_GET_ITEM(argdefs, 0);
12815 result =__Pyx_PyFunction_FastCallNoKw(co, args, Py_SIZE(argdefs), globals);
12819 if (kwargs != NULL) {
12821 kwtuple = PyTuple_New(2 * nk);
12822 if (kwtuple == NULL) {
12826 k = &PyTuple_GET_ITEM(kwtuple, 0);
12828 while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) {
12839 closure = PyFunction_GET_CLOSURE(func);
12840 #if PY_MAJOR_VERSION >= 3
12841 kwdefs = PyFunction_GET_KW_DEFAULTS(func);
12843 if (argdefs != NULL) {
12844 d = &PyTuple_GET_ITEM(argdefs, 0);
12845 nd = Py_SIZE(argdefs);
12851 #if PY_MAJOR_VERSION >= 3
12852 result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL,
12855 d, (int)nd, kwdefs, closure);
12857 result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL,
12860 d, (int)nd, closure);
12862 Py_XDECREF(kwtuple);
12864 Py_LeaveRecursiveCall();
12867 #endif // CPython < 3.6
12868 #endif // CYTHON_FAST_PYCALL
12870 /* PyObjectCallMethO */
12871 #if CYTHON_COMPILING_IN_CPYTHON
12872 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) {
12873 PyObject *self, *result;
12875 cfunc = PyCFunction_GET_FUNCTION(func);
12876 self = PyCFunction_GET_SELF(func);
12877 if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
12879 result = cfunc(self, arg);
12880 Py_LeaveRecursiveCall();
12881 if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
12884 "NULL result without error in PyObject_Call");
12890 /* PyObjectCallOneArg */
12891 #if CYTHON_COMPILING_IN_CPYTHON
12892 static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) {
12894 PyObject *args = PyTuple_New(1);
12895 if (unlikely(!args)) return NULL;
12897 PyTuple_SET_ITEM(args, 0, arg);
12898 result = __Pyx_PyObject_Call(func, args, NULL);
12902 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
12903 #if CYTHON_FAST_PYCALL
12904 if (PyFunction_Check(func)) {
12905 return __Pyx_PyFunction_FastCall(func, &arg, 1);
12908 #ifdef __Pyx_CyFunction_USED
12909 if (likely(PyCFunction_Check(func) || PyObject_TypeCheck(func, __pyx_CyFunctionType))) {
12911 if (likely(PyCFunction_Check(func))) {
12913 if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) {
12914 return __Pyx_PyObject_CallMethO(func, arg);
12915 #if CYTHON_FAST_PYCCALL
12916 } else if (PyCFunction_GET_FLAGS(func) & METH_FASTCALL) {
12917 return __Pyx_PyCFunction_FastCall(func, &arg, 1);
12921 return __Pyx__PyObject_CallOneArg(func, arg);
12924 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
12926 PyObject *args = PyTuple_Pack(1, arg);
12927 if (unlikely(!args)) return NULL;
12928 result = __Pyx_PyObject_Call(func, args, NULL);
12935 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
12937 if (!j) return NULL;
12938 r = PyObject_GetItem(o, j);
12942 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
12943 CYTHON_NCP_UNUSED int wraparound,
12944 CYTHON_NCP_UNUSED int boundscheck) {
12945 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
12946 if (wraparound & unlikely(i < 0)) i += PyList_GET_SIZE(o);
12947 if ((!boundscheck) || likely((0 <= i) & (i < PyList_GET_SIZE(o)))) {
12948 PyObject *r = PyList_GET_ITEM(o, i);
12952 return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
12954 return PySequence_GetItem(o, i);
12957 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
12958 CYTHON_NCP_UNUSED int wraparound,
12959 CYTHON_NCP_UNUSED int boundscheck) {
12960 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
12961 if (wraparound & unlikely(i < 0)) i += PyTuple_GET_SIZE(o);
12962 if ((!boundscheck) || likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) {
12963 PyObject *r = PyTuple_GET_ITEM(o, i);
12967 return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
12969 return PySequence_GetItem(o, i);
12972 static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list,
12973 CYTHON_NCP_UNUSED int wraparound,
12974 CYTHON_NCP_UNUSED int boundscheck) {
12975 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS && CYTHON_USE_TYPE_SLOTS
12976 if (is_list || PyList_CheckExact(o)) {
12977 Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o);
12978 if ((!boundscheck) || (likely((n >= 0) & (n < PyList_GET_SIZE(o))))) {
12979 PyObject *r = PyList_GET_ITEM(o, n);
12984 else if (PyTuple_CheckExact(o)) {
12985 Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o);
12986 if ((!boundscheck) || likely((n >= 0) & (n < PyTuple_GET_SIZE(o)))) {
12987 PyObject *r = PyTuple_GET_ITEM(o, n);
12992 PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence;
12993 if (likely(m && m->sq_item)) {
12994 if (wraparound && unlikely(i < 0) && likely(m->sq_length)) {
12995 Py_ssize_t l = m->sq_length(o);
12996 if (likely(l >= 0)) {
12999 if (!PyErr_ExceptionMatches(PyExc_OverflowError))
13004 return m->sq_item(o, i);
13008 if (is_list || PySequence_Check(o)) {
13009 return PySequence_GetItem(o, i);
13012 return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
13015 /* BufferFormatCheck */
13016 static CYTHON_INLINE int __Pyx_IsLittleEndian(void) {
13017 unsigned int n = 1;
13018 return *(unsigned char*)(&n) != 0;
13020 static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx,
13021 __Pyx_BufFmt_StackElem* stack,
13022 __Pyx_TypeInfo* type) {
13023 stack[0].field = &ctx->root;
13024 stack[0].parent_offset = 0;
13025 ctx->root.type = type;
13026 ctx->root.name = "buffer dtype";
13027 ctx->root.offset = 0;
13029 ctx->head->field = &ctx->root;
13030 ctx->fmt_offset = 0;
13031 ctx->head->parent_offset = 0;
13032 ctx->new_packmode = '@';
13033 ctx->enc_packmode = '@';
13034 ctx->new_count = 1;
13035 ctx->enc_count = 0;
13037 ctx->is_complex = 0;
13038 ctx->is_valid_array = 0;
13039 ctx->struct_alignment = 0;
13040 while (type->typegroup == 'S') {
13042 ctx->head->field = type->fields;
13043 ctx->head->parent_offset = 0;
13044 type = type->fields->type;
13047 static int __Pyx_BufFmt_ParseNumber(const char** ts) {
13049 const char* t = *ts;
13050 if (*t < '0' || *t > '9') {
13053 count = *t++ - '0';
13054 while (*t >= '0' && *t < '9') {
13056 count += *t++ - '0';
13062 static int __Pyx_BufFmt_ExpectNumber(const char **ts) {
13063 int number = __Pyx_BufFmt_ParseNumber(ts);
13065 PyErr_Format(PyExc_ValueError,\
13066 "Does not understand character buffer dtype format string ('%c')", **ts);
13069 static void __Pyx_BufFmt_RaiseUnexpectedChar(char ch) {
13070 PyErr_Format(PyExc_ValueError,
13071 "Unexpected format string character: '%c'", ch);
13073 static const char* __Pyx_BufFmt_DescribeTypeChar(char ch, int is_complex) {
13075 case 'c': return "'char'";
13076 case 'b': return "'signed char'";
13077 case 'B': return "'unsigned char'";
13078 case 'h': return "'short'";
13079 case 'H': return "'unsigned short'";
13080 case 'i': return "'int'";
13081 case 'I': return "'unsigned int'";
13082 case 'l': return "'long'";
13083 case 'L': return "'unsigned long'";
13084 case 'q': return "'long long'";
13085 case 'Q': return "'unsigned long long'";
13086 case 'f': return (is_complex ? "'complex float'" : "'float'");
13087 case 'd': return (is_complex ? "'complex double'" : "'double'");
13088 case 'g': return (is_complex ? "'complex long double'" : "'long double'");
13089 case 'T': return "a struct";
13090 case 'O': return "Python object";
13091 case 'P': return "a pointer";
13092 case 's': case 'p': return "a string";
13093 case 0: return "end";
13094 default: return "unparseable format string";
13097 static size_t __Pyx_BufFmt_TypeCharToStandardSize(char ch, int is_complex) {
13099 case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
13100 case 'h': case 'H': return 2;
13101 case 'i': case 'I': case 'l': case 'L': return 4;
13102 case 'q': case 'Q': return 8;
13103 case 'f': return (is_complex ? 8 : 4);
13104 case 'd': return (is_complex ? 16 : 8);
13106 PyErr_SetString(PyExc_ValueError, "Python does not define a standard format string size for long double ('g')..");
13109 case 'O': case 'P': return sizeof(void*);
13111 __Pyx_BufFmt_RaiseUnexpectedChar(ch);
13115 static size_t __Pyx_BufFmt_TypeCharToNativeSize(char ch, int is_complex) {
13117 case 'c': case 'b': case 'B': case 's': case 'p': return 1;
13118 case 'h': case 'H': return sizeof(short);
13119 case 'i': case 'I': return sizeof(int);
13120 case 'l': case 'L': return sizeof(long);
13121 #ifdef HAVE_LONG_LONG
13122 case 'q': case 'Q': return sizeof(PY_LONG_LONG);
13124 case 'f': return sizeof(float) * (is_complex ? 2 : 1);
13125 case 'd': return sizeof(double) * (is_complex ? 2 : 1);
13126 case 'g': return sizeof(long double) * (is_complex ? 2 : 1);
13127 case 'O': case 'P': return sizeof(void*);
13129 __Pyx_BufFmt_RaiseUnexpectedChar(ch);
13134 typedef struct { char c; short x; } __Pyx_st_short;
13135 typedef struct { char c; int x; } __Pyx_st_int;
13136 typedef struct { char c; long x; } __Pyx_st_long;
13137 typedef struct { char c; float x; } __Pyx_st_float;
13138 typedef struct { char c; double x; } __Pyx_st_double;
13139 typedef struct { char c; long double x; } __Pyx_st_longdouble;
13140 typedef struct { char c; void *x; } __Pyx_st_void_p;
13141 #ifdef HAVE_LONG_LONG
13142 typedef struct { char c; PY_LONG_LONG x; } __Pyx_st_longlong;
13144 static size_t __Pyx_BufFmt_TypeCharToAlignment(char ch, CYTHON_UNUSED int is_complex) {
13146 case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
13147 case 'h': case 'H': return sizeof(__Pyx_st_short) - sizeof(short);
13148 case 'i': case 'I': return sizeof(__Pyx_st_int) - sizeof(int);
13149 case 'l': case 'L': return sizeof(__Pyx_st_long) - sizeof(long);
13150 #ifdef HAVE_LONG_LONG
13151 case 'q': case 'Q': return sizeof(__Pyx_st_longlong) - sizeof(PY_LONG_LONG);
13153 case 'f': return sizeof(__Pyx_st_float) - sizeof(float);
13154 case 'd': return sizeof(__Pyx_st_double) - sizeof(double);
13155 case 'g': return sizeof(__Pyx_st_longdouble) - sizeof(long double);
13156 case 'P': case 'O': return sizeof(__Pyx_st_void_p) - sizeof(void*);
13158 __Pyx_BufFmt_RaiseUnexpectedChar(ch);
13162 /* These are for computing the padding at the end of the struct to align
13163 on the first member of the struct. This will probably the same as above,
13164 but we don't have any guarantees.
13166 typedef struct { short x; char c; } __Pyx_pad_short;
13167 typedef struct { int x; char c; } __Pyx_pad_int;
13168 typedef struct { long x; char c; } __Pyx_pad_long;
13169 typedef struct { float x; char c; } __Pyx_pad_float;
13170 typedef struct { double x; char c; } __Pyx_pad_double;
13171 typedef struct { long double x; char c; } __Pyx_pad_longdouble;
13172 typedef struct { void *x; char c; } __Pyx_pad_void_p;
13173 #ifdef HAVE_LONG_LONG
13174 typedef struct { PY_LONG_LONG x; char c; } __Pyx_pad_longlong;
13176 static size_t __Pyx_BufFmt_TypeCharToPadding(char ch, CYTHON_UNUSED int is_complex) {
13178 case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1;
13179 case 'h': case 'H': return sizeof(__Pyx_pad_short) - sizeof(short);
13180 case 'i': case 'I': return sizeof(__Pyx_pad_int) - sizeof(int);
13181 case 'l': case 'L': return sizeof(__Pyx_pad_long) - sizeof(long);
13182 #ifdef HAVE_LONG_LONG
13183 case 'q': case 'Q': return sizeof(__Pyx_pad_longlong) - sizeof(PY_LONG_LONG);
13185 case 'f': return sizeof(__Pyx_pad_float) - sizeof(float);
13186 case 'd': return sizeof(__Pyx_pad_double) - sizeof(double);
13187 case 'g': return sizeof(__Pyx_pad_longdouble) - sizeof(long double);
13188 case 'P': case 'O': return sizeof(__Pyx_pad_void_p) - sizeof(void*);
13190 __Pyx_BufFmt_RaiseUnexpectedChar(ch);
13194 static char __Pyx_BufFmt_TypeCharToGroup(char ch, int is_complex) {
13198 case 'b': case 'h': case 'i':
13199 case 'l': case 'q': case 's': case 'p':
13201 case 'B': case 'H': case 'I': case 'L': case 'Q':
13203 case 'f': case 'd': case 'g':
13204 return (is_complex ? 'C' : 'R');
13210 __Pyx_BufFmt_RaiseUnexpectedChar(ch);
13215 static void __Pyx_BufFmt_RaiseExpected(__Pyx_BufFmt_Context* ctx) {
13216 if (ctx->head == NULL || ctx->head->field == &ctx->root) {
13217 const char* expected;
13219 if (ctx->head == NULL) {
13223 expected = ctx->head->field->type->name;
13226 PyErr_Format(PyExc_ValueError,
13227 "Buffer dtype mismatch, expected %s%s%s but got %s",
13228 quote, expected, quote,
13229 __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex));
13231 __Pyx_StructField* field = ctx->head->field;
13232 __Pyx_StructField* parent = (ctx->head - 1)->field;
13233 PyErr_Format(PyExc_ValueError,
13234 "Buffer dtype mismatch, expected '%s' but got %s in '%s.%s'",
13235 field->type->name, __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex),
13236 parent->type->name, field->name);
13239 static int __Pyx_BufFmt_ProcessTypeChunk(__Pyx_BufFmt_Context* ctx) {
13241 size_t size, offset, arraysize = 1;
13242 if (ctx->enc_type == 0) return 0;
13243 if (ctx->head->field->type->arraysize[0]) {
13245 if (ctx->enc_type == 's' || ctx->enc_type == 'p') {
13246 ctx->is_valid_array = ctx->head->field->type->ndim == 1;
13248 if (ctx->enc_count != ctx->head->field->type->arraysize[0]) {
13249 PyErr_Format(PyExc_ValueError,
13250 "Expected a dimension of size %zu, got %zu",
13251 ctx->head->field->type->arraysize[0], ctx->enc_count);
13255 if (!ctx->is_valid_array) {
13256 PyErr_Format(PyExc_ValueError, "Expected %d dimensions, got %d",
13257 ctx->head->field->type->ndim, ndim);
13260 for (i = 0; i < ctx->head->field->type->ndim; i++) {
13261 arraysize *= ctx->head->field->type->arraysize[i];
13263 ctx->is_valid_array = 0;
13264 ctx->enc_count = 1;
13266 group = __Pyx_BufFmt_TypeCharToGroup(ctx->enc_type, ctx->is_complex);
13268 __Pyx_StructField* field = ctx->head->field;
13269 __Pyx_TypeInfo* type = field->type;
13270 if (ctx->enc_packmode == '@' || ctx->enc_packmode == '^') {
13271 size = __Pyx_BufFmt_TypeCharToNativeSize(ctx->enc_type, ctx->is_complex);
13273 size = __Pyx_BufFmt_TypeCharToStandardSize(ctx->enc_type, ctx->is_complex);
13275 if (ctx->enc_packmode == '@') {
13276 size_t align_at = __Pyx_BufFmt_TypeCharToAlignment(ctx->enc_type, ctx->is_complex);
13277 size_t align_mod_offset;
13278 if (align_at == 0) return -1;
13279 align_mod_offset = ctx->fmt_offset % align_at;
13280 if (align_mod_offset > 0) ctx->fmt_offset += align_at - align_mod_offset;
13281 if (ctx->struct_alignment == 0)
13282 ctx->struct_alignment = __Pyx_BufFmt_TypeCharToPadding(ctx->enc_type,
13285 if (type->size != size || type->typegroup != group) {
13286 if (type->typegroup == 'C' && type->fields != NULL) {
13287 size_t parent_offset = ctx->head->parent_offset + field->offset;
13289 ctx->head->field = type->fields;
13290 ctx->head->parent_offset = parent_offset;
13293 if ((type->typegroup == 'H' || group == 'H') && type->size == size) {
13295 __Pyx_BufFmt_RaiseExpected(ctx);
13299 offset = ctx->head->parent_offset + field->offset;
13300 if (ctx->fmt_offset != offset) {
13301 PyErr_Format(PyExc_ValueError,
13302 "Buffer dtype mismatch; next field is at offset %" CYTHON_FORMAT_SSIZE_T "d but %" CYTHON_FORMAT_SSIZE_T "d expected",
13303 (Py_ssize_t)ctx->fmt_offset, (Py_ssize_t)offset);
13306 ctx->fmt_offset += size;
13308 ctx->fmt_offset += (arraysize - 1) * size;
13311 if (field == &ctx->root) {
13313 if (ctx->enc_count != 0) {
13314 __Pyx_BufFmt_RaiseExpected(ctx);
13319 ctx->head->field = ++field;
13320 if (field->type == NULL) {
13322 field = ctx->head->field;
13324 } else if (field->type->typegroup == 'S') {
13325 size_t parent_offset = ctx->head->parent_offset + field->offset;
13326 if (field->type->fields->type == NULL) continue;
13327 field = field->type->fields;
13329 ctx->head->field = field;
13330 ctx->head->parent_offset = parent_offset;
13336 } while (ctx->enc_count);
13338 ctx->is_complex = 0;
13341 static CYTHON_INLINE PyObject *
13342 __pyx_buffmt_parse_array(__Pyx_BufFmt_Context* ctx, const char** tsp)
13344 const char *ts = *tsp;
13346 int ndim = ctx->head->field->type->ndim;
13349 if (ctx->new_count != 1) {
13350 PyErr_SetString(PyExc_ValueError,
13351 "Cannot handle repeated arrays in format string");
13354 if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
13355 while (*ts && *ts != ')') {
13357 case ' ': case '\f': case '\r': case '\n': case '\t': case '\v': continue;
13360 number = __Pyx_BufFmt_ExpectNumber(&ts);
13361 if (number == -1) return NULL;
13362 if (i < ndim && (size_t) number != ctx->head->field->type->arraysize[i])
13363 return PyErr_Format(PyExc_ValueError,
13364 "Expected a dimension of size %zu, got %d",
13365 ctx->head->field->type->arraysize[i], number);
13366 if (*ts != ',' && *ts != ')')
13367 return PyErr_Format(PyExc_ValueError,
13368 "Expected a comma in format string, got '%c'", *ts);
13369 if (*ts == ',') ts++;
13373 return PyErr_Format(PyExc_ValueError, "Expected %d dimension(s), got %d",
13374 ctx->head->field->type->ndim, i);
13376 PyErr_SetString(PyExc_ValueError,
13377 "Unexpected end of format string, expected ')'");
13380 ctx->is_valid_array = 1;
13381 ctx->new_count = 1;
13385 static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts) {
13390 if (ctx->enc_type != 0 && ctx->head == NULL) {
13391 __Pyx_BufFmt_RaiseExpected(ctx);
13394 if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
13395 if (ctx->head != NULL) {
13396 __Pyx_BufFmt_RaiseExpected(ctx);
13406 if (!__Pyx_IsLittleEndian()) {
13407 PyErr_SetString(PyExc_ValueError, "Little-endian buffer not supported on big-endian compiler");
13410 ctx->new_packmode = '=';
13415 if (__Pyx_IsLittleEndian()) {
13416 PyErr_SetString(PyExc_ValueError, "Big-endian buffer not supported on little-endian compiler");
13419 ctx->new_packmode = '=';
13425 ctx->new_packmode = *ts++;
13429 const char* ts_after_sub;
13430 size_t i, struct_count = ctx->new_count;
13431 size_t struct_alignment = ctx->struct_alignment;
13432 ctx->new_count = 1;
13435 PyErr_SetString(PyExc_ValueError, "Buffer acquisition: Expected '{' after 'T'");
13438 if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
13440 ctx->enc_count = 0;
13441 ctx->struct_alignment = 0;
13444 for (i = 0; i != struct_count; ++i) {
13445 ts_after_sub = __Pyx_BufFmt_CheckString(ctx, ts);
13446 if (!ts_after_sub) return NULL;
13449 if (struct_alignment) ctx->struct_alignment = struct_alignment;
13454 size_t alignment = ctx->struct_alignment;
13456 if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
13458 if (alignment && ctx->fmt_offset % alignment) {
13459 ctx->fmt_offset += alignment - (ctx->fmt_offset % alignment);
13464 if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
13465 ctx->fmt_offset += ctx->new_count;
13466 ctx->new_count = 1;
13467 ctx->enc_count = 0;
13469 ctx->enc_packmode = ctx->new_packmode;
13475 if (*ts != 'f' && *ts != 'd' && *ts != 'g') {
13476 __Pyx_BufFmt_RaiseUnexpectedChar('Z');
13479 case 'c': case 'b': case 'B': case 'h': case 'H': case 'i': case 'I':
13480 case 'l': case 'L': case 'q': case 'Q':
13481 case 'f': case 'd': case 'g':
13482 case 'O': case 'p':
13483 if (ctx->enc_type == *ts && got_Z == ctx->is_complex &&
13484 ctx->enc_packmode == ctx->new_packmode) {
13485 ctx->enc_count += ctx->new_count;
13486 ctx->new_count = 1;
13492 if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
13493 ctx->enc_count = ctx->new_count;
13494 ctx->enc_packmode = ctx->new_packmode;
13495 ctx->enc_type = *ts;
13496 ctx->is_complex = got_Z;
13498 ctx->new_count = 1;
13503 while(*ts != ':') ++ts;
13507 if (!__pyx_buffmt_parse_array(ctx, &ts)) return NULL;
13511 int number = __Pyx_BufFmt_ExpectNumber(&ts);
13512 if (number == -1) return NULL;
13513 ctx->new_count = (size_t)number;
13518 static CYTHON_INLINE void __Pyx_ZeroBuffer(Py_buffer* buf) {
13521 buf->strides = __Pyx_zeros;
13522 buf->shape = __Pyx_zeros;
13523 buf->suboffsets = __Pyx_minusones;
13525 static CYTHON_INLINE int __Pyx_GetBufferAndValidate(
13526 Py_buffer* buf, PyObject* obj, __Pyx_TypeInfo* dtype, int flags,
13527 int nd, int cast, __Pyx_BufFmt_StackElem* stack)
13529 if (obj == Py_None || obj == NULL) {
13530 __Pyx_ZeroBuffer(buf);
13534 if (__Pyx_GetBuffer(obj, buf, flags) == -1) goto fail;
13535 if (buf->ndim != nd) {
13536 PyErr_Format(PyExc_ValueError,
13537 "Buffer has wrong number of dimensions (expected %d, got %d)",
13542 __Pyx_BufFmt_Context ctx;
13543 __Pyx_BufFmt_Init(&ctx, stack, dtype);
13544 if (!__Pyx_BufFmt_CheckString(&ctx, buf->format)) goto fail;
13546 if ((unsigned)buf->itemsize != dtype->size) {
13547 PyErr_Format(PyExc_ValueError,
13548 "Item size of buffer (%" CYTHON_FORMAT_SSIZE_T "d byte%s) does not match size of '%s' (%" CYTHON_FORMAT_SSIZE_T "d byte%s)",
13549 buf->itemsize, (buf->itemsize > 1) ? "s" : "",
13550 dtype->name, (Py_ssize_t)dtype->size, (dtype->size > 1) ? "s" : "");
13553 if (buf->suboffsets == NULL) buf->suboffsets = __Pyx_minusones;
13556 __Pyx_ZeroBuffer(buf);
13559 static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info) {
13560 if (info->buf == NULL) return;
13561 if (info->suboffsets == __Pyx_minusones) info->suboffsets = NULL;
13562 __Pyx_ReleaseBuffer(info);
13565 /* FetchCommonType */
13566 static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type) {
13567 PyObject* fake_module;
13568 PyTypeObject* cached_type = NULL;
13569 fake_module = PyImport_AddModule((char*) "_cython_" CYTHON_ABI);
13570 if (!fake_module) return NULL;
13571 Py_INCREF(fake_module);
13572 cached_type = (PyTypeObject*) PyObject_GetAttrString(fake_module, type->tp_name);
13574 if (!PyType_Check((PyObject*)cached_type)) {
13575 PyErr_Format(PyExc_TypeError,
13576 "Shared Cython type %.200s is not a type object",
13580 if (cached_type->tp_basicsize != type->tp_basicsize) {
13581 PyErr_Format(PyExc_TypeError,
13582 "Shared Cython type %.200s has the wrong size, try recompiling",
13587 if (!PyErr_ExceptionMatches(PyExc_AttributeError)) goto bad;
13589 if (PyType_Ready(type) < 0) goto bad;
13590 if (PyObject_SetAttrString(fake_module, type->tp_name, (PyObject*) type) < 0)
13593 cached_type = type;
13596 Py_DECREF(fake_module);
13597 return cached_type;
13599 Py_XDECREF(cached_type);
13600 cached_type = NULL;
13604 /* CythonFunction */
13606 __Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *closure)
13608 if (unlikely(op->func_doc == NULL)) {
13609 if (op->func.m_ml->ml_doc) {
13610 #if PY_MAJOR_VERSION >= 3
13611 op->func_doc = PyUnicode_FromString(op->func.m_ml->ml_doc);
13613 op->func_doc = PyString_FromString(op->func.m_ml->ml_doc);
13615 if (unlikely(op->func_doc == NULL))
13618 Py_INCREF(Py_None);
13622 Py_INCREF(op->func_doc);
13623 return op->func_doc;
13626 __Pyx_CyFunction_set_doc(__pyx_CyFunctionObject *op, PyObject *value)
13628 PyObject *tmp = op->func_doc;
13629 if (value == NULL) {
13633 op->func_doc = value;
13638 __Pyx_CyFunction_get_name(__pyx_CyFunctionObject *op)
13640 if (unlikely(op->func_name == NULL)) {
13641 #if PY_MAJOR_VERSION >= 3
13642 op->func_name = PyUnicode_InternFromString(op->func.m_ml->ml_name);
13644 op->func_name = PyString_InternFromString(op->func.m_ml->ml_name);
13646 if (unlikely(op->func_name == NULL))
13649 Py_INCREF(op->func_name);
13650 return op->func_name;
13653 __Pyx_CyFunction_set_name(__pyx_CyFunctionObject *op, PyObject *value)
13656 #if PY_MAJOR_VERSION >= 3
13657 if (unlikely(value == NULL || !PyUnicode_Check(value))) {
13659 if (unlikely(value == NULL || !PyString_Check(value))) {
13661 PyErr_SetString(PyExc_TypeError,
13662 "__name__ must be set to a string object");
13665 tmp = op->func_name;
13667 op->func_name = value;
13672 __Pyx_CyFunction_get_qualname(__pyx_CyFunctionObject *op)
13674 Py_INCREF(op->func_qualname);
13675 return op->func_qualname;
13678 __Pyx_CyFunction_set_qualname(__pyx_CyFunctionObject *op, PyObject *value)
13681 #if PY_MAJOR_VERSION >= 3
13682 if (unlikely(value == NULL || !PyUnicode_Check(value))) {
13684 if (unlikely(value == NULL || !PyString_Check(value))) {
13686 PyErr_SetString(PyExc_TypeError,
13687 "__qualname__ must be set to a string object");
13690 tmp = op->func_qualname;
13692 op->func_qualname = value;
13697 __Pyx_CyFunction_get_self(__pyx_CyFunctionObject *m, CYTHON_UNUSED void *closure)
13700 self = m->func_closure;
13707 __Pyx_CyFunction_get_dict(__pyx_CyFunctionObject *op)
13709 if (unlikely(op->func_dict == NULL)) {
13710 op->func_dict = PyDict_New();
13711 if (unlikely(op->func_dict == NULL))
13714 Py_INCREF(op->func_dict);
13715 return op->func_dict;
13718 __Pyx_CyFunction_set_dict(__pyx_CyFunctionObject *op, PyObject *value)
13721 if (unlikely(value == NULL)) {
13722 PyErr_SetString(PyExc_TypeError,
13723 "function's dictionary may not be deleted");
13726 if (unlikely(!PyDict_Check(value))) {
13727 PyErr_SetString(PyExc_TypeError,
13728 "setting function's dictionary to a non-dict");
13731 tmp = op->func_dict;
13733 op->func_dict = value;
13738 __Pyx_CyFunction_get_globals(__pyx_CyFunctionObject *op)
13740 Py_INCREF(op->func_globals);
13741 return op->func_globals;
13744 __Pyx_CyFunction_get_closure(CYTHON_UNUSED __pyx_CyFunctionObject *op)
13746 Py_INCREF(Py_None);
13750 __Pyx_CyFunction_get_code(__pyx_CyFunctionObject *op)
13752 PyObject* result = (op->func_code) ? op->func_code : Py_None;
13757 __Pyx_CyFunction_init_defaults(__pyx_CyFunctionObject *op) {
13759 PyObject *res = op->defaults_getter((PyObject *) op);
13760 if (unlikely(!res))
13762 #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS
13763 op->defaults_tuple = PyTuple_GET_ITEM(res, 0);
13764 Py_INCREF(op->defaults_tuple);
13765 op->defaults_kwdict = PyTuple_GET_ITEM(res, 1);
13766 Py_INCREF(op->defaults_kwdict);
13768 op->defaults_tuple = PySequence_ITEM(res, 0);
13769 if (unlikely(!op->defaults_tuple)) result = -1;
13771 op->defaults_kwdict = PySequence_ITEM(res, 1);
13772 if (unlikely(!op->defaults_kwdict)) result = -1;
13779 __Pyx_CyFunction_set_defaults(__pyx_CyFunctionObject *op, PyObject* value) {
13783 } else if (value != Py_None && !PyTuple_Check(value)) {
13784 PyErr_SetString(PyExc_TypeError,
13785 "__defaults__ must be set to a tuple object");
13789 tmp = op->defaults_tuple;
13790 op->defaults_tuple = value;
13795 __Pyx_CyFunction_get_defaults(__pyx_CyFunctionObject *op) {
13796 PyObject* result = op->defaults_tuple;
13797 if (unlikely(!result)) {
13798 if (op->defaults_getter) {
13799 if (__Pyx_CyFunction_init_defaults(op) < 0) return NULL;
13800 result = op->defaults_tuple;
13809 __Pyx_CyFunction_set_kwdefaults(__pyx_CyFunctionObject *op, PyObject* value) {
13813 } else if (value != Py_None && !PyDict_Check(value)) {
13814 PyErr_SetString(PyExc_TypeError,
13815 "__kwdefaults__ must be set to a dict object");
13819 tmp = op->defaults_kwdict;
13820 op->defaults_kwdict = value;
13825 __Pyx_CyFunction_get_kwdefaults(__pyx_CyFunctionObject *op) {
13826 PyObject* result = op->defaults_kwdict;
13827 if (unlikely(!result)) {
13828 if (op->defaults_getter) {
13829 if (__Pyx_CyFunction_init_defaults(op) < 0) return NULL;
13830 result = op->defaults_kwdict;
13839 __Pyx_CyFunction_set_annotations(__pyx_CyFunctionObject *op, PyObject* value) {
13841 if (!value || value == Py_None) {
13843 } else if (!PyDict_Check(value)) {
13844 PyErr_SetString(PyExc_TypeError,
13845 "__annotations__ must be set to a dict object");
13849 tmp = op->func_annotations;
13850 op->func_annotations = value;
13855 __Pyx_CyFunction_get_annotations(__pyx_CyFunctionObject *op) {
13856 PyObject* result = op->func_annotations;
13857 if (unlikely(!result)) {
13858 result = PyDict_New();
13859 if (unlikely(!result)) return NULL;
13860 op->func_annotations = result;
13865 static PyGetSetDef __pyx_CyFunction_getsets[] = {
13866 {(char *) "func_doc", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
13867 {(char *) "__doc__", (getter)__Pyx_CyFunction_get_doc, (setter)__Pyx_CyFunction_set_doc, 0, 0},
13868 {(char *) "func_name", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
13869 {(char *) "__name__", (getter)__Pyx_CyFunction_get_name, (setter)__Pyx_CyFunction_set_name, 0, 0},
13870 {(char *) "__qualname__", (getter)__Pyx_CyFunction_get_qualname, (setter)__Pyx_CyFunction_set_qualname, 0, 0},
13871 {(char *) "__self__", (getter)__Pyx_CyFunction_get_self, 0, 0, 0},
13872 {(char *) "func_dict", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0},
13873 {(char *) "__dict__", (getter)__Pyx_CyFunction_get_dict, (setter)__Pyx_CyFunction_set_dict, 0, 0},
13874 {(char *) "func_globals", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
13875 {(char *) "__globals__", (getter)__Pyx_CyFunction_get_globals, 0, 0, 0},
13876 {(char *) "func_closure", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
13877 {(char *) "__closure__", (getter)__Pyx_CyFunction_get_closure, 0, 0, 0},
13878 {(char *) "func_code", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
13879 {(char *) "__code__", (getter)__Pyx_CyFunction_get_code, 0, 0, 0},
13880 {(char *) "func_defaults", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0},
13881 {(char *) "__defaults__", (getter)__Pyx_CyFunction_get_defaults, (setter)__Pyx_CyFunction_set_defaults, 0, 0},
13882 {(char *) "__kwdefaults__", (getter)__Pyx_CyFunction_get_kwdefaults, (setter)__Pyx_CyFunction_set_kwdefaults, 0, 0},
13883 {(char *) "__annotations__", (getter)__Pyx_CyFunction_get_annotations, (setter)__Pyx_CyFunction_set_annotations, 0, 0},
13886 static PyMemberDef __pyx_CyFunction_members[] = {
13887 {(char *) "__module__", T_OBJECT, offsetof(__pyx_CyFunctionObject, func.m_module), PY_WRITE_RESTRICTED, 0},
13891 __Pyx_CyFunction_reduce(__pyx_CyFunctionObject *m, CYTHON_UNUSED PyObject *args)
13893 #if PY_MAJOR_VERSION >= 3
13894 return PyUnicode_FromString(m->func.m_ml->ml_name);
13896 return PyString_FromString(m->func.m_ml->ml_name);
13899 static PyMethodDef __pyx_CyFunction_methods[] = {
13900 {"__reduce__", (PyCFunction)__Pyx_CyFunction_reduce, METH_VARARGS, 0},
13903 #if PY_VERSION_HEX < 0x030500A0
13904 #define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func_weakreflist)
13906 #define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func.m_weakreflist)
13908 static PyObject *__Pyx_CyFunction_New(PyTypeObject *type, PyMethodDef *ml, int flags, PyObject* qualname,
13909 PyObject *closure, PyObject *module, PyObject* globals, PyObject* code) {
13910 __pyx_CyFunctionObject *op = PyObject_GC_New(__pyx_CyFunctionObject, type);
13914 __Pyx_CyFunction_weakreflist(op) = NULL;
13915 op->func.m_ml = ml;
13916 op->func.m_self = (PyObject *) op;
13917 Py_XINCREF(closure);
13918 op->func_closure = closure;
13919 Py_XINCREF(module);
13920 op->func.m_module = module;
13921 op->func_dict = NULL;
13922 op->func_name = NULL;
13923 Py_INCREF(qualname);
13924 op->func_qualname = qualname;
13925 op->func_doc = NULL;
13926 op->func_classobj = NULL;
13927 op->func_globals = globals;
13928 Py_INCREF(op->func_globals);
13930 op->func_code = code;
13931 op->defaults_pyobjects = 0;
13932 op->defaults = NULL;
13933 op->defaults_tuple = NULL;
13934 op->defaults_kwdict = NULL;
13935 op->defaults_getter = NULL;
13936 op->func_annotations = NULL;
13937 PyObject_GC_Track(op);
13938 return (PyObject *) op;
13941 __Pyx_CyFunction_clear(__pyx_CyFunctionObject *m)
13943 Py_CLEAR(m->func_closure);
13944 Py_CLEAR(m->func.m_module);
13945 Py_CLEAR(m->func_dict);
13946 Py_CLEAR(m->func_name);
13947 Py_CLEAR(m->func_qualname);
13948 Py_CLEAR(m->func_doc);
13949 Py_CLEAR(m->func_globals);
13950 Py_CLEAR(m->func_code);
13951 Py_CLEAR(m->func_classobj);
13952 Py_CLEAR(m->defaults_tuple);
13953 Py_CLEAR(m->defaults_kwdict);
13954 Py_CLEAR(m->func_annotations);
13956 PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m);
13958 for (i = 0; i < m->defaults_pyobjects; i++)
13959 Py_XDECREF(pydefaults[i]);
13960 PyObject_Free(m->defaults);
13961 m->defaults = NULL;
13965 static void __Pyx_CyFunction_dealloc(__pyx_CyFunctionObject *m)
13967 PyObject_GC_UnTrack(m);
13968 if (__Pyx_CyFunction_weakreflist(m) != NULL)
13969 PyObject_ClearWeakRefs((PyObject *) m);
13970 __Pyx_CyFunction_clear(m);
13971 PyObject_GC_Del(m);
13973 static int __Pyx_CyFunction_traverse(__pyx_CyFunctionObject *m, visitproc visit, void *arg)
13975 Py_VISIT(m->func_closure);
13976 Py_VISIT(m->func.m_module);
13977 Py_VISIT(m->func_dict);
13978 Py_VISIT(m->func_name);
13979 Py_VISIT(m->func_qualname);
13980 Py_VISIT(m->func_doc);
13981 Py_VISIT(m->func_globals);
13982 Py_VISIT(m->func_code);
13983 Py_VISIT(m->func_classobj);
13984 Py_VISIT(m->defaults_tuple);
13985 Py_VISIT(m->defaults_kwdict);
13987 PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m);
13989 for (i = 0; i < m->defaults_pyobjects; i++)
13990 Py_VISIT(pydefaults[i]);
13994 static PyObject *__Pyx_CyFunction_descr_get(PyObject *func, PyObject *obj, PyObject *type)
13996 __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
13997 if (m->flags & __Pyx_CYFUNCTION_STATICMETHOD) {
14001 if (m->flags & __Pyx_CYFUNCTION_CLASSMETHOD) {
14003 type = (PyObject *)(Py_TYPE(obj));
14004 return __Pyx_PyMethod_New(func, type, (PyObject *)(Py_TYPE(type)));
14006 if (obj == Py_None)
14008 return __Pyx_PyMethod_New(func, obj, type);
14011 __Pyx_CyFunction_repr(__pyx_CyFunctionObject *op)
14013 #if PY_MAJOR_VERSION >= 3
14014 return PyUnicode_FromFormat("<cyfunction %U at %p>",
14015 op->func_qualname, (void *)op);
14017 return PyString_FromFormat("<cyfunction %s at %p>",
14018 PyString_AsString(op->func_qualname), (void *)op);
14021 static PyObject * __Pyx_CyFunction_CallMethod(PyObject *func, PyObject *self, PyObject *arg, PyObject *kw) {
14022 PyCFunctionObject* f = (PyCFunctionObject*)func;
14023 PyCFunction meth = f->m_ml->ml_meth;
14025 switch (f->m_ml->ml_flags & (METH_VARARGS | METH_KEYWORDS | METH_NOARGS | METH_O)) {
14027 if (likely(kw == NULL || PyDict_Size(kw) == 0))
14028 return (*meth)(self, arg);
14030 case METH_VARARGS | METH_KEYWORDS:
14031 return (*(PyCFunctionWithKeywords)meth)(self, arg, kw);
14033 if (likely(kw == NULL || PyDict_Size(kw) == 0)) {
14034 size = PyTuple_GET_SIZE(arg);
14035 if (likely(size == 0))
14036 return (*meth)(self, NULL);
14037 PyErr_Format(PyExc_TypeError,
14038 "%.200s() takes no arguments (%" CYTHON_FORMAT_SSIZE_T "d given)",
14039 f->m_ml->ml_name, size);
14044 if (likely(kw == NULL || PyDict_Size(kw) == 0)) {
14045 size = PyTuple_GET_SIZE(arg);
14046 if (likely(size == 1)) {
14047 PyObject *result, *arg0 = PySequence_ITEM(arg, 0);
14048 if (unlikely(!arg0)) return NULL;
14049 result = (*meth)(self, arg0);
14053 PyErr_Format(PyExc_TypeError,
14054 "%.200s() takes exactly one argument (%" CYTHON_FORMAT_SSIZE_T "d given)",
14055 f->m_ml->ml_name, size);
14060 PyErr_SetString(PyExc_SystemError, "Bad call flags in "
14061 "__Pyx_CyFunction_Call. METH_OLDARGS is no "
14062 "longer supported!");
14065 PyErr_Format(PyExc_TypeError, "%.200s() takes no keyword arguments",
14069 static CYTHON_INLINE PyObject *__Pyx_CyFunction_Call(PyObject *func, PyObject *arg, PyObject *kw) {
14070 return __Pyx_CyFunction_CallMethod(func, ((PyCFunctionObject*)func)->m_self, arg, kw);
14072 static PyObject *__Pyx_CyFunction_CallAsMethod(PyObject *func, PyObject *args, PyObject *kw) {
14074 __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *) func;
14075 if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) {
14077 PyObject *new_args;
14079 argc = PyTuple_GET_SIZE(args);
14080 new_args = PyTuple_GetSlice(args, 1, argc);
14081 if (unlikely(!new_args))
14083 self = PyTuple_GetItem(args, 0);
14084 if (unlikely(!self)) {
14085 Py_DECREF(new_args);
14088 result = __Pyx_CyFunction_CallMethod(func, self, new_args, kw);
14089 Py_DECREF(new_args);
14091 result = __Pyx_CyFunction_Call(func, args, kw);
14095 static PyTypeObject __pyx_CyFunctionType_type = {
14096 PyVarObject_HEAD_INIT(0, 0)
14097 "cython_function_or_method",
14098 sizeof(__pyx_CyFunctionObject),
14100 (destructor) __Pyx_CyFunction_dealloc,
14104 #if PY_MAJOR_VERSION < 3
14109 (reprfunc) __Pyx_CyFunction_repr,
14114 __Pyx_CyFunction_CallAsMethod,
14119 Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,
14121 (traverseproc) __Pyx_CyFunction_traverse,
14122 (inquiry) __Pyx_CyFunction_clear,
14124 #if PY_VERSION_HEX < 0x030500A0
14125 offsetof(__pyx_CyFunctionObject, func_weakreflist),
14127 offsetof(PyCFunctionObject, m_weakreflist),
14131 __pyx_CyFunction_methods,
14132 __pyx_CyFunction_members,
14133 __pyx_CyFunction_getsets,
14136 __Pyx_CyFunction_descr_get,
14138 offsetof(__pyx_CyFunctionObject, func_dict),
14151 #if PY_VERSION_HEX >= 0x030400a1
14155 static int __pyx_CyFunction_init(void) {
14156 __pyx_CyFunctionType = __Pyx_FetchCommonType(&__pyx_CyFunctionType_type);
14157 if (__pyx_CyFunctionType == NULL) {
14162 static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *func, size_t size, int pyobjects) {
14163 __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
14164 m->defaults = PyObject_Malloc(size);
14166 return PyErr_NoMemory();
14167 memset(m->defaults, 0, size);
14168 m->defaults_pyobjects = pyobjects;
14169 return m->defaults;
14171 static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *func, PyObject *tuple) {
14172 __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
14173 m->defaults_tuple = tuple;
14176 static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *func, PyObject *dict) {
14177 __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
14178 m->defaults_kwdict = dict;
14181 static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *func, PyObject *dict) {
14182 __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
14183 m->func_annotations = dict;
14187 /* BufferFallbackError */
14188 static void __Pyx_RaiseBufferFallbackError(void) {
14189 PyErr_SetString(PyExc_ValueError,
14190 "Buffer acquisition failed on assignment; and then reacquiring the old buffer failed too!");
14194 static CYTHON_INLINE Py_ssize_t __Pyx_div_Py_ssize_t(Py_ssize_t a, Py_ssize_t b) {
14195 Py_ssize_t q = a / b;
14196 Py_ssize_t r = a - q*b;
14197 q -= ((r != 0) & ((r ^ b) < 0));
14201 /* BufferIndexError */
14202 static void __Pyx_RaiseBufferIndexError(int axis) {
14203 PyErr_Format(PyExc_IndexError,
14204 "Out of bounds on buffer access (axis %d)", axis);
14207 /* RaiseTooManyValuesToUnpack */
14208 static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) {
14209 PyErr_Format(PyExc_ValueError,
14210 "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected);
14213 /* RaiseNeedMoreValuesToUnpack */
14214 static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) {
14215 PyErr_Format(PyExc_ValueError,
14216 "need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack",
14217 index, (index == 1) ? "" : "s");
14220 /* RaiseNoneIterError */
14221 static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) {
14222 PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
14225 /* SaveResetException */
14226 #if CYTHON_FAST_THREAD_STATE
14227 static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
14228 *type = tstate->exc_type;
14229 *value = tstate->exc_value;
14230 *tb = tstate->exc_traceback;
14232 Py_XINCREF(*value);
14235 static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) {
14236 PyObject *tmp_type, *tmp_value, *tmp_tb;
14237 tmp_type = tstate->exc_type;
14238 tmp_value = tstate->exc_value;
14239 tmp_tb = tstate->exc_traceback;
14240 tstate->exc_type = type;
14241 tstate->exc_value = value;
14242 tstate->exc_traceback = tb;
14243 Py_XDECREF(tmp_type);
14244 Py_XDECREF(tmp_value);
14245 Py_XDECREF(tmp_tb);
14249 /* PyErrExceptionMatches */
14250 #if CYTHON_FAST_THREAD_STATE
14251 static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err) {
14252 PyObject *exc_type = tstate->curexc_type;
14253 if (exc_type == err) return 1;
14254 if (unlikely(!exc_type)) return 0;
14255 return PyErr_GivenExceptionMatches(exc_type, err);
14260 #if CYTHON_FAST_THREAD_STATE
14261 static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
14263 static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) {
14265 PyObject *local_type, *local_value, *local_tb;
14266 #if CYTHON_FAST_THREAD_STATE
14267 PyObject *tmp_type, *tmp_value, *tmp_tb;
14268 local_type = tstate->curexc_type;
14269 local_value = tstate->curexc_value;
14270 local_tb = tstate->curexc_traceback;
14271 tstate->curexc_type = 0;
14272 tstate->curexc_value = 0;
14273 tstate->curexc_traceback = 0;
14275 PyErr_Fetch(&local_type, &local_value, &local_tb);
14277 PyErr_NormalizeException(&local_type, &local_value, &local_tb);
14278 #if CYTHON_FAST_THREAD_STATE
14279 if (unlikely(tstate->curexc_type))
14281 if (unlikely(PyErr_Occurred()))
14284 #if PY_MAJOR_VERSION >= 3
14286 if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0))
14290 Py_XINCREF(local_tb);
14291 Py_XINCREF(local_type);
14292 Py_XINCREF(local_value);
14293 *type = local_type;
14294 *value = local_value;
14296 #if CYTHON_FAST_THREAD_STATE
14297 tmp_type = tstate->exc_type;
14298 tmp_value = tstate->exc_value;
14299 tmp_tb = tstate->exc_traceback;
14300 tstate->exc_type = local_type;
14301 tstate->exc_value = local_value;
14302 tstate->exc_traceback = local_tb;
14303 Py_XDECREF(tmp_type);
14304 Py_XDECREF(tmp_value);
14305 Py_XDECREF(tmp_tb);
14307 PyErr_SetExcInfo(local_type, local_value, local_tb);
14314 Py_XDECREF(local_type);
14315 Py_XDECREF(local_value);
14316 Py_XDECREF(local_tb);
14321 static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) {
14322 PyObject *empty_list = 0;
14323 PyObject *module = 0;
14324 PyObject *global_dict = 0;
14325 PyObject *empty_dict = 0;
14327 #if PY_VERSION_HEX < 0x03030000
14328 PyObject *py_import;
14329 py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import);
14336 empty_list = PyList_New(0);
14341 global_dict = PyModule_GetDict(__pyx_m);
14344 empty_dict = PyDict_New();
14348 #if PY_MAJOR_VERSION >= 3
14350 if (strchr(__Pyx_MODULE_NAME, '.')) {
14351 #if PY_VERSION_HEX < 0x03030000
14352 PyObject *py_level = PyInt_FromLong(1);
14355 module = PyObject_CallFunctionObjArgs(py_import,
14356 name, global_dict, empty_dict, list, py_level, NULL);
14357 Py_DECREF(py_level);
14359 module = PyImport_ImportModuleLevelObject(
14360 name, global_dict, empty_dict, list, 1);
14363 if (!PyErr_ExceptionMatches(PyExc_ImportError))
14372 #if PY_VERSION_HEX < 0x03030000
14373 PyObject *py_level = PyInt_FromLong(level);
14376 module = PyObject_CallFunctionObjArgs(py_import,
14377 name, global_dict, empty_dict, list, py_level, NULL);
14378 Py_DECREF(py_level);
14380 module = PyImport_ImportModuleLevelObject(
14381 name, global_dict, empty_dict, list, level);
14386 #if PY_VERSION_HEX < 0x03030000
14387 Py_XDECREF(py_import);
14389 Py_XDECREF(empty_list);
14390 Py_XDECREF(empty_dict);
14394 /* CodeObjectCache */
14395 static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) {
14396 int start = 0, mid = 0, end = count - 1;
14397 if (end >= 0 && code_line > entries[end].code_line) {
14400 while (start < end) {
14401 mid = start + (end - start) / 2;
14402 if (code_line < entries[mid].code_line) {
14404 } else if (code_line > entries[mid].code_line) {
14410 if (code_line <= entries[mid].code_line) {
14416 static PyCodeObject *__pyx_find_code_object(int code_line) {
14417 PyCodeObject* code_object;
14419 if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
14422 pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
14423 if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) {
14426 code_object = __pyx_code_cache.entries[pos].code_object;
14427 Py_INCREF(code_object);
14428 return code_object;
14430 static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
14432 __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
14433 if (unlikely(!code_line)) {
14436 if (unlikely(!entries)) {
14437 entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry));
14438 if (likely(entries)) {
14439 __pyx_code_cache.entries = entries;
14440 __pyx_code_cache.max_count = 64;
14441 __pyx_code_cache.count = 1;
14442 entries[0].code_line = code_line;
14443 entries[0].code_object = code_object;
14444 Py_INCREF(code_object);
14448 pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line);
14449 if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) {
14450 PyCodeObject* tmp = entries[pos].code_object;
14451 entries[pos].code_object = code_object;
14455 if (__pyx_code_cache.count == __pyx_code_cache.max_count) {
14456 int new_max = __pyx_code_cache.max_count + 64;
14457 entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc(
14458 __pyx_code_cache.entries, (size_t)new_max*sizeof(__Pyx_CodeObjectCacheEntry));
14459 if (unlikely(!entries)) {
14462 __pyx_code_cache.entries = entries;
14463 __pyx_code_cache.max_count = new_max;
14465 for (i=__pyx_code_cache.count; i>pos; i--) {
14466 entries[i] = entries[i-1];
14468 entries[pos].code_line = code_line;
14469 entries[pos].code_object = code_object;
14470 __pyx_code_cache.count++;
14471 Py_INCREF(code_object);
14475 #include "compile.h"
14476 #include "frameobject.h"
14477 #include "traceback.h"
14478 static PyCodeObject* __Pyx_CreateCodeObjectForTraceback(
14479 const char *funcname, int c_line,
14480 int py_line, const char *filename) {
14481 PyCodeObject *py_code = 0;
14482 PyObject *py_srcfile = 0;
14483 PyObject *py_funcname = 0;
14484 #if PY_MAJOR_VERSION < 3
14485 py_srcfile = PyString_FromString(filename);
14487 py_srcfile = PyUnicode_FromString(filename);
14489 if (!py_srcfile) goto bad;
14491 #if PY_MAJOR_VERSION < 3
14492 py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
14494 py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
14498 #if PY_MAJOR_VERSION < 3
14499 py_funcname = PyString_FromString(funcname);
14501 py_funcname = PyUnicode_FromString(funcname);
14504 if (!py_funcname) goto bad;
14505 py_code = __Pyx_PyCode_New(
14511 __pyx_empty_bytes, /*PyObject *code,*/
14512 __pyx_empty_tuple, /*PyObject *consts,*/
14513 __pyx_empty_tuple, /*PyObject *names,*/
14514 __pyx_empty_tuple, /*PyObject *varnames,*/
14515 __pyx_empty_tuple, /*PyObject *freevars,*/
14516 __pyx_empty_tuple, /*PyObject *cellvars,*/
14517 py_srcfile, /*PyObject *filename,*/
14518 py_funcname, /*PyObject *name,*/
14520 __pyx_empty_bytes /*PyObject *lnotab*/
14522 Py_DECREF(py_srcfile);
14523 Py_DECREF(py_funcname);
14526 Py_XDECREF(py_srcfile);
14527 Py_XDECREF(py_funcname);
14530 static void __Pyx_AddTraceback(const char *funcname, int c_line,
14531 int py_line, const char *filename) {
14532 PyCodeObject *py_code = 0;
14533 PyFrameObject *py_frame = 0;
14534 py_code = __pyx_find_code_object(c_line ? c_line : py_line);
14536 py_code = __Pyx_CreateCodeObjectForTraceback(
14537 funcname, c_line, py_line, filename);
14538 if (!py_code) goto bad;
14539 __pyx_insert_code_object(c_line ? c_line : py_line, py_code);
14541 py_frame = PyFrame_New(
14542 PyThreadState_GET(), /*PyThreadState *tstate,*/
14543 py_code, /*PyCodeObject *code,*/
14544 __pyx_d, /*PyObject *globals,*/
14545 0 /*PyObject *locals*/
14547 if (!py_frame) goto bad;
14548 __Pyx_PyFrame_SetLineNumber(py_frame, py_line);
14549 PyTraceBack_Here(py_frame);
14551 Py_XDECREF(py_code);
14552 Py_XDECREF(py_frame);
14555 #if PY_MAJOR_VERSION < 3
14556 static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags) {
14557 if (PyObject_CheckBuffer(obj)) return PyObject_GetBuffer(obj, view, flags);
14558 if (PyObject_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) return __pyx_pw_5numpy_7ndarray_1__getbuffer__(obj, view, flags);
14559 PyErr_Format(PyExc_TypeError, "'%.200s' does not have the buffer interface", Py_TYPE(obj)->tp_name);
14562 static void __Pyx_ReleaseBuffer(Py_buffer *view) {
14563 PyObject *obj = view->obj;
14565 if (PyObject_CheckBuffer(obj)) {
14566 PyBuffer_Release(view);
14569 if (PyObject_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) { __pyx_pw_5numpy_7ndarray_3__releasebuffer__(obj, view); return; }
14577 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) {
14578 const long neg_one = (long) -1, const_zero = (long) 0;
14579 const int is_unsigned = neg_one > const_zero;
14581 if (sizeof(long) < sizeof(long)) {
14582 return PyInt_FromLong((long) value);
14583 } else if (sizeof(long) <= sizeof(unsigned long)) {
14584 return PyLong_FromUnsignedLong((unsigned long) value);
14585 #ifdef HAVE_LONG_LONG
14586 } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
14587 return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
14591 if (sizeof(long) <= sizeof(long)) {
14592 return PyInt_FromLong((long) value);
14593 #ifdef HAVE_LONG_LONG
14594 } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
14595 return PyLong_FromLongLong((PY_LONG_LONG) value);
14600 int one = 1; int little = (int)*(unsigned char *)&one;
14601 unsigned char *bytes = (unsigned char *)&value;
14602 return _PyLong_FromByteArray(bytes, sizeof(long),
14603 little, !is_unsigned);
14607 /* CIntFromPyVerify */
14608 #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\
14609 __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0)
14610 #define __PYX_VERIFY_RETURN_INT_EXC(target_type, func_type, func_value)\
14611 __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 1)
14612 #define __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, exc)\
14614 func_type value = func_value;\
14615 if (sizeof(target_type) < sizeof(func_type)) {\
14616 if (unlikely(value != (func_type) (target_type) value)) {\
14617 func_type zero = 0;\
14618 if (exc && unlikely(value == (func_type)-1 && PyErr_Occurred()))\
14619 return (target_type) -1;\
14620 if (is_unsigned && unlikely(value < zero))\
14621 goto raise_neg_overflow;\
14623 goto raise_overflow;\
14626 return (target_type) value;\
14630 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_siz(siz value) {
14631 const siz neg_one = (siz) -1, const_zero = (siz) 0;
14632 const int is_unsigned = neg_one > const_zero;
14634 if (sizeof(siz) < sizeof(long)) {
14635 return PyInt_FromLong((long) value);
14636 } else if (sizeof(siz) <= sizeof(unsigned long)) {
14637 return PyLong_FromUnsignedLong((unsigned long) value);
14638 #ifdef HAVE_LONG_LONG
14639 } else if (sizeof(siz) <= sizeof(unsigned PY_LONG_LONG)) {
14640 return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
14644 if (sizeof(siz) <= sizeof(long)) {
14645 return PyInt_FromLong((long) value);
14646 #ifdef HAVE_LONG_LONG
14647 } else if (sizeof(siz) <= sizeof(PY_LONG_LONG)) {
14648 return PyLong_FromLongLong((PY_LONG_LONG) value);
14653 int one = 1; int little = (int)*(unsigned char *)&one;
14654 unsigned char *bytes = (unsigned char *)&value;
14655 return _PyLong_FromByteArray(bytes, sizeof(siz),
14656 little, !is_unsigned);
14661 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_Py_intptr_t(Py_intptr_t value) {
14662 const Py_intptr_t neg_one = (Py_intptr_t) -1, const_zero = (Py_intptr_t) 0;
14663 const int is_unsigned = neg_one > const_zero;
14665 if (sizeof(Py_intptr_t) < sizeof(long)) {
14666 return PyInt_FromLong((long) value);
14667 } else if (sizeof(Py_intptr_t) <= sizeof(unsigned long)) {
14668 return PyLong_FromUnsignedLong((unsigned long) value);
14669 #ifdef HAVE_LONG_LONG
14670 } else if (sizeof(Py_intptr_t) <= sizeof(unsigned PY_LONG_LONG)) {
14671 return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
14675 if (sizeof(Py_intptr_t) <= sizeof(long)) {
14676 return PyInt_FromLong((long) value);
14677 #ifdef HAVE_LONG_LONG
14678 } else if (sizeof(Py_intptr_t) <= sizeof(PY_LONG_LONG)) {
14679 return PyLong_FromLongLong((PY_LONG_LONG) value);
14684 int one = 1; int little = (int)*(unsigned char *)&one;
14685 unsigned char *bytes = (unsigned char *)&value;
14686 return _PyLong_FromByteArray(bytes, sizeof(Py_intptr_t),
14687 little, !is_unsigned);
14692 #if CYTHON_CCOMPLEX
14694 static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
14695 return ::std::complex< float >(x, y);
14698 static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
14699 return x + y*(__pyx_t_float_complex)_Complex_I;
14703 static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
14704 __pyx_t_float_complex z;
14712 #if CYTHON_CCOMPLEX
14714 static CYTHON_INLINE int __Pyx_c_eq_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
14715 return (a.real == b.real) && (a.imag == b.imag);
14717 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sum_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
14718 __pyx_t_float_complex z;
14719 z.real = a.real + b.real;
14720 z.imag = a.imag + b.imag;
14723 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_diff_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
14724 __pyx_t_float_complex z;
14725 z.real = a.real - b.real;
14726 z.imag = a.imag - b.imag;
14729 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prod_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
14730 __pyx_t_float_complex z;
14731 z.real = a.real * b.real - a.imag * b.imag;
14732 z.imag = a.real * b.imag + a.imag * b.real;
14736 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
14738 return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.real);
14739 } else if (fabsf(b.real) >= fabsf(b.imag)) {
14740 if (b.real == 0 && b.imag == 0) {
14741 return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.imag);
14743 float r = b.imag / b.real;
14744 float s = 1.0 / (b.real + b.imag * r);
14745 return __pyx_t_float_complex_from_parts(
14746 (a.real + a.imag * r) * s, (a.imag - a.real * r) * s);
14749 float r = b.real / b.imag;
14750 float s = 1.0 / (b.imag + b.real * r);
14751 return __pyx_t_float_complex_from_parts(
14752 (a.real * r + a.imag) * s, (a.imag * r - a.real) * s);
14756 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
14758 return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.real);
14760 float denom = b.real * b.real + b.imag * b.imag;
14761 return __pyx_t_float_complex_from_parts(
14762 (a.real * b.real + a.imag * b.imag) / denom,
14763 (a.imag * b.real - a.real * b.imag) / denom);
14767 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_neg_float(__pyx_t_float_complex a) {
14768 __pyx_t_float_complex z;
14773 static CYTHON_INLINE int __Pyx_c_is_zero_float(__pyx_t_float_complex a) {
14774 return (a.real == 0) && (a.imag == 0);
14776 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conj_float(__pyx_t_float_complex a) {
14777 __pyx_t_float_complex z;
14783 static CYTHON_INLINE float __Pyx_c_abs_float(__pyx_t_float_complex z) {
14784 #if !defined(HAVE_HYPOT) || defined(_MSC_VER)
14785 return sqrtf(z.real*z.real + z.imag*z.imag);
14787 return hypotf(z.real, z.imag);
14790 static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_pow_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
14791 __pyx_t_float_complex z;
14792 float r, lnr, theta, z_r, z_theta;
14793 if (b.imag == 0 && b.real == (int)b.real) {
14795 float denom = a.real * a.real + a.imag * a.imag;
14796 a.real = a.real / denom;
14797 a.imag = -a.imag / denom;
14800 switch ((int)b.real) {
14808 z = __Pyx_c_prod_float(a, a);
14809 return __Pyx_c_prod_float(a, a);
14811 z = __Pyx_c_prod_float(a, a);
14812 return __Pyx_c_prod_float(z, a);
14814 z = __Pyx_c_prod_float(a, a);
14815 return __Pyx_c_prod_float(z, z);
14821 } else if (b.imag == 0) {
14822 z.real = powf(a.real, b.real);
14825 } else if (a.real > 0) {
14830 theta = atan2f(0, -1);
14833 r = __Pyx_c_abs_float(a);
14834 theta = atan2f(a.imag, a.real);
14837 z_r = expf(lnr * b.real - theta * b.imag);
14838 z_theta = theta * b.real + lnr * b.imag;
14839 z.real = z_r * cosf(z_theta);
14840 z.imag = z_r * sinf(z_theta);
14847 #if CYTHON_CCOMPLEX
14849 static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
14850 return ::std::complex< double >(x, y);
14853 static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
14854 return x + y*(__pyx_t_double_complex)_Complex_I;
14858 static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
14859 __pyx_t_double_complex z;
14867 #if CYTHON_CCOMPLEX
14869 static CYTHON_INLINE int __Pyx_c_eq_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
14870 return (a.real == b.real) && (a.imag == b.imag);
14872 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
14873 __pyx_t_double_complex z;
14874 z.real = a.real + b.real;
14875 z.imag = a.imag + b.imag;
14878 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
14879 __pyx_t_double_complex z;
14880 z.real = a.real - b.real;
14881 z.imag = a.imag - b.imag;
14884 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
14885 __pyx_t_double_complex z;
14886 z.real = a.real * b.real - a.imag * b.imag;
14887 z.imag = a.real * b.imag + a.imag * b.real;
14891 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
14893 return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.real);
14894 } else if (fabs(b.real) >= fabs(b.imag)) {
14895 if (b.real == 0 && b.imag == 0) {
14896 return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.imag);
14898 double r = b.imag / b.real;
14899 double s = 1.0 / (b.real + b.imag * r);
14900 return __pyx_t_double_complex_from_parts(
14901 (a.real + a.imag * r) * s, (a.imag - a.real * r) * s);
14904 double r = b.real / b.imag;
14905 double s = 1.0 / (b.imag + b.real * r);
14906 return __pyx_t_double_complex_from_parts(
14907 (a.real * r + a.imag) * s, (a.imag * r - a.real) * s);
14911 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
14913 return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.real);
14915 double denom = b.real * b.real + b.imag * b.imag;
14916 return __pyx_t_double_complex_from_parts(
14917 (a.real * b.real + a.imag * b.imag) / denom,
14918 (a.imag * b.real - a.real * b.imag) / denom);
14922 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg_double(__pyx_t_double_complex a) {
14923 __pyx_t_double_complex z;
14928 static CYTHON_INLINE int __Pyx_c_is_zero_double(__pyx_t_double_complex a) {
14929 return (a.real == 0) && (a.imag == 0);
14931 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj_double(__pyx_t_double_complex a) {
14932 __pyx_t_double_complex z;
14938 static CYTHON_INLINE double __Pyx_c_abs_double(__pyx_t_double_complex z) {
14939 #if !defined(HAVE_HYPOT) || defined(_MSC_VER)
14940 return sqrt(z.real*z.real + z.imag*z.imag);
14942 return hypot(z.real, z.imag);
14945 static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
14946 __pyx_t_double_complex z;
14947 double r, lnr, theta, z_r, z_theta;
14948 if (b.imag == 0 && b.real == (int)b.real) {
14950 double denom = a.real * a.real + a.imag * a.imag;
14951 a.real = a.real / denom;
14952 a.imag = -a.imag / denom;
14955 switch ((int)b.real) {
14963 z = __Pyx_c_prod_double(a, a);
14964 return __Pyx_c_prod_double(a, a);
14966 z = __Pyx_c_prod_double(a, a);
14967 return __Pyx_c_prod_double(z, a);
14969 z = __Pyx_c_prod_double(a, a);
14970 return __Pyx_c_prod_double(z, z);
14976 } else if (b.imag == 0) {
14977 z.real = pow(a.real, b.real);
14980 } else if (a.real > 0) {
14985 theta = atan2(0, -1);
14988 r = __Pyx_c_abs_double(a);
14989 theta = atan2(a.imag, a.real);
14992 z_r = exp(lnr * b.real - theta * b.imag);
14993 z_theta = theta * b.real + lnr * b.imag;
14994 z.real = z_r * cos(z_theta);
14995 z.imag = z_r * sin(z_theta);
15002 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) {
15003 const int neg_one = (int) -1, const_zero = (int) 0;
15004 const int is_unsigned = neg_one > const_zero;
15006 if (sizeof(int) < sizeof(long)) {
15007 return PyInt_FromLong((long) value);
15008 } else if (sizeof(int) <= sizeof(unsigned long)) {
15009 return PyLong_FromUnsignedLong((unsigned long) value);
15010 #ifdef HAVE_LONG_LONG
15011 } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
15012 return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
15016 if (sizeof(int) <= sizeof(long)) {
15017 return PyInt_FromLong((long) value);
15018 #ifdef HAVE_LONG_LONG
15019 } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
15020 return PyLong_FromLongLong((PY_LONG_LONG) value);
15025 int one = 1; int little = (int)*(unsigned char *)&one;
15026 unsigned char *bytes = (unsigned char *)&value;
15027 return _PyLong_FromByteArray(bytes, sizeof(int),
15028 little, !is_unsigned);
15033 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum__NPY_TYPES(enum NPY_TYPES value) {
15034 const enum NPY_TYPES neg_one = (enum NPY_TYPES) -1, const_zero = (enum NPY_TYPES) 0;
15035 const int is_unsigned = neg_one > const_zero;
15037 if (sizeof(enum NPY_TYPES) < sizeof(long)) {
15038 return PyInt_FromLong((long) value);
15039 } else if (sizeof(enum NPY_TYPES) <= sizeof(unsigned long)) {
15040 return PyLong_FromUnsignedLong((unsigned long) value);
15041 #ifdef HAVE_LONG_LONG
15042 } else if (sizeof(enum NPY_TYPES) <= sizeof(unsigned PY_LONG_LONG)) {
15043 return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value);
15047 if (sizeof(enum NPY_TYPES) <= sizeof(long)) {
15048 return PyInt_FromLong((long) value);
15049 #ifdef HAVE_LONG_LONG
15050 } else if (sizeof(enum NPY_TYPES) <= sizeof(PY_LONG_LONG)) {
15051 return PyLong_FromLongLong((PY_LONG_LONG) value);
15056 int one = 1; int little = (int)*(unsigned char *)&one;
15057 unsigned char *bytes = (unsigned char *)&value;
15058 return _PyLong_FromByteArray(bytes, sizeof(enum NPY_TYPES),
15059 little, !is_unsigned);
15064 static CYTHON_INLINE siz __Pyx_PyInt_As_siz(PyObject *x) {
15065 const siz neg_one = (siz) -1, const_zero = (siz) 0;
15066 const int is_unsigned = neg_one > const_zero;
15067 #if PY_MAJOR_VERSION < 3
15068 if (likely(PyInt_Check(x))) {
15069 if (sizeof(siz) < sizeof(long)) {
15070 __PYX_VERIFY_RETURN_INT(siz, long, PyInt_AS_LONG(x))
15072 long val = PyInt_AS_LONG(x);
15073 if (is_unsigned && unlikely(val < 0)) {
15074 goto raise_neg_overflow;
15080 if (likely(PyLong_Check(x))) {
15082 #if CYTHON_USE_PYLONG_INTERNALS
15083 const digit* digits = ((PyLongObject*)x)->ob_digit;
15084 switch (Py_SIZE(x)) {
15085 case 0: return (siz) 0;
15086 case 1: __PYX_VERIFY_RETURN_INT(siz, digit, digits[0])
15088 if (8 * sizeof(siz) > 1 * PyLong_SHIFT) {
15089 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
15090 __PYX_VERIFY_RETURN_INT(siz, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
15091 } else if (8 * sizeof(siz) >= 2 * PyLong_SHIFT) {
15092 return (siz) (((((siz)digits[1]) << PyLong_SHIFT) | (siz)digits[0]));
15097 if (8 * sizeof(siz) > 2 * PyLong_SHIFT) {
15098 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
15099 __PYX_VERIFY_RETURN_INT(siz, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
15100 } else if (8 * sizeof(siz) >= 3 * PyLong_SHIFT) {
15101 return (siz) (((((((siz)digits[2]) << PyLong_SHIFT) | (siz)digits[1]) << PyLong_SHIFT) | (siz)digits[0]));
15106 if (8 * sizeof(siz) > 3 * PyLong_SHIFT) {
15107 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
15108 __PYX_VERIFY_RETURN_INT(siz, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
15109 } else if (8 * sizeof(siz) >= 4 * PyLong_SHIFT) {
15110 return (siz) (((((((((siz)digits[3]) << PyLong_SHIFT) | (siz)digits[2]) << PyLong_SHIFT) | (siz)digits[1]) << PyLong_SHIFT) | (siz)digits[0]));
15116 #if CYTHON_COMPILING_IN_CPYTHON
15117 if (unlikely(Py_SIZE(x) < 0)) {
15118 goto raise_neg_overflow;
15122 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
15123 if (unlikely(result < 0))
15125 if (unlikely(result == 1))
15126 goto raise_neg_overflow;
15129 if (sizeof(siz) <= sizeof(unsigned long)) {
15130 __PYX_VERIFY_RETURN_INT_EXC(siz, unsigned long, PyLong_AsUnsignedLong(x))
15131 #ifdef HAVE_LONG_LONG
15132 } else if (sizeof(siz) <= sizeof(unsigned PY_LONG_LONG)) {
15133 __PYX_VERIFY_RETURN_INT_EXC(siz, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
15137 #if CYTHON_USE_PYLONG_INTERNALS
15138 const digit* digits = ((PyLongObject*)x)->ob_digit;
15139 switch (Py_SIZE(x)) {
15140 case 0: return (siz) 0;
15141 case -1: __PYX_VERIFY_RETURN_INT(siz, sdigit, (sdigit) (-(sdigit)digits[0]))
15142 case 1: __PYX_VERIFY_RETURN_INT(siz, digit, +digits[0])
15144 if (8 * sizeof(siz) - 1 > 1 * PyLong_SHIFT) {
15145 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
15146 __PYX_VERIFY_RETURN_INT(siz, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
15147 } else if (8 * sizeof(siz) - 1 > 2 * PyLong_SHIFT) {
15148 return (siz) (((siz)-1)*(((((siz)digits[1]) << PyLong_SHIFT) | (siz)digits[0])));
15153 if (8 * sizeof(siz) > 1 * PyLong_SHIFT) {
15154 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
15155 __PYX_VERIFY_RETURN_INT(siz, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
15156 } else if (8 * sizeof(siz) - 1 > 2 * PyLong_SHIFT) {
15157 return (siz) ((((((siz)digits[1]) << PyLong_SHIFT) | (siz)digits[0])));
15162 if (8 * sizeof(siz) - 1 > 2 * PyLong_SHIFT) {
15163 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
15164 __PYX_VERIFY_RETURN_INT(siz, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
15165 } else if (8 * sizeof(siz) - 1 > 3 * PyLong_SHIFT) {
15166 return (siz) (((siz)-1)*(((((((siz)digits[2]) << PyLong_SHIFT) | (siz)digits[1]) << PyLong_SHIFT) | (siz)digits[0])));
15171 if (8 * sizeof(siz) > 2 * PyLong_SHIFT) {
15172 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
15173 __PYX_VERIFY_RETURN_INT(siz, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
15174 } else if (8 * sizeof(siz) - 1 > 3 * PyLong_SHIFT) {
15175 return (siz) ((((((((siz)digits[2]) << PyLong_SHIFT) | (siz)digits[1]) << PyLong_SHIFT) | (siz)digits[0])));
15180 if (8 * sizeof(siz) - 1 > 3 * PyLong_SHIFT) {
15181 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
15182 __PYX_VERIFY_RETURN_INT(siz, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
15183 } else if (8 * sizeof(siz) - 1 > 4 * PyLong_SHIFT) {
15184 return (siz) (((siz)-1)*(((((((((siz)digits[3]) << PyLong_SHIFT) | (siz)digits[2]) << PyLong_SHIFT) | (siz)digits[1]) << PyLong_SHIFT) | (siz)digits[0])));
15189 if (8 * sizeof(siz) > 3 * PyLong_SHIFT) {
15190 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
15191 __PYX_VERIFY_RETURN_INT(siz, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
15192 } else if (8 * sizeof(siz) - 1 > 4 * PyLong_SHIFT) {
15193 return (siz) ((((((((((siz)digits[3]) << PyLong_SHIFT) | (siz)digits[2]) << PyLong_SHIFT) | (siz)digits[1]) << PyLong_SHIFT) | (siz)digits[0])));
15199 if (sizeof(siz) <= sizeof(long)) {
15200 __PYX_VERIFY_RETURN_INT_EXC(siz, long, PyLong_AsLong(x))
15201 #ifdef HAVE_LONG_LONG
15202 } else if (sizeof(siz) <= sizeof(PY_LONG_LONG)) {
15203 __PYX_VERIFY_RETURN_INT_EXC(siz, PY_LONG_LONG, PyLong_AsLongLong(x))
15208 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
15209 PyErr_SetString(PyExc_RuntimeError,
15210 "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
15213 PyObject *v = __Pyx_PyNumber_IntOrLong(x);
15214 #if PY_MAJOR_VERSION < 3
15215 if (likely(v) && !PyLong_Check(v)) {
15217 v = PyNumber_Long(tmp);
15222 int one = 1; int is_little = (int)*(unsigned char *)&one;
15223 unsigned char *bytes = (unsigned char *)&val;
15224 int ret = _PyLong_AsByteArray((PyLongObject *)v,
15225 bytes, sizeof(val),
15226 is_little, !is_unsigned);
15236 PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
15237 if (!tmp) return (siz) -1;
15238 val = __Pyx_PyInt_As_siz(tmp);
15243 PyErr_SetString(PyExc_OverflowError,
15244 "value too large to convert to siz");
15246 raise_neg_overflow:
15247 PyErr_SetString(PyExc_OverflowError,
15248 "can't convert negative value to siz");
15253 static CYTHON_INLINE size_t __Pyx_PyInt_As_size_t(PyObject *x) {
15254 const size_t neg_one = (size_t) -1, const_zero = (size_t) 0;
15255 const int is_unsigned = neg_one > const_zero;
15256 #if PY_MAJOR_VERSION < 3
15257 if (likely(PyInt_Check(x))) {
15258 if (sizeof(size_t) < sizeof(long)) {
15259 __PYX_VERIFY_RETURN_INT(size_t, long, PyInt_AS_LONG(x))
15261 long val = PyInt_AS_LONG(x);
15262 if (is_unsigned && unlikely(val < 0)) {
15263 goto raise_neg_overflow;
15265 return (size_t) val;
15269 if (likely(PyLong_Check(x))) {
15271 #if CYTHON_USE_PYLONG_INTERNALS
15272 const digit* digits = ((PyLongObject*)x)->ob_digit;
15273 switch (Py_SIZE(x)) {
15274 case 0: return (size_t) 0;
15275 case 1: __PYX_VERIFY_RETURN_INT(size_t, digit, digits[0])
15277 if (8 * sizeof(size_t) > 1 * PyLong_SHIFT) {
15278 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
15279 __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
15280 } else if (8 * sizeof(size_t) >= 2 * PyLong_SHIFT) {
15281 return (size_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
15286 if (8 * sizeof(size_t) > 2 * PyLong_SHIFT) {
15287 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
15288 __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
15289 } else if (8 * sizeof(size_t) >= 3 * PyLong_SHIFT) {
15290 return (size_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
15295 if (8 * sizeof(size_t) > 3 * PyLong_SHIFT) {
15296 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
15297 __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
15298 } else if (8 * sizeof(size_t) >= 4 * PyLong_SHIFT) {
15299 return (size_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
15305 #if CYTHON_COMPILING_IN_CPYTHON
15306 if (unlikely(Py_SIZE(x) < 0)) {
15307 goto raise_neg_overflow;
15311 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
15312 if (unlikely(result < 0))
15313 return (size_t) -1;
15314 if (unlikely(result == 1))
15315 goto raise_neg_overflow;
15318 if (sizeof(size_t) <= sizeof(unsigned long)) {
15319 __PYX_VERIFY_RETURN_INT_EXC(size_t, unsigned long, PyLong_AsUnsignedLong(x))
15320 #ifdef HAVE_LONG_LONG
15321 } else if (sizeof(size_t) <= sizeof(unsigned PY_LONG_LONG)) {
15322 __PYX_VERIFY_RETURN_INT_EXC(size_t, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
15326 #if CYTHON_USE_PYLONG_INTERNALS
15327 const digit* digits = ((PyLongObject*)x)->ob_digit;
15328 switch (Py_SIZE(x)) {
15329 case 0: return (size_t) 0;
15330 case -1: __PYX_VERIFY_RETURN_INT(size_t, sdigit, (sdigit) (-(sdigit)digits[0]))
15331 case 1: __PYX_VERIFY_RETURN_INT(size_t, digit, +digits[0])
15333 if (8 * sizeof(size_t) - 1 > 1 * PyLong_SHIFT) {
15334 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
15335 __PYX_VERIFY_RETURN_INT(size_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
15336 } else if (8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT) {
15337 return (size_t) (((size_t)-1)*(((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
15342 if (8 * sizeof(size_t) > 1 * PyLong_SHIFT) {
15343 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
15344 __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
15345 } else if (8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT) {
15346 return (size_t) ((((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
15351 if (8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT) {
15352 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
15353 __PYX_VERIFY_RETURN_INT(size_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
15354 } else if (8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT) {
15355 return (size_t) (((size_t)-1)*(((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
15360 if (8 * sizeof(size_t) > 2 * PyLong_SHIFT) {
15361 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
15362 __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
15363 } else if (8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT) {
15364 return (size_t) ((((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
15369 if (8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT) {
15370 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
15371 __PYX_VERIFY_RETURN_INT(size_t, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
15372 } else if (8 * sizeof(size_t) - 1 > 4 * PyLong_SHIFT) {
15373 return (size_t) (((size_t)-1)*(((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
15378 if (8 * sizeof(size_t) > 3 * PyLong_SHIFT) {
15379 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
15380 __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
15381 } else if (8 * sizeof(size_t) - 1 > 4 * PyLong_SHIFT) {
15382 return (size_t) ((((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])));
15388 if (sizeof(size_t) <= sizeof(long)) {
15389 __PYX_VERIFY_RETURN_INT_EXC(size_t, long, PyLong_AsLong(x))
15390 #ifdef HAVE_LONG_LONG
15391 } else if (sizeof(size_t) <= sizeof(PY_LONG_LONG)) {
15392 __PYX_VERIFY_RETURN_INT_EXC(size_t, PY_LONG_LONG, PyLong_AsLongLong(x))
15397 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
15398 PyErr_SetString(PyExc_RuntimeError,
15399 "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
15402 PyObject *v = __Pyx_PyNumber_IntOrLong(x);
15403 #if PY_MAJOR_VERSION < 3
15404 if (likely(v) && !PyLong_Check(v)) {
15406 v = PyNumber_Long(tmp);
15411 int one = 1; int is_little = (int)*(unsigned char *)&one;
15412 unsigned char *bytes = (unsigned char *)&val;
15413 int ret = _PyLong_AsByteArray((PyLongObject *)v,
15414 bytes, sizeof(val),
15415 is_little, !is_unsigned);
15421 return (size_t) -1;
15425 PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
15426 if (!tmp) return (size_t) -1;
15427 val = __Pyx_PyInt_As_size_t(tmp);
15432 PyErr_SetString(PyExc_OverflowError,
15433 "value too large to convert to size_t");
15434 return (size_t) -1;
15435 raise_neg_overflow:
15436 PyErr_SetString(PyExc_OverflowError,
15437 "can't convert negative value to size_t");
15438 return (size_t) -1;
15442 static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) {
15443 const int neg_one = (int) -1, const_zero = (int) 0;
15444 const int is_unsigned = neg_one > const_zero;
15445 #if PY_MAJOR_VERSION < 3
15446 if (likely(PyInt_Check(x))) {
15447 if (sizeof(int) < sizeof(long)) {
15448 __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x))
15450 long val = PyInt_AS_LONG(x);
15451 if (is_unsigned && unlikely(val < 0)) {
15452 goto raise_neg_overflow;
15458 if (likely(PyLong_Check(x))) {
15460 #if CYTHON_USE_PYLONG_INTERNALS
15461 const digit* digits = ((PyLongObject*)x)->ob_digit;
15462 switch (Py_SIZE(x)) {
15463 case 0: return (int) 0;
15464 case 1: __PYX_VERIFY_RETURN_INT(int, digit, digits[0])
15466 if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
15467 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
15468 __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
15469 } else if (8 * sizeof(int) >= 2 * PyLong_SHIFT) {
15470 return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
15475 if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
15476 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
15477 __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
15478 } else if (8 * sizeof(int) >= 3 * PyLong_SHIFT) {
15479 return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
15484 if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
15485 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
15486 __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
15487 } else if (8 * sizeof(int) >= 4 * PyLong_SHIFT) {
15488 return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]));
15494 #if CYTHON_COMPILING_IN_CPYTHON
15495 if (unlikely(Py_SIZE(x) < 0)) {
15496 goto raise_neg_overflow;
15500 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
15501 if (unlikely(result < 0))
15503 if (unlikely(result == 1))
15504 goto raise_neg_overflow;
15507 if (sizeof(int) <= sizeof(unsigned long)) {
15508 __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x))
15509 #ifdef HAVE_LONG_LONG
15510 } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) {
15511 __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
15515 #if CYTHON_USE_PYLONG_INTERNALS
15516 const digit* digits = ((PyLongObject*)x)->ob_digit;
15517 switch (Py_SIZE(x)) {
15518 case 0: return (int) 0;
15519 case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, (sdigit) (-(sdigit)digits[0]))
15520 case 1: __PYX_VERIFY_RETURN_INT(int, digit, +digits[0])
15522 if (8 * sizeof(int) - 1 > 1 * PyLong_SHIFT) {
15523 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
15524 __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
15525 } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
15526 return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
15531 if (8 * sizeof(int) > 1 * PyLong_SHIFT) {
15532 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
15533 __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
15534 } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
15535 return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
15540 if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) {
15541 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
15542 __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
15543 } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
15544 return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
15549 if (8 * sizeof(int) > 2 * PyLong_SHIFT) {
15550 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
15551 __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
15552 } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
15553 return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
15558 if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) {
15559 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
15560 __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
15561 } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
15562 return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
15567 if (8 * sizeof(int) > 3 * PyLong_SHIFT) {
15568 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
15569 __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
15570 } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) {
15571 return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])));
15577 if (sizeof(int) <= sizeof(long)) {
15578 __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x))
15579 #ifdef HAVE_LONG_LONG
15580 } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) {
15581 __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x))
15586 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
15587 PyErr_SetString(PyExc_RuntimeError,
15588 "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
15591 PyObject *v = __Pyx_PyNumber_IntOrLong(x);
15592 #if PY_MAJOR_VERSION < 3
15593 if (likely(v) && !PyLong_Check(v)) {
15595 v = PyNumber_Long(tmp);
15600 int one = 1; int is_little = (int)*(unsigned char *)&one;
15601 unsigned char *bytes = (unsigned char *)&val;
15602 int ret = _PyLong_AsByteArray((PyLongObject *)v,
15603 bytes, sizeof(val),
15604 is_little, !is_unsigned);
15614 PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
15615 if (!tmp) return (int) -1;
15616 val = __Pyx_PyInt_As_int(tmp);
15621 PyErr_SetString(PyExc_OverflowError,
15622 "value too large to convert to int");
15624 raise_neg_overflow:
15625 PyErr_SetString(PyExc_OverflowError,
15626 "can't convert negative value to int");
15631 static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) {
15632 const long neg_one = (long) -1, const_zero = (long) 0;
15633 const int is_unsigned = neg_one > const_zero;
15634 #if PY_MAJOR_VERSION < 3
15635 if (likely(PyInt_Check(x))) {
15636 if (sizeof(long) < sizeof(long)) {
15637 __PYX_VERIFY_RETURN_INT(long, long, PyInt_AS_LONG(x))
15639 long val = PyInt_AS_LONG(x);
15640 if (is_unsigned && unlikely(val < 0)) {
15641 goto raise_neg_overflow;
15647 if (likely(PyLong_Check(x))) {
15649 #if CYTHON_USE_PYLONG_INTERNALS
15650 const digit* digits = ((PyLongObject*)x)->ob_digit;
15651 switch (Py_SIZE(x)) {
15652 case 0: return (long) 0;
15653 case 1: __PYX_VERIFY_RETURN_INT(long, digit, digits[0])
15655 if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
15656 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
15657 __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
15658 } else if (8 * sizeof(long) >= 2 * PyLong_SHIFT) {
15659 return (long) (((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
15664 if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
15665 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
15666 __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
15667 } else if (8 * sizeof(long) >= 3 * PyLong_SHIFT) {
15668 return (long) (((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
15673 if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
15674 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
15675 __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
15676 } else if (8 * sizeof(long) >= 4 * PyLong_SHIFT) {
15677 return (long) (((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0]));
15683 #if CYTHON_COMPILING_IN_CPYTHON
15684 if (unlikely(Py_SIZE(x) < 0)) {
15685 goto raise_neg_overflow;
15689 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
15690 if (unlikely(result < 0))
15692 if (unlikely(result == 1))
15693 goto raise_neg_overflow;
15696 if (sizeof(long) <= sizeof(unsigned long)) {
15697 __PYX_VERIFY_RETURN_INT_EXC(long, unsigned long, PyLong_AsUnsignedLong(x))
15698 #ifdef HAVE_LONG_LONG
15699 } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) {
15700 __PYX_VERIFY_RETURN_INT_EXC(long, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x))
15704 #if CYTHON_USE_PYLONG_INTERNALS
15705 const digit* digits = ((PyLongObject*)x)->ob_digit;
15706 switch (Py_SIZE(x)) {
15707 case 0: return (long) 0;
15708 case -1: __PYX_VERIFY_RETURN_INT(long, sdigit, (sdigit) (-(sdigit)digits[0]))
15709 case 1: __PYX_VERIFY_RETURN_INT(long, digit, +digits[0])
15711 if (8 * sizeof(long) - 1 > 1 * PyLong_SHIFT) {
15712 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
15713 __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
15714 } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
15715 return (long) (((long)-1)*(((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
15720 if (8 * sizeof(long) > 1 * PyLong_SHIFT) {
15721 if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) {
15722 __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
15723 } else if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
15724 return (long) ((((((long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
15729 if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
15730 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
15731 __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
15732 } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
15733 return (long) (((long)-1)*(((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
15738 if (8 * sizeof(long) > 2 * PyLong_SHIFT) {
15739 if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) {
15740 __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
15741 } else if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
15742 return (long) ((((((((long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
15747 if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) {
15748 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
15749 __PYX_VERIFY_RETURN_INT(long, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
15750 } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
15751 return (long) (((long)-1)*(((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
15756 if (8 * sizeof(long) > 3 * PyLong_SHIFT) {
15757 if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) {
15758 __PYX_VERIFY_RETURN_INT(long, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])))
15759 } else if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) {
15760 return (long) ((((((((((long)digits[3]) << PyLong_SHIFT) | (long)digits[2]) << PyLong_SHIFT) | (long)digits[1]) << PyLong_SHIFT) | (long)digits[0])));
15766 if (sizeof(long) <= sizeof(long)) {
15767 __PYX_VERIFY_RETURN_INT_EXC(long, long, PyLong_AsLong(x))
15768 #ifdef HAVE_LONG_LONG
15769 } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) {
15770 __PYX_VERIFY_RETURN_INT_EXC(long, PY_LONG_LONG, PyLong_AsLongLong(x))
15775 #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray)
15776 PyErr_SetString(PyExc_RuntimeError,
15777 "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers");
15780 PyObject *v = __Pyx_PyNumber_IntOrLong(x);
15781 #if PY_MAJOR_VERSION < 3
15782 if (likely(v) && !PyLong_Check(v)) {
15784 v = PyNumber_Long(tmp);
15789 int one = 1; int is_little = (int)*(unsigned char *)&one;
15790 unsigned char *bytes = (unsigned char *)&val;
15791 int ret = _PyLong_AsByteArray((PyLongObject *)v,
15792 bytes, sizeof(val),
15793 is_little, !is_unsigned);
15803 PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
15804 if (!tmp) return (long) -1;
15805 val = __Pyx_PyInt_As_long(tmp);
15810 PyErr_SetString(PyExc_OverflowError,
15811 "value too large to convert to long");
15813 raise_neg_overflow:
15814 PyErr_SetString(PyExc_OverflowError,
15815 "can't convert negative value to long");
15819 /* CheckBinaryVersion */
15820 static int __Pyx_check_binary_version(void) {
15821 char ctversion[4], rtversion[4];
15822 PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION);
15823 PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion());
15824 if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) {
15826 PyOS_snprintf(message, sizeof(message),
15827 "compiletime version %s of module '%.100s' "
15828 "does not match runtime version %s",
15829 ctversion, __Pyx_MODULE_NAME, rtversion);
15830 return PyErr_WarnEx(NULL, message, 1);
15836 #ifndef __PYX_HAVE_RT_ImportModule
15837 #define __PYX_HAVE_RT_ImportModule
15838 static PyObject *__Pyx_ImportModule(const char *name) {
15839 PyObject *py_name = 0;
15840 PyObject *py_module = 0;
15841 py_name = __Pyx_PyIdentifier_FromString(name);
15844 py_module = PyImport_Import(py_name);
15845 Py_DECREF(py_name);
15848 Py_XDECREF(py_name);
15854 #ifndef __PYX_HAVE_RT_ImportType
15855 #define __PYX_HAVE_RT_ImportType
15856 static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name,
15857 size_t size, int strict)
15859 PyObject *py_module = 0;
15860 PyObject *result = 0;
15861 PyObject *py_name = 0;
15863 Py_ssize_t basicsize;
15864 #ifdef Py_LIMITED_API
15865 PyObject *py_basicsize;
15867 py_module = __Pyx_ImportModule(module_name);
15870 py_name = __Pyx_PyIdentifier_FromString(class_name);
15873 result = PyObject_GetAttr(py_module, py_name);
15874 Py_DECREF(py_name);
15876 Py_DECREF(py_module);
15880 if (!PyType_Check(result)) {
15881 PyErr_Format(PyExc_TypeError,
15882 "%.200s.%.200s is not a type object",
15883 module_name, class_name);
15886 #ifndef Py_LIMITED_API
15887 basicsize = ((PyTypeObject *)result)->tp_basicsize;
15889 py_basicsize = PyObject_GetAttrString(result, "__basicsize__");
15892 basicsize = PyLong_AsSsize_t(py_basicsize);
15893 Py_DECREF(py_basicsize);
15895 if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred())
15898 if (!strict && (size_t)basicsize > size) {
15899 PyOS_snprintf(warning, sizeof(warning),
15900 "%s.%s size changed, may indicate binary incompatibility. Expected %zd, got %zd",
15901 module_name, class_name, basicsize, size);
15902 if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad;
15904 else if ((size_t)basicsize != size) {
15905 PyErr_Format(PyExc_ValueError,
15906 "%.200s.%.200s has the wrong size, try recompiling. Expected %zd, got %zd",
15907 module_name, class_name, basicsize, size);
15910 return (PyTypeObject *)result;
15912 Py_XDECREF(py_module);
15913 Py_XDECREF(result);
15919 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
15921 #if PY_MAJOR_VERSION < 3
15922 if (t->is_unicode) {
15923 *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL);
15924 } else if (t->intern) {
15925 *t->p = PyString_InternFromString(t->s);
15927 *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
15930 if (t->is_unicode | t->is_str) {
15932 *t->p = PyUnicode_InternFromString(t->s);
15933 } else if (t->encoding) {
15934 *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL);
15936 *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
15939 *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
15949 static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char* c_str) {
15950 return __Pyx_PyUnicode_FromStringAndSize(c_str, (Py_ssize_t)strlen(c_str));
15952 static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject* o) {
15954 return __Pyx_PyObject_AsStringAndSize(o, &ignore);
15956 static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) {
15957 #if CYTHON_COMPILING_IN_CPYTHON && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT)
15959 #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
15960 __Pyx_sys_getdefaultencoding_not_ascii &&
15962 PyUnicode_Check(o)) {
15963 #if PY_VERSION_HEX < 0x03030000
15965 PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL);
15966 if (!defenc) return NULL;
15967 defenc_c = PyBytes_AS_STRING(defenc);
15968 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
15970 char* end = defenc_c + PyBytes_GET_SIZE(defenc);
15972 for (c = defenc_c; c < end; c++) {
15973 if ((unsigned char) (*c) >= 128) {
15974 PyUnicode_AsASCIIString(o);
15980 *length = PyBytes_GET_SIZE(defenc);
15983 if (__Pyx_PyUnicode_READY(o) == -1) return NULL;
15984 #if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
15985 if (PyUnicode_IS_ASCII(o)) {
15986 *length = PyUnicode_GET_LENGTH(o);
15987 return PyUnicode_AsUTF8(o);
15989 PyUnicode_AsASCIIString(o);
15993 return PyUnicode_AsUTF8AndSize(o, length);
15998 #if (!CYTHON_COMPILING_IN_PYPY) || (defined(PyByteArray_AS_STRING) && defined(PyByteArray_GET_SIZE))
15999 if (PyByteArray_Check(o)) {
16000 *length = PyByteArray_GET_SIZE(o);
16001 return PyByteArray_AS_STRING(o);
16006 int r = PyBytes_AsStringAndSize(o, &result, length);
16007 if (unlikely(r < 0)) {
16014 static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) {
16015 int is_true = x == Py_True;
16016 if (is_true | (x == Py_False) | (x == Py_None)) return is_true;
16017 else return PyObject_IsTrue(x);
16019 static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) {
16020 #if CYTHON_USE_TYPE_SLOTS
16021 PyNumberMethods *m;
16023 const char *name = NULL;
16024 PyObject *res = NULL;
16025 #if PY_MAJOR_VERSION < 3
16026 if (PyInt_Check(x) || PyLong_Check(x))
16028 if (PyLong_Check(x))
16030 return __Pyx_NewRef(x);
16031 #if CYTHON_USE_TYPE_SLOTS
16032 m = Py_TYPE(x)->tp_as_number;
16033 #if PY_MAJOR_VERSION < 3
16034 if (m && m->nb_int) {
16036 res = PyNumber_Int(x);
16038 else if (m && m->nb_long) {
16040 res = PyNumber_Long(x);
16043 if (m && m->nb_int) {
16045 res = PyNumber_Long(x);
16049 res = PyNumber_Int(x);
16052 #if PY_MAJOR_VERSION < 3
16053 if (!PyInt_Check(res) && !PyLong_Check(res)) {
16055 if (!PyLong_Check(res)) {
16057 PyErr_Format(PyExc_TypeError,
16058 "__%.4s__ returned non-%.4s (type %.200s)",
16059 name, name, Py_TYPE(res)->tp_name);
16064 else if (!PyErr_Occurred()) {
16065 PyErr_SetString(PyExc_TypeError,
16066 "an integer is required");
16070 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
16073 #if PY_MAJOR_VERSION < 3
16074 if (likely(PyInt_CheckExact(b))) {
16075 if (sizeof(Py_ssize_t) >= sizeof(long))
16076 return PyInt_AS_LONG(b);
16078 return PyInt_AsSsize_t(x);
16081 if (likely(PyLong_CheckExact(b))) {
16082 #if CYTHON_USE_PYLONG_INTERNALS
16083 const digit* digits = ((PyLongObject*)b)->ob_digit;
16084 const Py_ssize_t size = Py_SIZE(b);
16085 if (likely(__Pyx_sst_abs(size) <= 1)) {
16086 ival = likely(size) ? digits[0] : 0;
16087 if (size == -1) ival = -ival;
16092 if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
16093 return (Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
16097 if (8 * sizeof(Py_ssize_t) > 2 * PyLong_SHIFT) {
16098 return -(Py_ssize_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
16102 if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
16103 return (Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
16107 if (8 * sizeof(Py_ssize_t) > 3 * PyLong_SHIFT) {
16108 return -(Py_ssize_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
16112 if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
16113 return (Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
16117 if (8 * sizeof(Py_ssize_t) > 4 * PyLong_SHIFT) {
16118 return -(Py_ssize_t) (((((((((size_t)digits[3]) << PyLong_SHIFT) | (size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]));
16124 return PyLong_AsSsize_t(b);
16126 x = PyNumber_Index(b);
16128 ival = PyInt_AsSsize_t(x);
16132 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
16133 return PyInt_FromSize_t(ival);
16137 #endif /* Py_PYTHON_H */