pcb defect detetcion application
[ealt-edge.git] / example-apps / PDD / pcb-defect-detection / data / lib_coco / PythonAPI / pycocotools / _mask.c
1 /* Generated by Cython 0.25.2 */
2
3 #define PY_SSIZE_T_CLEAN
4 #include "Python.h"
5 #ifndef Py_PYTHON_H
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+.
9 #else
10 #define CYTHON_ABI "0_25_2"
11 #include <stddef.h>
12 #ifndef offsetof
13   #define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
14 #endif
15 #if !defined(WIN32) && !defined(MS_WINDOWS)
16   #ifndef __stdcall
17     #define __stdcall
18   #endif
19   #ifndef __cdecl
20     #define __cdecl
21   #endif
22   #ifndef __fastcall
23     #define __fastcall
24   #endif
25 #endif
26 #ifndef DL_IMPORT
27   #define DL_IMPORT(t) t
28 #endif
29 #ifndef DL_EXPORT
30   #define DL_EXPORT(t) t
31 #endif
32 #ifndef HAVE_LONG_LONG
33   #if PY_VERSION_HEX >= 0x03030000 || (PY_MAJOR_VERSION == 2 && PY_VERSION_HEX >= 0x02070000)
34     #define HAVE_LONG_LONG
35   #endif
36 #endif
37 #ifndef PY_LONG_LONG
38   #define PY_LONG_LONG LONG_LONG
39 #endif
40 #ifndef Py_HUGE_VAL
41   #define Py_HUGE_VAL HUGE_VAL
42 #endif
43 #ifdef PYPY_VERSION
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
75   #endif
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
82   #endif
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
89   #endif
90   #ifndef CYTHON_ASSUME_SAFE_MACROS
91     #define CYTHON_ASSUME_SAFE_MACROS 1
92   #endif
93   #ifndef CYTHON_UNPACK_METHODS
94     #define CYTHON_UNPACK_METHODS 1
95   #endif
96   #undef CYTHON_FAST_THREAD_STATE
97   #define CYTHON_FAST_THREAD_STATE 0
98   #undef CYTHON_FAST_PYCALL
99   #define CYTHON_FAST_PYCALL 0
100 #else
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
106   #endif
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
112   #endif
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
118   #endif
119   #ifndef CYTHON_USE_PYLIST_INTERNALS
120     #define CYTHON_USE_PYLIST_INTERNALS 1
121   #endif
122   #ifndef CYTHON_USE_UNICODE_INTERNALS
123     #define CYTHON_USE_UNICODE_INTERNALS 1
124   #endif
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
130   #endif
131   #ifndef CYTHON_AVOID_BORROWED_REFS
132     #define CYTHON_AVOID_BORROWED_REFS 0
133   #endif
134   #ifndef CYTHON_ASSUME_SAFE_MACROS
135     #define CYTHON_ASSUME_SAFE_MACROS 1
136   #endif
137   #ifndef CYTHON_UNPACK_METHODS
138     #define CYTHON_UNPACK_METHODS 1
139   #endif
140   #ifndef CYTHON_FAST_THREAD_STATE
141     #define CYTHON_FAST_THREAD_STATE 1
142   #endif
143   #ifndef CYTHON_FAST_PYCALL
144     #define CYTHON_FAST_PYCALL 1
145   #endif
146 #endif
147 #if !defined(CYTHON_FAST_PYCCALL)
148 #define CYTHON_FAST_PYCCALL  (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1)
149 #endif
150 #if CYTHON_USE_PYLONG_INTERNALS
151   #include "longintrepr.h"
152   #undef SHIFT
153   #undef BASE
154   #undef MASK
155 #endif
156 #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag)
157   #define Py_OptimizeFlag 0
158 #endif
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
166 #else
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
171 #endif
172 #ifndef Py_TPFLAGS_CHECKTYPES
173   #define Py_TPFLAGS_CHECKTYPES 0
174 #endif
175 #ifndef Py_TPFLAGS_HAVE_INDEX
176   #define Py_TPFLAGS_HAVE_INDEX 0
177 #endif
178 #ifndef Py_TPFLAGS_HAVE_NEWBUFFER
179   #define Py_TPFLAGS_HAVE_NEWBUFFER 0
180 #endif
181 #ifndef Py_TPFLAGS_HAVE_FINALIZE
182   #define Py_TPFLAGS_HAVE_FINALIZE 0
183 #endif
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);
188 #else
189   #define __Pyx_PyCFunctionFast _PyCFunctionFast
190 #endif
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)))))
194 #else
195 #define __Pyx_PyFastCFunction_Check(func) 0
196 #endif
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)))
209 #else
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))
223 #endif
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)
227 #else
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))
231 #endif
232 #if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains)
233   #define PyUnicode_Contains(u, s)  PySequence_Contains(u, s)
234 #endif
235 #if CYTHON_COMPILING_IN_PYPY && !defined(PyByteArray_Check)
236   #define PyByteArray_Check(obj)  PyObject_TypeCheck(obj, &PyByteArray_Type)
237 #endif
238 #if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Format)
239   #define PyObject_Format(obj, fmt)  PyObject_CallMethod(obj, "__format__", "O", fmt)
240 #endif
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)
245 #endif
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)
249 #else
250   #define __Pyx_PyCode_HasFreeVars(co)  (PyCode_GetNumFree(co) > 0)
251   #define __Pyx_PyFrame_SetLineNumber(frame, lineno)  (frame)->f_lineno = (lineno)
252 #endif
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)
257 #else
258   #define __Pyx_PyString_Format(a, b)  PyString_Format(a, b)
259 #endif
260 #if PY_MAJOR_VERSION < 3 && !defined(PyObject_ASCII)
261   #define PyObject_ASCII(o)            PyObject_Repr(o)
262 #endif
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
269 #endif
270 #if PY_MAJOR_VERSION >= 3
271   #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj)
272   #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj)
273 #else
274   #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj))
275   #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj))
276 #endif
277 #ifndef PySet_CheckExact
278   #define PySet_CheckExact(obj)        (Py_TYPE(obj) == &PySet_Type)
279 #endif
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
298 #endif
299 #if PY_MAJOR_VERSION >= 3
300   #define PyBoolObject                 PyLongObject
301 #endif
302 #if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY
303   #ifndef PyUnicode_InternFromString
304     #define PyUnicode_InternFromString(s) PyUnicode_FromString(s)
305   #endif
306 #endif
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
311 #else
312   #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
313   #define __Pyx_PyInt_AsHash_t   PyInt_AsSsize_t
314 #endif
315 #if PY_MAJOR_VERSION >= 3
316   #define __Pyx_PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func))
317 #else
318   #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass)
319 #endif
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)
324   #else
325     typedef struct {
326         unaryfunc am_await;
327         unaryfunc am_aiter;
328         unaryfunc am_anext;
329     } __Pyx_PyAsyncMethodsStruct;
330     #define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved))
331   #endif
332 #else
333   #define __Pyx_PyType_AsAsync(obj) NULL
334 #endif
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
342   #else
343     #define CYTHON_RESTRICT
344   #endif
345 #endif
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__))
350 #   else
351 #     define CYTHON_UNUSED
352 #   endif
353 # elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
354 #   define CYTHON_UNUSED __attribute__ ((__unused__))
355 # else
356 #   define CYTHON_UNUSED
357 # endif
358 #endif
359 #ifndef CYTHON_MAYBE_UNUSED_VAR
360 #  if defined(__cplusplus)
361      template<class T> void CYTHON_MAYBE_UNUSED_VAR( const T& ) { }
362 #  else
363 #    define CYTHON_MAYBE_UNUSED_VAR(x) (void)(x)
364 #  endif
365 #endif
366 #ifndef CYTHON_NCP_UNUSED
367 # if CYTHON_COMPILING_IN_CPYTHON
368 #  define CYTHON_NCP_UNUSED
369 # else
370 #  define CYTHON_NCP_UNUSED CYTHON_UNUSED
371 # endif
372 #endif
373 #define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None)
374
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
384   #else
385     #define CYTHON_INLINE
386   #endif
387 #endif
388
389 #if defined(WIN32) || defined(MS_WINDOWS)
390   #define _USE_MATH_DEFINES
391 #endif
392 #include <math.h>
393 #ifdef NAN
394 #define __PYX_NAN() ((float) NAN)
395 #else
396 static CYTHON_INLINE float __PYX_NAN() {
397   float value;
398   memset(&value, 0xFF, sizeof(value));
399   return value;
400 }
401 #endif
402 #if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL)
403 #define __Pyx_truncl trunc
404 #else
405 #define __Pyx_truncl truncl
406 #endif
407
408
409 #define __PYX_ERR(f_index, lineno, Ln_error) \
410 { \
411   __pyx_filename = __pyx_f[f_index]; __pyx_lineno = lineno; __pyx_clineno = __LINE__; goto Ln_error; \
412 }
413
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)
417 #else
418   #define __Pyx_PyNumber_Divide(x,y)         PyNumber_Divide(x,y)
419   #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceDivide(x,y)
420 #endif
421
422 #ifndef __PYX_EXTERN_C
423   #ifdef __cplusplus
424     #define __PYX_EXTERN_C extern "C"
425   #else
426     #define __PYX_EXTERN_C extern
427   #endif
428 #endif
429
430 #define __PYX_HAVE__pycocotools___mask
431 #define __PYX_HAVE_API__pycocotools___mask
432 #include <string.h>
433 #include <stdio.h>
434 #include <stdlib.h>
435 #include "numpy/arrayobject.h"
436 #include "numpy/ufuncobject.h"
437 #include "maskApi.h"
438 #ifdef _OPENMP
439 #include <omp.h>
440 #endif /* _OPENMP */
441
442 #ifdef PYREX_WITHOUT_ASSERTIONS
443 #define CYTHON_WITHOUT_ASSERTIONS
444 #endif
445
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;
448
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
467     #include <cstdlib>
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)
479 #else
480     #define __Pyx_sst_abs(value) ((value<0) ? -value : value)
481 #endif
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
492 #else
493     #define __Pyx_PyStr_FromString        __Pyx_PyUnicode_FromString
494     #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
495 #endif
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)
505 {
506     const Py_UNICODE *u_end = u;
507     while (*u_end++) ;
508     return (size_t)(u_end - u - 1);
509 }
510 #else
511 #define __Pyx_Py_UNICODE_strlen Py_UNICODE_strlen
512 #endif
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))
525 #else
526 #define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
527 #endif
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))
531 #else
532 #define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x))
533 #endif
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) {
538     PyObject* sys;
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");
544     if (!sys) goto bad;
545     default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL);
546     Py_DECREF(sys);
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;
552     } else {
553         char ascii_chars[128];
554         int c;
555         for (c = 0; c < 128; c++) {
556             ascii_chars[c] = c;
557         }
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) {
563             PyErr_Format(
564                 PyExc_ValueError,
565                 "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.",
566                 default_encoding_c);
567             goto bad;
568         }
569         Py_DECREF(ascii_chars_u);
570         Py_DECREF(ascii_chars_b);
571     }
572     Py_DECREF(default_encoding);
573     return 0;
574 bad:
575     Py_XDECREF(default_encoding);
576     Py_XDECREF(ascii_chars_u);
577     Py_XDECREF(ascii_chars_b);
578     return -1;
579 }
580 #endif
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)
583 #else
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) {
588     PyObject* sys;
589     PyObject* default_encoding = NULL;
590     char* default_encoding_c;
591     sys = PyImport_ImportModule("sys");
592     if (!sys) goto bad;
593     default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
594     Py_DECREF(sys);
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);
602     return 0;
603 bad:
604     Py_XDECREF(default_encoding);
605     return -1;
606 }
607 #endif
608 #endif
609
610
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__ */
619
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;
630
631 /* Header.proto */
632 #if !defined(CYTHON_CCOMPLEX)
633   #if defined(__cplusplus)
634     #define CYTHON_CCOMPLEX 1
635   #elif defined(_Complex_I)
636     #define CYTHON_CCOMPLEX 1
637   #else
638     #define CYTHON_CCOMPLEX 0
639   #endif
640 #endif
641 #if CYTHON_CCOMPLEX
642   #ifdef __cplusplus
643     #include <complex>
644   #else
645     #include <complex.h>
646   #endif
647 #endif
648 #if CYTHON_CCOMPLEX && !defined(__cplusplus) && defined(__sun__) && defined(__GNUC__)
649   #undef _Complex_I
650   #define _Complex_I 1.0fj
651 #endif
652
653
654 static const char *__pyx_f[] = {
655   "pycocotools/_mask.pyx",
656   "__init__.pxd",
657   "type.pxd",
658 };
659 /* BufferFormatStructs.proto */
660 #define IS_UNSIGNED(type) (((type) -1) > 0)
661 struct __Pyx_StructField_;
662 #define __PYX_BUF_FLAGS_PACKED_STRUCT (1 << 0)
663 typedef struct {
664   const char* name;
665   struct __Pyx_StructField_* fields;
666   size_t size;
667   size_t arraysize[8];
668   int ndim;
669   char typegroup;
670   char is_unsigned;
671   int flags;
672 } __Pyx_TypeInfo;
673 typedef struct __Pyx_StructField_ {
674   __Pyx_TypeInfo* type;
675   const char* name;
676   size_t offset;
677 } __Pyx_StructField;
678 typedef struct {
679   __Pyx_StructField* field;
680   size_t parent_offset;
681 } __Pyx_BufFmt_StackElem;
682 typedef struct {
683   __Pyx_StructField root;
684   __Pyx_BufFmt_StackElem* head;
685   size_t fmt_offset;
686   size_t new_count, enc_count;
687   size_t struct_alignment;
688   int is_complex;
689   char enc_type;
690   char new_packmode;
691   char enc_packmode;
692   char is_valid_array;
693 } __Pyx_BufFmt_Context;
694
695
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.
698  * 
699  * ctypedef npy_int8       int8_t             # <<<<<<<<<<<<<<
700  * ctypedef npy_int16      int16_t
701  * ctypedef npy_int32      int32_t
702  */
703 typedef npy_int8 __pyx_t_5numpy_int8_t;
704
705 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":726
706  * 
707  * ctypedef npy_int8       int8_t
708  * ctypedef npy_int16      int16_t             # <<<<<<<<<<<<<<
709  * ctypedef npy_int32      int32_t
710  * ctypedef npy_int64      int64_t
711  */
712 typedef npy_int16 __pyx_t_5numpy_int16_t;
713
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
720  */
721 typedef npy_int32 __pyx_t_5numpy_int32_t;
722
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
729  */
730 typedef npy_int64 __pyx_t_5numpy_int64_t;
731
732 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":732
733  * #ctypedef npy_int128     int128_t
734  * 
735  * ctypedef npy_uint8      uint8_t             # <<<<<<<<<<<<<<
736  * ctypedef npy_uint16     uint16_t
737  * ctypedef npy_uint32     uint32_t
738  */
739 typedef npy_uint8 __pyx_t_5numpy_uint8_t;
740
741 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":733
742  * 
743  * ctypedef npy_uint8      uint8_t
744  * ctypedef npy_uint16     uint16_t             # <<<<<<<<<<<<<<
745  * ctypedef npy_uint32     uint32_t
746  * ctypedef npy_uint64     uint64_t
747  */
748 typedef npy_uint16 __pyx_t_5numpy_uint16_t;
749
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
756  */
757 typedef npy_uint32 __pyx_t_5numpy_uint32_t;
758
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
765  */
766 typedef npy_uint64 __pyx_t_5numpy_uint64_t;
767
768 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":739
769  * #ctypedef npy_uint128    uint128_t
770  * 
771  * ctypedef npy_float32    float32_t             # <<<<<<<<<<<<<<
772  * ctypedef npy_float64    float64_t
773  * #ctypedef npy_float80    float80_t
774  */
775 typedef npy_float32 __pyx_t_5numpy_float32_t;
776
777 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":740
778  * 
779  * ctypedef npy_float32    float32_t
780  * ctypedef npy_float64    float64_t             # <<<<<<<<<<<<<<
781  * #ctypedef npy_float80    float80_t
782  * #ctypedef npy_float128   float128_t
783  */
784 typedef npy_float64 __pyx_t_5numpy_float64_t;
785
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
792  */
793 typedef npy_long __pyx_t_5numpy_int_t;
794
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
800  * 
801  */
802 typedef npy_longlong __pyx_t_5numpy_long_t;
803
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             # <<<<<<<<<<<<<<
808  * 
809  * ctypedef npy_ulong      uint_t
810  */
811 typedef npy_longlong __pyx_t_5numpy_longlong_t;
812
813 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":753
814  * ctypedef npy_longlong   longlong_t
815  * 
816  * ctypedef npy_ulong      uint_t             # <<<<<<<<<<<<<<
817  * ctypedef npy_ulonglong  ulong_t
818  * ctypedef npy_ulonglong  ulonglong_t
819  */
820 typedef npy_ulong __pyx_t_5numpy_uint_t;
821
822 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":754
823  * 
824  * ctypedef npy_ulong      uint_t
825  * ctypedef npy_ulonglong  ulong_t             # <<<<<<<<<<<<<<
826  * ctypedef npy_ulonglong  ulonglong_t
827  * 
828  */
829 typedef npy_ulonglong __pyx_t_5numpy_ulong_t;
830
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             # <<<<<<<<<<<<<<
835  * 
836  * ctypedef npy_intp       intp_t
837  */
838 typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t;
839
840 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":757
841  * ctypedef npy_ulonglong  ulonglong_t
842  * 
843  * ctypedef npy_intp       intp_t             # <<<<<<<<<<<<<<
844  * ctypedef npy_uintp      uintp_t
845  * 
846  */
847 typedef npy_intp __pyx_t_5numpy_intp_t;
848
849 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":758
850  * 
851  * ctypedef npy_intp       intp_t
852  * ctypedef npy_uintp      uintp_t             # <<<<<<<<<<<<<<
853  * 
854  * ctypedef npy_double     float_t
855  */
856 typedef npy_uintp __pyx_t_5numpy_uintp_t;
857
858 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":760
859  * ctypedef npy_uintp      uintp_t
860  * 
861  * ctypedef npy_double     float_t             # <<<<<<<<<<<<<<
862  * ctypedef npy_double     double_t
863  * ctypedef npy_longdouble longdouble_t
864  */
865 typedef npy_double __pyx_t_5numpy_float_t;
866
867 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":761
868  * 
869  * ctypedef npy_double     float_t
870  * ctypedef npy_double     double_t             # <<<<<<<<<<<<<<
871  * ctypedef npy_longdouble longdouble_t
872  * 
873  */
874 typedef npy_double __pyx_t_5numpy_double_t;
875
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             # <<<<<<<<<<<<<<
880  * 
881  * ctypedef npy_cfloat      cfloat_t
882  */
883 typedef npy_longdouble __pyx_t_5numpy_longdouble_t;
884 /* Declarations.proto */
885 #if CYTHON_CCOMPLEX
886   #ifdef __cplusplus
887     typedef ::std::complex< float > __pyx_t_float_complex;
888   #else
889     typedef float _Complex __pyx_t_float_complex;
890   #endif
891 #else
892     typedef struct { float real, imag; } __pyx_t_float_complex;
893 #endif
894 static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float, float);
895
896 /* Declarations.proto */
897 #if CYTHON_CCOMPLEX
898   #ifdef __cplusplus
899     typedef ::std::complex< double > __pyx_t_double_complex;
900   #else
901     typedef double _Complex __pyx_t_double_complex;
902   #endif
903 #else
904     typedef struct { double real, imag; } __pyx_t_double_complex;
905 #endif
906 static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double, double);
907
908
909 /*--- Type declarations ---*/
910 struct __pyx_obj_11pycocotools_5_mask_RLEs;
911 struct __pyx_obj_11pycocotools_5_mask_Masks;
912
913 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":764
914  * ctypedef npy_longdouble longdouble_t
915  * 
916  * ctypedef npy_cfloat      cfloat_t             # <<<<<<<<<<<<<<
917  * ctypedef npy_cdouble     cdouble_t
918  * ctypedef npy_clongdouble clongdouble_t
919  */
920 typedef npy_cfloat __pyx_t_5numpy_cfloat_t;
921
922 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":765
923  * 
924  * ctypedef npy_cfloat      cfloat_t
925  * ctypedef npy_cdouble     cdouble_t             # <<<<<<<<<<<<<<
926  * ctypedef npy_clongdouble clongdouble_t
927  * 
928  */
929 typedef npy_cdouble __pyx_t_5numpy_cdouble_t;
930
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             # <<<<<<<<<<<<<<
935  * 
936  * ctypedef npy_cdouble     complex_t
937  */
938 typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t;
939
940 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":768
941  * ctypedef npy_clongdouble clongdouble_t
942  * 
943  * ctypedef npy_cdouble     complex_t             # <<<<<<<<<<<<<<
944  * 
945  * cdef inline object PyArray_MultiIterNew1(a):
946  */
947 typedef npy_cdouble __pyx_t_5numpy_complex_t;
948
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:             # <<<<<<<<<<<<<<
953  *     cdef RLE *_R
954  *     cdef siz _n
955  */
956 struct __pyx_obj_11pycocotools_5_mask_RLEs {
957   PyObject_HEAD
958   RLE *_R;
959   siz _n;
960 };
961
962
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:             # <<<<<<<<<<<<<<
967  *     cdef byte *_mask
968  *     cdef siz _h
969  */
970 struct __pyx_obj_11pycocotools_5_mask_Masks {
971   PyObject_HEAD
972   byte *_mask;
973   siz _h;
974   siz _w;
975   siz _n;
976 };
977
978
979 /* --- Runtime support code (head) --- */
980 /* Refnanny.proto */
981 #ifndef CYTHON_REFNANNY
982   #define CYTHON_REFNANNY 0
983 #endif
984 #if CYTHON_REFNANNY
985   typedef struct {
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;
996 #ifdef WITH_THREAD
997   #define __Pyx_RefNannySetupContext(name, acquire_gil)\
998           if (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);\
1002           } else {\
1003               __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
1004           }
1005 #else
1006   #define __Pyx_RefNannySetupContext(name, acquire_gil)\
1007           __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
1008 #endif
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)
1019 #else
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)
1031 #endif
1032 #define __Pyx_XDECREF_SET(r, v) do {\
1033         PyObject *tmp = (PyObject *) r;\
1034         r = v; __Pyx_XDECREF(tmp);\
1035     } while (0)
1036 #define __Pyx_DECREF_SET(r, v) do {\
1037         PyObject *tmp = (PyObject *) r;\
1038         r = v; __Pyx_DECREF(tmp);\
1039     } while (0)
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)
1042
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));
1052 #endif
1053     return PyObject_GetAttr(obj, attr_name);
1054 }
1055 #else
1056 #define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
1057 #endif
1058
1059 /* GetBuiltinName.proto */
1060 static PyObject *__Pyx_GetBuiltinName(PyObject *name);
1061
1062 /* RaiseDoubleKeywords.proto */
1063 static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name);
1064
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);
1069
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);
1073
1074 /* IncludeStringH.proto */
1075 #include <string.h>
1076
1077 /* BytesEquals.proto */
1078 static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals);
1079
1080 /* UnicodeEquals.proto */
1081 static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals);
1082
1083 /* StrEquals.proto */
1084 #if PY_MAJOR_VERSION >= 3
1085 #define __Pyx_PyString_Equals __Pyx_PyUnicode_Equals
1086 #else
1087 #define __Pyx_PyString_Equals __Pyx_PyBytes_Equals
1088 #endif
1089
1090 /* PyObjectCall.proto */
1091 #if CYTHON_COMPILING_IN_CPYTHON
1092 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw);
1093 #else
1094 #define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw)
1095 #endif
1096
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();
1101 #else
1102 #define __Pyx_PyThreadState_declare
1103 #define __Pyx_PyThreadState_assign
1104 #endif
1105
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);
1114 #else
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)
1119 #endif
1120
1121 /* RaiseException.proto */
1122 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause);
1123
1124 /* ExtTypeTest.proto */
1125 static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type);
1126
1127 /* ArgTypeTest.proto */
1128 static CYTHON_INLINE int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed,
1129     const char *name, int exact);
1130
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))) {
1137         Py_INCREF(x);
1138         PyList_SET_ITEM(list, len, x);
1139         Py_SIZE(list) = len+1;
1140         return 0;
1141     }
1142     return PyList_Append(list, x);
1143 }
1144 #else
1145 #define __Pyx_PyList_Append(L,x) PyList_Append(L,x)
1146 #endif
1147
1148 /* PyIntBinop.proto */
1149 #if !CYTHON_COMPILING_IN_PYPY
1150 static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, long intval, int inplace);
1151 #else
1152 #define __Pyx_PyInt_AddObjC(op1, op2, intval, inplace)\
1153     (inplace ? PyNumber_InPlaceAdd(op1, op2) : PyNumber_Add(op1, op2))
1154 #endif
1155
1156 /* PyIntBinop.proto */
1157 #if !CYTHON_COMPILING_IN_PYPY
1158 static PyObject* __Pyx_PyInt_EqObjC(PyObject *op1, PyObject *op2, long intval, int inplace);
1159 #else
1160 #define __Pyx_PyInt_EqObjC(op1, op2, intval, inplace)\
1161     PyObject_RichCompare(op1, op2, Py_EQ)
1162     #endif
1163
1164 /* GetModuleGlobalName.proto */
1165 static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name);
1166
1167 /* PyCFunctionFastCall.proto */
1168 #if CYTHON_FAST_PYCCALL
1169 static CYTHON_INLINE PyObject *__Pyx_PyCFunction_FastCall(PyObject *func, PyObject **args, Py_ssize_t nargs);
1170 #else
1171 #define __Pyx_PyCFunction_FastCall(func, args, nargs)  (assert(0), NULL)
1172 #endif
1173
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);
1180 #else
1181 #define __Pyx_PyFunction_FastCallDict(func, args, nargs, kwargs) _PyFunction_FastCallDict(func, args, nargs, kwargs)
1182 #endif
1183 #endif
1184
1185 /* PyObjectCallMethO.proto */
1186 #if CYTHON_COMPILING_IN_CPYTHON
1187 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg);
1188 #endif
1189
1190 /* PyObjectCallOneArg.proto */
1191 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg);
1192
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);
1214
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
1223
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)) {
1230         Py_INCREF(x);
1231         PyList_SET_ITEM(list, len, x);
1232         Py_SIZE(list) = len+1;
1233         return 0;
1234     }
1235     return PyList_Append(list, x);
1236 }
1237 #else
1238 #define __Pyx_ListComp_Append(L,x) PyList_Append(L,x)
1239 #endif
1240
1241 /* FetchCommonType.proto */
1242 static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type);
1243
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)
1258 typedef struct {
1259     PyCFunctionObject func;
1260 #if PY_VERSION_HEX < 0x030500A0
1261     PyObject *func_weakreflist;
1262 #endif
1263     PyObject *func_dict;
1264     PyObject *func_name;
1265     PyObject *func_qualname;
1266     PyObject *func_doc;
1267     PyObject *func_globals;
1268     PyObject *func_code;
1269     PyObject *func_closure;
1270     PyObject *func_classobj;
1271     void *defaults;
1272     int defaults_pyobjects;
1273     int flags;
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,
1284                                       PyObject *self,
1285                                       PyObject *module, PyObject *globals,
1286                                       PyObject* code);
1287 static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *m,
1288                                                          size_t size,
1289                                                          int pyobjects);
1290 static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *m,
1291                                                             PyObject *tuple);
1292 static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *m,
1293                                                              PyObject *dict);
1294 static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *m,
1295                                                               PyObject *dict);
1296 static int __pyx_CyFunction_init(void);
1297
1298 /* BufferFallbackError.proto */
1299 static void __Pyx_RaiseBufferFallbackError(void);
1300
1301 /* None.proto */
1302 static CYTHON_INLINE Py_ssize_t __Pyx_div_Py_ssize_t(Py_ssize_t, Py_ssize_t);
1303
1304 /* BufferIndexError.proto */
1305 static void __Pyx_RaiseBufferIndexError(int axis);
1306
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));
1312 }
1313
1314 /* DictGetItem.proto */
1315 #if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY
1316 static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) {
1317     PyObject *value;
1318     value = PyDict_GetItemWithError(d, key);
1319     if (unlikely(!value)) {
1320         if (!PyErr_Occurred()) {
1321             PyObject* args = PyTuple_Pack(1, key);
1322             if (likely(args))
1323                 PyErr_SetObject(PyExc_KeyError, args);
1324             Py_XDECREF(args);
1325         }
1326         return NULL;
1327     }
1328     Py_INCREF(value);
1329     return value;
1330 }
1331 #else
1332     #define __Pyx_PyDict_GetItem(d, key) PyObject_GetItem(d, key)
1333 #endif
1334
1335 /* RaiseTooManyValuesToUnpack.proto */
1336 static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);
1337
1338 /* RaiseNeedMoreValuesToUnpack.proto */
1339 static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);
1340
1341 /* RaiseNoneIterError.proto */
1342 static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void);
1343
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);
1350 #else
1351 #define __Pyx_ExceptionSave(type, value, tb)   PyErr_GetExcInfo(type, value, tb)
1352 #define __Pyx_ExceptionReset(type, value, tb)  PyErr_SetExcInfo(type, value, tb)
1353 #endif
1354
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);
1359 #else
1360 #define __Pyx_PyErr_ExceptionMatches(err)  PyErr_ExceptionMatches(err)
1361 #endif
1362
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);
1367 #else
1368 static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb);
1369 #endif
1370
1371 /* Import.proto */
1372 static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level);
1373
1374 /* CodeObjectCache.proto */
1375 typedef struct {
1376     PyCodeObject* code_object;
1377     int code_line;
1378 } __Pyx_CodeObjectCacheEntry;
1379 struct __Pyx_CodeObjectCache {
1380     int count;
1381     int max_count;
1382     __Pyx_CodeObjectCacheEntry* entries;
1383 };
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);
1388
1389 /* AddTraceback.proto */
1390 static void __Pyx_AddTraceback(const char *funcname, int c_line,
1391                                int py_line, const char *filename);
1392
1393 /* BufferStructDeclare.proto */
1394 typedef struct {
1395   Py_ssize_t shape, strides, suboffsets;
1396 } __Pyx_Buf_DimInfo;
1397 typedef struct {
1398   size_t refcount;
1399   Py_buffer pybuffer;
1400 } __Pyx_Buffer;
1401 typedef struct {
1402   __Pyx_Buffer *rcbuffer;
1403   char *data;
1404   __Pyx_Buf_DimInfo diminfo[8];
1405 } __Pyx_LocalBuf_ND;
1406
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);
1410 #else
1411     #define __Pyx_GetBuffer PyObject_GetBuffer
1412     #define __Pyx_ReleaseBuffer PyBuffer_Release
1413 #endif
1414
1415
1416 /* None.proto */
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};
1419
1420 /* CIntToPy.proto */
1421 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value);
1422
1423 /* CIntToPy.proto */
1424 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_siz(siz value);
1425
1426 /* CIntToPy.proto */
1427 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_Py_intptr_t(Py_intptr_t value);
1428
1429 /* RealImag.proto */
1430 #if CYTHON_CCOMPLEX
1431   #ifdef __cplusplus
1432     #define __Pyx_CREAL(z) ((z).real())
1433     #define __Pyx_CIMAG(z) ((z).imag())
1434   #else
1435     #define __Pyx_CREAL(z) (__real__(z))
1436     #define __Pyx_CIMAG(z) (__imag__(z))
1437   #endif
1438 #else
1439     #define __Pyx_CREAL(z) ((z).real)
1440     #define __Pyx_CIMAG(z) ((z).imag)
1441 #endif
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))
1446 #else
1447     #define __Pyx_SET_CREAL(z,x) __Pyx_CREAL(z) = (x)
1448     #define __Pyx_SET_CIMAG(z,y) __Pyx_CIMAG(z) = (y)
1449 #endif
1450
1451 /* Arithmetic.proto */
1452 #if CYTHON_CCOMPLEX
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))
1459   #ifdef __cplusplus
1460     #define __Pyx_c_is_zero_float(z) ((z)==(float)0)
1461     #define __Pyx_c_conj_float(z)    (::std::conj(z))
1462     #if 1
1463         #define __Pyx_c_abs_float(z)     (::std::abs(z))
1464         #define __Pyx_c_pow_float(a, b)  (::std::pow(a, b))
1465     #endif
1466   #else
1467     #define __Pyx_c_is_zero_float(z) ((z)==0)
1468     #define __Pyx_c_conj_float(z)    (conjf(z))
1469     #if 1
1470         #define __Pyx_c_abs_float(z)     (cabsf(z))
1471         #define __Pyx_c_pow_float(a, b)  (cpowf(a, b))
1472     #endif
1473  #endif
1474 #else
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);
1483     #if 1
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);
1486     #endif
1487 #endif
1488
1489 /* Arithmetic.proto */
1490 #if CYTHON_CCOMPLEX
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))
1497   #ifdef __cplusplus
1498     #define __Pyx_c_is_zero_double(z) ((z)==(double)0)
1499     #define __Pyx_c_conj_double(z)    (::std::conj(z))
1500     #if 1
1501         #define __Pyx_c_abs_double(z)     (::std::abs(z))
1502         #define __Pyx_c_pow_double(a, b)  (::std::pow(a, b))
1503     #endif
1504   #else
1505     #define __Pyx_c_is_zero_double(z) ((z)==0)
1506     #define __Pyx_c_conj_double(z)    (conj(z))
1507     #if 1
1508         #define __Pyx_c_abs_double(z)     (cabs(z))
1509         #define __Pyx_c_pow_double(a, b)  (cpow(a, b))
1510     #endif
1511  #endif
1512 #else
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);
1521     #if 1
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);
1524     #endif
1525 #endif
1526
1527 /* CIntToPy.proto */
1528 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value);
1529
1530 /* CIntToPy.proto */
1531 static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum__NPY_TYPES(enum NPY_TYPES value);
1532
1533 /* CIntFromPy.proto */
1534 static CYTHON_INLINE siz __Pyx_PyInt_As_siz(PyObject *);
1535
1536 /* CIntFromPy.proto */
1537 static CYTHON_INLINE size_t __Pyx_PyInt_As_size_t(PyObject *);
1538
1539 /* CIntFromPy.proto */
1540 static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *);
1541
1542 /* CIntFromPy.proto */
1543 static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *);
1544
1545 /* CheckBinaryVersion.proto */
1546 static int __Pyx_check_binary_version(void);
1547
1548 /* PyIdentifierFromString.proto */
1549 #if !defined(__Pyx_PyIdentifier_FromString)
1550 #if PY_MAJOR_VERSION < 3
1551   #define __Pyx_PyIdentifier_FromString(s) PyString_FromString(s)
1552 #else
1553   #define __Pyx_PyIdentifier_FromString(s) PyUnicode_FromString(s)
1554 #endif
1555 #endif
1556
1557 /* ModuleImport.proto */
1558 static PyObject *__Pyx_ImportModule(const char *name);
1559
1560 /* TypeImport.proto */
1561 static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict);
1562
1563 /* InitStrings.proto */
1564 static int __Pyx_InitStrings(__Pyx_StringTabEntry *t);
1565
1566
1567 /* Module declarations from 'cpython.buffer' */
1568
1569 /* Module declarations from 'libc.string' */
1570
1571 /* Module declarations from 'libc.stdio' */
1572
1573 /* Module declarations from '__builtin__' */
1574
1575 /* Module declarations from 'cpython.type' */
1576 static PyTypeObject *__pyx_ptype_7cpython_4type_type = 0;
1577
1578 /* Module declarations from 'cpython' */
1579
1580 /* Module declarations from 'cpython.object' */
1581
1582 /* Module declarations from 'cpython.ref' */
1583
1584 /* Module declarations from 'libc.stdlib' */
1585
1586 /* Module declarations from 'numpy' */
1587
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*/
1596
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;
1605
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;
1902
1903 /* "pycocotools/_mask.pyx":60
1904  *     cdef siz _n
1905  * 
1906  *     def __cinit__(self, siz n =0):             # <<<<<<<<<<<<<<
1907  *         rlesInit(&self._R, n)
1908  *         self._n = n
1909  */
1910
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) {
1914   siz __pyx_v_n;
1915   int __pyx_r;
1916   __Pyx_RefNannyDeclarations
1917   __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
1918   {
1919     static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_n,0};
1920     PyObject* values[1] = {0};
1921     if (unlikely(__pyx_kwds)) {
1922       Py_ssize_t kw_args;
1923       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
1924       switch (pos_args) {
1925         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
1926         case  0: break;
1927         default: goto __pyx_L5_argtuple_error;
1928       }
1929       kw_args = PyDict_Size(__pyx_kwds);
1930       switch (pos_args) {
1931         case  0:
1932         if (kw_args > 0) {
1933           PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_n);
1934           if (value) { values[0] = value; kw_args--; }
1935         }
1936       }
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)
1939       }
1940     } else {
1941       switch (PyTuple_GET_SIZE(__pyx_args)) {
1942         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
1943         case  0: break;
1944         default: goto __pyx_L5_argtuple_error;
1945       }
1946     }
1947     if (values[0]) {
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)
1949     } else {
1950       __pyx_v_n = ((siz)0);
1951     }
1952   }
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)
1956   __pyx_L3_error:;
1957   __Pyx_AddTraceback("pycocotools._mask.RLEs.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
1958   __Pyx_RefNannyFinishContext();
1959   return -1;
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);
1962
1963   /* function exit code */
1964   __Pyx_RefNannyFinishContext();
1965   return __pyx_r;
1966 }
1967
1968 static int __pyx_pf_11pycocotools_5_mask_4RLEs___cinit__(struct __pyx_obj_11pycocotools_5_mask_RLEs *__pyx_v_self, siz __pyx_v_n) {
1969   int __pyx_r;
1970   __Pyx_RefNannyDeclarations
1971   __Pyx_RefNannySetupContext("__cinit__", 0);
1972
1973   /* "pycocotools/_mask.pyx":61
1974  * 
1975  *     def __cinit__(self, siz n =0):
1976  *         rlesInit(&self._R, n)             # <<<<<<<<<<<<<<
1977  *         self._n = n
1978  * 
1979  */
1980   rlesInit((&__pyx_v_self->_R), __pyx_v_n);
1981
1982   /* "pycocotools/_mask.pyx":62
1983  *     def __cinit__(self, siz n =0):
1984  *         rlesInit(&self._R, n)
1985  *         self._n = n             # <<<<<<<<<<<<<<
1986  * 
1987  *     # free the RLE array here
1988  */
1989   __pyx_v_self->_n = __pyx_v_n;
1990
1991   /* "pycocotools/_mask.pyx":60
1992  *     cdef siz _n
1993  * 
1994  *     def __cinit__(self, siz n =0):             # <<<<<<<<<<<<<<
1995  *         rlesInit(&self._R, n)
1996  *         self._n = n
1997  */
1998
1999   /* function exit code */
2000   __pyx_r = 0;
2001   __Pyx_RefNannyFinishContext();
2002   return __pyx_r;
2003 }
2004
2005 /* "pycocotools/_mask.pyx":65
2006  * 
2007  *     # free the RLE array here
2008  *     def __dealloc__(self):             # <<<<<<<<<<<<<<
2009  *         if self._R is not NULL:
2010  *             for i in range(self._n):
2011  */
2012
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));
2019
2020   /* function exit code */
2021   __Pyx_RefNannyFinishContext();
2022 }
2023
2024 static void __pyx_pf_11pycocotools_5_mask_4RLEs_2__dealloc__(struct __pyx_obj_11pycocotools_5_mask_RLEs *__pyx_v_self) {
2025   siz __pyx_v_i;
2026   __Pyx_RefNannyDeclarations
2027   int __pyx_t_1;
2028   siz __pyx_t_2;
2029   siz __pyx_t_3;
2030   __Pyx_RefNannySetupContext("__dealloc__", 0);
2031
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)
2038  */
2039   __pyx_t_1 = ((__pyx_v_self->_R != NULL) != 0);
2040   if (__pyx_t_1) {
2041
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)
2047  *             free(self._R)
2048  */
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;
2052
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)             # <<<<<<<<<<<<<<
2057  *             free(self._R)
2058  *     def __getattr__(self, key):
2059  */
2060       free((__pyx_v_self->_R[__pyx_v_i]).cnts);
2061     }
2062
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):
2068  *         if key == 'n':
2069  */
2070     free(__pyx_v_self->_R);
2071
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)
2078  */
2079   }
2080
2081   /* "pycocotools/_mask.pyx":65
2082  * 
2083  *     # free the RLE array here
2084  *     def __dealloc__(self):             # <<<<<<<<<<<<<<
2085  *         if self._R is not NULL:
2086  *             for i in range(self._n):
2087  */
2088
2089   /* function exit code */
2090   __Pyx_RefNannyFinishContext();
2091 }
2092
2093 /* "pycocotools/_mask.pyx":70
2094  *                 free(self._R[i].cnts)
2095  *             free(self._R)
2096  *     def __getattr__(self, key):             # <<<<<<<<<<<<<<
2097  *         if key == 'n':
2098  *             return self._n
2099  */
2100
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));
2108
2109   /* function exit code */
2110   __Pyx_RefNannyFinishContext();
2111   return __pyx_r;
2112 }
2113
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
2117   int __pyx_t_1;
2118   PyObject *__pyx_t_2 = NULL;
2119   PyObject *__pyx_t_3 = NULL;
2120   __Pyx_RefNannySetupContext("__getattr__", 0);
2121
2122   /* "pycocotools/_mask.pyx":71
2123  *             free(self._R)
2124  *     def __getattr__(self, key):
2125  *         if key == 'n':             # <<<<<<<<<<<<<<
2126  *             return self._n
2127  *         raise AttributeError(key)
2128  */
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)
2130   if (__pyx_t_1) {
2131
2132     /* "pycocotools/_mask.pyx":72
2133  *     def __getattr__(self, key):
2134  *         if key == 'n':
2135  *             return self._n             # <<<<<<<<<<<<<<
2136  *         raise AttributeError(key)
2137  * 
2138  */
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;
2143     __pyx_t_2 = 0;
2144     goto __pyx_L0;
2145
2146     /* "pycocotools/_mask.pyx":71
2147  *             free(self._R)
2148  *     def __getattr__(self, key):
2149  *         if key == 'n':             # <<<<<<<<<<<<<<
2150  *             return self._n
2151  *         raise AttributeError(key)
2152  */
2153   }
2154
2155   /* "pycocotools/_mask.pyx":73
2156  *         if key == 'n':
2157  *             return self._n
2158  *         raise AttributeError(key)             # <<<<<<<<<<<<<<
2159  * 
2160  * # python class to wrap Mask array in C
2161  */
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)
2173
2174   /* "pycocotools/_mask.pyx":70
2175  *                 free(self._R[i].cnts)
2176  *             free(self._R)
2177  *     def __getattr__(self, key):             # <<<<<<<<<<<<<<
2178  *         if key == 'n':
2179  *             return self._n
2180  */
2181
2182   /* function exit code */
2183   __pyx_L1_error:;
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);
2187   __pyx_r = NULL;
2188   __pyx_L0:;
2189   __Pyx_XGIVEREF(__pyx_r);
2190   __Pyx_RefNannyFinishContext();
2191   return __pyx_r;
2192 }
2193
2194 /* "pycocotools/_mask.pyx":83
2195  *     cdef siz _n
2196  * 
2197  *     def __cinit__(self, h, w, n):             # <<<<<<<<<<<<<<
2198  *         self._mask = <byte*> malloc(h*w*n* sizeof(byte))
2199  *         self._h = h
2200  */
2201
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;
2208   int __pyx_r;
2209   __Pyx_RefNannyDeclarations
2210   __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0);
2211   {
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)) {
2215       Py_ssize_t kw_args;
2216       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
2217       switch (pos_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);
2221         case  0: break;
2222         default: goto __pyx_L5_argtuple_error;
2223       }
2224       kw_args = PyDict_Size(__pyx_kwds);
2225       switch (pos_args) {
2226         case  0:
2227         if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_h)) != 0)) kw_args--;
2228         else goto __pyx_L5_argtuple_error;
2229         case  1:
2230         if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_w)) != 0)) kw_args--;
2231         else {
2232           __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 3, 3, 1); __PYX_ERR(0, 83, __pyx_L3_error)
2233         }
2234         case  2:
2235         if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_n)) != 0)) kw_args--;
2236         else {
2237           __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 3, 3, 2); __PYX_ERR(0, 83, __pyx_L3_error)
2238         }
2239       }
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)
2242       }
2243     } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
2244       goto __pyx_L5_argtuple_error;
2245     } else {
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);
2249     }
2250     __pyx_v_h = values[0];
2251     __pyx_v_w = values[1];
2252     __pyx_v_n = values[2];
2253   }
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)
2257   __pyx_L3_error:;
2258   __Pyx_AddTraceback("pycocotools._mask.Masks.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename);
2259   __Pyx_RefNannyFinishContext();
2260   return -1;
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);
2263
2264   /* function exit code */
2265   __Pyx_RefNannyFinishContext();
2266   return __pyx_r;
2267 }
2268
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) {
2270   int __pyx_r;
2271   __Pyx_RefNannyDeclarations
2272   PyObject *__pyx_t_1 = NULL;
2273   PyObject *__pyx_t_2 = NULL;
2274   PyObject *__pyx_t_3 = NULL;
2275   size_t __pyx_t_4;
2276   siz __pyx_t_5;
2277   __Pyx_RefNannySetupContext("__cinit__", 0);
2278
2279   /* "pycocotools/_mask.pyx":84
2280  * 
2281  *     def __cinit__(self, h, w, n):
2282  *         self._mask = <byte*> malloc(h*w*n* sizeof(byte))             # <<<<<<<<<<<<<<
2283  *         self._h = h
2284  *         self._w = w
2285  */
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));
2300
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             # <<<<<<<<<<<<<<
2305  *         self._w = w
2306  *         self._n = n
2307  */
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;
2310
2311   /* "pycocotools/_mask.pyx":86
2312  *         self._mask = <byte*> malloc(h*w*n* sizeof(byte))
2313  *         self._h = h
2314  *         self._w = w             # <<<<<<<<<<<<<<
2315  *         self._n = n
2316  *     # def __dealloc__(self):
2317  */
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;
2320
2321   /* "pycocotools/_mask.pyx":87
2322  *         self._h = h
2323  *         self._w = w
2324  *         self._n = n             # <<<<<<<<<<<<<<
2325  *     # def __dealloc__(self):
2326  *         # the memory management of _mask has been passed to np.ndarray
2327  */
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;
2330
2331   /* "pycocotools/_mask.pyx":83
2332  *     cdef siz _n
2333  * 
2334  *     def __cinit__(self, h, w, n):             # <<<<<<<<<<<<<<
2335  *         self._mask = <byte*> malloc(h*w*n* sizeof(byte))
2336  *         self._h = h
2337  */
2338
2339   /* function exit code */
2340   __pyx_r = 0;
2341   goto __pyx_L0;
2342   __pyx_L1_error:;
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);
2347   __pyx_r = -1;
2348   __pyx_L0:;
2349   __Pyx_RefNannyFinishContext();
2350   return __pyx_r;
2351 }
2352
2353 /* "pycocotools/_mask.pyx":93
2354  * 
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
2359  */
2360
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));
2368
2369   /* function exit code */
2370   __Pyx_RefNannyFinishContext();
2371   return __pyx_r;
2372 }
2373
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);
2385
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')
2392  */
2393   (__pyx_v_shape[0]) = ((((npy_intp)__pyx_v_self->_h) * __pyx_v_self->_w) * __pyx_v_self->_n);
2394
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)
2401  */
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);
2421   __pyx_t_1 = 0;
2422   __pyx_t_3 = 0;
2423   __pyx_t_4 = 0;
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);
2428   __pyx_t_5 = 0;
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;
2438   __pyx_t_3 = 0;
2439
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)             # <<<<<<<<<<<<<<
2444  *         return ndarray
2445  * 
2446  */
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);
2449
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             # <<<<<<<<<<<<<<
2454  * 
2455  * # internal conversion from Python RLEs object to compressed RLE format
2456  */
2457   __Pyx_XDECREF(__pyx_r);
2458   __Pyx_INCREF(__pyx_v_ndarray);
2459   __pyx_r = __pyx_v_ndarray;
2460   goto __pyx_L0;
2461
2462   /* "pycocotools/_mask.pyx":93
2463  * 
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
2468  */
2469
2470   /* function exit code */
2471   __pyx_L1_error:;
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);
2478   __pyx_r = NULL;
2479   __pyx_L0:;
2480   __Pyx_XDECREF(__pyx_v_ndarray);
2481   __Pyx_XGIVEREF(__pyx_r);
2482   __Pyx_RefNannyFinishContext();
2483   return __pyx_r;
2484 }
2485
2486 /* "pycocotools/_mask.pyx":103
2487  * 
2488  * # internal conversion from Python RLEs object to compressed RLE format
2489  * def _toString(RLEs Rs):             # <<<<<<<<<<<<<<
2490  *     cdef siz n = Rs.n
2491  *     cdef bytes py_string
2492  */
2493
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));
2503
2504   /* function exit code */
2505   goto __pyx_L0;
2506   __pyx_L1_error:;
2507   __pyx_r = NULL;
2508   __pyx_L0:;
2509   __Pyx_RefNannyFinishContext();
2510   return __pyx_r;
2511 }
2512
2513 static PyObject *__pyx_pf_11pycocotools_5_mask__toString(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_11pycocotools_5_mask_RLEs *__pyx_v_Rs) {
2514   siz __pyx_v_n;
2515   PyObject *__pyx_v_py_string = 0;
2516   char *__pyx_v_c_string;
2517   PyObject *__pyx_v_objs = NULL;
2518   siz __pyx_v_i;
2519   PyObject *__pyx_r = NULL;
2520   __Pyx_RefNannyDeclarations
2521   PyObject *__pyx_t_1 = NULL;
2522   siz __pyx_t_2;
2523   siz __pyx_t_3;
2524   PyObject *__pyx_t_4 = NULL;
2525   PyObject *__pyx_t_5 = NULL;
2526   PyObject *__pyx_t_6 = NULL;
2527   int __pyx_t_7;
2528   __Pyx_RefNannySetupContext("_toString", 0);
2529
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
2536  */
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;
2542
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] )
2549  */
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);
2553   __pyx_t_1 = 0;
2554
2555   /* "pycocotools/_mask.pyx":108
2556  *     cdef char* c_string
2557  *     objs = []
2558  *     for i in range(n):             # <<<<<<<<<<<<<<
2559  *         c_string = rleToString( <RLE*> &Rs._R[i] )
2560  *         py_string = c_string
2561  */
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;
2565
2566     /* "pycocotools/_mask.pyx":109
2567  *     objs = []
2568  *     for i in range(n):
2569  *         c_string = rleToString( <RLE*> &Rs._R[i] )             # <<<<<<<<<<<<<<
2570  *         py_string = c_string
2571  *         objs.append({
2572  */
2573     __pyx_v_c_string = rleToString(((RLE *)(&(__pyx_v_Rs->_R[__pyx_v_i]))));
2574
2575     /* "pycocotools/_mask.pyx":110
2576  *     for i in range(n):
2577  *         c_string = rleToString( <RLE*> &Rs._R[i] )
2578  *         py_string = c_string             # <<<<<<<<<<<<<<
2579  *         objs.append({
2580  *             'size': [Rs._R[i].h, Rs._R[i].w],
2581  */
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));
2585     __pyx_t_1 = 0;
2586
2587     /* "pycocotools/_mask.pyx":112
2588  *         py_string = c_string
2589  *         objs.append({
2590  *             'size': [Rs._R[i].h, Rs._R[i].w],             # <<<<<<<<<<<<<<
2591  *             'counts': py_string
2592  *         })
2593  */
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);
2606     __pyx_t_4 = 0;
2607     __pyx_t_5 = 0;
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;
2610
2611     /* "pycocotools/_mask.pyx":114
2612  *             'size': [Rs._R[i].h, Rs._R[i].w],
2613  *             'counts': py_string
2614  *         })             # <<<<<<<<<<<<<<
2615  *         free(c_string)
2616  *     return objs
2617  */
2618     if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_counts, __pyx_v_py_string) < 0) __PYX_ERR(0, 112, __pyx_L1_error)
2619
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
2626  */
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;
2629
2630     /* "pycocotools/_mask.pyx":115
2631  *             'counts': py_string
2632  *         })
2633  *         free(c_string)             # <<<<<<<<<<<<<<
2634  *     return objs
2635  * 
2636  */
2637     free(__pyx_v_c_string);
2638   }
2639
2640   /* "pycocotools/_mask.pyx":116
2641  *         })
2642  *         free(c_string)
2643  *     return objs             # <<<<<<<<<<<<<<
2644  * 
2645  * # internal conversion from compressed RLE format to Python RLEs object
2646  */
2647   __Pyx_XDECREF(__pyx_r);
2648   __Pyx_INCREF(__pyx_v_objs);
2649   __pyx_r = __pyx_v_objs;
2650   goto __pyx_L0;
2651
2652   /* "pycocotools/_mask.pyx":103
2653  * 
2654  * # internal conversion from Python RLEs object to compressed RLE format
2655  * def _toString(RLEs Rs):             # <<<<<<<<<<<<<<
2656  *     cdef siz n = Rs.n
2657  *     cdef bytes py_string
2658  */
2659
2660   /* function exit code */
2661   __pyx_L1_error:;
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);
2667   __pyx_r = NULL;
2668   __pyx_L0:;
2669   __Pyx_XDECREF(__pyx_v_py_string);
2670   __Pyx_XDECREF(__pyx_v_objs);
2671   __Pyx_XGIVEREF(__pyx_r);
2672   __Pyx_RefNannyFinishContext();
2673   return __pyx_r;
2674 }
2675
2676 /* "pycocotools/_mask.pyx":119
2677  * 
2678  * # internal conversion from compressed RLE format to Python RLEs object
2679  * def _frString(rleObjs):             # <<<<<<<<<<<<<<
2680  *     cdef siz n = len(rleObjs)
2681  *     Rs = RLEs(n)
2682  */
2683
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));
2692
2693   /* function exit code */
2694   __Pyx_RefNannyFinishContext();
2695   return __pyx_r;
2696 }
2697
2698 static PyObject *__pyx_pf_11pycocotools_5_mask_2_frString(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_rleObjs) {
2699   siz __pyx_v_n;
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;
2713   int __pyx_t_7;
2714   PyObject *__pyx_t_8 = NULL;
2715   PyObject *__pyx_t_9 = NULL;
2716   PyObject *__pyx_t_10 = NULL;
2717   PyObject *__pyx_t_11 = NULL;
2718   char *__pyx_t_12;
2719   Py_ssize_t __pyx_t_13;
2720   siz __pyx_t_14;
2721   siz __pyx_t_15;
2722   __Pyx_RefNannySetupContext("_frString", 0);
2723
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)             # <<<<<<<<<<<<<<
2728  *     Rs = RLEs(n)
2729  *     cdef bytes py_string
2730  */
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;
2733
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
2740  */
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);
2747   __pyx_t_2 = 0;
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);
2752   __pyx_t_2 = 0;
2753
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')
2760  */
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;
2765     __pyx_t_4 = NULL;
2766   } else {
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)
2770   }
2771   for (;;) {
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)
2777         #else
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);
2780         #endif
2781       } else {
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)
2785         #else
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);
2788         #endif
2789       }
2790     } else {
2791       __pyx_t_5 = __pyx_t_4(__pyx_t_3);
2792       if (unlikely(!__pyx_t_5)) {
2793         PyObject* exc_type = PyErr_Occurred();
2794         if (exc_type) {
2795           if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
2796           else __PYX_ERR(0, 124, __pyx_L1_error)
2797         }
2798         break;
2799       }
2800       __Pyx_GOTREF(__pyx_t_5);
2801     }
2802     __Pyx_XDECREF_SET(__pyx_v_obj, __pyx_t_5);
2803     __pyx_t_5 = 0;
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;
2810     __pyx_t_5 = 0;
2811
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:
2818  */
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;
2826     if (__pyx_t_7) {
2827
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']
2834  */
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);
2841       __pyx_t_6 = 0;
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));
2853       __pyx_t_6 = 0;
2854
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:
2861  */
2862       goto __pyx_L5;
2863     }
2864
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']
2870  *         else:
2871  */
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;
2879     if (__pyx_t_7) {
2880
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']             # <<<<<<<<<<<<<<
2885  *         else:
2886  *             raise Exception('Python version must be 2 or 3')
2887  */
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;
2894       if (__pyx_t_7) {
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);
2899         __pyx_t_10 = NULL;
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);
2907           }
2908         }
2909         if (!__pyx_t_10) {
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);
2913         } else {
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;
2921           } else
2922           #endif
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;
2930           } else
2931           #endif
2932           {
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);
2938             __pyx_t_9 = 0;
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;
2942           }
2943         }
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;
2947         __pyx_t_8 = 0;
2948       } else {
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;
2953         __pyx_t_8 = 0;
2954       }
2955       __Pyx_XDECREF_SET(__pyx_v_py_string, ((PyObject*)__pyx_t_5));
2956       __pyx_t_5 = 0;
2957
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']
2963  *         else:
2964  */
2965       goto __pyx_L5;
2966     }
2967
2968     /* "pycocotools/_mask.pyx":130
2969  *             py_string = str.encode(obj['counts']) if type(obj['counts']) == str else obj['counts']
2970  *         else:
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] )
2974  */
2975     /*else*/ {
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)
2981     }
2982     __pyx_L5:;
2983
2984     /* "pycocotools/_mask.pyx":131
2985  *         else:
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] )
2989  *     return Rs
2990  */
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;
2993
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] )             # <<<<<<<<<<<<<<
2998  *     return Rs
2999  * 
3000  */
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);
3017
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')
3024  */
3025   }
3026   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
3027   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3028
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             # <<<<<<<<<<<<<<
3033  * 
3034  * # encode mask to RLEs objects
3035  */
3036   __Pyx_XDECREF(__pyx_r);
3037   __Pyx_INCREF(((PyObject *)__pyx_v_Rs));
3038   __pyx_r = ((PyObject *)__pyx_v_Rs);
3039   goto __pyx_L0;
3040
3041   /* "pycocotools/_mask.pyx":119
3042  * 
3043  * # internal conversion from compressed RLE format to Python RLEs object
3044  * def _frString(rleObjs):             # <<<<<<<<<<<<<<
3045  *     cdef siz n = len(rleObjs)
3046  *     Rs = RLEs(n)
3047  */
3048
3049   /* function exit code */
3050   __pyx_L1_error:;
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);
3060   __pyx_r = NULL;
3061   __pyx_L0:;
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();
3068   return __pyx_r;
3069 }
3070
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)
3077  */
3078
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));
3088
3089   /* function exit code */
3090   goto __pyx_L0;
3091   __pyx_L1_error:;
3092   __pyx_r = NULL;
3093   __pyx_L0:;
3094   __Pyx_RefNannyFinishContext();
3095   return __pyx_r;
3096 }
3097
3098 static PyObject *__pyx_pf_11pycocotools_5_mask_4encode(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_mask) {
3099   npy_intp __pyx_v_h;
3100   npy_intp __pyx_v_w;
3101   npy_intp __pyx_v_n;
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
3108   npy_intp __pyx_t_1;
3109   npy_intp __pyx_t_2;
3110   npy_intp __pyx_t_3;
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;
3120   {
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)
3123   }
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];
3125
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)
3132  */
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;
3139
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)
3146  */
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);
3153   __pyx_t_4 = 0;
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);
3158   __pyx_t_4 = 0;
3159
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)
3165  *     return objs
3166  */
3167   rleEncode(__pyx_v_Rs->_R, ((byte *)__pyx_v_mask->data), __pyx_v_h, __pyx_v_w, __pyx_v_n);
3168
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)             # <<<<<<<<<<<<<<
3173  *     return objs
3174  * 
3175  */
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);
3178   __pyx_t_6 = NULL;
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);
3186     }
3187   }
3188   if (!__pyx_t_6) {
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);
3191   } else {
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);
3198     } else
3199     #endif
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);
3206     } else
3207     #endif
3208     {
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;
3218     }
3219   }
3220   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
3221   __pyx_v_objs = __pyx_t_4;
3222   __pyx_t_4 = 0;
3223
3224   /* "pycocotools/_mask.pyx":142
3225  *     rleEncode(Rs._R,<byte*>mask.data,h,w,n)
3226  *     objs = _toString(Rs)
3227  *     return objs             # <<<<<<<<<<<<<<
3228  * 
3229  * # decode mask from compressed list of RLE string or RLEs object
3230  */
3231   __Pyx_XDECREF(__pyx_r);
3232   __Pyx_INCREF(__pyx_v_objs);
3233   __pyx_r = __pyx_v_objs;
3234   goto __pyx_L0;
3235
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)
3242  */
3243
3244   /* function exit code */
3245   __pyx_L1_error:;
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);
3257   __pyx_r = NULL;
3258   goto __pyx_L2;
3259   __pyx_L0:;
3260   __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_mask.rcbuffer->pybuffer);
3261   __pyx_L2:;
3262   __Pyx_XDECREF((PyObject *)__pyx_v_Rs);
3263   __Pyx_XDECREF(__pyx_v_objs);
3264   __Pyx_XGIVEREF(__pyx_r);
3265   __Pyx_RefNannyFinishContext();
3266   return __pyx_r;
3267 }
3268
3269 /* "pycocotools/_mask.pyx":145
3270  * 
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
3275  */
3276
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));
3285
3286   /* function exit code */
3287   __Pyx_RefNannyFinishContext();
3288   return __pyx_r;
3289 }
3290
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;
3293   siz __pyx_v_h;
3294   siz __pyx_v_w;
3295   siz __pyx_v_n;
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;
3303   siz __pyx_t_5;
3304   siz __pyx_t_6;
3305   siz __pyx_t_7;
3306   __Pyx_RefNannySetupContext("decode", 0);
3307
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)
3314  */
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);
3317   __pyx_t_3 = NULL;
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);
3325     }
3326   }
3327   if (!__pyx_t_3) {
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);
3330   } else {
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);
3337     } else
3338     #endif
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);
3345     } else
3346     #endif
3347     {
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;
3357     }
3358   }
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);
3362   __pyx_t_1 = 0;
3363
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);
3370  */
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;
3377
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)
3384  */
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);
3399   __pyx_t_1 = 0;
3400   __pyx_t_2 = 0;
3401   __pyx_t_4 = 0;
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);
3406   __pyx_t_4 = 0;
3407
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)
3413  * 
3414  */
3415   rleDecode(((RLE *)__pyx_v_Rs->_R), __pyx_v_masks->_mask, __pyx_v_n);
3416
3417   /* "pycocotools/_mask.pyx":150
3418  *     masks = Masks(h, w, n)
3419  *     rleDecode(<RLE*>Rs._R, masks._mask, n);
3420  *     return np.array(masks)             # <<<<<<<<<<<<<<
3421  * 
3422  * def merge(rleObjs, intersect=0):
3423  */
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;
3430   __pyx_t_3 = NULL;
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);
3438     }
3439   }
3440   if (!__pyx_t_3) {
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);
3443   } else {
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);
3450     } else
3451     #endif
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);
3458     } else
3459     #endif
3460     {
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;
3470     }
3471   }
3472   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
3473   __pyx_r = __pyx_t_4;
3474   __pyx_t_4 = 0;
3475   goto __pyx_L0;
3476
3477   /* "pycocotools/_mask.pyx":145
3478  * 
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
3483  */
3484
3485   /* function exit code */
3486   __pyx_L1_error:;
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);
3492   __pyx_r = NULL;
3493   __pyx_L0:;
3494   __Pyx_XDECREF((PyObject *)__pyx_v_Rs);
3495   __Pyx_XDECREF((PyObject *)__pyx_v_masks);
3496   __Pyx_XGIVEREF(__pyx_r);
3497   __Pyx_RefNannyFinishContext();
3498   return __pyx_r;
3499 }
3500
3501 /* "pycocotools/_mask.pyx":152
3502  *     return np.array(masks)
3503  * 
3504  * def merge(rleObjs, intersect=0):             # <<<<<<<<<<<<<<
3505  *     cdef RLEs Rs = _frString(rleObjs)
3506  *     cdef RLEs R = RLEs(1)
3507  */
3508
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);
3518   {
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)) {
3523       Py_ssize_t kw_args;
3524       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
3525       switch (pos_args) {
3526         case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
3527         case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
3528         case  0: break;
3529         default: goto __pyx_L5_argtuple_error;
3530       }
3531       kw_args = PyDict_Size(__pyx_kwds);
3532       switch (pos_args) {
3533         case  0:
3534         if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_rleObjs)) != 0)) kw_args--;
3535         else goto __pyx_L5_argtuple_error;
3536         case  1:
3537         if (kw_args > 0) {
3538           PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_intersect);
3539           if (value) { values[1] = value; kw_args--; }
3540         }
3541       }
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)
3544       }
3545     } else {
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);
3549         break;
3550         default: goto __pyx_L5_argtuple_error;
3551       }
3552     }
3553     __pyx_v_rleObjs = values[0];
3554     __pyx_v_intersect = values[1];
3555   }
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)
3559   __pyx_L3_error:;
3560   __Pyx_AddTraceback("pycocotools._mask.merge", __pyx_clineno, __pyx_lineno, __pyx_filename);
3561   __Pyx_RefNannyFinishContext();
3562   return NULL;
3563   __pyx_L4_argument_unpacking_done:;
3564   __pyx_r = __pyx_pf_11pycocotools_5_mask_8merge(__pyx_self, __pyx_v_rleObjs, __pyx_v_intersect);
3565
3566   /* function exit code */
3567   __Pyx_RefNannyFinishContext();
3568   return __pyx_r;
3569 }
3570
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;
3581   int __pyx_t_5;
3582   __Pyx_RefNannySetupContext("merge", 0);
3583
3584   /* "pycocotools/_mask.pyx":153
3585  * 
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)
3590  */
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);
3593   __pyx_t_3 = NULL;
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);
3601     }
3602   }
3603   if (!__pyx_t_3) {
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);
3606   } else {
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);
3613     } else
3614     #endif
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);
3621     } else
3622     #endif
3623     {
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;
3633     }
3634   }
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);
3638   __pyx_t_1 = 0;
3639
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]
3646  */
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);
3650   __pyx_t_1 = 0;
3651
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]
3657  *     return obj
3658  */
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);
3661
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]             # <<<<<<<<<<<<<<
3666  *     return obj
3667  * 
3668  */
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);
3671   __pyx_t_4 = NULL;
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);
3679     }
3680   }
3681   if (!__pyx_t_4) {
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);
3684   } else {
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);
3691     } else
3692     #endif
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);
3699     } else
3700     #endif
3701     {
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;
3711     }
3712   }
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;
3718   __pyx_t_2 = 0;
3719
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             # <<<<<<<<<<<<<<
3724  * 
3725  * def area(rleObjs):
3726  */
3727   __Pyx_XDECREF(__pyx_r);
3728   __Pyx_INCREF(__pyx_v_obj);
3729   __pyx_r = __pyx_v_obj;
3730   goto __pyx_L0;
3731
3732   /* "pycocotools/_mask.pyx":152
3733  *     return np.array(masks)
3734  * 
3735  * def merge(rleObjs, intersect=0):             # <<<<<<<<<<<<<<
3736  *     cdef RLEs Rs = _frString(rleObjs)
3737  *     cdef RLEs R = RLEs(1)
3738  */
3739
3740   /* function exit code */
3741   __pyx_L1_error:;
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);
3747   __pyx_r = NULL;
3748   __pyx_L0:;
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();
3754   return __pyx_r;
3755 }
3756
3757 /* "pycocotools/_mask.pyx":159
3758  *     return obj
3759  * 
3760  * def area(rleObjs):             # <<<<<<<<<<<<<<
3761  *     cdef RLEs Rs = _frString(rleObjs)
3762  *     cdef uint* _a = <uint*> malloc(Rs._n* sizeof(uint))
3763  */
3764
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));
3773
3774   /* function exit code */
3775   __Pyx_RefNannyFinishContext();
3776   return __pyx_r;
3777 }
3778
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;
3781   uint *__pyx_v__a;
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);
3792
3793   /* "pycocotools/_mask.pyx":160
3794  * 
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)
3799  */
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);
3802   __pyx_t_3 = NULL;
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);
3810     }
3811   }
3812   if (!__pyx_t_3) {
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);
3815   } else {
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);
3822     } else
3823     #endif
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);
3830     } else
3831     #endif
3832     {
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;
3842     }
3843   }
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);
3847   __pyx_t_1 = 0;
3848
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]
3855  */
3856   __pyx_v__a = ((uint *)malloc((__pyx_v_Rs->_n * (sizeof(unsigned int)))));
3857
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
3864  */
3865   rleArea(__pyx_v_Rs->_R, __pyx_v_Rs->_n, __pyx_v__a);
3866
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)
3873  */
3874   (__pyx_v_shape[0]) = ((npy_intp)__pyx_v_Rs->_n);
3875
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)
3882  */
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);
3894   __pyx_t_1 = 0;
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);
3899   __pyx_t_4 = 0;
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;
3915   __pyx_t_5 = 0;
3916
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)
3922  *     return a
3923  */
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);
3927   __pyx_t_5 = 0;
3928
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)             # <<<<<<<<<<<<<<
3933  *     return a
3934  * 
3935  */
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);
3938
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             # <<<<<<<<<<<<<<
3943  * 
3944  * # iou computation. support function overload (RLEs-RLEs and bbox-bbox).
3945  */
3946   __Pyx_XDECREF(__pyx_r);
3947   __Pyx_INCREF(__pyx_v_a);
3948   __pyx_r = __pyx_v_a;
3949   goto __pyx_L0;
3950
3951   /* "pycocotools/_mask.pyx":159
3952  *     return obj
3953  * 
3954  * def area(rleObjs):             # <<<<<<<<<<<<<<
3955  *     cdef RLEs Rs = _frString(rleObjs)
3956  *     cdef uint* _a = <uint*> malloc(Rs._n* sizeof(uint))
3957  */
3958
3959   /* function exit code */
3960   __pyx_L1_error:;
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);
3967   __pyx_r = NULL;
3968   __pyx_L0:;
3969   __Pyx_XDECREF((PyObject *)__pyx_v_Rs);
3970   __Pyx_XDECREF(__pyx_v_a);
3971   __Pyx_XGIVEREF(__pyx_r);
3972   __Pyx_RefNannyFinishContext();
3973   return __pyx_r;
3974 }
3975
3976 /* "pycocotools/_mask.pyx":171
3977  * 
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:
3982  */
3983
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);
3994   {
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)) {
3998       Py_ssize_t kw_args;
3999       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
4000       switch (pos_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);
4004         case  0: break;
4005         default: goto __pyx_L5_argtuple_error;
4006       }
4007       kw_args = PyDict_Size(__pyx_kwds);
4008       switch (pos_args) {
4009         case  0:
4010         if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_dt)) != 0)) kw_args--;
4011         else goto __pyx_L5_argtuple_error;
4012         case  1:
4013         if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_gt)) != 0)) kw_args--;
4014         else {
4015           __Pyx_RaiseArgtupleInvalid("iou", 1, 3, 3, 1); __PYX_ERR(0, 171, __pyx_L3_error)
4016         }
4017         case  2:
4018         if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_pyiscrowd)) != 0)) kw_args--;
4019         else {
4020           __Pyx_RaiseArgtupleInvalid("iou", 1, 3, 3, 2); __PYX_ERR(0, 171, __pyx_L3_error)
4021         }
4022       }
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)
4025       }
4026     } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
4027       goto __pyx_L5_argtuple_error;
4028     } else {
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);
4032     }
4033     __pyx_v_dt = values[0];
4034     __pyx_v_gt = values[1];
4035     __pyx_v_pyiscrowd = values[2];
4036   }
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)
4040   __pyx_L3_error:;
4041   __Pyx_AddTraceback("pycocotools._mask.iou", __pyx_clineno, __pyx_lineno, __pyx_filename);
4042   __Pyx_RefNannyFinishContext();
4043   return NULL;
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);
4046
4047   /* function exit code */
4048   __Pyx_RefNannyFinishContext();
4049   return __pyx_r;
4050 }
4051
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:
4057  *             return objs
4058  */
4059
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));
4068
4069   /* function exit code */
4070   __Pyx_RefNannyFinishContext();
4071   return __pyx_r;
4072 }
4073
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;
4081   int __pyx_t_2;
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;
4087   int __pyx_t_8;
4088   int __pyx_t_9;
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);
4096
4097   /* "pycocotools/_mask.pyx":173
4098  * def iou( dt, gt, pyiscrowd ):
4099  *     def _preproc(objs):
4100  *         if len(objs) == 0:             # <<<<<<<<<<<<<<
4101  *             return objs
4102  *         if type(objs) == np.ndarray:
4103  */
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);
4106   if (__pyx_t_2) {
4107
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:
4114  */
4115     __Pyx_XDECREF(__pyx_r);
4116     __Pyx_INCREF(__pyx_v_objs);
4117     __pyx_r = __pyx_v_objs;
4118     goto __pyx_L0;
4119
4120     /* "pycocotools/_mask.pyx":173
4121  * def iou( dt, gt, pyiscrowd ):
4122  *     def _preproc(objs):
4123  *         if len(objs) == 0:             # <<<<<<<<<<<<<<
4124  *             return objs
4125  *         if type(objs) == np.ndarray:
4126  */
4127   }
4128
4129   /* "pycocotools/_mask.pyx":175
4130  *         if len(objs) == 0:
4131  *             return objs
4132  *         if type(objs) == np.ndarray:             # <<<<<<<<<<<<<<
4133  *             if len(objs.shape) == 1:
4134  *                 objs = objs.reshape((objs[0], 1))
4135  */
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;
4139   if (__pyx_t_2) {
4140
4141     /* "pycocotools/_mask.pyx":176
4142  *             return objs
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
4147  */
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);
4153     if (__pyx_t_2) {
4154
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:
4161  */
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);
4173       __pyx_t_5 = 0;
4174       __pyx_t_5 = NULL;
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);
4182         }
4183       }
4184       if (!__pyx_t_5) {
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);
4188       } else {
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;
4196         } else
4197         #endif
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;
4205         } else
4206         #endif
4207         {
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);
4213           __pyx_t_6 = 0;
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;
4217         }
4218       }
4219       __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4220       __Pyx_DECREF_SET(__pyx_v_objs, __pyx_t_3);
4221       __pyx_t_3 = 0;
4222
4223       /* "pycocotools/_mask.pyx":176
4224  *             return objs
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
4229  */
4230     }
4231
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)
4238  */
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);
4244     if (!__pyx_t_8) {
4245     } else {
4246       __pyx_t_2 = __pyx_t_8;
4247       goto __pyx_L7_bool_binop_done;
4248     }
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:;
4262     if (__pyx_t_2) {
4263
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:
4270  */
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)
4276
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)
4283  */
4284     }
4285
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
4292  */
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;
4300     __pyx_t_7 = NULL;
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);
4308       }
4309     }
4310     if (!__pyx_t_7) {
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);
4314     } else {
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;
4322       } else
4323       #endif
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;
4331       } else
4332       #endif
4333       {
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);
4339         __pyx_t_6 = 0;
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;
4343       }
4344     }
4345     __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
4346     __Pyx_DECREF_SET(__pyx_v_objs, __pyx_t_3);
4347     __pyx_t_3 = 0;
4348
4349     /* "pycocotools/_mask.pyx":175
4350  *         if len(objs) == 0:
4351  *             return objs
4352  *         if type(objs) == np.ndarray:             # <<<<<<<<<<<<<<
4353  *             if len(objs.shape) == 1:
4354  *                 objs = objs.reshape((objs[0], 1))
4355  */
4356     goto __pyx_L4;
4357   }
4358
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]))
4365  */
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;
4369   if (__pyx_t_2) {
4370
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]))
4376  *             if isbox:
4377  */
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;
4392       __pyx_t_11 = NULL;
4393     } else {
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)
4397     }
4398     for (;;) {
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)
4404           #else
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);
4407           #endif
4408         } else {
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)
4412           #else
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);
4415           #endif
4416         }
4417       } else {
4418         __pyx_t_12 = __pyx_t_11(__pyx_t_10);
4419         if (unlikely(!__pyx_t_12)) {
4420           PyObject* exc_type = PyErr_Occurred();
4421           if (exc_type) {
4422             if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
4423             else __PYX_ERR(0, 184, __pyx_L1_error)
4424           }
4425           break;
4426         }
4427         __Pyx_GOTREF(__pyx_t_12);
4428       }
4429       __Pyx_XDECREF_SET(__pyx_v_obj, __pyx_t_12);
4430       __pyx_t_12 = 0;
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);
4433       if (__pyx_t_2) {
4434       } else {
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;
4438         __pyx_t_14 = 0;
4439         goto __pyx_L11_bool_binop_done;
4440       }
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)
4443       if (!__pyx_t_2) {
4444         __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
4445       } else {
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;
4450       }
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;
4458     }
4459     __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
4460     __pyx_t_10 = NULL;
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);
4468       }
4469     }
4470     if (!__pyx_t_10) {
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);
4474     } else {
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;
4482       } else
4483       #endif
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;
4491       } else
4492       #endif
4493       {
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);
4499         __pyx_t_6 = 0;
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;
4503       }
4504     }
4505     __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
4506     __pyx_t_7 = NULL;
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);
4514       }
4515     }
4516     if (!__pyx_t_7) {
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);
4520     } else {
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;
4528       } else
4529       #endif
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;
4537       } else
4538       #endif
4539       {
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);
4545         __pyx_t_4 = 0;
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;
4549       }
4550     }
4551     __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
4552     __pyx_v_isbox = __pyx_t_3;
4553     __pyx_t_3 = 0;
4554
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]))             # <<<<<<<<<<<<<<
4559  *             if isbox:
4560  *                 objs = np.array(objs, dtype=np.double)
4561  */
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;
4576       __pyx_t_11 = NULL;
4577     } else {
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)
4581     }
4582     for (;;) {
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)
4588           #else
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);
4591           #endif
4592         } else {
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)
4596           #else
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);
4599           #endif
4600         }
4601       } else {
4602         __pyx_t_10 = __pyx_t_11(__pyx_t_6);
4603         if (unlikely(!__pyx_t_10)) {
4604           PyObject* exc_type = PyErr_Occurred();
4605           if (exc_type) {
4606             if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
4607             else __PYX_ERR(0, 185, __pyx_L1_error)
4608           }
4609           break;
4610         }
4611         __Pyx_GOTREF(__pyx_t_10);
4612       }
4613       __Pyx_XDECREF_SET(__pyx_v_obj, __pyx_t_10);
4614       __pyx_t_10 = 0;
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;
4618     }
4619     __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
4620     __pyx_t_6 = NULL;
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);
4628       }
4629     }
4630     if (!__pyx_t_6) {
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);
4634     } else {
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;
4642       } else
4643       #endif
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;
4651       } else
4652       #endif
4653       {
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);
4659         __pyx_t_4 = 0;
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;
4663       }
4664     }
4665     __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
4666     __pyx_t_7 = NULL;
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);
4674       }
4675     }
4676     if (!__pyx_t_7) {
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);
4680     } else {
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;
4688       } else
4689       #endif
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;
4697       } else
4698       #endif
4699       {
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);
4705         __pyx_t_5 = 0;
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;
4709       }
4710     }
4711     __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
4712     __pyx_v_isrle = __pyx_t_3;
4713     __pyx_t_3 = 0;
4714
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:
4721  */
4722     __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_isbox); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 186, __pyx_L1_error)
4723     if (__pyx_t_2) {
4724
4725       /* "pycocotools/_mask.pyx":187
4726  *             isrle = np.all(np.array([type(obj) == dict for obj in objs]))
4727  *             if isbox:
4728  *                 objs = np.array(objs, dtype=np.double)             # <<<<<<<<<<<<<<
4729  *                 if len(objs.shape) == 1:
4730  *                     objs = objs.reshape((1,objs.shape[0]))
4731  */
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);
4757       __pyx_t_7 = 0;
4758
4759       /* "pycocotools/_mask.pyx":188
4760  *             if isbox:
4761  *                 objs = np.array(objs, dtype=np.double)
4762  *                 if len(objs.shape) == 1:             # <<<<<<<<<<<<<<
4763  *                     objs = objs.reshape((1,objs.shape[0]))
4764  *             elif isrle:
4765  */
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);
4771       if (__pyx_t_2) {
4772
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]))             # <<<<<<<<<<<<<<
4777  *             elif isrle:
4778  *                 objs = _frString(objs)
4779  */
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);
4794         __pyx_t_12 = 0;
4795         __pyx_t_12 = NULL;
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);
4803           }
4804         }
4805         if (!__pyx_t_12) {
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);
4809         } else {
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;
4817           } else
4818           #endif
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;
4826           } else
4827           #endif
4828           {
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);
4834             __pyx_t_3 = 0;
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;
4838           }
4839         }
4840         __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
4841         __Pyx_DECREF_SET(__pyx_v_objs, __pyx_t_7);
4842         __pyx_t_7 = 0;
4843
4844         /* "pycocotools/_mask.pyx":188
4845  *             if isbox:
4846  *                 objs = np.array(objs, dtype=np.double)
4847  *                 if len(objs.shape) == 1:             # <<<<<<<<<<<<<<
4848  *                     objs = objs.reshape((1,objs.shape[0]))
4849  *             elif isrle:
4850  */
4851       }
4852
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:
4859  */
4860       goto __pyx_L16;
4861     }
4862
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)
4868  *             else:
4869  */
4870     __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_isrle); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 190, __pyx_L1_error)
4871     if (__pyx_t_2) {
4872
4873       /* "pycocotools/_mask.pyx":191
4874  *                     objs = objs.reshape((1,objs.shape[0]))
4875  *             elif isrle:
4876  *                 objs = _frString(objs)             # <<<<<<<<<<<<<<
4877  *             else:
4878  *                 raise Exception('list input can be bounding box (Nx4) or RLEs ([RLE])')
4879  */
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);
4882       __pyx_t_5 = NULL;
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);
4890         }
4891       }
4892       if (!__pyx_t_5) {
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);
4895       } else {
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);
4902         } else
4903         #endif
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);
4910         } else
4911         #endif
4912         {
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;
4922         }
4923       }
4924       __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
4925       __Pyx_DECREF_SET(__pyx_v_objs, __pyx_t_7);
4926       __pyx_t_7 = 0;
4927
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)
4933  *             else:
4934  */
4935       goto __pyx_L16;
4936     }
4937
4938     /* "pycocotools/_mask.pyx":193
4939  *                 objs = _frString(objs)
4940  *             else:
4941  *                 raise Exception('list input can be bounding box (Nx4) or RLEs ([RLE])')             # <<<<<<<<<<<<<<
4942  *         else:
4943  *             raise Exception('unrecognized type.  The following type: RLEs (rle), np.ndarray (box), and list (box) are supported.')
4944  */
4945     /*else*/ {
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)
4951     }
4952     __pyx_L16:;
4953
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]))
4960  */
4961     goto __pyx_L4;
4962   }
4963
4964   /* "pycocotools/_mask.pyx":195
4965  *                 raise Exception('list input can be bounding box (Nx4) or RLEs ([RLE])')
4966  *         else:
4967  *             raise Exception('unrecognized type.  The following type: RLEs (rle), np.ndarray (box), and list (box) are supported.')             # <<<<<<<<<<<<<<
4968  *         return objs
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):
4970  */
4971   /*else*/ {
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)
4977   }
4978   __pyx_L4:;
4979
4980   /* "pycocotools/_mask.pyx":196
4981  *         else:
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 )
4986  */
4987   __Pyx_XDECREF(__pyx_r);
4988   __Pyx_INCREF(__pyx_v_objs);
4989   __pyx_r = __pyx_v_objs;
4990   goto __pyx_L0;
4991
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:
4997  *             return objs
4998  */
4999
5000   /* function exit code */
5001   __pyx_L1_error:;
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);
5011   __pyx_r = NULL;
5012   __pyx_L0:;
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();
5019   return __pyx_r;
5020 }
5021
5022 /* "pycocotools/_mask.pyx":197
5023  *             raise Exception('unrecognized type.  The following type: RLEs (rle), np.ndarray (box), and list (box) are supported.')
5024  *         return objs
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):
5028  */
5029
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;
5037   siz __pyx_v_m;
5038   siz __pyx_v_n;
5039   PyArrayObject *__pyx_v__iou = 0;
5040   PyObject *__pyx_r = 0;
5041   __Pyx_RefNannyDeclarations
5042   __Pyx_RefNannySetupContext("_rleIou (wrapper)", 0);
5043   {
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)) {
5047       Py_ssize_t kw_args;
5048       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
5049       switch (pos_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);
5056         case  0: break;
5057         default: goto __pyx_L5_argtuple_error;
5058       }
5059       kw_args = PyDict_Size(__pyx_kwds);
5060       switch (pos_args) {
5061         case  0:
5062         if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_dt)) != 0)) kw_args--;
5063         else goto __pyx_L5_argtuple_error;
5064         case  1:
5065         if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_gt)) != 0)) kw_args--;
5066         else {
5067           __Pyx_RaiseArgtupleInvalid("_rleIou", 1, 6, 6, 1); __PYX_ERR(0, 197, __pyx_L3_error)
5068         }
5069         case  2:
5070         if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_iscrowd)) != 0)) kw_args--;
5071         else {
5072           __Pyx_RaiseArgtupleInvalid("_rleIou", 1, 6, 6, 2); __PYX_ERR(0, 197, __pyx_L3_error)
5073         }
5074         case  3:
5075         if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_m)) != 0)) kw_args--;
5076         else {
5077           __Pyx_RaiseArgtupleInvalid("_rleIou", 1, 6, 6, 3); __PYX_ERR(0, 197, __pyx_L3_error)
5078         }
5079         case  4:
5080         if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_n)) != 0)) kw_args--;
5081         else {
5082           __Pyx_RaiseArgtupleInvalid("_rleIou", 1, 6, 6, 4); __PYX_ERR(0, 197, __pyx_L3_error)
5083         }
5084         case  5:
5085         if (likely((values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_iou)) != 0)) kw_args--;
5086         else {
5087           __Pyx_RaiseArgtupleInvalid("_rleIou", 1, 6, 6, 5); __PYX_ERR(0, 197, __pyx_L3_error)
5088         }
5089       }
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)
5092       }
5093     } else if (PyTuple_GET_SIZE(__pyx_args) != 6) {
5094       goto __pyx_L5_argtuple_error;
5095     } else {
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);
5102     }
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]);
5109   }
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)
5113   __pyx_L3_error:;
5114   __Pyx_AddTraceback("pycocotools._mask.iou._rleIou", __pyx_clineno, __pyx_lineno, __pyx_filename);
5115   __Pyx_RefNannyFinishContext();
5116   return NULL;
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);
5123
5124   /* function exit code */
5125   goto __pyx_L0;
5126   __pyx_L1_error:;
5127   __pyx_r = NULL;
5128   __pyx_L0:;
5129   __Pyx_RefNannyFinishContext();
5130   return __pyx_r;
5131 }
5132
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;
5149   {
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)
5152   }
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];
5154   {
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)
5157   }
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];
5159
5160   /* "pycocotools/_mask.pyx":198
5161  *         return objs
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 )
5166  */
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));
5168
5169   /* "pycocotools/_mask.pyx":197
5170  *             raise Exception('unrecognized type.  The following type: RLEs (rle), np.ndarray (box), and list (box) are supported.')
5171  *         return objs
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):
5175  */
5176
5177   /* function exit code */
5178   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
5179   goto __pyx_L0;
5180   __pyx_L1_error:;
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);
5189   __pyx_r = NULL;
5190   goto __pyx_L2;
5191   __pyx_L0:;
5192   __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd__iou.rcbuffer->pybuffer);
5193   __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_iscrowd.rcbuffer->pybuffer);
5194   __pyx_L2:;
5195   __Pyx_XGIVEREF(__pyx_r);
5196   __Pyx_RefNannyFinishContext();
5197   return __pyx_r;
5198 }
5199
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 )
5205  *     def _len(obj):
5206  */
5207
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;
5215   siz __pyx_v_m;
5216   siz __pyx_v_n;
5217   PyArrayObject *__pyx_v__iou = 0;
5218   PyObject *__pyx_r = 0;
5219   __Pyx_RefNannyDeclarations
5220   __Pyx_RefNannySetupContext("_bbIou (wrapper)", 0);
5221   {
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)) {
5225       Py_ssize_t kw_args;
5226       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
5227       switch (pos_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);
5234         case  0: break;
5235         default: goto __pyx_L5_argtuple_error;
5236       }
5237       kw_args = PyDict_Size(__pyx_kwds);
5238       switch (pos_args) {
5239         case  0:
5240         if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_dt)) != 0)) kw_args--;
5241         else goto __pyx_L5_argtuple_error;
5242         case  1:
5243         if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_gt)) != 0)) kw_args--;
5244         else {
5245           __Pyx_RaiseArgtupleInvalid("_bbIou", 1, 6, 6, 1); __PYX_ERR(0, 199, __pyx_L3_error)
5246         }
5247         case  2:
5248         if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_iscrowd)) != 0)) kw_args--;
5249         else {
5250           __Pyx_RaiseArgtupleInvalid("_bbIou", 1, 6, 6, 2); __PYX_ERR(0, 199, __pyx_L3_error)
5251         }
5252         case  3:
5253         if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_m)) != 0)) kw_args--;
5254         else {
5255           __Pyx_RaiseArgtupleInvalid("_bbIou", 1, 6, 6, 3); __PYX_ERR(0, 199, __pyx_L3_error)
5256         }
5257         case  4:
5258         if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_n)) != 0)) kw_args--;
5259         else {
5260           __Pyx_RaiseArgtupleInvalid("_bbIou", 1, 6, 6, 4); __PYX_ERR(0, 199, __pyx_L3_error)
5261         }
5262         case  5:
5263         if (likely((values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_iou)) != 0)) kw_args--;
5264         else {
5265           __Pyx_RaiseArgtupleInvalid("_bbIou", 1, 6, 6, 5); __PYX_ERR(0, 199, __pyx_L3_error)
5266         }
5267       }
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)
5270       }
5271     } else if (PyTuple_GET_SIZE(__pyx_args) != 6) {
5272       goto __pyx_L5_argtuple_error;
5273     } else {
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);
5280     }
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]);
5287   }
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)
5291   __pyx_L3_error:;
5292   __Pyx_AddTraceback("pycocotools._mask.iou._bbIou", __pyx_clineno, __pyx_lineno, __pyx_filename);
5293   __Pyx_RefNannyFinishContext();
5294   return NULL;
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);
5301
5302   /* function exit code */
5303   goto __pyx_L0;
5304   __pyx_L1_error:;
5305   __pyx_r = NULL;
5306   __pyx_L0:;
5307   __Pyx_RefNannyFinishContext();
5308   return __pyx_r;
5309 }
5310
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;
5339   {
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)
5342   }
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];
5344   {
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)
5347   }
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];
5349   {
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)
5352   }
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];
5354   {
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)
5357   }
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];
5359
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 )             # <<<<<<<<<<<<<<
5364  *     def _len(obj):
5365  *         cdef siz N = 0
5366  */
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));
5368
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 )
5374  *     def _len(obj):
5375  */
5376
5377   /* function exit code */
5378   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
5379   goto __pyx_L0;
5380   __pyx_L1_error:;
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);
5391   __pyx_r = NULL;
5392   goto __pyx_L2;
5393   __pyx_L0:;
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);
5398   __pyx_L2:;
5399   __Pyx_XGIVEREF(__pyx_r);
5400   __Pyx_RefNannyFinishContext();
5401   return __pyx_r;
5402 }
5403
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):             # <<<<<<<<<<<<<<
5408  *         cdef siz N = 0
5409  *         if type(obj) == RLEs:
5410  */
5411
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));
5420
5421   /* function exit code */
5422   __Pyx_RefNannyFinishContext();
5423   return __pyx_r;
5424 }
5425
5426 static PyObject *__pyx_pf_11pycocotools_5_mask_3iou_6_len(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_obj) {
5427   siz __pyx_v_N;
5428   PyObject *__pyx_r = NULL;
5429   __Pyx_RefNannyDeclarations
5430   PyObject *__pyx_t_1 = NULL;
5431   int __pyx_t_2;
5432   siz __pyx_t_3;
5433   Py_ssize_t __pyx_t_4;
5434   PyObject *__pyx_t_5 = NULL;
5435   __Pyx_RefNannySetupContext("_len", 0);
5436
5437   /* "pycocotools/_mask.pyx":202
5438  *         bbIou( <BB> dt.data, <BB> gt.data, m, n, <byte*> iscrowd.data, <double*>_iou.data )
5439  *     def _len(obj):
5440  *         cdef siz N = 0             # <<<<<<<<<<<<<<
5441  *         if type(obj) == RLEs:
5442  *             N = obj.n
5443  */
5444   __pyx_v_N = 0;
5445
5446   /* "pycocotools/_mask.pyx":203
5447  *     def _len(obj):
5448  *         cdef siz N = 0
5449  *         if type(obj) == RLEs:             # <<<<<<<<<<<<<<
5450  *             N = obj.n
5451  *         elif len(obj)==0:
5452  */
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;
5456   if (__pyx_t_2) {
5457
5458     /* "pycocotools/_mask.pyx":204
5459  *         cdef siz N = 0
5460  *         if type(obj) == RLEs:
5461  *             N = obj.n             # <<<<<<<<<<<<<<
5462  *         elif len(obj)==0:
5463  *             pass
5464  */
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;
5470
5471     /* "pycocotools/_mask.pyx":203
5472  *     def _len(obj):
5473  *         cdef siz N = 0
5474  *         if type(obj) == RLEs:             # <<<<<<<<<<<<<<
5475  *             N = obj.n
5476  *         elif len(obj)==0:
5477  */
5478     goto __pyx_L3;
5479   }
5480
5481   /* "pycocotools/_mask.pyx":205
5482  *         if type(obj) == RLEs:
5483  *             N = obj.n
5484  *         elif len(obj)==0:             # <<<<<<<<<<<<<<
5485  *             pass
5486  *         elif type(obj) == np.ndarray:
5487  */
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);
5490   if (__pyx_t_2) {
5491     goto __pyx_L3;
5492   }
5493
5494   /* "pycocotools/_mask.pyx":207
5495  *         elif len(obj)==0:
5496  *             pass
5497  *         elif type(obj) == np.ndarray:             # <<<<<<<<<<<<<<
5498  *             N = obj.shape[0]
5499  *         return N
5500  */
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;
5504   if (__pyx_t_2) {
5505
5506     /* "pycocotools/_mask.pyx":208
5507  *             pass
5508  *         elif type(obj) == np.ndarray:
5509  *             N = obj.shape[0]             # <<<<<<<<<<<<<<
5510  *         return N
5511  *     # convert iscrowd to numpy array
5512  */
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;
5521
5522     /* "pycocotools/_mask.pyx":207
5523  *         elif len(obj)==0:
5524  *             pass
5525  *         elif type(obj) == np.ndarray:             # <<<<<<<<<<<<<<
5526  *             N = obj.shape[0]
5527  *         return N
5528  */
5529   }
5530   __pyx_L3:;
5531
5532   /* "pycocotools/_mask.pyx":209
5533  *         elif type(obj) == np.ndarray:
5534  *             N = obj.shape[0]
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)
5538  */
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;
5543   __pyx_t_5 = 0;
5544   goto __pyx_L0;
5545
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):             # <<<<<<<<<<<<<<
5550  *         cdef siz N = 0
5551  *         if type(obj) == RLEs:
5552  */
5553
5554   /* function exit code */
5555   __pyx_L1_error:;
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);
5559   __pyx_r = NULL;
5560   __pyx_L0:;
5561   __Pyx_XGIVEREF(__pyx_r);
5562   __Pyx_RefNannyFinishContext();
5563   return __pyx_r;
5564 }
5565
5566 /* "pycocotools/_mask.pyx":171
5567  * 
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:
5572  */
5573
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;
5580   siz __pyx_v_m;
5581   siz __pyx_v_n;
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;
5596   siz __pyx_t_7;
5597   int __pyx_t_8;
5598   int __pyx_t_9;
5599   int __pyx_t_10;
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;
5608
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:
5614  *             return objs
5615  */
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;
5619   __pyx_t_1 = 0;
5620
5621   /* "pycocotools/_mask.pyx":197
5622  *             raise Exception('unrecognized type.  The following type: RLEs (rle), np.ndarray (box), and list (box) are supported.')
5623  *         return objs
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):
5627  */
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;
5631   __pyx_t_1 = 0;
5632
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 )
5638  *     def _len(obj):
5639  */
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;
5643   __pyx_t_1 = 0;
5644
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):             # <<<<<<<<<<<<<<
5649  *         cdef siz N = 0
5650  *         if type(obj) == RLEs:
5651  */
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;
5655   __pyx_t_1 = 0;
5656
5657   /* "pycocotools/_mask.pyx":211
5658  *         return N
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
5662  *     cdef siz m, n
5663  */
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);
5690   {
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];
5696     }
5697   }
5698   __pyx_t_6 = 0;
5699   __pyx_v_iscrowd = ((PyArrayObject *)__pyx_t_5);
5700   __pyx_t_5 = 0;
5701
5702   /* "pycocotools/_mask.pyx":214
5703  *     # simple type checking
5704  *     cdef siz m, n
5705  *     dt = _preproc(dt)             # <<<<<<<<<<<<<<
5706  *     gt = _preproc(gt)
5707  *     m = _len(dt)
5708  */
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);
5712   __pyx_t_5 = 0;
5713
5714   /* "pycocotools/_mask.pyx":215
5715  *     cdef siz m, n
5716  *     dt = _preproc(dt)
5717  *     gt = _preproc(gt)             # <<<<<<<<<<<<<<
5718  *     m = _len(dt)
5719  *     n = _len(gt)
5720  */
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);
5724   __pyx_t_5 = 0;
5725
5726   /* "pycocotools/_mask.pyx":216
5727  *     dt = _preproc(dt)
5728  *     gt = _preproc(gt)
5729  *     m = _len(dt)             # <<<<<<<<<<<<<<
5730  *     n = _len(gt)
5731  *     if m == 0 or n == 0:
5732  */
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;
5738
5739   /* "pycocotools/_mask.pyx":217
5740  *     gt = _preproc(gt)
5741  *     m = _len(dt)
5742  *     n = _len(gt)             # <<<<<<<<<<<<<<
5743  *     if m == 0 or n == 0:
5744  *         return []
5745  */
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;
5751
5752   /* "pycocotools/_mask.pyx":218
5753  *     m = _len(dt)
5754  *     n = _len(gt)
5755  *     if m == 0 or n == 0:             # <<<<<<<<<<<<<<
5756  *         return []
5757  *     if not type(dt) == type(gt):
5758  */
5759   __pyx_t_9 = ((__pyx_v_m == 0) != 0);
5760   if (!__pyx_t_9) {
5761   } else {
5762     __pyx_t_8 = __pyx_t_9;
5763     goto __pyx_L4_bool_binop_done;
5764   }
5765   __pyx_t_9 = ((__pyx_v_n == 0) != 0);
5766   __pyx_t_8 = __pyx_t_9;
5767   __pyx_L4_bool_binop_done:;
5768   if (__pyx_t_8) {
5769
5770     /* "pycocotools/_mask.pyx":219
5771  *     n = _len(gt)
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')
5776  */
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;
5781     __pyx_t_5 = 0;
5782     goto __pyx_L0;
5783
5784     /* "pycocotools/_mask.pyx":218
5785  *     m = _len(dt)
5786  *     n = _len(gt)
5787  *     if m == 0 or n == 0:             # <<<<<<<<<<<<<<
5788  *         return []
5789  *     if not type(dt) == type(gt):
5790  */
5791   }
5792
5793   /* "pycocotools/_mask.pyx":220
5794  *     if m == 0 or n == 0:
5795  *         return []
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')
5798  * 
5799  */
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);
5804   if (__pyx_t_9) {
5805
5806     /* "pycocotools/_mask.pyx":221
5807  *         return []
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')             # <<<<<<<<<<<<<<
5810  * 
5811  *     # define local variables
5812  */
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)
5818
5819     /* "pycocotools/_mask.pyx":220
5820  *     if m == 0 or n == 0:
5821  *         return []
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')
5824  * 
5825  */
5826   }
5827
5828   /* "pycocotools/_mask.pyx":224
5829  * 
5830  *     # define local variables
5831  *     cdef double* _iou = <double*> 0             # <<<<<<<<<<<<<<
5832  *     cdef np.npy_intp shape[1]
5833  *     # check type and assign iou function
5834  */
5835   __pyx_v__iou = ((double *)0);
5836
5837   /* "pycocotools/_mask.pyx":227
5838  *     cdef np.npy_intp shape[1]
5839  *     # check type and assign iou function
5840  *     if type(dt) == RLEs:             # <<<<<<<<<<<<<<
5841  *         _iouFun = _rleIou
5842  *     elif type(dt) == np.ndarray:
5843  */
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;
5847   if (__pyx_t_9) {
5848
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:
5854  *         _iouFun = _bbIou
5855  */
5856     __Pyx_INCREF(__pyx_v__rleIou);
5857     __pyx_v__iouFun = __pyx_v__rleIou;
5858
5859     /* "pycocotools/_mask.pyx":227
5860  *     cdef np.npy_intp shape[1]
5861  *     # check type and assign iou function
5862  *     if type(dt) == RLEs:             # <<<<<<<<<<<<<<
5863  *         _iouFun = _rleIou
5864  *     elif type(dt) == np.ndarray:
5865  */
5866     goto __pyx_L7;
5867   }
5868
5869   /* "pycocotools/_mask.pyx":229
5870  *     if type(dt) == RLEs:
5871  *         _iouFun = _rleIou
5872  *     elif type(dt) == np.ndarray:             # <<<<<<<<<<<<<<
5873  *         _iouFun = _bbIou
5874  *     else:
5875  */
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;
5879   if (__pyx_t_9) {
5880
5881     /* "pycocotools/_mask.pyx":230
5882  *         _iouFun = _rleIou
5883  *     elif type(dt) == np.ndarray:
5884  *         _iouFun = _bbIou             # <<<<<<<<<<<<<<
5885  *     else:
5886  *         raise Exception('input data type not allowed.')
5887  */
5888     __Pyx_INCREF(__pyx_v__bbIou);
5889     __pyx_v__iouFun = __pyx_v__bbIou;
5890
5891     /* "pycocotools/_mask.pyx":229
5892  *     if type(dt) == RLEs:
5893  *         _iouFun = _rleIou
5894  *     elif type(dt) == np.ndarray:             # <<<<<<<<<<<<<<
5895  *         _iouFun = _bbIou
5896  *     else:
5897  */
5898     goto __pyx_L7;
5899   }
5900
5901   /* "pycocotools/_mask.pyx":232
5902  *         _iouFun = _bbIou
5903  *     else:
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)
5907  */
5908   /*else*/ {
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)
5914   }
5915   __pyx_L7:;
5916
5917   /* "pycocotools/_mask.pyx":233
5918  *     else:
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
5923  */
5924   __pyx_v__iou = ((double *)malloc(((__pyx_v_m * __pyx_v_n) * (sizeof(double)))));
5925
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)
5932  */
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);
5944   __pyx_t_5 = 0;
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);
5949   __pyx_t_1 = 0;
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;
5965   __pyx_t_4 = 0;
5966
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)
5973  */
5974   (__pyx_v_shape[0]) = (((npy_intp)__pyx_v_m) * __pyx_v_n);
5975
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)
5982  */
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);
5986   __pyx_t_4 = 0;
5987
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')
5994  */
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);
5997
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')
6003  * 
6004  */
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;
6011   __pyx_t_10 = 0;
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);
6019       __pyx_t_10 = 1;
6020     }
6021   }
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;
6030   } else
6031   #endif
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;
6040   } else
6041   #endif
6042   {
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);
6045     if (__pyx_t_2) {
6046       __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_2); __pyx_t_2 = NULL;
6047     }
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);
6064     __pyx_t_1 = 0;
6065     __pyx_t_5 = 0;
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;
6069   }
6070   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6071   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
6072
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')             # <<<<<<<<<<<<<<
6077  * 
6078  * def toBbox( rleObjs ):
6079  */
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);
6093   __pyx_t_3 = 0;
6094   __pyx_t_11 = 0;
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);
6099   __pyx_t_5 = 0;
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;
6109   __pyx_t_3 = 0;
6110   goto __pyx_L0;
6111
6112   /* "pycocotools/_mask.pyx":171
6113  * 
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:
6118  */
6119
6120   /* function exit code */
6121   __pyx_L1_error:;
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);
6135   __pyx_r = NULL;
6136   goto __pyx_L2;
6137   __pyx_L0:;
6138   __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_iscrowd.rcbuffer->pybuffer);
6139   __pyx_L2:;
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();
6151   return __pyx_r;
6152 }
6153
6154 /* "pycocotools/_mask.pyx":241
6155  *     return iou.reshape((m,n), order='F')
6156  * 
6157  * def toBbox( rleObjs ):             # <<<<<<<<<<<<<<
6158  *     cdef RLEs Rs = _frString(rleObjs)
6159  *     cdef siz n = Rs.n
6160  */
6161
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));
6170
6171   /* function exit code */
6172   __Pyx_RefNannyFinishContext();
6173   return __pyx_r;
6174 }
6175
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;
6178   siz __pyx_v_n;
6179   BB __pyx_v__bb;
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;
6188   siz __pyx_t_5;
6189   PyObject *__pyx_t_6 = NULL;
6190   __Pyx_RefNannySetupContext("toBbox", 0);
6191
6192   /* "pycocotools/_mask.pyx":242
6193  * 
6194  * def toBbox( rleObjs ):
6195  *     cdef RLEs Rs = _frString(rleObjs)             # <<<<<<<<<<<<<<
6196  *     cdef siz n = Rs.n
6197  *     cdef BB _bb = <BB> malloc(4*n* sizeof(double))
6198  */
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);
6201   __pyx_t_3 = NULL;
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);
6209     }
6210   }
6211   if (!__pyx_t_3) {
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);
6214   } else {
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);
6221     } else
6222     #endif
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);
6229     } else
6230     #endif
6231     {
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;
6241     }
6242   }
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);
6246   __pyx_t_1 = 0;
6247
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 )
6254  */
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;
6260
6261   /* "pycocotools/_mask.pyx":244
6262  *     cdef RLEs Rs = _frString(rleObjs)
6263  *     cdef siz n = Rs.n
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]
6267  */
6268   __pyx_v__bb = ((BB)malloc(((4 * __pyx_v_n) * (sizeof(double)))));
6269
6270   /* "pycocotools/_mask.pyx":245
6271  *     cdef siz n = Rs.n
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
6276  */
6277   rleToBbox(((RLE const *)__pyx_v_Rs->_R), __pyx_v__bb, __pyx_v_n);
6278
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))
6285  */
6286   (__pyx_v_shape[0]) = (((npy_intp)4) * __pyx_v_n);
6287
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)
6294  */
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);
6309   __pyx_t_1 = 0;
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);
6314   __pyx_t_4 = 0;
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;
6330   __pyx_t_6 = 0;
6331
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)
6337  *     return bb
6338  */
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);
6353   __pyx_t_4 = 0;
6354   __pyx_t_4 = NULL;
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);
6362     }
6363   }
6364   if (!__pyx_t_4) {
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);
6368   } else {
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;
6376     } else
6377     #endif
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;
6385     } else
6386     #endif
6387     {
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);
6393       __pyx_t_2 = 0;
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;
6397     }
6398   }
6399   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
6400   __Pyx_DECREF_SET(__pyx_v_bb, __pyx_t_6);
6401   __pyx_t_6 = 0;
6402
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)             # <<<<<<<<<<<<<<
6407  *     return bb
6408  * 
6409  */
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);
6412
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             # <<<<<<<<<<<<<<
6417  * 
6418  * def frBbox(np.ndarray[np.double_t, ndim=2] bb, siz h, siz w ):
6419  */
6420   __Pyx_XDECREF(__pyx_r);
6421   __Pyx_INCREF(__pyx_v_bb);
6422   __pyx_r = __pyx_v_bb;
6423   goto __pyx_L0;
6424
6425   /* "pycocotools/_mask.pyx":241
6426  *     return iou.reshape((m,n), order='F')
6427  * 
6428  * def toBbox( rleObjs ):             # <<<<<<<<<<<<<<
6429  *     cdef RLEs Rs = _frString(rleObjs)
6430  *     cdef siz n = Rs.n
6431  */
6432
6433   /* function exit code */
6434   __pyx_L1_error:;
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);
6441   __pyx_r = NULL;
6442   __pyx_L0:;
6443   __Pyx_XDECREF((PyObject *)__pyx_v_Rs);
6444   __Pyx_XDECREF(__pyx_v_bb);
6445   __Pyx_XGIVEREF(__pyx_r);
6446   __Pyx_RefNannyFinishContext();
6447   return __pyx_r;
6448 }
6449
6450 /* "pycocotools/_mask.pyx":253
6451  *     return bb
6452  * 
6453  * def frBbox(np.ndarray[np.double_t, ndim=2] bb, siz h, siz w ):             # <<<<<<<<<<<<<<
6454  *     cdef siz n = bb.shape[0]
6455  *     Rs = RLEs(n)
6456  */
6457
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;
6463   siz __pyx_v_h;
6464   siz __pyx_v_w;
6465   PyObject *__pyx_r = 0;
6466   __Pyx_RefNannyDeclarations
6467   __Pyx_RefNannySetupContext("frBbox (wrapper)", 0);
6468   {
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)) {
6472       Py_ssize_t kw_args;
6473       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
6474       switch (pos_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);
6478         case  0: break;
6479         default: goto __pyx_L5_argtuple_error;
6480       }
6481       kw_args = PyDict_Size(__pyx_kwds);
6482       switch (pos_args) {
6483         case  0:
6484         if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_bb)) != 0)) kw_args--;
6485         else goto __pyx_L5_argtuple_error;
6486         case  1:
6487         if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_h)) != 0)) kw_args--;
6488         else {
6489           __Pyx_RaiseArgtupleInvalid("frBbox", 1, 3, 3, 1); __PYX_ERR(0, 253, __pyx_L3_error)
6490         }
6491         case  2:
6492         if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_w)) != 0)) kw_args--;
6493         else {
6494           __Pyx_RaiseArgtupleInvalid("frBbox", 1, 3, 3, 2); __PYX_ERR(0, 253, __pyx_L3_error)
6495         }
6496       }
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)
6499       }
6500     } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
6501       goto __pyx_L5_argtuple_error;
6502     } else {
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);
6506     }
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)
6510   }
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)
6514   __pyx_L3_error:;
6515   __Pyx_AddTraceback("pycocotools._mask.frBbox", __pyx_clineno, __pyx_lineno, __pyx_filename);
6516   __Pyx_RefNannyFinishContext();
6517   return NULL;
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);
6521
6522   /* function exit code */
6523   goto __pyx_L0;
6524   __pyx_L1_error:;
6525   __pyx_r = NULL;
6526   __pyx_L0:;
6527   __Pyx_RefNannyFinishContext();
6528   return __pyx_r;
6529 }
6530
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) {
6532   siz __pyx_v_n;
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;
6548   {
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)
6551   }
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];
6553
6554   /* "pycocotools/_mask.pyx":254
6555  * 
6556  * def frBbox(np.ndarray[np.double_t, ndim=2] bb, siz h, siz w ):
6557  *     cdef siz n = bb.shape[0]             # <<<<<<<<<<<<<<
6558  *     Rs = RLEs(n)
6559  *     rleFrBbox( <RLE*> Rs._R, <const BB> bb.data, h, w, n )
6560  */
6561   __pyx_v_n = (__pyx_v_bb->dimensions[0]);
6562
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)
6569  */
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);
6576   __pyx_t_1 = 0;
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);
6581   __pyx_t_1 = 0;
6582
6583   /* "pycocotools/_mask.pyx":256
6584  *     cdef siz n = bb.shape[0]
6585  *     Rs = RLEs(n)
6586  *     rleFrBbox( <RLE*> Rs._R, <const BB> bb.data, h, w, n )             # <<<<<<<<<<<<<<
6587  *     objs = _toString(Rs)
6588  *     return objs
6589  */
6590   rleFrBbox(((RLE *)__pyx_v_Rs->_R), ((BB const )__pyx_v_bb->data), __pyx_v_h, __pyx_v_w, __pyx_v_n);
6591
6592   /* "pycocotools/_mask.pyx":257
6593  *     Rs = RLEs(n)
6594  *     rleFrBbox( <RLE*> Rs._R, <const BB> bb.data, h, w, n )
6595  *     objs = _toString(Rs)             # <<<<<<<<<<<<<<
6596  *     return objs
6597  * 
6598  */
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);
6601   __pyx_t_3 = NULL;
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);
6609     }
6610   }
6611   if (!__pyx_t_3) {
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);
6614   } else {
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);
6621     } else
6622     #endif
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);
6629     } else
6630     #endif
6631     {
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;
6641     }
6642   }
6643   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6644   __pyx_v_objs = __pyx_t_1;
6645   __pyx_t_1 = 0;
6646
6647   /* "pycocotools/_mask.pyx":258
6648  *     rleFrBbox( <RLE*> Rs._R, <const BB> bb.data, h, w, n )
6649  *     objs = _toString(Rs)
6650  *     return objs             # <<<<<<<<<<<<<<
6651  * 
6652  * def frPoly( poly, siz h, siz w ):
6653  */
6654   __Pyx_XDECREF(__pyx_r);
6655   __Pyx_INCREF(__pyx_v_objs);
6656   __pyx_r = __pyx_v_objs;
6657   goto __pyx_L0;
6658
6659   /* "pycocotools/_mask.pyx":253
6660  *     return bb
6661  * 
6662  * def frBbox(np.ndarray[np.double_t, ndim=2] bb, siz h, siz w ):             # <<<<<<<<<<<<<<
6663  *     cdef siz n = bb.shape[0]
6664  *     Rs = RLEs(n)
6665  */
6666
6667   /* function exit code */
6668   __pyx_L1_error:;
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);
6680   __pyx_r = NULL;
6681   goto __pyx_L2;
6682   __pyx_L0:;
6683   __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_bb.rcbuffer->pybuffer);
6684   __pyx_L2:;
6685   __Pyx_XDECREF((PyObject *)__pyx_v_Rs);
6686   __Pyx_XDECREF(__pyx_v_objs);
6687   __Pyx_XGIVEREF(__pyx_r);
6688   __Pyx_RefNannyFinishContext();
6689   return __pyx_r;
6690 }
6691
6692 /* "pycocotools/_mask.pyx":260
6693  *     return objs
6694  * 
6695  * def frPoly( poly, siz h, siz w ):             # <<<<<<<<<<<<<<
6696  *     cdef np.ndarray[np.double_t, ndim=1] np_poly
6697  *     n = len(poly)
6698  */
6699
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;
6705   siz __pyx_v_h;
6706   siz __pyx_v_w;
6707   PyObject *__pyx_r = 0;
6708   __Pyx_RefNannyDeclarations
6709   __Pyx_RefNannySetupContext("frPoly (wrapper)", 0);
6710   {
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)) {
6714       Py_ssize_t kw_args;
6715       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
6716       switch (pos_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);
6720         case  0: break;
6721         default: goto __pyx_L5_argtuple_error;
6722       }
6723       kw_args = PyDict_Size(__pyx_kwds);
6724       switch (pos_args) {
6725         case  0:
6726         if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_poly)) != 0)) kw_args--;
6727         else goto __pyx_L5_argtuple_error;
6728         case  1:
6729         if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_h)) != 0)) kw_args--;
6730         else {
6731           __Pyx_RaiseArgtupleInvalid("frPoly", 1, 3, 3, 1); __PYX_ERR(0, 260, __pyx_L3_error)
6732         }
6733         case  2:
6734         if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_w)) != 0)) kw_args--;
6735         else {
6736           __Pyx_RaiseArgtupleInvalid("frPoly", 1, 3, 3, 2); __PYX_ERR(0, 260, __pyx_L3_error)
6737         }
6738       }
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)
6741       }
6742     } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
6743       goto __pyx_L5_argtuple_error;
6744     } else {
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);
6748     }
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)
6752   }
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)
6756   __pyx_L3_error:;
6757   __Pyx_AddTraceback("pycocotools._mask.frPoly", __pyx_clineno, __pyx_lineno, __pyx_filename);
6758   __Pyx_RefNannyFinishContext();
6759   return NULL;
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);
6762
6763   /* function exit code */
6764   __Pyx_RefNannyFinishContext();
6765   return __pyx_r;
6766 }
6767
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;
6789   int __pyx_t_11;
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;
6800
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)             # <<<<<<<<<<<<<<
6805  *     Rs = RLEs(n)
6806  *     for i, p in enumerate(poly):
6807  */
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;
6810
6811   /* "pycocotools/_mask.pyx":263
6812  *     cdef np.ndarray[np.double_t, ndim=1] np_poly
6813  *     n = len(poly)
6814  *     Rs = RLEs(n)             # <<<<<<<<<<<<<<
6815  *     for i, p in enumerate(poly):
6816  *         np_poly = np.array(p, dtype=np.double, order='F')
6817  */
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);
6824   __pyx_t_2 = 0;
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);
6829   __pyx_t_2 = 0;
6830
6831   /* "pycocotools/_mask.pyx":264
6832  *     n = len(poly)
6833  *     Rs = RLEs(n)
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 )
6837  */
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;
6842     __pyx_t_4 = NULL;
6843   } else {
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)
6847   }
6848   for (;;) {
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)
6854         #else
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);
6857         #endif
6858       } else {
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)
6862         #else
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);
6865         #endif
6866       }
6867     } else {
6868       __pyx_t_5 = __pyx_t_4(__pyx_t_3);
6869       if (unlikely(!__pyx_t_5)) {
6870         PyObject* exc_type = PyErr_Occurred();
6871         if (exc_type) {
6872           if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
6873           else __PYX_ERR(0, 264, __pyx_L1_error)
6874         }
6875         break;
6876       }
6877       __Pyx_GOTREF(__pyx_t_5);
6878     }
6879     __Pyx_XDECREF_SET(__pyx_v_p, __pyx_t_5);
6880     __pyx_t_5 = 0;
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;
6887     __pyx_t_5 = 0;
6888
6889     /* "pycocotools/_mask.pyx":265
6890  *     Rs = RLEs(n)
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)
6895  */
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);
6923     {
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();
6932         } else {
6933           PyErr_Restore(__pyx_t_12, __pyx_t_13, __pyx_t_14);
6934         }
6935       }
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)
6938     }
6939     __pyx_t_10 = 0;
6940     __Pyx_XDECREF_SET(__pyx_v_np_poly, ((PyArrayObject *)__pyx_t_9));
6941     __pyx_t_9 = 0;
6942
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)
6948  *     return objs
6949  */
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);
6953
6954     /* "pycocotools/_mask.pyx":264
6955  *     n = len(poly)
6956  *     Rs = RLEs(n)
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 )
6960  */
6961   }
6962   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
6963   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
6964
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)             # <<<<<<<<<<<<<<
6969  *     return objs
6970  * 
6971  */
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);
6974   __pyx_t_9 = NULL;
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);
6982     }
6983   }
6984   if (!__pyx_t_9) {
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);
6987   } else {
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);
6994     } else
6995     #endif
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);
7002     } else
7003     #endif
7004     {
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;
7014     }
7015   }
7016   __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7017   __pyx_v_objs = __pyx_t_2;
7018   __pyx_t_2 = 0;
7019
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             # <<<<<<<<<<<<<<
7024  * 
7025  * def frUncompressedRLE(ucRles, siz h, siz w):
7026  */
7027   __Pyx_XDECREF(__pyx_r);
7028   __Pyx_INCREF(__pyx_v_objs);
7029   __pyx_r = __pyx_v_objs;
7030   goto __pyx_L0;
7031
7032   /* "pycocotools/_mask.pyx":260
7033  *     return objs
7034  * 
7035  * def frPoly( poly, siz h, siz w ):             # <<<<<<<<<<<<<<
7036  *     cdef np.ndarray[np.double_t, ndim=1] np_poly
7037  *     n = len(poly)
7038  */
7039
7040   /* function exit code */
7041   __pyx_L1_error:;
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);
7056   __pyx_r = NULL;
7057   goto __pyx_L2;
7058   __pyx_L0:;
7059   __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_np_poly.rcbuffer->pybuffer);
7060   __pyx_L2:;
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();
7068   return __pyx_r;
7069 }
7070
7071 /* "pycocotools/_mask.pyx":270
7072  *     return objs
7073  * 
7074  * def frUncompressedRLE(ucRles, siz h, siz w):             # <<<<<<<<<<<<<<
7075  *     cdef np.ndarray[np.uint32_t, ndim=1] cnts
7076  *     cdef RLE R
7077  */
7078
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);
7089   {
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)) {
7093       Py_ssize_t kw_args;
7094       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
7095       switch (pos_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);
7099         case  0: break;
7100         default: goto __pyx_L5_argtuple_error;
7101       }
7102       kw_args = PyDict_Size(__pyx_kwds);
7103       switch (pos_args) {
7104         case  0:
7105         if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_ucRles)) != 0)) kw_args--;
7106         else goto __pyx_L5_argtuple_error;
7107         case  1:
7108         if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_h)) != 0)) kw_args--;
7109         else {
7110           __Pyx_RaiseArgtupleInvalid("frUncompressedRLE", 1, 3, 3, 1); __PYX_ERR(0, 270, __pyx_L3_error)
7111         }
7112         case  2:
7113         if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_w)) != 0)) kw_args--;
7114         else {
7115           __Pyx_RaiseArgtupleInvalid("frUncompressedRLE", 1, 3, 3, 2); __PYX_ERR(0, 270, __pyx_L3_error)
7116         }
7117       }
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)
7120       }
7121     } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
7122       goto __pyx_L5_argtuple_error;
7123     } else {
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);
7127     }
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)
7131   }
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)
7135   __pyx_L3_error:;
7136   __Pyx_AddTraceback("pycocotools._mask.frUncompressedRLE", __pyx_clineno, __pyx_lineno, __pyx_filename);
7137   __Pyx_RefNannyFinishContext();
7138   return NULL;
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);
7141
7142   /* function exit code */
7143   __Pyx_RefNannyFinishContext();
7144   return __pyx_r;
7145 }
7146
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;
7149   RLE __pyx_v_R;
7150   uint *__pyx_v_data;
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;
7168   int __pyx_t_9;
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;
7175   RLE __pyx_t_16;
7176   siz __pyx_t_17;
7177   int __pyx_t_18;
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;
7183
7184   /* "pycocotools/_mask.pyx":274
7185  *     cdef RLE R
7186  *     cdef uint *data
7187  *     n = len(ucRles)             # <<<<<<<<<<<<<<
7188  *     objs = []
7189  *     for i in range(n):
7190  */
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;
7193
7194   /* "pycocotools/_mask.pyx":275
7195  *     cdef uint *data
7196  *     n = len(ucRles)
7197  *     objs = []             # <<<<<<<<<<<<<<
7198  *     for i in range(n):
7199  *         Rs = RLEs(1)
7200  */
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);
7204   __pyx_t_2 = 0;
7205
7206   /* "pycocotools/_mask.pyx":276
7207  *     n = len(ucRles)
7208  *     objs = []
7209  *     for i in range(n):             # <<<<<<<<<<<<<<
7210  *         Rs = RLEs(1)
7211  *         cnts = np.array(ucRles[i]['counts'], dtype=np.uint32)
7212  */
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;
7216
7217     /* "pycocotools/_mask.pyx":277
7218  *     objs = []
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
7223  */
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));
7227     __pyx_t_2 = 0;
7228
7229     /* "pycocotools/_mask.pyx":278
7230  *     for i in range(n):
7231  *         Rs = RLEs(1)
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))
7235  */
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);
7250     __pyx_t_5 = 0;
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);
7267     {
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();
7276         } else {
7277           PyErr_Restore(__pyx_t_10, __pyx_t_11, __pyx_t_12);
7278         }
7279       }
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)
7282     }
7283     __pyx_t_8 = 0;
7284     __Pyx_XDECREF_SET(__pyx_v_cnts, ((PyArrayObject *)__pyx_t_7));
7285     __pyx_t_7 = 0;
7286
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]
7293  */
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)))));
7296
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)
7303  */
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;
7307
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)
7313  *         Rs._R[0] = R
7314  */
7315       __pyx_t_15 = __pyx_v_j;
7316       __pyx_t_9 = -1;
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)
7324       }
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)));
7326     }
7327
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)             # <<<<<<<<<<<<<<
7332  *         Rs._R[0] = R
7333  *         objs.append(_toString(Rs)[0])
7334  */
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;
7361
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])
7367  *     return objs
7368  */
7369     (__pyx_v_Rs->_R[0]) = __pyx_v_R;
7370
7371     /* "pycocotools/_mask.pyx":285
7372  *         R = RLE(ucRles[i]['size'][0], ucRles[i]['size'][1], len(cnts), <uint*> data)
7373  *         Rs._R[0] = R
7374  *         objs.append(_toString(Rs)[0])             # <<<<<<<<<<<<<<
7375  *     return objs
7376  * 
7377  */
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);
7380     __pyx_t_2 = NULL;
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);
7388       }
7389     }
7390     if (!__pyx_t_2) {
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);
7393     } else {
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);
7400       } else
7401       #endif
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);
7408       } else
7409       #endif
7410       {
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;
7420       }
7421     }
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;
7428   }
7429
7430   /* "pycocotools/_mask.pyx":286
7431  *         Rs._R[0] = R
7432  *         objs.append(_toString(Rs)[0])
7433  *     return objs             # <<<<<<<<<<<<<<
7434  * 
7435  * def frPyObjects(pyobj, h, w):
7436  */
7437   __Pyx_XDECREF(__pyx_r);
7438   __Pyx_INCREF(__pyx_v_objs);
7439   __pyx_r = __pyx_v_objs;
7440   goto __pyx_L0;
7441
7442   /* "pycocotools/_mask.pyx":270
7443  *     return objs
7444  * 
7445  * def frUncompressedRLE(ucRles, siz h, siz w):             # <<<<<<<<<<<<<<
7446  *     cdef np.ndarray[np.uint32_t, ndim=1] cnts
7447  *     cdef RLE R
7448  */
7449
7450   /* function exit code */
7451   __pyx_L1_error:;
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);
7464   __pyx_r = NULL;
7465   goto __pyx_L2;
7466   __pyx_L0:;
7467   __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_cnts.rcbuffer->pybuffer);
7468   __pyx_L2:;
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();
7474   return __pyx_r;
7475 }
7476
7477 /* "pycocotools/_mask.pyx":288
7478  *     return objs
7479  * 
7480  * def frPyObjects(pyobj, h, w):             # <<<<<<<<<<<<<<
7481  *     # encode rle from a list of python objects
7482  *     if type(pyobj) == np.ndarray:
7483  */
7484
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);
7495   {
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)) {
7499       Py_ssize_t kw_args;
7500       const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
7501       switch (pos_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);
7505         case  0: break;
7506         default: goto __pyx_L5_argtuple_error;
7507       }
7508       kw_args = PyDict_Size(__pyx_kwds);
7509       switch (pos_args) {
7510         case  0:
7511         if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_pyobj)) != 0)) kw_args--;
7512         else goto __pyx_L5_argtuple_error;
7513         case  1:
7514         if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_h)) != 0)) kw_args--;
7515         else {
7516           __Pyx_RaiseArgtupleInvalid("frPyObjects", 1, 3, 3, 1); __PYX_ERR(0, 288, __pyx_L3_error)
7517         }
7518         case  2:
7519         if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_w)) != 0)) kw_args--;
7520         else {
7521           __Pyx_RaiseArgtupleInvalid("frPyObjects", 1, 3, 3, 2); __PYX_ERR(0, 288, __pyx_L3_error)
7522         }
7523       }
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)
7526       }
7527     } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
7528       goto __pyx_L5_argtuple_error;
7529     } else {
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);
7533     }
7534     __pyx_v_pyobj = values[0];
7535     __pyx_v_h = values[1];
7536     __pyx_v_w = values[2];
7537   }
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)
7541   __pyx_L3_error:;
7542   __Pyx_AddTraceback("pycocotools._mask.frPyObjects", __pyx_clineno, __pyx_lineno, __pyx_filename);
7543   __Pyx_RefNannyFinishContext();
7544   return NULL;
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);
7547
7548   /* function exit code */
7549   __Pyx_RefNannyFinishContext();
7550   return __pyx_r;
7551 }
7552
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;
7558   int __pyx_t_2;
7559   PyObject *__pyx_t_3 = NULL;
7560   PyObject *__pyx_t_4 = NULL;
7561   int __pyx_t_5;
7562   PyObject *__pyx_t_6 = NULL;
7563   int __pyx_t_7;
7564   Py_ssize_t __pyx_t_8;
7565   int __pyx_t_9;
7566   PyObject *__pyx_t_10 = NULL;
7567   __Pyx_RefNannySetupContext("frPyObjects", 0);
7568
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:
7575  */
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;
7579   if (__pyx_t_2) {
7580
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)
7587  */
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);
7590     __pyx_t_4 = NULL;
7591     __pyx_t_5 = 0;
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);
7599         __pyx_t_5 = 1;
7600       }
7601     }
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);
7608     } else
7609     #endif
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);
7616     } else
7617     #endif
7618     {
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);
7621       if (__pyx_t_4) {
7622         __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL;
7623       }
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;
7636     }
7637     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7638     __pyx_v_objs = __pyx_t_1;
7639     __pyx_t_1 = 0;
7640
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:
7647  */
7648     goto __pyx_L3;
7649   }
7650
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:
7657  */
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;
7661   if (__pyx_t_7) {
7662   } else {
7663     __pyx_t_2 = __pyx_t_7;
7664     goto __pyx_L4_bool_binop_done;
7665   }
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:;
7673   if (__pyx_t_2) {
7674
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)
7681  */
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);
7684     __pyx_t_6 = NULL;
7685     __pyx_t_5 = 0;
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);
7693         __pyx_t_5 = 1;
7694       }
7695     }
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);
7702     } else
7703     #endif
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);
7710     } else
7711     #endif
7712     {
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);
7715       if (__pyx_t_6) {
7716         __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_6); __pyx_t_6 = NULL;
7717       }
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;
7730     }
7731     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7732     __pyx_v_objs = __pyx_t_1;
7733     __pyx_t_1 = 0;
7734
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:
7741  */
7742     goto __pyx_L3;
7743   }
7744
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 \
7751  */
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;
7755   if (__pyx_t_7) {
7756   } else {
7757     __pyx_t_2 = __pyx_t_7;
7758     goto __pyx_L6_bool_binop_done;
7759   }
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:;
7767   if (__pyx_t_2) {
7768
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]:
7775  */
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);
7778     __pyx_t_4 = NULL;
7779     __pyx_t_5 = 0;
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);
7787         __pyx_t_5 = 1;
7788       }
7789     }
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);
7796     } else
7797     #endif
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);
7804     } else
7805     #endif
7806     {
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);
7809       if (__pyx_t_4) {
7810         __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL;
7811       }
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;
7824     }
7825     __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
7826     __pyx_v_objs = __pyx_t_1;
7827     __pyx_t_1 = 0;
7828
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 \
7835  */
7836     goto __pyx_L3;
7837   }
7838
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)
7845  */
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;
7849   if (__pyx_t_7) {
7850   } else {
7851     __pyx_t_2 = __pyx_t_7;
7852     goto __pyx_L8_bool_binop_done;
7853   }
7854
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
7861  */
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);
7864
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)
7871  */
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;
7876   if (__pyx_t_7) {
7877   } else {
7878     __pyx_t_2 = __pyx_t_7;
7879     goto __pyx_L8_bool_binop_done;
7880   }
7881
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
7888  */
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);
7894   if (__pyx_t_9) {
7895   } else {
7896     __pyx_t_2 = __pyx_t_9;
7897     goto __pyx_L8_bool_binop_done;
7898   }
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:;
7906
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)
7913  */
7914   if (__pyx_t_2) {
7915
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:
7922  */
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);
7925     __pyx_t_6 = NULL;
7926     __pyx_t_5 = 0;
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);
7934         __pyx_t_5 = 1;
7935       }
7936     }
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);
7943     } else
7944     #endif
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);
7951     } else
7952     #endif
7953     {
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);
7956       if (__pyx_t_6) {
7957         __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_6); __pyx_t_6 = NULL;
7958       }
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;
7971     }
7972     __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
7973     __pyx_v_objs = __pyx_t_3;
7974     __pyx_t_3 = 0;
7975
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)
7982  */
7983     goto __pyx_L3;
7984   }
7985
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:
7992  */
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;
7996   if (__pyx_t_7) {
7997   } else {
7998     __pyx_t_2 = __pyx_t_7;
7999     goto __pyx_L12_bool_binop_done;
8000   }
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:;
8005   if (__pyx_t_2) {
8006
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]
8013  */
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);
8021     __pyx_t_6 = NULL;
8022     __pyx_t_5 = 0;
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);
8030         __pyx_t_5 = 1;
8031       }
8032     }
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;
8040     } else
8041     #endif
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;
8049     } else
8050     #endif
8051     {
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);
8054       if (__pyx_t_6) {
8055         __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_6); __pyx_t_6 = NULL;
8056       }
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);
8065       __pyx_t_4 = 0;
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;
8069     }
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;
8075     __pyx_t_1 = 0;
8076
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:
8083  */
8084     goto __pyx_L3;
8085   }
8086
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:
8093  */
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;
8097   if (__pyx_t_7) {
8098   } else {
8099     __pyx_t_2 = __pyx_t_7;
8100     goto __pyx_L14_bool_binop_done;
8101   }
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:;
8106   if (__pyx_t_2) {
8107
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]
8114  */
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);
8122     __pyx_t_4 = NULL;
8123     __pyx_t_5 = 0;
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);
8131         __pyx_t_5 = 1;
8132       }
8133     }
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;
8141     } else
8142     #endif
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;
8150     } else
8151     #endif
8152     {
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);
8155       if (__pyx_t_4) {
8156         __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL;
8157       }
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);
8166       __pyx_t_10 = 0;
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;
8170     }
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;
8176     __pyx_t_3 = 0;
8177
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:
8184  */
8185     goto __pyx_L3;
8186   }
8187
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]
8193  *     else:
8194  */
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;
8198   if (__pyx_t_7) {
8199   } else {
8200     __pyx_t_2 = __pyx_t_7;
8201     goto __pyx_L16_bool_binop_done;
8202   }
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);
8205   if (__pyx_t_9) {
8206   } else {
8207     __pyx_t_2 = __pyx_t_9;
8208     goto __pyx_L16_bool_binop_done;
8209   }
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:;
8214   if (__pyx_t_2) {
8215
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]             # <<<<<<<<<<<<<<
8220  *     else:
8221  *         raise Exception('input type is not supported.')
8222  */
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);
8230     __pyx_t_10 = NULL;
8231     __pyx_t_5 = 0;
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);
8239         __pyx_t_5 = 1;
8240       }
8241     }
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;
8249     } else
8250     #endif
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;
8258     } else
8259     #endif
8260     {
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);
8263       if (__pyx_t_10) {
8264         __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_10); __pyx_t_10 = NULL;
8265       }
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);
8274       __pyx_t_6 = 0;
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;
8278     }
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;
8284     __pyx_t_1 = 0;
8285
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]
8291  *     else:
8292  */
8293     goto __pyx_L3;
8294   }
8295
8296   /* "pycocotools/_mask.pyx":307
8297  *         objs = frUncompressedRLE([pyobj], h, w)[0]
8298  *     else:
8299  *         raise Exception('input type is not supported.')             # <<<<<<<<<<<<<<
8300  *     return objs
8301  */
8302   /*else*/ {
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)
8308   }
8309   __pyx_L3:;
8310
8311   /* "pycocotools/_mask.pyx":308
8312  *     else:
8313  *         raise Exception('input type is not supported.')
8314  *     return objs             # <<<<<<<<<<<<<<
8315  */
8316   __Pyx_XDECREF(__pyx_r);
8317   __Pyx_INCREF(__pyx_v_objs);
8318   __pyx_r = __pyx_v_objs;
8319   goto __pyx_L0;
8320
8321   /* "pycocotools/_mask.pyx":288
8322  *     return objs
8323  * 
8324  * def frPyObjects(pyobj, h, w):             # <<<<<<<<<<<<<<
8325  *     # encode rle from a list of python objects
8326  *     if type(pyobj) == np.ndarray:
8327  */
8328
8329   /* function exit code */
8330   __pyx_L1_error:;
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);
8337   __pyx_r = NULL;
8338   __pyx_L0:;
8339   __Pyx_XDECREF(__pyx_v_objs);
8340   __Pyx_XGIVEREF(__pyx_r);
8341   __Pyx_RefNannyFinishContext();
8342   return __pyx_r;
8343 }
8344
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.
8351  */
8352
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) {
8356   int __pyx_r;
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));
8360
8361   /* function exit code */
8362   __Pyx_RefNannyFinishContext();
8363   return __pyx_r;
8364 }
8365
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;
8368   int __pyx_v_i;
8369   int __pyx_v_ndim;
8370   int __pyx_v_endian_detector;
8371   int __pyx_v_little_endian;
8372   int __pyx_v_t;
8373   char *__pyx_v_f;
8374   PyArray_Descr *__pyx_v_descr = 0;
8375   int __pyx_v_offset;
8376   int __pyx_v_hasfields;
8377   int __pyx_r;
8378   __Pyx_RefNannyDeclarations
8379   int __pyx_t_1;
8380   int __pyx_t_2;
8381   PyObject *__pyx_t_3 = NULL;
8382   int __pyx_t_4;
8383   int __pyx_t_5;
8384   PyObject *__pyx_t_6 = NULL;
8385   char *__pyx_t_7;
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);
8390   }
8391
8392   /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":203
8393  *             # of flags
8394  * 
8395  *             if info == NULL: return             # <<<<<<<<<<<<<<
8396  * 
8397  *             cdef int copy_shape, i, ndim
8398  */
8399   __pyx_t_1 = ((__pyx_v_info == NULL) != 0);
8400   if (__pyx_t_1) {
8401     __pyx_r = 0;
8402     goto __pyx_L0;
8403   }
8404
8405   /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":206
8406  * 
8407  *             cdef int copy_shape, i, ndim
8408  *             cdef int endian_detector = 1             # <<<<<<<<<<<<<<
8409  *             cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)
8410  * 
8411  */
8412   __pyx_v_endian_detector = 1;
8413
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)             # <<<<<<<<<<<<<<
8418  * 
8419  *             ndim = PyArray_NDIM(self)
8420  */
8421   __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0);
8422
8423   /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":209
8424  *             cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)
8425  * 
8426  *             ndim = PyArray_NDIM(self)             # <<<<<<<<<<<<<<
8427  * 
8428  *             if sizeof(npy_intp) != sizeof(Py_ssize_t):
8429  */
8430   __pyx_v_ndim = PyArray_NDIM(__pyx_v_self);
8431
8432   /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":211
8433  *             ndim = PyArray_NDIM(self)
8434  * 
8435  *             if sizeof(npy_intp) != sizeof(Py_ssize_t):             # <<<<<<<<<<<<<<
8436  *                 copy_shape = 1
8437  *             else:
8438  */
8439   __pyx_t_1 = (((sizeof(npy_intp)) != (sizeof(Py_ssize_t))) != 0);
8440   if (__pyx_t_1) {
8441
8442     /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":212
8443  * 
8444  *             if sizeof(npy_intp) != sizeof(Py_ssize_t):
8445  *                 copy_shape = 1             # <<<<<<<<<<<<<<
8446  *             else:
8447  *                 copy_shape = 0
8448  */
8449     __pyx_v_copy_shape = 1;
8450
8451     /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":211
8452  *             ndim = PyArray_NDIM(self)
8453  * 
8454  *             if sizeof(npy_intp) != sizeof(Py_ssize_t):             # <<<<<<<<<<<<<<
8455  *                 copy_shape = 1
8456  *             else:
8457  */
8458     goto __pyx_L4;
8459   }
8460
8461   /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":214
8462  *                 copy_shape = 1
8463  *             else:
8464  *                 copy_shape = 0             # <<<<<<<<<<<<<<
8465  * 
8466  *             if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS)
8467  */
8468   /*else*/ {
8469     __pyx_v_copy_shape = 0;
8470   }
8471   __pyx_L4:;
8472
8473   /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":216
8474  *                 copy_shape = 0
8475  * 
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")
8479  */
8480   __pyx_t_2 = (((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS) != 0);
8481   if (__pyx_t_2) {
8482   } else {
8483     __pyx_t_1 = __pyx_t_2;
8484     goto __pyx_L6_bool_binop_done;
8485   }
8486
8487   /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":217
8488  * 
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")
8492  * 
8493  */
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:;
8497
8498   /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":216
8499  *                 copy_shape = 0
8500  * 
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")
8504  */
8505   if (__pyx_t_1) {
8506
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")             # <<<<<<<<<<<<<<
8511  * 
8512  *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
8513  */
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)
8519
8520     /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":216
8521  *                 copy_shape = 0
8522  * 
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")
8526  */
8527   }
8528
8529   /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":220
8530  *                 raise ValueError(u"ndarray is not C contiguous")
8531  * 
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")
8535  */
8536   __pyx_t_2 = (((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS) != 0);
8537   if (__pyx_t_2) {
8538   } else {
8539     __pyx_t_1 = __pyx_t_2;
8540     goto __pyx_L9_bool_binop_done;
8541   }
8542
8543   /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":221
8544  * 
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")
8548  * 
8549  */
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:;
8553
8554   /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":220
8555  *                 raise ValueError(u"ndarray is not C contiguous")
8556  * 
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")
8560  */
8561   if (__pyx_t_1) {
8562
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")             # <<<<<<<<<<<<<<
8567  * 
8568  *             info.buf = PyArray_DATA(self)
8569  */
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)
8575
8576     /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":220
8577  *                 raise ValueError(u"ndarray is not C contiguous")
8578  * 
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")
8582  */
8583   }
8584
8585   /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":224
8586  *                 raise ValueError(u"ndarray is not Fortran contiguous")
8587  * 
8588  *             info.buf = PyArray_DATA(self)             # <<<<<<<<<<<<<<
8589  *             info.ndim = ndim
8590  *             if copy_shape:
8591  */
8592   __pyx_v_info->buf = PyArray_DATA(__pyx_v_self);
8593
8594   /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":225
8595  * 
8596  *             info.buf = PyArray_DATA(self)
8597  *             info.ndim = ndim             # <<<<<<<<<<<<<<
8598  *             if copy_shape:
8599  *                 # Allocate new buffer for strides and shape info.
8600  */
8601   __pyx_v_info->ndim = __pyx_v_ndim;
8602
8603   /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":226
8604  *             info.buf = PyArray_DATA(self)
8605  *             info.ndim = ndim
8606  *             if copy_shape:             # <<<<<<<<<<<<<<
8607  *                 # Allocate new buffer for strides and shape info.
8608  *                 # This is allocated as one block, strides first.
8609  */
8610   __pyx_t_1 = (__pyx_v_copy_shape != 0);
8611   if (__pyx_t_1) {
8612
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):
8619  */
8620     __pyx_v_info->strides = ((Py_ssize_t *)malloc((((sizeof(Py_ssize_t)) * ((size_t)__pyx_v_ndim)) * 2)));
8621
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]
8628  */
8629     __pyx_v_info->shape = (__pyx_v_info->strides + __pyx_v_ndim);
8630
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]
8637  */
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;
8641
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]
8647  *             else:
8648  */
8649       (__pyx_v_info->strides[__pyx_v_i]) = (PyArray_STRIDES(__pyx_v_self)[__pyx_v_i]);
8650
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]             # <<<<<<<<<<<<<<
8655  *             else:
8656  *                 info.strides = <Py_ssize_t*>PyArray_STRIDES(self)
8657  */
8658       (__pyx_v_info->shape[__pyx_v_i]) = (PyArray_DIMS(__pyx_v_self)[__pyx_v_i]);
8659     }
8660
8661     /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":226
8662  *             info.buf = PyArray_DATA(self)
8663  *             info.ndim = ndim
8664  *             if copy_shape:             # <<<<<<<<<<<<<<
8665  *                 # Allocate new buffer for strides and shape info.
8666  *                 # This is allocated as one block, strides first.
8667  */
8668     goto __pyx_L11;
8669   }
8670
8671   /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":235
8672  *                     info.shape[i] = PyArray_DIMS(self)[i]
8673  *             else:
8674  *                 info.strides = <Py_ssize_t*>PyArray_STRIDES(self)             # <<<<<<<<<<<<<<
8675  *                 info.shape = <Py_ssize_t*>PyArray_DIMS(self)
8676  *             info.suboffsets = NULL
8677  */
8678   /*else*/ {
8679     __pyx_v_info->strides = ((Py_ssize_t *)PyArray_STRIDES(__pyx_v_self));
8680
8681     /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":236
8682  *             else:
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)
8687  */
8688     __pyx_v_info->shape = ((Py_ssize_t *)PyArray_DIMS(__pyx_v_self));
8689   }
8690   __pyx_L11:;
8691
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)
8698  */
8699   __pyx_v_info->suboffsets = NULL;
8700
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)
8706  * 
8707  */
8708   __pyx_v_info->itemsize = PyArray_ITEMSIZE(__pyx_v_self);
8709
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)             # <<<<<<<<<<<<<<
8714  * 
8715  *             cdef int t
8716  */
8717   __pyx_v_info->readonly = (!(PyArray_ISWRITEABLE(__pyx_v_self) != 0));
8718
8719   /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":242
8720  * 
8721  *             cdef int t
8722  *             cdef char* f = NULL             # <<<<<<<<<<<<<<
8723  *             cdef dtype descr = self.descr
8724  *             cdef int offset
8725  */
8726   __pyx_v_f = NULL;
8727
8728   /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":243
8729  *             cdef int t
8730  *             cdef char* f = NULL
8731  *             cdef dtype descr = self.descr             # <<<<<<<<<<<<<<
8732  *             cdef int offset
8733  * 
8734  */
8735   __pyx_t_3 = ((PyObject *)__pyx_v_self->descr);
8736   __Pyx_INCREF(__pyx_t_3);
8737   __pyx_v_descr = ((PyArray_Descr *)__pyx_t_3);
8738   __pyx_t_3 = 0;
8739
8740   /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":246
8741  *             cdef int offset
8742  * 
8743  *             cdef bint hasfields = PyDataType_HASFIELDS(descr)             # <<<<<<<<<<<<<<
8744  * 
8745  *             if not hasfields and not copy_shape:
8746  */
8747   __pyx_v_hasfields = PyDataType_HASFIELDS(__pyx_v_descr);
8748
8749   /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":248
8750  *             cdef bint hasfields = PyDataType_HASFIELDS(descr)
8751  * 
8752  *             if not hasfields and not copy_shape:             # <<<<<<<<<<<<<<
8753  *                 # do not call releasebuffer
8754  *                 info.obj = None
8755  */
8756   __pyx_t_2 = ((!(__pyx_v_hasfields != 0)) != 0);
8757   if (__pyx_t_2) {
8758   } else {
8759     __pyx_t_1 = __pyx_t_2;
8760     goto __pyx_L15_bool_binop_done;
8761   }
8762   __pyx_t_2 = ((!(__pyx_v_copy_shape != 0)) != 0);
8763   __pyx_t_1 = __pyx_t_2;
8764   __pyx_L15_bool_binop_done:;
8765   if (__pyx_t_1) {
8766
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             # <<<<<<<<<<<<<<
8771  *             else:
8772  *                 # need to call releasebuffer
8773  */
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;
8779
8780     /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":248
8781  *             cdef bint hasfields = PyDataType_HASFIELDS(descr)
8782  * 
8783  *             if not hasfields and not copy_shape:             # <<<<<<<<<<<<<<
8784  *                 # do not call releasebuffer
8785  *                 info.obj = None
8786  */
8787     goto __pyx_L14;
8788   }
8789
8790   /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":253
8791  *             else:
8792  *                 # need to call releasebuffer
8793  *                 info.obj = self             # <<<<<<<<<<<<<<
8794  * 
8795  *             if not hasfields:
8796  */
8797   /*else*/ {
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);
8803   }
8804   __pyx_L14:;
8805
8806   /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":255
8807  *                 info.obj = self
8808  * 
8809  *             if not hasfields:             # <<<<<<<<<<<<<<
8810  *                 t = descr.type_num
8811  *                 if ((descr.byteorder == c'>' and little_endian) or
8812  */
8813   __pyx_t_1 = ((!(__pyx_v_hasfields != 0)) != 0);
8814   if (__pyx_t_1) {
8815
8816     /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":256
8817  * 
8818  *             if not hasfields:
8819  *                 t = descr.type_num             # <<<<<<<<<<<<<<
8820  *                 if ((descr.byteorder == c'>' and little_endian) or
8821  *                     (descr.byteorder == c'<' and not little_endian)):
8822  */
8823     __pyx_t_4 = __pyx_v_descr->type_num;
8824     __pyx_v_t = __pyx_t_4;
8825
8826     /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":257
8827  *             if not hasfields:
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")
8832  */
8833     __pyx_t_2 = ((__pyx_v_descr->byteorder == '>') != 0);
8834     if (!__pyx_t_2) {
8835       goto __pyx_L20_next_or;
8836     } else {
8837     }
8838     __pyx_t_2 = (__pyx_v_little_endian != 0);
8839     if (!__pyx_t_2) {
8840     } else {
8841       __pyx_t_1 = __pyx_t_2;
8842       goto __pyx_L19_bool_binop_done;
8843     }
8844     __pyx_L20_next_or:;
8845
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"
8852  */
8853     __pyx_t_2 = ((__pyx_v_descr->byteorder == '<') != 0);
8854     if (__pyx_t_2) {
8855     } else {
8856       __pyx_t_1 = __pyx_t_2;
8857       goto __pyx_L19_bool_binop_done;
8858     }
8859     __pyx_t_2 = ((!(__pyx_v_little_endian != 0)) != 0);
8860     __pyx_t_1 = __pyx_t_2;
8861     __pyx_L19_bool_binop_done:;
8862
8863     /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":257
8864  *             if not hasfields:
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")
8869  */
8870     if (__pyx_t_1) {
8871
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"
8878  */
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)
8884
8885       /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":257
8886  *             if not hasfields:
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")
8891  */
8892     }
8893
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"
8900  */
8901     switch (__pyx_v_t) {
8902       case NPY_BYTE:
8903       __pyx_v_f = ((char *)"b");
8904       break;
8905
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"
8912  */
8913       case NPY_UBYTE:
8914       __pyx_v_f = ((char *)"B");
8915       break;
8916
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"
8923  */
8924       case NPY_SHORT:
8925       __pyx_v_f = ((char *)"h");
8926       break;
8927
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"
8934  */
8935       case NPY_USHORT:
8936       __pyx_v_f = ((char *)"H");
8937       break;
8938
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"
8945  */
8946       case NPY_INT:
8947       __pyx_v_f = ((char *)"i");
8948       break;
8949
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"
8956  */
8957       case NPY_UINT:
8958       __pyx_v_f = ((char *)"I");
8959       break;
8960
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"
8967  */
8968       case NPY_LONG:
8969       __pyx_v_f = ((char *)"l");
8970       break;
8971
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"
8978  */
8979       case NPY_ULONG:
8980       __pyx_v_f = ((char *)"L");
8981       break;
8982
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"
8989  */
8990       case NPY_LONGLONG:
8991       __pyx_v_f = ((char *)"q");
8992       break;
8993
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"
9000  */
9001       case NPY_ULONGLONG:
9002       __pyx_v_f = ((char *)"Q");
9003       break;
9004
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"
9011  */
9012       case NPY_FLOAT:
9013       __pyx_v_f = ((char *)"f");
9014       break;
9015
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"
9022  */
9023       case NPY_DOUBLE:
9024       __pyx_v_f = ((char *)"d");
9025       break;
9026
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"
9033  */
9034       case NPY_LONGDOUBLE:
9035       __pyx_v_f = ((char *)"g");
9036       break;
9037
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"
9044  */
9045       case NPY_CFLOAT:
9046       __pyx_v_f = ((char *)"Zf");
9047       break;
9048
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"
9055  */
9056       case NPY_CDOUBLE:
9057       __pyx_v_f = ((char *)"Zd");
9058       break;
9059
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"
9065  *                 else:
9066  */
9067       case NPY_CLONGDOUBLE:
9068       __pyx_v_f = ((char *)"Zg");
9069       break;
9070
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"             # <<<<<<<<<<<<<<
9075  *                 else:
9076  *                     raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
9077  */
9078       case NPY_OBJECT:
9079       __pyx_v_f = ((char *)"O");
9080       break;
9081       default:
9082
9083       /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":278
9084  *                 elif t == NPY_OBJECT:      f = "O"
9085  *                 else:
9086  *                     raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)             # <<<<<<<<<<<<<<
9087  *                 info.format = f
9088  *                 return
9089  */
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);
9099       __pyx_t_6 = 0;
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)
9106       break;
9107     }
9108
9109     /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":279
9110  *                 else:
9111  *                     raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
9112  *                 info.format = f             # <<<<<<<<<<<<<<
9113  *                 return
9114  *             else:
9115  */
9116     __pyx_v_info->format = __pyx_v_f;
9117
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)
9120  *                 info.format = f
9121  *                 return             # <<<<<<<<<<<<<<
9122  *             else:
9123  *                 info.format = <char*>stdlib.malloc(_buffer_format_string_len)
9124  */
9125     __pyx_r = 0;
9126     goto __pyx_L0;
9127
9128     /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":255
9129  *                 info.obj = self
9130  * 
9131  *             if not hasfields:             # <<<<<<<<<<<<<<
9132  *                 t = descr.type_num
9133  *                 if ((descr.byteorder == c'>' and little_endian) or
9134  */
9135   }
9136
9137   /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":282
9138  *                 return
9139  *             else:
9140  *                 info.format = <char*>stdlib.malloc(_buffer_format_string_len)             # <<<<<<<<<<<<<<
9141  *                 info.format[0] = c'^' # Native data types, manual alignment
9142  *                 offset = 0
9143  */
9144   /*else*/ {
9145     __pyx_v_info->format = ((char *)malloc(0xFF));
9146
9147     /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":283
9148  *             else:
9149  *                 info.format = <char*>stdlib.malloc(_buffer_format_string_len)
9150  *                 info.format[0] = c'^' # Native data types, manual alignment             # <<<<<<<<<<<<<<
9151  *                 offset = 0
9152  *                 f = _util_dtypestring(descr, info.format + 1,
9153  */
9154     (__pyx_v_info->format[0]) = '^';
9155
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,
9162  */
9163     __pyx_v_offset = 0;
9164
9165     /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":285
9166  *                 info.format[0] = c'^' # Native data types, manual alignment
9167  *                 offset = 0
9168  *                 f = _util_dtypestring(descr, info.format + 1,             # <<<<<<<<<<<<<<
9169  *                                       info.format + _buffer_format_string_len,
9170  *                                       &offset)
9171  */
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;
9174
9175     /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":288
9176  *                                       info.format + _buffer_format_string_len,
9177  *                                       &offset)
9178  *                 f[0] = c'\0' # Terminate format string             # <<<<<<<<<<<<<<
9179  * 
9180  *         def __releasebuffer__(ndarray self, Py_buffer* info):
9181  */
9182     (__pyx_v_f[0]) = '\x00';
9183   }
9184
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.
9191  */
9192
9193   /* function exit code */
9194   __pyx_r = 0;
9195   goto __pyx_L0;
9196   __pyx_L1_error:;
9197   __Pyx_XDECREF(__pyx_t_3);
9198   __Pyx_XDECREF(__pyx_t_6);
9199   __Pyx_AddTraceback("numpy.ndarray.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename);
9200   __pyx_r = -1;
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;
9204   }
9205   goto __pyx_L2;
9206   __pyx_L0:;
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;
9210   }
9211   __pyx_L2:;
9212   __Pyx_XDECREF((PyObject *)__pyx_v_descr);
9213   __Pyx_RefNannyFinishContext();
9214   return __pyx_r;
9215 }
9216
9217 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":290
9218  *                 f[0] = c'\0' # Terminate format string
9219  * 
9220  *         def __releasebuffer__(ndarray self, Py_buffer* info):             # <<<<<<<<<<<<<<
9221  *             if PyArray_HASFIELDS(self):
9222  *                 stdlib.free(info.format)
9223  */
9224
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));
9231
9232   /* function exit code */
9233   __Pyx_RefNannyFinishContext();
9234 }
9235
9236 static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info) {
9237   __Pyx_RefNannyDeclarations
9238   int __pyx_t_1;
9239   __Pyx_RefNannySetupContext("__releasebuffer__", 0);
9240
9241   /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":291
9242  * 
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):
9247  */
9248   __pyx_t_1 = (PyArray_HASFIELDS(__pyx_v_self) != 0);
9249   if (__pyx_t_1) {
9250
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)
9257  */
9258     free(__pyx_v_info->format);
9259
9260     /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":291
9261  * 
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):
9266  */
9267   }
9268
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
9275  */
9276   __pyx_t_1 = (((sizeof(npy_intp)) != (sizeof(Py_ssize_t))) != 0);
9277   if (__pyx_t_1) {
9278
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
9284  * 
9285  */
9286     free(__pyx_v_info->strides);
9287
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
9294  */
9295   }
9296
9297   /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":290
9298  *                 f[0] = c'\0' # Terminate format string
9299  * 
9300  *         def __releasebuffer__(ndarray self, Py_buffer* info):             # <<<<<<<<<<<<<<
9301  *             if PyArray_HASFIELDS(self):
9302  *                 stdlib.free(info.format)
9303  */
9304
9305   /* function exit code */
9306   __Pyx_RefNannyFinishContext();
9307 }
9308
9309 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":770
9310  * ctypedef npy_cdouble     complex_t
9311  * 
9312  * cdef inline object PyArray_MultiIterNew1(a):             # <<<<<<<<<<<<<<
9313  *     return PyArray_MultiIterNew(1, <void*>a)
9314  * 
9315  */
9316
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);
9322
9323   /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":771
9324  * 
9325  * cdef inline object PyArray_MultiIterNew1(a):
9326  *     return PyArray_MultiIterNew(1, <void*>a)             # <<<<<<<<<<<<<<
9327  * 
9328  * cdef inline object PyArray_MultiIterNew2(a, b):
9329  */
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;
9334   __pyx_t_1 = 0;
9335   goto __pyx_L0;
9336
9337   /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":770
9338  * ctypedef npy_cdouble     complex_t
9339  * 
9340  * cdef inline object PyArray_MultiIterNew1(a):             # <<<<<<<<<<<<<<
9341  *     return PyArray_MultiIterNew(1, <void*>a)
9342  * 
9343  */
9344
9345   /* function exit code */
9346   __pyx_L1_error:;
9347   __Pyx_XDECREF(__pyx_t_1);
9348   __Pyx_AddTraceback("numpy.PyArray_MultiIterNew1", __pyx_clineno, __pyx_lineno, __pyx_filename);
9349   __pyx_r = 0;
9350   __pyx_L0:;
9351   __Pyx_XGIVEREF(__pyx_r);
9352   __Pyx_RefNannyFinishContext();
9353   return __pyx_r;
9354 }
9355
9356 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":773
9357  *     return PyArray_MultiIterNew(1, <void*>a)
9358  * 
9359  * cdef inline object PyArray_MultiIterNew2(a, b):             # <<<<<<<<<<<<<<
9360  *     return PyArray_MultiIterNew(2, <void*>a, <void*>b)
9361  * 
9362  */
9363
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);
9369
9370   /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":774
9371  * 
9372  * cdef inline object PyArray_MultiIterNew2(a, b):
9373  *     return PyArray_MultiIterNew(2, <void*>a, <void*>b)             # <<<<<<<<<<<<<<
9374  * 
9375  * cdef inline object PyArray_MultiIterNew3(a, b, c):
9376  */
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;
9381   __pyx_t_1 = 0;
9382   goto __pyx_L0;
9383
9384   /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":773
9385  *     return PyArray_MultiIterNew(1, <void*>a)
9386  * 
9387  * cdef inline object PyArray_MultiIterNew2(a, b):             # <<<<<<<<<<<<<<
9388  *     return PyArray_MultiIterNew(2, <void*>a, <void*>b)
9389  * 
9390  */
9391
9392   /* function exit code */
9393   __pyx_L1_error:;
9394   __Pyx_XDECREF(__pyx_t_1);
9395   __Pyx_AddTraceback("numpy.PyArray_MultiIterNew2", __pyx_clineno, __pyx_lineno, __pyx_filename);
9396   __pyx_r = 0;
9397   __pyx_L0:;
9398   __Pyx_XGIVEREF(__pyx_r);
9399   __Pyx_RefNannyFinishContext();
9400   return __pyx_r;
9401 }
9402
9403 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":776
9404  *     return PyArray_MultiIterNew(2, <void*>a, <void*>b)
9405  * 
9406  * cdef inline object PyArray_MultiIterNew3(a, b, c):             # <<<<<<<<<<<<<<
9407  *     return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
9408  * 
9409  */
9410
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);
9416
9417   /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":777
9418  * 
9419  * cdef inline object PyArray_MultiIterNew3(a, b, c):
9420  *     return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)             # <<<<<<<<<<<<<<
9421  * 
9422  * cdef inline object PyArray_MultiIterNew4(a, b, c, d):
9423  */
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;
9428   __pyx_t_1 = 0;
9429   goto __pyx_L0;
9430
9431   /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":776
9432  *     return PyArray_MultiIterNew(2, <void*>a, <void*>b)
9433  * 
9434  * cdef inline object PyArray_MultiIterNew3(a, b, c):             # <<<<<<<<<<<<<<
9435  *     return PyArray_MultiIterNew(3, <void*>a, <void*>b, <void*> c)
9436  * 
9437  */
9438
9439   /* function exit code */
9440   __pyx_L1_error:;
9441   __Pyx_XDECREF(__pyx_t_1);
9442   __Pyx_AddTraceback("numpy.PyArray_MultiIterNew3", __pyx_clineno, __pyx_lineno, __pyx_filename);
9443   __pyx_r = 0;
9444   __pyx_L0:;
9445   __Pyx_XGIVEREF(__pyx_r);
9446   __Pyx_RefNannyFinishContext();
9447   return __pyx_r;
9448 }
9449
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)
9452  * 
9453  * cdef inline object PyArray_MultiIterNew4(a, b, c, d):             # <<<<<<<<<<<<<<
9454  *     return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
9455  * 
9456  */
9457
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);
9463
9464   /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":780
9465  * 
9466  * cdef inline object PyArray_MultiIterNew4(a, b, c, d):
9467  *     return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)             # <<<<<<<<<<<<<<
9468  * 
9469  * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e):
9470  */
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;
9475   __pyx_t_1 = 0;
9476   goto __pyx_L0;
9477
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)
9480  * 
9481  * cdef inline object PyArray_MultiIterNew4(a, b, c, d):             # <<<<<<<<<<<<<<
9482  *     return PyArray_MultiIterNew(4, <void*>a, <void*>b, <void*>c, <void*> d)
9483  * 
9484  */
9485
9486   /* function exit code */
9487   __pyx_L1_error:;
9488   __Pyx_XDECREF(__pyx_t_1);
9489   __Pyx_AddTraceback("numpy.PyArray_MultiIterNew4", __pyx_clineno, __pyx_lineno, __pyx_filename);
9490   __pyx_r = 0;
9491   __pyx_L0:;
9492   __Pyx_XGIVEREF(__pyx_r);
9493   __Pyx_RefNannyFinishContext();
9494   return __pyx_r;
9495 }
9496
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)
9499  * 
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)
9502  * 
9503  */
9504
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);
9510
9511   /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":783
9512  * 
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)             # <<<<<<<<<<<<<<
9515  * 
9516  * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL:
9517  */
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;
9522   __pyx_t_1 = 0;
9523   goto __pyx_L0;
9524
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)
9527  * 
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)
9530  * 
9531  */
9532
9533   /* function exit code */
9534   __pyx_L1_error:;
9535   __Pyx_XDECREF(__pyx_t_1);
9536   __Pyx_AddTraceback("numpy.PyArray_MultiIterNew5", __pyx_clineno, __pyx_lineno, __pyx_filename);
9537   __pyx_r = 0;
9538   __pyx_L0:;
9539   __Pyx_XGIVEREF(__pyx_r);
9540   __Pyx_RefNannyFinishContext();
9541   return __pyx_r;
9542 }
9543
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)
9546  * 
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.
9550  */
9551
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;
9560   char *__pyx_r;
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;
9566   int __pyx_t_5;
9567   int __pyx_t_6;
9568   int __pyx_t_7;
9569   long __pyx_t_8;
9570   char *__pyx_t_9;
9571   __Pyx_RefNannySetupContext("_util_dtypestring", 0);
9572
9573   /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":790
9574  * 
9575  *     cdef dtype child
9576  *     cdef int endian_detector = 1             # <<<<<<<<<<<<<<
9577  *     cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)
9578  *     cdef tuple fields
9579  */
9580   __pyx_v_endian_detector = 1;
9581
9582   /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":791
9583  *     cdef dtype child
9584  *     cdef int endian_detector = 1
9585  *     cdef bint little_endian = ((<char*>&endian_detector)[0] != 0)             # <<<<<<<<<<<<<<
9586  *     cdef tuple fields
9587  * 
9588  */
9589   __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0);
9590
9591   /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":794
9592  *     cdef tuple fields
9593  * 
9594  *     for childname in descr.names:             # <<<<<<<<<<<<<<
9595  *         fields = descr.fields[childname]
9596  *         child, new_offset = fields
9597  */
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)
9601   }
9602   __pyx_t_1 = __pyx_v_descr->names; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0;
9603   for (;;) {
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)
9607     #else
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);
9610     #endif
9611     __Pyx_XDECREF_SET(__pyx_v_childname, __pyx_t_3);
9612     __pyx_t_3 = 0;
9613
9614     /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":795
9615  * 
9616  *     for childname in descr.names:
9617  *         fields = descr.fields[childname]             # <<<<<<<<<<<<<<
9618  *         child, new_offset = fields
9619  * 
9620  */
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)
9624     }
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));
9629     __pyx_t_3 = 0;
9630
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             # <<<<<<<<<<<<<<
9635  * 
9636  *         if (end - f) - <int>(new_offset - offset[0]) < 15:
9637  */
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);
9642       #else
9643       Py_ssize_t size = PySequence_Size(sequence);
9644       #endif
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)
9649       }
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);
9655       #else
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);
9660       #endif
9661     } else {
9662       __Pyx_RaiseNoneNotIterableError(); __PYX_ERR(1, 796, __pyx_L1_error)
9663     }
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));
9666     __pyx_t_3 = 0;
9667     __Pyx_XDECREF_SET(__pyx_v_new_offset, __pyx_t_4);
9668     __pyx_t_4 = 0;
9669
9670     /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":798
9671  *         child, new_offset = fields
9672  * 
9673  *         if (end - f) - <int>(new_offset - offset[0]) < 15:             # <<<<<<<<<<<<<<
9674  *             raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
9675  * 
9676  */
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);
9685     if (__pyx_t_6) {
9686
9687       /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":799
9688  * 
9689  *         if (end - f) - <int>(new_offset - offset[0]) < 15:
9690  *             raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")             # <<<<<<<<<<<<<<
9691  * 
9692  *         if ((child.byteorder == c'>' and little_endian) or
9693  */
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)
9699
9700       /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":798
9701  *         child, new_offset = fields
9702  * 
9703  *         if (end - f) - <int>(new_offset - offset[0]) < 15:             # <<<<<<<<<<<<<<
9704  *             raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")
9705  * 
9706  */
9707     }
9708
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")
9711  * 
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")
9715  */
9716     __pyx_t_7 = ((__pyx_v_child->byteorder == '>') != 0);
9717     if (!__pyx_t_7) {
9718       goto __pyx_L8_next_or;
9719     } else {
9720     }
9721     __pyx_t_7 = (__pyx_v_little_endian != 0);
9722     if (!__pyx_t_7) {
9723     } else {
9724       __pyx_t_6 = __pyx_t_7;
9725       goto __pyx_L7_bool_binop_done;
9726     }
9727     __pyx_L8_next_or:;
9728
9729     /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":802
9730  * 
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
9735  */
9736     __pyx_t_7 = ((__pyx_v_child->byteorder == '<') != 0);
9737     if (__pyx_t_7) {
9738     } else {
9739       __pyx_t_6 = __pyx_t_7;
9740       goto __pyx_L7_bool_binop_done;
9741     }
9742     __pyx_t_7 = ((!(__pyx_v_little_endian != 0)) != 0);
9743     __pyx_t_6 = __pyx_t_7;
9744     __pyx_L7_bool_binop_done:;
9745
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")
9748  * 
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")
9752  */
9753     if (__pyx_t_6) {
9754
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
9761  */
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)
9767
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")
9770  * 
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")
9774  */
9775     }
9776
9777     /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":813
9778  * 
9779  *         # Output padding bytes
9780  *         while offset[0] < new_offset:             # <<<<<<<<<<<<<<
9781  *             f[0] = 120 # "x"; pad byte
9782  *             f += 1
9783  */
9784     while (1) {
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;
9792
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             # <<<<<<<<<<<<<<
9797  *             f += 1
9798  *             offset[0] += 1
9799  */
9800       (__pyx_v_f[0]) = 0x78;
9801
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             # <<<<<<<<<<<<<<
9806  *             offset[0] += 1
9807  * 
9808  */
9809       __pyx_v_f = (__pyx_v_f + 1);
9810
9811       /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":816
9812  *             f[0] = 120 # "x"; pad byte
9813  *             f += 1
9814  *             offset[0] += 1             # <<<<<<<<<<<<<<
9815  * 
9816  *         offset[0] += child.itemsize
9817  */
9818       __pyx_t_8 = 0;
9819       (__pyx_v_offset[__pyx_t_8]) = ((__pyx_v_offset[__pyx_t_8]) + 1);
9820     }
9821
9822     /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":818
9823  *             offset[0] += 1
9824  * 
9825  *         offset[0] += child.itemsize             # <<<<<<<<<<<<<<
9826  * 
9827  *         if not PyDataType_HASFIELDS(child):
9828  */
9829     __pyx_t_8 = 0;
9830     (__pyx_v_offset[__pyx_t_8]) = ((__pyx_v_offset[__pyx_t_8]) + __pyx_v_child->elsize);
9831
9832     /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":820
9833  *         offset[0] += child.itemsize
9834  * 
9835  *         if not PyDataType_HASFIELDS(child):             # <<<<<<<<<<<<<<
9836  *             t = child.type_num
9837  *             if end - f < 5:
9838  */
9839     __pyx_t_6 = ((!(PyDataType_HASFIELDS(__pyx_v_child) != 0)) != 0);
9840     if (__pyx_t_6) {
9841
9842       /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":821
9843  * 
9844  *         if not PyDataType_HASFIELDS(child):
9845  *             t = child.type_num             # <<<<<<<<<<<<<<
9846  *             if end - f < 5:
9847  *                 raise RuntimeError(u"Format string allocated too short.")
9848  */
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);
9852       __pyx_t_4 = 0;
9853
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.")
9859  * 
9860  */
9861       __pyx_t_6 = (((__pyx_v_end - __pyx_v_f) < 5) != 0);
9862       if (__pyx_t_6) {
9863
9864         /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":823
9865  *             t = child.type_num
9866  *             if end - f < 5:
9867  *                 raise RuntimeError(u"Format string allocated too short.")             # <<<<<<<<<<<<<<
9868  * 
9869  *             # Until ticket #99 is fixed, use integers to avoid warnings
9870  */
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)
9876
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.")
9882  * 
9883  */
9884       }
9885
9886       /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":826
9887  * 
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"
9892  */
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;
9899       if (__pyx_t_6) {
9900         (__pyx_v_f[0]) = 98;
9901         goto __pyx_L15;
9902       }
9903
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"
9910  */
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;
9917       if (__pyx_t_6) {
9918         (__pyx_v_f[0]) = 66;
9919         goto __pyx_L15;
9920       }
9921
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"
9928  */
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;
9935       if (__pyx_t_6) {
9936         (__pyx_v_f[0]) = 0x68;
9937         goto __pyx_L15;
9938       }
9939
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"
9946  */
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;
9953       if (__pyx_t_6) {
9954         (__pyx_v_f[0]) = 72;
9955         goto __pyx_L15;
9956       }
9957
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"
9964  */
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;
9971       if (__pyx_t_6) {
9972         (__pyx_v_f[0]) = 0x69;
9973         goto __pyx_L15;
9974       }
9975
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"
9982  */
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;
9989       if (__pyx_t_6) {
9990         (__pyx_v_f[0]) = 73;
9991         goto __pyx_L15;
9992       }
9993
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"
10000  */
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;
10007       if (__pyx_t_6) {
10008         (__pyx_v_f[0]) = 0x6C;
10009         goto __pyx_L15;
10010       }
10011
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"
10018  */
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;
10025       if (__pyx_t_6) {
10026         (__pyx_v_f[0]) = 76;
10027         goto __pyx_L15;
10028       }
10029
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"
10036  */
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;
10043       if (__pyx_t_6) {
10044         (__pyx_v_f[0]) = 0x71;
10045         goto __pyx_L15;
10046       }
10047
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"
10054  */
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;
10061       if (__pyx_t_6) {
10062         (__pyx_v_f[0]) = 81;
10063         goto __pyx_L15;
10064       }
10065
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"
10072  */
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;
10079       if (__pyx_t_6) {
10080         (__pyx_v_f[0]) = 0x66;
10081         goto __pyx_L15;
10082       }
10083
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
10090  */
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;
10097       if (__pyx_t_6) {
10098         (__pyx_v_f[0]) = 0x64;
10099         goto __pyx_L15;
10100       }
10101
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
10108  */
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;
10115       if (__pyx_t_6) {
10116         (__pyx_v_f[0]) = 0x67;
10117         goto __pyx_L15;
10118       }
10119
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
10126  */
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;
10133       if (__pyx_t_6) {
10134         (__pyx_v_f[0]) = 90;
10135         (__pyx_v_f[1]) = 0x66;
10136         __pyx_v_f = (__pyx_v_f + 1);
10137         goto __pyx_L15;
10138       }
10139
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"
10146  */
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;
10153       if (__pyx_t_6) {
10154         (__pyx_v_f[0]) = 90;
10155         (__pyx_v_f[1]) = 0x64;
10156         __pyx_v_f = (__pyx_v_f + 1);
10157         goto __pyx_L15;
10158       }
10159
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"
10165  *             else:
10166  */
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;
10173       if (__pyx_t_6) {
10174         (__pyx_v_f[0]) = 90;
10175         (__pyx_v_f[1]) = 0x67;
10176         __pyx_v_f = (__pyx_v_f + 1);
10177         goto __pyx_L15;
10178       }
10179
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"             # <<<<<<<<<<<<<<
10184  *             else:
10185  *                 raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
10186  */
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;
10193       if (__pyx_t_6) {
10194         (__pyx_v_f[0]) = 79;
10195         goto __pyx_L15;
10196       }
10197
10198       /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":844
10199  *             elif t == NPY_OBJECT:      f[0] = 79 #"O"
10200  *             else:
10201  *                 raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)             # <<<<<<<<<<<<<<
10202  *             f += 1
10203  *         else:
10204  */
10205       /*else*/ {
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);
10212         __pyx_t_3 = 0;
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)
10219       }
10220       __pyx_L15:;
10221
10222       /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":845
10223  *             else:
10224  *                 raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t)
10225  *             f += 1             # <<<<<<<<<<<<<<
10226  *         else:
10227  *             # Cython ignores struct boundary information ("T{...}"),
10228  */
10229       __pyx_v_f = (__pyx_v_f + 1);
10230
10231       /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":820
10232  *         offset[0] += child.itemsize
10233  * 
10234  *         if not PyDataType_HASFIELDS(child):             # <<<<<<<<<<<<<<
10235  *             t = child.type_num
10236  *             if end - f < 5:
10237  */
10238       goto __pyx_L13;
10239     }
10240
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)             # <<<<<<<<<<<<<<
10245  *     return f
10246  * 
10247  */
10248     /*else*/ {
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;
10251     }
10252     __pyx_L13:;
10253
10254     /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":794
10255  *     cdef tuple fields
10256  * 
10257  *     for childname in descr.names:             # <<<<<<<<<<<<<<
10258  *         fields = descr.fields[childname]
10259  *         child, new_offset = fields
10260  */
10261   }
10262   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
10263
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             # <<<<<<<<<<<<<<
10268  * 
10269  * 
10270  */
10271   __pyx_r = __pyx_v_f;
10272   goto __pyx_L0;
10273
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)
10276  * 
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.
10280  */
10281
10282   /* function exit code */
10283   __pyx_L1_error:;
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);
10288   __pyx_r = NULL;
10289   __pyx_L0:;
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();
10296   return __pyx_r;
10297 }
10298
10299 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":966
10300  * 
10301  * 
10302  * cdef inline void set_array_base(ndarray arr, object base):             # <<<<<<<<<<<<<<
10303  *      cdef PyObject* baseptr
10304  *      if base is None:
10305  */
10306
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
10310   int __pyx_t_1;
10311   int __pyx_t_2;
10312   __Pyx_RefNannySetupContext("set_array_base", 0);
10313
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:             # <<<<<<<<<<<<<<
10318  *          baseptr = NULL
10319  *      else:
10320  */
10321   __pyx_t_1 = (__pyx_v_base == Py_None);
10322   __pyx_t_2 = (__pyx_t_1 != 0);
10323   if (__pyx_t_2) {
10324
10325     /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":969
10326  *      cdef PyObject* baseptr
10327  *      if base is None:
10328  *          baseptr = NULL             # <<<<<<<<<<<<<<
10329  *      else:
10330  *          Py_INCREF(base) # important to do this before decref below!
10331  */
10332     __pyx_v_baseptr = NULL;
10333
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:             # <<<<<<<<<<<<<<
10338  *          baseptr = NULL
10339  *      else:
10340  */
10341     goto __pyx_L3;
10342   }
10343
10344   /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":971
10345  *          baseptr = NULL
10346  *      else:
10347  *          Py_INCREF(base) # important to do this before decref below!             # <<<<<<<<<<<<<<
10348  *          baseptr = <PyObject*>base
10349  *      Py_XDECREF(arr.base)
10350  */
10351   /*else*/ {
10352     Py_INCREF(__pyx_v_base);
10353
10354     /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":972
10355  *      else:
10356  *          Py_INCREF(base) # important to do this before decref below!
10357  *          baseptr = <PyObject*>base             # <<<<<<<<<<<<<<
10358  *      Py_XDECREF(arr.base)
10359  *      arr.base = baseptr
10360  */
10361     __pyx_v_baseptr = ((PyObject *)__pyx_v_base);
10362   }
10363   __pyx_L3:;
10364
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
10370  * 
10371  */
10372   Py_XDECREF(__pyx_v_arr->base);
10373
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             # <<<<<<<<<<<<<<
10378  * 
10379  * cdef inline object get_array_base(ndarray arr):
10380  */
10381   __pyx_v_arr->base = __pyx_v_baseptr;
10382
10383   /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":966
10384  * 
10385  * 
10386  * cdef inline void set_array_base(ndarray arr, object base):             # <<<<<<<<<<<<<<
10387  *      cdef PyObject* baseptr
10388  *      if base is None:
10389  */
10390
10391   /* function exit code */
10392   __Pyx_RefNannyFinishContext();
10393 }
10394
10395 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":976
10396  *      arr.base = baseptr
10397  * 
10398  * cdef inline object get_array_base(ndarray arr):             # <<<<<<<<<<<<<<
10399  *     if arr.base is NULL:
10400  *         return None
10401  */
10402
10403 static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__pyx_v_arr) {
10404   PyObject *__pyx_r = NULL;
10405   __Pyx_RefNannyDeclarations
10406   int __pyx_t_1;
10407   __Pyx_RefNannySetupContext("get_array_base", 0);
10408
10409   /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":977
10410  * 
10411  * cdef inline object get_array_base(ndarray arr):
10412  *     if arr.base is NULL:             # <<<<<<<<<<<<<<
10413  *         return None
10414  *     else:
10415  */
10416   __pyx_t_1 = ((__pyx_v_arr->base == NULL) != 0);
10417   if (__pyx_t_1) {
10418
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             # <<<<<<<<<<<<<<
10423  *     else:
10424  *         return <object>arr.base
10425  */
10426     __Pyx_XDECREF(__pyx_r);
10427     __Pyx_INCREF(Py_None);
10428     __pyx_r = Py_None;
10429     goto __pyx_L0;
10430
10431     /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":977
10432  * 
10433  * cdef inline object get_array_base(ndarray arr):
10434  *     if arr.base is NULL:             # <<<<<<<<<<<<<<
10435  *         return None
10436  *     else:
10437  */
10438   }
10439
10440   /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":980
10441  *         return None
10442  *     else:
10443  *         return <object>arr.base             # <<<<<<<<<<<<<<
10444  * 
10445  * 
10446  */
10447   /*else*/ {
10448     __Pyx_XDECREF(__pyx_r);
10449     __Pyx_INCREF(((PyObject *)__pyx_v_arr->base));
10450     __pyx_r = ((PyObject *)__pyx_v_arr->base);
10451     goto __pyx_L0;
10452   }
10453
10454   /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":976
10455  *      arr.base = baseptr
10456  * 
10457  * cdef inline object get_array_base(ndarray arr):             # <<<<<<<<<<<<<<
10458  *     if arr.base is NULL:
10459  *         return None
10460  */
10461
10462   /* function exit code */
10463   __pyx_L0:;
10464   __Pyx_XGIVEREF(__pyx_r);
10465   __Pyx_RefNannyFinishContext();
10466   return __pyx_r;
10467 }
10468
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
10471  * # Cython code.
10472  * cdef inline int import_array() except -1:             # <<<<<<<<<<<<<<
10473  *     try:
10474  *         _import_array()
10475  */
10476
10477 static CYTHON_INLINE int __pyx_f_5numpy_import_array(void) {
10478   int __pyx_r;
10479   __Pyx_RefNannyDeclarations
10480   PyObject *__pyx_t_1 = NULL;
10481   PyObject *__pyx_t_2 = NULL;
10482   PyObject *__pyx_t_3 = NULL;
10483   int __pyx_t_4;
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);
10489
10490   /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":986
10491  * # Cython code.
10492  * cdef inline int import_array() except -1:
10493  *     try:             # <<<<<<<<<<<<<<
10494  *         _import_array()
10495  *     except Exception:
10496  */
10497   {
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);
10504     /*try:*/ {
10505
10506       /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":987
10507  * cdef inline int import_array() except -1:
10508  *     try:
10509  *         _import_array()             # <<<<<<<<<<<<<<
10510  *     except Exception:
10511  *         raise ImportError("numpy.core.multiarray failed to import")
10512  */
10513       __pyx_t_4 = _import_array(); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(1, 987, __pyx_L3_error)
10514
10515       /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":986
10516  * # Cython code.
10517  * cdef inline int import_array() except -1:
10518  *     try:             # <<<<<<<<<<<<<<
10519  *         _import_array()
10520  *     except Exception:
10521  */
10522     }
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;
10527     __pyx_L3_error:;
10528     __Pyx_PyThreadState_assign
10529
10530     /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":988
10531  *     try:
10532  *         _import_array()
10533  *     except Exception:             # <<<<<<<<<<<<<<
10534  *         raise ImportError("numpy.core.multiarray failed to import")
10535  * 
10536  */
10537     __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
10538     if (__pyx_t_4) {
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);
10544
10545       /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":989
10546  *         _import_array()
10547  *     except Exception:
10548  *         raise ImportError("numpy.core.multiarray failed to import")             # <<<<<<<<<<<<<<
10549  * 
10550  * cdef inline int import_umath() except -1:
10551  */
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)
10557     }
10558     goto __pyx_L5_except_error;
10559     __pyx_L5_except_error:;
10560
10561     /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":986
10562  * # Cython code.
10563  * cdef inline int import_array() except -1:
10564  *     try:             # <<<<<<<<<<<<<<
10565  *         _import_array()
10566  *     except Exception:
10567  */
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:;
10575   }
10576
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
10579  * # Cython code.
10580  * cdef inline int import_array() except -1:             # <<<<<<<<<<<<<<
10581  *     try:
10582  *         _import_array()
10583  */
10584
10585   /* function exit code */
10586   __pyx_r = 0;
10587   goto __pyx_L0;
10588   __pyx_L1_error:;
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);
10594   __pyx_r = -1;
10595   __pyx_L0:;
10596   __Pyx_RefNannyFinishContext();
10597   return __pyx_r;
10598 }
10599
10600 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":991
10601  *         raise ImportError("numpy.core.multiarray failed to import")
10602  * 
10603  * cdef inline int import_umath() except -1:             # <<<<<<<<<<<<<<
10604  *     try:
10605  *         _import_umath()
10606  */
10607
10608 static CYTHON_INLINE int __pyx_f_5numpy_import_umath(void) {
10609   int __pyx_r;
10610   __Pyx_RefNannyDeclarations
10611   PyObject *__pyx_t_1 = NULL;
10612   PyObject *__pyx_t_2 = NULL;
10613   PyObject *__pyx_t_3 = NULL;
10614   int __pyx_t_4;
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);
10620
10621   /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":992
10622  * 
10623  * cdef inline int import_umath() except -1:
10624  *     try:             # <<<<<<<<<<<<<<
10625  *         _import_umath()
10626  *     except Exception:
10627  */
10628   {
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);
10635     /*try:*/ {
10636
10637       /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":993
10638  * cdef inline int import_umath() except -1:
10639  *     try:
10640  *         _import_umath()             # <<<<<<<<<<<<<<
10641  *     except Exception:
10642  *         raise ImportError("numpy.core.umath failed to import")
10643  */
10644       __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(1, 993, __pyx_L3_error)
10645
10646       /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":992
10647  * 
10648  * cdef inline int import_umath() except -1:
10649  *     try:             # <<<<<<<<<<<<<<
10650  *         _import_umath()
10651  *     except Exception:
10652  */
10653     }
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;
10658     __pyx_L3_error:;
10659     __Pyx_PyThreadState_assign
10660
10661     /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":994
10662  *     try:
10663  *         _import_umath()
10664  *     except Exception:             # <<<<<<<<<<<<<<
10665  *         raise ImportError("numpy.core.umath failed to import")
10666  * 
10667  */
10668     __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
10669     if (__pyx_t_4) {
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);
10675
10676       /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":995
10677  *         _import_umath()
10678  *     except Exception:
10679  *         raise ImportError("numpy.core.umath failed to import")             # <<<<<<<<<<<<<<
10680  * 
10681  * cdef inline int import_ufunc() except -1:
10682  */
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)
10688     }
10689     goto __pyx_L5_except_error;
10690     __pyx_L5_except_error:;
10691
10692     /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":992
10693  * 
10694  * cdef inline int import_umath() except -1:
10695  *     try:             # <<<<<<<<<<<<<<
10696  *         _import_umath()
10697  *     except Exception:
10698  */
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:;
10706   }
10707
10708   /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":991
10709  *         raise ImportError("numpy.core.multiarray failed to import")
10710  * 
10711  * cdef inline int import_umath() except -1:             # <<<<<<<<<<<<<<
10712  *     try:
10713  *         _import_umath()
10714  */
10715
10716   /* function exit code */
10717   __pyx_r = 0;
10718   goto __pyx_L0;
10719   __pyx_L1_error:;
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);
10725   __pyx_r = -1;
10726   __pyx_L0:;
10727   __Pyx_RefNannyFinishContext();
10728   return __pyx_r;
10729 }
10730
10731 /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":997
10732  *         raise ImportError("numpy.core.umath failed to import")
10733  * 
10734  * cdef inline int import_ufunc() except -1:             # <<<<<<<<<<<<<<
10735  *     try:
10736  *         _import_umath()
10737  */
10738
10739 static CYTHON_INLINE int __pyx_f_5numpy_import_ufunc(void) {
10740   int __pyx_r;
10741   __Pyx_RefNannyDeclarations
10742   PyObject *__pyx_t_1 = NULL;
10743   PyObject *__pyx_t_2 = NULL;
10744   PyObject *__pyx_t_3 = NULL;
10745   int __pyx_t_4;
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);
10751
10752   /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":998
10753  * 
10754  * cdef inline int import_ufunc() except -1:
10755  *     try:             # <<<<<<<<<<<<<<
10756  *         _import_umath()
10757  *     except Exception:
10758  */
10759   {
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);
10766     /*try:*/ {
10767
10768       /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":999
10769  * cdef inline int import_ufunc() except -1:
10770  *     try:
10771  *         _import_umath()             # <<<<<<<<<<<<<<
10772  *     except Exception:
10773  *         raise ImportError("numpy.core.umath failed to import")
10774  */
10775       __pyx_t_4 = _import_umath(); if (unlikely(__pyx_t_4 == -1)) __PYX_ERR(1, 999, __pyx_L3_error)
10776
10777       /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":998
10778  * 
10779  * cdef inline int import_ufunc() except -1:
10780  *     try:             # <<<<<<<<<<<<<<
10781  *         _import_umath()
10782  *     except Exception:
10783  */
10784     }
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;
10789     __pyx_L3_error:;
10790     __Pyx_PyThreadState_assign
10791
10792     /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1000
10793  *     try:
10794  *         _import_umath()
10795  *     except Exception:             # <<<<<<<<<<<<<<
10796  *         raise ImportError("numpy.core.umath failed to import")
10797  */
10798     __pyx_t_4 = __Pyx_PyErr_ExceptionMatches(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0])));
10799     if (__pyx_t_4) {
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);
10805
10806       /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1001
10807  *         _import_umath()
10808  *     except Exception:
10809  *         raise ImportError("numpy.core.umath failed to import")             # <<<<<<<<<<<<<<
10810  */
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)
10816     }
10817     goto __pyx_L5_except_error;
10818     __pyx_L5_except_error:;
10819
10820     /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":998
10821  * 
10822  * cdef inline int import_ufunc() except -1:
10823  *     try:             # <<<<<<<<<<<<<<
10824  *         _import_umath()
10825  *     except Exception:
10826  */
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:;
10834   }
10835
10836   /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":997
10837  *         raise ImportError("numpy.core.umath failed to import")
10838  * 
10839  * cdef inline int import_ufunc() except -1:             # <<<<<<<<<<<<<<
10840  *     try:
10841  *         _import_umath()
10842  */
10843
10844   /* function exit code */
10845   __pyx_r = 0;
10846   goto __pyx_L0;
10847   __pyx_L1_error:;
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);
10853   __pyx_r = -1;
10854   __pyx_L0:;
10855   __Pyx_RefNannyFinishContext();
10856   return __pyx_r;
10857 }
10858
10859 static PyObject *__pyx_tp_new_11pycocotools_5_mask_RLEs(PyTypeObject *t, PyObject *a, PyObject *k) {
10860   PyObject *o;
10861   if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
10862     o = (*t->tp_alloc)(t, 0);
10863   } else {
10864     o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
10865   }
10866   if (unlikely(!o)) return 0;
10867   if (unlikely(__pyx_pw_11pycocotools_5_mask_4RLEs_1__cinit__(o, a, k) < 0)) goto bad;
10868   return o;
10869   bad:
10870   Py_DECREF(o); o = 0;
10871   return NULL;
10872 }
10873
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;
10878   }
10879   #endif
10880   {
10881     PyObject *etype, *eval, *etb;
10882     PyErr_Fetch(&etype, &eval, &etb);
10883     ++Py_REFCNT(o);
10884     __pyx_pw_11pycocotools_5_mask_4RLEs_3__dealloc__(o);
10885     --Py_REFCNT(o);
10886     PyErr_Restore(etype, eval, etb);
10887   }
10888   (*Py_TYPE(o)->tp_free)(o);
10889 }
10890
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)) {
10894     PyErr_Clear();
10895     v = __pyx_pw_11pycocotools_5_mask_4RLEs_5__getattr__(o, n);
10896   }
10897   return v;
10898 }
10899
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},
10902   {0, 0, 0, 0}
10903 };
10904
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*/
10909   0, /*tp_itemsize*/
10910   __pyx_tp_dealloc_11pycocotools_5_mask_RLEs, /*tp_dealloc*/
10911   0, /*tp_print*/
10912   0, /*tp_getattr*/
10913   0, /*tp_setattr*/
10914   #if PY_MAJOR_VERSION < 3
10915   0, /*tp_compare*/
10916   #endif
10917   #if PY_MAJOR_VERSION >= 3
10918   0, /*tp_as_async*/
10919   #endif
10920   0, /*tp_repr*/
10921   0, /*tp_as_number*/
10922   0, /*tp_as_sequence*/
10923   0, /*tp_as_mapping*/
10924   0, /*tp_hash*/
10925   0, /*tp_call*/
10926   0, /*tp_str*/
10927   __pyx_tp_getattro_11pycocotools_5_mask_RLEs, /*tp_getattro*/
10928   0, /*tp_setattro*/
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*/
10931   0, /*tp_doc*/
10932   0, /*tp_traverse*/
10933   0, /*tp_clear*/
10934   0, /*tp_richcompare*/
10935   0, /*tp_weaklistoffset*/
10936   0, /*tp_iter*/
10937   0, /*tp_iternext*/
10938   __pyx_methods_11pycocotools_5_mask_RLEs, /*tp_methods*/
10939   0, /*tp_members*/
10940   0, /*tp_getset*/
10941   0, /*tp_base*/
10942   0, /*tp_dict*/
10943   0, /*tp_descr_get*/
10944   0, /*tp_descr_set*/
10945   0, /*tp_dictoffset*/
10946   0, /*tp_init*/
10947   0, /*tp_alloc*/
10948   __pyx_tp_new_11pycocotools_5_mask_RLEs, /*tp_new*/
10949   0, /*tp_free*/
10950   0, /*tp_is_gc*/
10951   0, /*tp_bases*/
10952   0, /*tp_mro*/
10953   0, /*tp_cache*/
10954   0, /*tp_subclasses*/
10955   0, /*tp_weaklist*/
10956   0, /*tp_del*/
10957   0, /*tp_version_tag*/
10958   #if PY_VERSION_HEX >= 0x030400a1
10959   0, /*tp_finalize*/
10960   #endif
10961 };
10962
10963 static PyObject *__pyx_tp_new_11pycocotools_5_mask_Masks(PyTypeObject *t, PyObject *a, PyObject *k) {
10964   PyObject *o;
10965   if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) {
10966     o = (*t->tp_alloc)(t, 0);
10967   } else {
10968     o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0);
10969   }
10970   if (unlikely(!o)) return 0;
10971   if (unlikely(__pyx_pw_11pycocotools_5_mask_5Masks_1__cinit__(o, a, k) < 0)) goto bad;
10972   return o;
10973   bad:
10974   Py_DECREF(o); o = 0;
10975   return NULL;
10976 }
10977
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;
10982   }
10983   #endif
10984   (*Py_TYPE(o)->tp_free)(o);
10985 }
10986
10987 static PyMethodDef __pyx_methods_11pycocotools_5_mask_Masks[] = {
10988   {"__array__", (PyCFunction)__pyx_pw_11pycocotools_5_mask_5Masks_3__array__, METH_NOARGS, 0},
10989   {0, 0, 0, 0}
10990 };
10991
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*/
10996   0, /*tp_itemsize*/
10997   __pyx_tp_dealloc_11pycocotools_5_mask_Masks, /*tp_dealloc*/
10998   0, /*tp_print*/
10999   0, /*tp_getattr*/
11000   0, /*tp_setattr*/
11001   #if PY_MAJOR_VERSION < 3
11002   0, /*tp_compare*/
11003   #endif
11004   #if PY_MAJOR_VERSION >= 3
11005   0, /*tp_as_async*/
11006   #endif
11007   0, /*tp_repr*/
11008   0, /*tp_as_number*/
11009   0, /*tp_as_sequence*/
11010   0, /*tp_as_mapping*/
11011   0, /*tp_hash*/
11012   0, /*tp_call*/
11013   0, /*tp_str*/
11014   0, /*tp_getattro*/
11015   0, /*tp_setattro*/
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*/
11018   0, /*tp_doc*/
11019   0, /*tp_traverse*/
11020   0, /*tp_clear*/
11021   0, /*tp_richcompare*/
11022   0, /*tp_weaklistoffset*/
11023   0, /*tp_iter*/
11024   0, /*tp_iternext*/
11025   __pyx_methods_11pycocotools_5_mask_Masks, /*tp_methods*/
11026   0, /*tp_members*/
11027   0, /*tp_getset*/
11028   0, /*tp_base*/
11029   0, /*tp_dict*/
11030   0, /*tp_descr_get*/
11031   0, /*tp_descr_set*/
11032   0, /*tp_dictoffset*/
11033   0, /*tp_init*/
11034   0, /*tp_alloc*/
11035   __pyx_tp_new_11pycocotools_5_mask_Masks, /*tp_new*/
11036   0, /*tp_free*/
11037   0, /*tp_is_gc*/
11038   0, /*tp_bases*/
11039   0, /*tp_mro*/
11040   0, /*tp_cache*/
11041   0, /*tp_subclasses*/
11042   0, /*tp_weaklist*/
11043   0, /*tp_del*/
11044   0, /*tp_version_tag*/
11045   #if PY_VERSION_HEX >= 0x030400a1
11046   0, /*tp_finalize*/
11047   #endif
11048 };
11049
11050 static PyMethodDef __pyx_methods[] = {
11051   {0, 0, 0, 0}
11052 };
11053
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 },
11058   #else
11059     PyModuleDef_HEAD_INIT,
11060   #endif
11061     "_mask",
11062     0, /* m_doc */
11063     -1, /* m_size */
11064     __pyx_methods /* m_methods */,
11065     NULL, /* m_reload */
11066     NULL, /* m_traverse */
11067     NULL, /* m_clear */
11068     NULL /* m_free */
11069 };
11070 #endif
11071
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}
11178 };
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)
11186   return 0;
11187   __pyx_L1_error:;
11188   return -1;
11189 }
11190
11191 static int __Pyx_InitCachedConstants(void) {
11192   __Pyx_RefNannyDeclarations
11193   __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);
11194
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']
11201  */
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_);
11205
11206   /* "pycocotools/_mask.pyx":130
11207  *             py_string = str.encode(obj['counts']) if type(obj['counts']) == str else obj['counts']
11208  *         else:
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] )
11212  */
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);
11216
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]
11223  */
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);
11227
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:
11234  */
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);
11238
11239   /* "pycocotools/_mask.pyx":193
11240  *                 objs = _frString(objs)
11241  *             else:
11242  *                 raise Exception('list input can be bounding box (Nx4) or RLEs ([RLE])')             # <<<<<<<<<<<<<<
11243  *         else:
11244  *             raise Exception('unrecognized type.  The following type: RLEs (rle), np.ndarray (box), and list (box) are supported.')
11245  */
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);
11249
11250   /* "pycocotools/_mask.pyx":195
11251  *                 raise Exception('list input can be bounding box (Nx4) or RLEs ([RLE])')
11252  *         else:
11253  *             raise Exception('unrecognized type.  The following type: RLEs (rle), np.ndarray (box), and list (box) are supported.')             # <<<<<<<<<<<<<<
11254  *         return objs
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):
11256  */
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);
11260
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:
11266  *             return objs
11267  */
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)
11272
11273   /* "pycocotools/_mask.pyx":197
11274  *             raise Exception('unrecognized type.  The following type: RLEs (rle), np.ndarray (box), and list (box) are supported.')
11275  *         return objs
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):
11279  */
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)
11284
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 )
11290  *     def _len(obj):
11291  */
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)
11296
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):             # <<<<<<<<<<<<<<
11301  *         cdef siz N = 0
11302  *         if type(obj) == RLEs:
11303  */
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)
11308
11309   /* "pycocotools/_mask.pyx":221
11310  *         return []
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')             # <<<<<<<<<<<<<<
11313  * 
11314  *     # define local variables
11315  */
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);
11319
11320   /* "pycocotools/_mask.pyx":232
11321  *         _iouFun = _bbIou
11322  *     else:
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)
11326  */
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);
11330
11331   /* "pycocotools/_mask.pyx":277
11332  *     objs = []
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
11337  */
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);
11341
11342   /* "pycocotools/_mask.pyx":307
11343  *         objs = frUncompressedRLE([pyobj], h, w)[0]
11344  *     else:
11345  *         raise Exception('input type is not supported.')             # <<<<<<<<<<<<<<
11346  *     return objs
11347  */
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);
11351
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")             # <<<<<<<<<<<<<<
11356  * 
11357  *             if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS)
11358  */
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);
11362
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")             # <<<<<<<<<<<<<<
11367  * 
11368  *             info.buf = PyArray_DATA(self)
11369  */
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);
11373
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"
11380  */
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);
11384
11385   /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":799
11386  * 
11387  *         if (end - f) - <int>(new_offset - offset[0]) < 15:
11388  *             raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd")             # <<<<<<<<<<<<<<
11389  * 
11390  *         if ((child.byteorder == c'>' and little_endian) or
11391  */
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);
11395
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
11402  */
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);
11406
11407   /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":823
11408  *             t = child.type_num
11409  *             if end - f < 5:
11410  *                 raise RuntimeError(u"Format string allocated too short.")             # <<<<<<<<<<<<<<
11411  * 
11412  *             # Until ticket #99 is fixed, use integers to avoid warnings
11413  */
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);
11417
11418   /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":989
11419  *         _import_array()
11420  *     except Exception:
11421  *         raise ImportError("numpy.core.multiarray failed to import")             # <<<<<<<<<<<<<<
11422  * 
11423  * cdef inline int import_umath() except -1:
11424  */
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);
11428
11429   /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":995
11430  *         _import_umath()
11431  *     except Exception:
11432  *         raise ImportError("numpy.core.umath failed to import")             # <<<<<<<<<<<<<<
11433  * 
11434  * cdef inline int import_ufunc() except -1:
11435  */
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);
11439
11440   /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":1001
11441  *         _import_umath()
11442  *     except Exception:
11443  *         raise ImportError("numpy.core.umath failed to import")             # <<<<<<<<<<<<<<
11444  */
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);
11448
11449   /* "pycocotools/_mask.pyx":103
11450  * 
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
11455  */
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)
11460
11461   /* "pycocotools/_mask.pyx":119
11462  * 
11463  * # internal conversion from compressed RLE format to Python RLEs object
11464  * def _frString(rleObjs):             # <<<<<<<<<<<<<<
11465  *     cdef siz n = len(rleObjs)
11466  *     Rs = RLEs(n)
11467  */
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)
11472
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)
11479  */
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)
11484
11485   /* "pycocotools/_mask.pyx":145
11486  * 
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
11491  */
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)
11496
11497   /* "pycocotools/_mask.pyx":152
11498  *     return np.array(masks)
11499  * 
11500  * def merge(rleObjs, intersect=0):             # <<<<<<<<<<<<<<
11501  *     cdef RLEs Rs = _frString(rleObjs)
11502  *     cdef RLEs R = RLEs(1)
11503  */
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)
11508
11509   /* "pycocotools/_mask.pyx":159
11510  *     return obj
11511  * 
11512  * def area(rleObjs):             # <<<<<<<<<<<<<<
11513  *     cdef RLEs Rs = _frString(rleObjs)
11514  *     cdef uint* _a = <uint*> malloc(Rs._n* sizeof(uint))
11515  */
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)
11520
11521   /* "pycocotools/_mask.pyx":171
11522  * 
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:
11527  */
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)
11532
11533   /* "pycocotools/_mask.pyx":241
11534  *     return iou.reshape((m,n), order='F')
11535  * 
11536  * def toBbox( rleObjs ):             # <<<<<<<<<<<<<<
11537  *     cdef RLEs Rs = _frString(rleObjs)
11538  *     cdef siz n = Rs.n
11539  */
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)
11544
11545   /* "pycocotools/_mask.pyx":253
11546  *     return bb
11547  * 
11548  * def frBbox(np.ndarray[np.double_t, ndim=2] bb, siz h, siz w ):             # <<<<<<<<<<<<<<
11549  *     cdef siz n = bb.shape[0]
11550  *     Rs = RLEs(n)
11551  */
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)
11556
11557   /* "pycocotools/_mask.pyx":260
11558  *     return objs
11559  * 
11560  * def frPoly( poly, siz h, siz w ):             # <<<<<<<<<<<<<<
11561  *     cdef np.ndarray[np.double_t, ndim=1] np_poly
11562  *     n = len(poly)
11563  */
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)
11568
11569   /* "pycocotools/_mask.pyx":270
11570  *     return objs
11571  * 
11572  * def frUncompressedRLE(ucRles, siz h, siz w):             # <<<<<<<<<<<<<<
11573  *     cdef np.ndarray[np.uint32_t, ndim=1] cnts
11574  *     cdef RLE R
11575  */
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)
11580
11581   /* "pycocotools/_mask.pyx":288
11582  *     return objs
11583  * 
11584  * def frPyObjects(pyobj, h, w):             # <<<<<<<<<<<<<<
11585  *     # encode rle from a list of python objects
11586  *     if type(pyobj) == np.ndarray:
11587  */
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();
11593   return 0;
11594   __pyx_L1_error:;
11595   __Pyx_RefNannyFinishContext();
11596   return -1;
11597 }
11598
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)
11606   return 0;
11607   __pyx_L1_error:;
11608   return -1;
11609 }
11610
11611 #if PY_MAJOR_VERSION < 3
11612 PyMODINIT_FUNC init_mask(void); /*proto*/
11613 PyMODINIT_FUNC init_mask(void)
11614 #else
11615 PyMODINIT_FUNC PyInit__mask(void); /*proto*/
11616 PyMODINIT_FUNC PyInit__mask(void)
11617 #endif
11618 {
11619   PyObject *__pyx_t_1 = NULL;
11620   PyObject *__pyx_t_2 = NULL;
11621   int __pyx_t_3;
11622   __Pyx_RefNannyDeclarations
11623   #if CYTHON_REFNANNY
11624   __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny");
11625   if (!__Pyx_RefNanny) {
11626       PyErr_Clear();
11627       __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny");
11628       if (!__Pyx_RefNanny)
11629           Py_FatalError("failed to import 'refnanny' module");
11630   }
11631   #endif
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)
11639   #endif
11640   #ifdef __Pyx_FusedFunction_USED
11641   if (__pyx_FusedFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
11642   #endif
11643   #ifdef __Pyx_Coroutine_USED
11644   if (__pyx_Coroutine_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
11645   #endif
11646   #ifdef __Pyx_Generator_USED
11647   if (__pyx_Generator_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
11648   #endif
11649   #ifdef __Pyx_StopAsyncIteration_USED
11650   if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error)
11651   #endif
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();
11657   #endif
11658   #endif
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);
11662   #else
11663   __pyx_m = PyModule_Create(&__pyx_moduledef);
11664   #endif
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);
11671   #endif
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)
11677   #endif
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)
11680   }
11681   #if PY_MAJOR_VERSION >= 3
11682   {
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)
11686     }
11687   }
11688   #endif
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),
11709   #else
11710   sizeof(PyHeapTypeObject),
11711   #endif
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)
11723   #endif
11724
11725   /* "pycocotools/_mask.pyx":11
11726  * #**************************************************************************
11727  * 
11728  * __author__ = 'tsungyi'             # <<<<<<<<<<<<<<
11729  * 
11730  * import sys
11731  */
11732   if (PyDict_SetItem(__pyx_d, __pyx_n_s_author, __pyx_n_s_tsungyi) < 0) __PYX_ERR(0, 11, __pyx_L1_error)
11733
11734   /* "pycocotools/_mask.pyx":13
11735  * __author__ = 'tsungyi'
11736  * 
11737  * import sys             # <<<<<<<<<<<<<<
11738  * PYTHON_VERSION = sys.version_info[0]
11739  * 
11740  */
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;
11745
11746   /* "pycocotools/_mask.pyx":14
11747  * 
11748  * import sys
11749  * PYTHON_VERSION = sys.version_info[0]             # <<<<<<<<<<<<<<
11750  * 
11751  * # import both Python-level and C-level symbols of Numpy
11752  */
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;
11763
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
11770  */
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;
11775
11776   /* "pycocotools/_mask.pyx":23
11777  * 
11778  * # intialized Numpy. must do.
11779  * np.import_array()             # <<<<<<<<<<<<<<
11780  * 
11781  * # import numpy C function
11782  */
11783   __pyx_t_3 = __pyx_f_5numpy_import_array(); if (unlikely(__pyx_t_3 == -1)) __PYX_ERR(0, 23, __pyx_L1_error)
11784
11785   /* "pycocotools/_mask.pyx":103
11786  * 
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
11791  */
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;
11796
11797   /* "pycocotools/_mask.pyx":119
11798  * 
11799  * # internal conversion from compressed RLE format to Python RLEs object
11800  * def _frString(rleObjs):             # <<<<<<<<<<<<<<
11801  *     cdef siz n = len(rleObjs)
11802  *     Rs = RLEs(n)
11803  */
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;
11808
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)
11815  */
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;
11820
11821   /* "pycocotools/_mask.pyx":145
11822  * 
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
11827  */
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;
11832
11833   /* "pycocotools/_mask.pyx":152
11834  *     return np.array(masks)
11835  * 
11836  * def merge(rleObjs, intersect=0):             # <<<<<<<<<<<<<<
11837  *     cdef RLEs Rs = _frString(rleObjs)
11838  *     cdef RLEs R = RLEs(1)
11839  */
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;
11844
11845   /* "pycocotools/_mask.pyx":159
11846  *     return obj
11847  * 
11848  * def area(rleObjs):             # <<<<<<<<<<<<<<
11849  *     cdef RLEs Rs = _frString(rleObjs)
11850  *     cdef uint* _a = <uint*> malloc(Rs._n* sizeof(uint))
11851  */
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;
11856
11857   /* "pycocotools/_mask.pyx":171
11858  * 
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:
11863  */
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;
11868
11869   /* "pycocotools/_mask.pyx":241
11870  *     return iou.reshape((m,n), order='F')
11871  * 
11872  * def toBbox( rleObjs ):             # <<<<<<<<<<<<<<
11873  *     cdef RLEs Rs = _frString(rleObjs)
11874  *     cdef siz n = Rs.n
11875  */
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;
11880
11881   /* "pycocotools/_mask.pyx":253
11882  *     return bb
11883  * 
11884  * def frBbox(np.ndarray[np.double_t, ndim=2] bb, siz h, siz w ):             # <<<<<<<<<<<<<<
11885  *     cdef siz n = bb.shape[0]
11886  *     Rs = RLEs(n)
11887  */
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;
11892
11893   /* "pycocotools/_mask.pyx":260
11894  *     return objs
11895  * 
11896  * def frPoly( poly, siz h, siz w ):             # <<<<<<<<<<<<<<
11897  *     cdef np.ndarray[np.double_t, ndim=1] np_poly
11898  *     n = len(poly)
11899  */
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;
11904
11905   /* "pycocotools/_mask.pyx":270
11906  *     return objs
11907  * 
11908  * def frUncompressedRLE(ucRles, siz h, siz w):             # <<<<<<<<<<<<<<
11909  *     cdef np.ndarray[np.uint32_t, ndim=1] cnts
11910  *     cdef RLE R
11911  */
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;
11916
11917   /* "pycocotools/_mask.pyx":288
11918  *     return objs
11919  * 
11920  * def frPyObjects(pyobj, h, w):             # <<<<<<<<<<<<<<
11921  *     # encode rle from a list of python objects
11922  *     if type(pyobj) == np.ndarray:
11923  */
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;
11928
11929   /* "pycocotools/_mask.pyx":1
11930  * # distutils: language = c             # <<<<<<<<<<<<<<
11931  * # distutils: sources = ../common/maskApi.c
11932  * 
11933  */
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;
11938
11939   /* "../../../../../softWares/anaconda/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":997
11940  *         raise ImportError("numpy.core.umath failed to import")
11941  * 
11942  * cdef inline int import_ufunc() except -1:             # <<<<<<<<<<<<<<
11943  *     try:
11944  *         _import_umath()
11945  */
11946
11947   /*--- Wrapped vars code ---*/
11948
11949   goto __pyx_L0;
11950   __pyx_L1_error:;
11951   __Pyx_XDECREF(__pyx_t_1);
11952   __Pyx_XDECREF(__pyx_t_2);
11953   if (__pyx_m) {
11954     if (__pyx_d) {
11955       __Pyx_AddTraceback("init pycocotools._mask", __pyx_clineno, __pyx_lineno, __pyx_filename);
11956     }
11957     Py_DECREF(__pyx_m); __pyx_m = 0;
11958   } else if (!PyErr_Occurred()) {
11959     PyErr_SetString(PyExc_ImportError, "init pycocotools._mask");
11960   }
11961   __pyx_L0:;
11962   __Pyx_RefNannyFinishContext();
11963   #if PY_MAJOR_VERSION < 3
11964   return;
11965   #else
11966   return __pyx_m;
11967   #endif
11968 }
11969
11970 /* --- Runtime support code --- */
11971 /* Refnanny */
11972 #if CYTHON_REFNANNY
11973 static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) {
11974     PyObject *m = NULL, *p = NULL;
11975     void *r = NULL;
11976     m = PyImport_ImportModule((char *)modname);
11977     if (!m) goto end;
11978     p = PyObject_GetAttrString(m, (char *)"RefNannyAPI");
11979     if (!p) goto end;
11980     r = PyLong_AsVoidPtr(p);
11981 end:
11982     Py_XDECREF(p);
11983     Py_XDECREF(m);
11984     return (__Pyx_RefNannyAPIStruct *)r;
11985 }
11986 #endif
11987
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);
11995 #else
11996             "name '%.200s' is not defined", PyString_AS_STRING(name));
11997 #endif
11998     }
11999     return result;
12000 }
12001
12002 /* RaiseDoubleKeywords */
12003 static void __Pyx_RaiseDoubleKeywordsError(
12004     const char* func_name,
12005     PyObject* kw_name)
12006 {
12007     PyErr_Format(PyExc_TypeError,
12008         #if PY_MAJOR_VERSION >= 3
12009         "%s() got multiple values for keyword argument '%U'", func_name, kw_name);
12010         #else
12011         "%s() got multiple values for keyword argument '%s'", func_name,
12012         PyString_AsString(kw_name));
12013         #endif
12014 }
12015
12016 /* ParseKeywords */
12017 static int __Pyx_ParseOptionalKeywords(
12018     PyObject *kwds,
12019     PyObject **argnames[],
12020     PyObject *kwds2,
12021     PyObject *values[],
12022     Py_ssize_t num_pos_args,
12023     const char* function_name)
12024 {
12025     PyObject *key = 0, *value = 0;
12026     Py_ssize_t pos = 0;
12027     PyObject*** name;
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++;
12032         if (*name) {
12033             values[name-argnames] = value;
12034             continue;
12035         }
12036         name = first_kw_arg;
12037         #if PY_MAJOR_VERSION < 3
12038         if (likely(PyString_CheckExact(key)) || likely(PyString_Check(key))) {
12039             while (*name) {
12040                 if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key))
12041                         && _PyString_Eq(**name, key)) {
12042                     values[name-argnames] = value;
12043                     break;
12044                 }
12045                 name++;
12046             }
12047             if (*name) continue;
12048             else {
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;
12055                     }
12056                     argname++;
12057                 }
12058             }
12059         } else
12060         #endif
12061         if (likely(PyUnicode_Check(key))) {
12062             while (*name) {
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 :
12066                 #endif
12067                     PyUnicode_Compare(**name, key);
12068                 if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
12069                 if (cmp == 0) {
12070                     values[name-argnames] = value;
12071                     break;
12072                 }
12073                 name++;
12074             }
12075             if (*name) continue;
12076             else {
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 :
12082                     #endif
12083                         PyUnicode_Compare(**argname, key);
12084                     if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad;
12085                     if (cmp == 0) goto arg_passed_twice;
12086                     argname++;
12087                 }
12088             }
12089         } else
12090             goto invalid_keyword_type;
12091         if (kwds2) {
12092             if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad;
12093         } else {
12094             goto invalid_keyword;
12095         }
12096     }
12097     return 0;
12098 arg_passed_twice:
12099     __Pyx_RaiseDoubleKeywordsError(function_name, key);
12100     goto bad;
12101 invalid_keyword_type:
12102     PyErr_Format(PyExc_TypeError,
12103         "%.200s() keywords must be strings", function_name);
12104     goto bad;
12105 invalid_keyword:
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));
12110     #else
12111         "%s() got an unexpected keyword argument '%U'",
12112         function_name, key);
12113     #endif
12114 bad:
12115     return -1;
12116 }
12117
12118 /* RaiseArgTupleInvalid */
12119 static void __Pyx_RaiseArgtupleInvalid(
12120     const char* func_name,
12121     int exact,
12122     Py_ssize_t num_min,
12123     Py_ssize_t num_max,
12124     Py_ssize_t num_found)
12125 {
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";
12131     } else {
12132         num_expected = num_max;
12133         more_or_less = "at most";
12134     }
12135     if (exact) {
12136         more_or_less = "exactly";
12137     }
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);
12142 }
12143
12144 /* BytesEquals */
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);
12148 #else
12149     if (s1 == s2) {
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);
12162         } else {
12163             int result = memcmp(ps1, ps2, (size_t)length);
12164             return (equals == Py_EQ) ? (result == 0) : (result != 0);
12165         }
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);
12170     } else {
12171         int result;
12172         PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
12173         if (!py_result)
12174             return -1;
12175         result = __Pyx_PyObject_IsTrue(py_result);
12176         Py_DECREF(py_result);
12177         return result;
12178     }
12179 #endif
12180 }
12181
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);
12186 #else
12187 #if PY_MAJOR_VERSION < 3
12188     PyObject* owned_ref = NULL;
12189 #endif
12190     int s1_is_unicode, s2_is_unicode;
12191     if (s1 == s2) {
12192         goto return_eq;
12193     }
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))
12200             return -1;
12201         s2 = owned_ref;
12202         s2_is_unicode = 1;
12203     } else if ((s2_is_unicode & (!s1_is_unicode)) && PyString_CheckExact(s1)) {
12204         owned_ref = PyUnicode_FromObject(s1);
12205         if (unlikely(!owned_ref))
12206             return -1;
12207         s1 = owned_ref;
12208         s1_is_unicode = 1;
12209     } else if (((!s2_is_unicode) & (!s1_is_unicode))) {
12210         return __Pyx_PyBytes_Equals(s1, s2, equals);
12211     }
12212 #endif
12213     if (s1_is_unicode & s2_is_unicode) {
12214         Py_ssize_t length;
12215         int kind;
12216         void *data1, *data2;
12217         if (unlikely(__Pyx_PyUnicode_READY(s1) < 0) || unlikely(__Pyx_PyUnicode_READY(s2) < 0))
12218             return -1;
12219         length = __Pyx_PyUnicode_GET_LENGTH(s1);
12220         if (length != __Pyx_PyUnicode_GET_LENGTH(s2)) {
12221             goto return_ne;
12222         }
12223         kind = __Pyx_PyUnicode_KIND(s1);
12224         if (kind != __Pyx_PyUnicode_KIND(s2)) {
12225             goto return_ne;
12226         }
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)) {
12230             goto return_ne;
12231         } else if (length == 1) {
12232             goto return_eq;
12233         } else {
12234             int result = memcmp(data1, data2, (size_t)(length * kind));
12235             #if PY_MAJOR_VERSION < 3
12236             Py_XDECREF(owned_ref);
12237             #endif
12238             return (equals == Py_EQ) ? (result == 0) : (result != 0);
12239         }
12240     } else if ((s1 == Py_None) & s2_is_unicode) {
12241         goto return_ne;
12242     } else if ((s2 == Py_None) & s1_is_unicode) {
12243         goto return_ne;
12244     } else {
12245         int result;
12246         PyObject* py_result = PyObject_RichCompare(s1, s2, equals);
12247         if (!py_result)
12248             return -1;
12249         result = __Pyx_PyObject_IsTrue(py_result);
12250         Py_DECREF(py_result);
12251         return result;
12252     }
12253 return_eq:
12254     #if PY_MAJOR_VERSION < 3
12255     Py_XDECREF(owned_ref);
12256     #endif
12257     return (equals == Py_EQ);
12258 return_ne:
12259     #if PY_MAJOR_VERSION < 3
12260     Py_XDECREF(owned_ref);
12261     #endif
12262     return (equals == Py_NE);
12263 #endif
12264 }
12265
12266 /* PyObjectCall */
12267 #if CYTHON_COMPILING_IN_CPYTHON
12268 static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) {
12269     PyObject *result;
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")))
12274         return NULL;
12275     result = (*call)(func, arg, kw);
12276     Py_LeaveRecursiveCall();
12277     if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
12278         PyErr_SetString(
12279             PyExc_SystemError,
12280             "NULL result without error in PyObject_Call");
12281     }
12282     return result;
12283 }
12284 #endif
12285
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);
12299 }
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;
12307 }
12308 #endif
12309
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
12315     Py_XINCREF(type);
12316     if (!value || value == Py_None)
12317         value = NULL;
12318     else
12319         Py_INCREF(value);
12320     if (!tb || tb == Py_None)
12321         tb = NULL;
12322     else {
12323         Py_INCREF(tb);
12324         if (!PyTraceBack_Check(tb)) {
12325             PyErr_SetString(PyExc_TypeError,
12326                 "raise: arg 3 must be a traceback or None");
12327             goto raise_error;
12328         }
12329     }
12330     if (PyType_Check(type)) {
12331 #if CYTHON_COMPILING_IN_PYPY
12332         if (!value) {
12333             Py_INCREF(Py_None);
12334             value = Py_None;
12335         }
12336 #endif
12337         PyErr_NormalizeException(&type, &value, &tb);
12338     } else {
12339         if (value) {
12340             PyErr_SetString(PyExc_TypeError,
12341                 "instance exception may not have a separate value");
12342             goto raise_error;
12343         }
12344         value = type;
12345         type = (PyObject*) Py_TYPE(type);
12346         Py_INCREF(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");
12350             goto raise_error;
12351         }
12352     }
12353     __Pyx_PyThreadState_assign
12354     __Pyx_ErrRestore(type, value, tb);
12355     return;
12356 raise_error:
12357     Py_XDECREF(value);
12358     Py_XDECREF(type);
12359     Py_XDECREF(tb);
12360     return;
12361 }
12362 #else
12363 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) {
12364     PyObject* owned_instance = NULL;
12365     if (tb == Py_None) {
12366         tb = 0;
12367     } else if (tb && !PyTraceBack_Check(tb)) {
12368         PyErr_SetString(PyExc_TypeError,
12369             "raise: arg 3 must be a traceback or None");
12370         goto bad;
12371     }
12372     if (value == Py_None)
12373         value = 0;
12374     if (PyExceptionInstance_Check(type)) {
12375         if (value) {
12376             PyErr_SetString(PyExc_TypeError,
12377                 "instance exception may not have a separate value");
12378             goto bad;
12379         }
12380         value = type;
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)) {
12391                     goto bad;
12392                 } else {
12393                     type = instance_class;
12394                 }
12395             }
12396         }
12397         if (!instance_class) {
12398             PyObject *args;
12399             if (!value)
12400                 args = PyTuple_New(0);
12401             else if (PyTuple_Check(value)) {
12402                 Py_INCREF(value);
12403                 args = value;
12404             } else
12405                 args = PyTuple_Pack(1, value);
12406             if (!args)
12407                 goto bad;
12408             owned_instance = PyObject_Call(type, args, NULL);
12409             Py_DECREF(args);
12410             if (!owned_instance)
12411                 goto bad;
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));
12418                 goto bad;
12419             }
12420         }
12421     } else {
12422         PyErr_SetString(PyExc_TypeError,
12423             "raise: exception class must be a subclass of BaseException");
12424         goto bad;
12425     }
12426 #if PY_VERSION_HEX >= 0x03030000
12427     if (cause) {
12428 #else
12429     if (cause && cause != Py_None) {
12430 #endif
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)
12437                 goto bad;
12438         } else if (PyExceptionInstance_Check(cause)) {
12439             fixed_cause = cause;
12440             Py_INCREF(fixed_cause);
12441         } else {
12442             PyErr_SetString(PyExc_TypeError,
12443                             "exception causes must derive from "
12444                             "BaseException");
12445             goto bad;
12446         }
12447         PyException_SetCause(value, fixed_cause);
12448     }
12449     PyErr_SetObject(type, value);
12450     if (tb) {
12451 #if CYTHON_COMPILING_IN_PYPY
12452         PyObject *tmp_type, *tmp_value, *tmp_tb;
12453         PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb);
12454         Py_INCREF(tb);
12455         PyErr_Restore(tmp_type, tmp_value, tb);
12456         Py_XDECREF(tmp_tb);
12457 #else
12458         PyThreadState *tstate = PyThreadState_GET();
12459         PyObject* tmp_tb = tstate->curexc_traceback;
12460         if (tb != tmp_tb) {
12461             Py_INCREF(tb);
12462             tstate->curexc_traceback = tb;
12463             Py_XDECREF(tmp_tb);
12464         }
12465 #endif
12466     }
12467 bad:
12468     Py_XDECREF(owned_instance);
12469     return;
12470 }
12471 #endif
12472
12473 /* ExtTypeTest */
12474   static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) {
12475     if (unlikely(!type)) {
12476         PyErr_SetString(PyExc_SystemError, "Missing type object");
12477         return 0;
12478     }
12479     if (likely(PyObject_TypeCheck(obj, type)))
12480         return 1;
12481     PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s",
12482                  Py_TYPE(obj)->tp_name, type->tp_name);
12483     return 0;
12484 }
12485
12486 /* ArgTypeTest */
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);
12491 }
12492 static CYTHON_INLINE int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed,
12493     const char *name, int exact)
12494 {
12495     if (unlikely(!type)) {
12496         PyErr_SetString(PyExc_SystemError, "Missing type object");
12497         return 0;
12498     }
12499     if (none_allowed && obj == Py_None) return 1;
12500     else if (exact) {
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;
12504         #endif
12505     }
12506     else {
12507         if (likely(PyObject_TypeCheck(obj, type))) return 1;
12508     }
12509     __Pyx_RaiseArgumentTypeInvalid(name, obj, type);
12510     return 0;
12511 }
12512
12513 /* PyIntBinop */
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;
12519         long x;
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);
12525     }
12526     #endif
12527     #if CYTHON_USE_PYLONG_INTERNALS
12528     if (likely(PyLong_CheckExact(op1))) {
12529         const long b = intval;
12530         long a, x;
12531 #ifdef HAVE_LONG_LONG
12532         const PY_LONG_LONG llb = intval;
12533         PY_LONG_LONG lla, llx;
12534 #endif
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;
12540         } else {
12541             switch (size) {
12542                 case -2:
12543                     if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
12544                         a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
12545                         break;
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]));
12549                         goto long_long;
12550 #endif
12551                     }
12552                 case 2:
12553                     if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
12554                         a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
12555                         break;
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]));
12559                         goto long_long;
12560 #endif
12561                     }
12562                 case -3:
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]));
12565                         break;
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]));
12569                         goto long_long;
12570 #endif
12571                     }
12572                 case 3:
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]));
12575                         break;
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]));
12579                         goto long_long;
12580 #endif
12581                     }
12582                 case -4:
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]));
12585                         break;
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]));
12589                         goto long_long;
12590 #endif
12591                     }
12592                 case 4:
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]));
12595                         break;
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]));
12599                         goto long_long;
12600 #endif
12601                     }
12602                 default: return PyLong_Type.tp_as_number->nb_add(op1, op2);
12603             }
12604         }
12605                 x = a + b;
12606             return PyLong_FromLong(x);
12607 #ifdef HAVE_LONG_LONG
12608         long_long:
12609                 llx = lla + llb;
12610             return PyLong_FromLongLong(llx);
12611 #endif
12612         
12613         
12614     }
12615     #endif
12616     if (PyFloat_CheckExact(op1)) {
12617         const long b = intval;
12618         double a = PyFloat_AS_DOUBLE(op1);
12619             double result;
12620             PyFPE_START_PROTECT("add", return NULL)
12621             result = ((double)a) + (double)b;
12622             PyFPE_END_PROTECT(result)
12623             return PyFloat_FromDouble(result);
12624     }
12625     return (inplace ? PyNumber_InPlaceAdd : PyNumber_Add)(op1, op2);
12626 }
12627 #endif
12628
12629 /* PyIntBinop */
12630   #if !CYTHON_COMPILING_IN_PYPY
12631 static PyObject* __Pyx_PyInt_EqObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, CYTHON_UNUSED int inplace) {
12632     if (op1 == op2) {
12633         Py_RETURN_TRUE;
12634     }
12635     #if PY_MAJOR_VERSION < 3
12636     if (likely(PyInt_CheckExact(op1))) {
12637         const long b = intval;
12638         long a = PyInt_AS_LONG(op1);
12639         if (a == b) {
12640             Py_RETURN_TRUE;
12641         } else {
12642             Py_RETURN_FALSE;
12643         }
12644     }
12645     #endif
12646     #if CYTHON_USE_PYLONG_INTERNALS
12647     if (likely(PyLong_CheckExact(op1))) {
12648         const long b = intval;
12649         long a;
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;
12655         } else {
12656             switch (size) {
12657                 case -2:
12658                     if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
12659                         a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
12660                         break;
12661                     }
12662                 case 2:
12663                     if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) {
12664                         a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]));
12665                         break;
12666                     }
12667                 case -3:
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]));
12670                         break;
12671                     }
12672                 case 3:
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]));
12675                         break;
12676                     }
12677                 case -4:
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]));
12680                         break;
12681                     }
12682                 case 4:
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]));
12685                         break;
12686                     }
12687                 #if PyLong_SHIFT < 30 && PyLong_SHIFT != 15
12688                 default: return PyLong_Type.tp_richcompare(op1, op2, Py_EQ);
12689                 #else
12690                 default: Py_RETURN_FALSE;
12691                 #endif
12692             }
12693         }
12694             if (a == b) {
12695                 Py_RETURN_TRUE;
12696             } else {
12697                 Py_RETURN_FALSE;
12698             }
12699     }
12700     #endif
12701     if (PyFloat_CheckExact(op1)) {
12702         const long b = intval;
12703         double a = PyFloat_AS_DOUBLE(op1);
12704             if ((double)a == (double)b) {
12705                 Py_RETURN_TRUE;
12706             } else {
12707                 Py_RETURN_FALSE;
12708             }
12709     }
12710     return PyObject_RichCompare(op1, op2, Py_EQ);
12711 }
12712 #endif
12713
12714 /* GetModuleGlobalName */
12715   static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name) {
12716     PyObject *result;
12717 #if !CYTHON_AVOID_BORROWED_REFS
12718     result = PyDict_GetItem(__pyx_d, name);
12719     if (likely(result)) {
12720         Py_INCREF(result);
12721     } else {
12722 #else
12723     result = PyObject_GetItem(__pyx_d, name);
12724     if (!result) {
12725         PyErr_Clear();
12726 #endif
12727         result = __Pyx_GetBuiltinName(name);
12728     }
12729     return result;
12730 }
12731
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);
12747 }
12748 #endif  // CYTHON_FAST_PYCCALL
12749
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) {
12755     PyFrameObject *f;
12756     PyThreadState *tstate = PyThreadState_GET();
12757     PyObject **fastlocals;
12758     Py_ssize_t i;
12759     PyObject *result;
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.
12764        */
12765     assert(tstate != NULL);
12766     f = PyFrame_New(tstate, co, globals, NULL);
12767     if (f == NULL) {
12768         return NULL;
12769     }
12770     fastlocals = f->f_localsplus;
12771     for (i = 0; i < na; i++) {
12772         Py_INCREF(*args);
12773         fastlocals[i] = *args++;
12774     }
12775     result = PyEval_EvalFrameEx(f,0);
12776     ++tstate->recursion_depth;
12777     Py_DECREF(f);
12778     --tstate->recursion_depth;
12779     return result;
12780 }
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);
12786     PyObject *closure;
12787 #if PY_MAJOR_VERSION >= 3
12788     PyObject *kwdefs;
12789 #endif
12790     PyObject *kwtuple, **k;
12791     PyObject **d;
12792     Py_ssize_t nd;
12793     Py_ssize_t nk;
12794     PyObject *result;
12795     assert(kwargs == NULL || PyDict_Check(kwargs));
12796     nk = kwargs ? PyDict_Size(kwargs) : 0;
12797     if (Py_EnterRecursiveCall((char*)" while calling a Python object")) {
12798         return NULL;
12799     }
12800     if (
12801 #if PY_MAJOR_VERSION >= 3
12802             co->co_kwonlyargcount == 0 &&
12803 #endif
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);
12808             goto done;
12809         }
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);
12816             goto done;
12817         }
12818     }
12819     if (kwargs != NULL) {
12820         Py_ssize_t pos, i;
12821         kwtuple = PyTuple_New(2 * nk);
12822         if (kwtuple == NULL) {
12823             result = NULL;
12824             goto done;
12825         }
12826         k = &PyTuple_GET_ITEM(kwtuple, 0);
12827         pos = i = 0;
12828         while (PyDict_Next(kwargs, &pos, &k[i], &k[i+1])) {
12829             Py_INCREF(k[i]);
12830             Py_INCREF(k[i+1]);
12831             i += 2;
12832         }
12833         nk = i / 2;
12834     }
12835     else {
12836         kwtuple = NULL;
12837         k = NULL;
12838     }
12839     closure = PyFunction_GET_CLOSURE(func);
12840 #if PY_MAJOR_VERSION >= 3
12841     kwdefs = PyFunction_GET_KW_DEFAULTS(func);
12842 #endif
12843     if (argdefs != NULL) {
12844         d = &PyTuple_GET_ITEM(argdefs, 0);
12845         nd = Py_SIZE(argdefs);
12846     }
12847     else {
12848         d = NULL;
12849         nd = 0;
12850     }
12851 #if PY_MAJOR_VERSION >= 3
12852     result = PyEval_EvalCodeEx((PyObject*)co, globals, (PyObject *)NULL,
12853                                args, nargs,
12854                                k, (int)nk,
12855                                d, (int)nd, kwdefs, closure);
12856 #else
12857     result = PyEval_EvalCodeEx(co, globals, (PyObject *)NULL,
12858                                args, nargs,
12859                                k, (int)nk,
12860                                d, (int)nd, closure);
12861 #endif
12862     Py_XDECREF(kwtuple);
12863 done:
12864     Py_LeaveRecursiveCall();
12865     return result;
12866 }
12867 #endif  // CPython < 3.6
12868 #endif  // CYTHON_FAST_PYCALL
12869
12870 /* PyObjectCallMethO */
12871     #if CYTHON_COMPILING_IN_CPYTHON
12872 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg) {
12873     PyObject *self, *result;
12874     PyCFunction cfunc;
12875     cfunc = PyCFunction_GET_FUNCTION(func);
12876     self = PyCFunction_GET_SELF(func);
12877     if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object")))
12878         return NULL;
12879     result = cfunc(self, arg);
12880     Py_LeaveRecursiveCall();
12881     if (unlikely(!result) && unlikely(!PyErr_Occurred())) {
12882         PyErr_SetString(
12883             PyExc_SystemError,
12884             "NULL result without error in PyObject_Call");
12885     }
12886     return result;
12887 }
12888 #endif
12889
12890 /* PyObjectCallOneArg */
12891     #if CYTHON_COMPILING_IN_CPYTHON
12892 static PyObject* __Pyx__PyObject_CallOneArg(PyObject *func, PyObject *arg) {
12893     PyObject *result;
12894     PyObject *args = PyTuple_New(1);
12895     if (unlikely(!args)) return NULL;
12896     Py_INCREF(arg);
12897     PyTuple_SET_ITEM(args, 0, arg);
12898     result = __Pyx_PyObject_Call(func, args, NULL);
12899     Py_DECREF(args);
12900     return result;
12901 }
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);
12906     }
12907 #endif
12908 #ifdef __Pyx_CyFunction_USED
12909     if (likely(PyCFunction_Check(func) || PyObject_TypeCheck(func, __pyx_CyFunctionType))) {
12910 #else
12911     if (likely(PyCFunction_Check(func))) {
12912 #endif
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);
12918 #endif
12919         }
12920     }
12921     return __Pyx__PyObject_CallOneArg(func, arg);
12922 }
12923 #else
12924 static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) {
12925     PyObject *result;
12926     PyObject *args = PyTuple_Pack(1, arg);
12927     if (unlikely(!args)) return NULL;
12928     result = __Pyx_PyObject_Call(func, args, NULL);
12929     Py_DECREF(args);
12930     return result;
12931 }
12932 #endif
12933
12934 /* GetItemInt */
12935       static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
12936     PyObject *r;
12937     if (!j) return NULL;
12938     r = PyObject_GetItem(o, j);
12939     Py_DECREF(j);
12940     return r;
12941 }
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);
12949         Py_INCREF(r);
12950         return r;
12951     }
12952     return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
12953 #else
12954     return PySequence_GetItem(o, i);
12955 #endif
12956 }
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);
12964         Py_INCREF(r);
12965         return r;
12966     }
12967     return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
12968 #else
12969     return PySequence_GetItem(o, i);
12970 #endif
12971 }
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);
12980             Py_INCREF(r);
12981             return r;
12982         }
12983     }
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);
12988             Py_INCREF(r);
12989             return r;
12990         }
12991     } else {
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)) {
12997                     i += l;
12998                 } else {
12999                     if (!PyErr_ExceptionMatches(PyExc_OverflowError))
13000                         return NULL;
13001                     PyErr_Clear();
13002                 }
13003             }
13004             return m->sq_item(o, i);
13005         }
13006     }
13007 #else
13008     if (is_list || PySequence_Check(o)) {
13009         return PySequence_GetItem(o, i);
13010     }
13011 #endif
13012     return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
13013 }
13014
13015 /* BufferFormatCheck */
13016       static CYTHON_INLINE int __Pyx_IsLittleEndian(void) {
13017   unsigned int n = 1;
13018   return *(unsigned char*)(&n) != 0;
13019 }
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;
13028   ctx->head = stack;
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;
13036   ctx->enc_type = 0;
13037   ctx->is_complex = 0;
13038   ctx->is_valid_array = 0;
13039   ctx->struct_alignment = 0;
13040   while (type->typegroup == 'S') {
13041     ++ctx->head;
13042     ctx->head->field = type->fields;
13043     ctx->head->parent_offset = 0;
13044     type = type->fields->type;
13045   }
13046 }
13047 static int __Pyx_BufFmt_ParseNumber(const char** ts) {
13048     int count;
13049     const char* t = *ts;
13050     if (*t < '0' || *t > '9') {
13051       return -1;
13052     } else {
13053         count = *t++ - '0';
13054         while (*t >= '0' && *t < '9') {
13055             count *= 10;
13056             count += *t++ - '0';
13057         }
13058     }
13059     *ts = t;
13060     return count;
13061 }
13062 static int __Pyx_BufFmt_ExpectNumber(const char **ts) {
13063     int number = __Pyx_BufFmt_ParseNumber(ts);
13064     if (number == -1)
13065         PyErr_Format(PyExc_ValueError,\
13066                      "Does not understand character buffer dtype format string ('%c')", **ts);
13067     return number;
13068 }
13069 static void __Pyx_BufFmt_RaiseUnexpectedChar(char ch) {
13070   PyErr_Format(PyExc_ValueError,
13071                "Unexpected format string character: '%c'", ch);
13072 }
13073 static const char* __Pyx_BufFmt_DescribeTypeChar(char ch, int is_complex) {
13074   switch (ch) {
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";
13095   }
13096 }
13097 static size_t __Pyx_BufFmt_TypeCharToStandardSize(char ch, int is_complex) {
13098   switch (ch) {
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);
13105     case 'g': {
13106       PyErr_SetString(PyExc_ValueError, "Python does not define a standard format string size for long double ('g')..");
13107       return 0;
13108     }
13109     case 'O': case 'P': return sizeof(void*);
13110     default:
13111       __Pyx_BufFmt_RaiseUnexpectedChar(ch);
13112       return 0;
13113     }
13114 }
13115 static size_t __Pyx_BufFmt_TypeCharToNativeSize(char ch, int is_complex) {
13116   switch (ch) {
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);
13123     #endif
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*);
13128     default: {
13129       __Pyx_BufFmt_RaiseUnexpectedChar(ch);
13130       return 0;
13131     }
13132   }
13133 }
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;
13143 #endif
13144 static size_t __Pyx_BufFmt_TypeCharToAlignment(char ch, CYTHON_UNUSED int is_complex) {
13145   switch (ch) {
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);
13152 #endif
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*);
13157     default:
13158       __Pyx_BufFmt_RaiseUnexpectedChar(ch);
13159       return 0;
13160     }
13161 }
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.
13165  */
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;
13175 #endif
13176 static size_t __Pyx_BufFmt_TypeCharToPadding(char ch, CYTHON_UNUSED int is_complex) {
13177   switch (ch) {
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);
13184 #endif
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*);
13189     default:
13190       __Pyx_BufFmt_RaiseUnexpectedChar(ch);
13191       return 0;
13192     }
13193 }
13194 static char __Pyx_BufFmt_TypeCharToGroup(char ch, int is_complex) {
13195   switch (ch) {
13196     case 'c':
13197         return 'H';
13198     case 'b': case 'h': case 'i':
13199     case 'l': case 'q': case 's': case 'p':
13200         return 'I';
13201     case 'B': case 'H': case 'I': case 'L': case 'Q':
13202         return 'U';
13203     case 'f': case 'd': case 'g':
13204         return (is_complex ? 'C' : 'R');
13205     case 'O':
13206         return 'O';
13207     case 'P':
13208         return 'P';
13209     default: {
13210       __Pyx_BufFmt_RaiseUnexpectedChar(ch);
13211       return 0;
13212     }
13213   }
13214 }
13215 static void __Pyx_BufFmt_RaiseExpected(__Pyx_BufFmt_Context* ctx) {
13216   if (ctx->head == NULL || ctx->head->field == &ctx->root) {
13217     const char* expected;
13218     const char* quote;
13219     if (ctx->head == NULL) {
13220       expected = "end";
13221       quote = "";
13222     } else {
13223       expected = ctx->head->field->type->name;
13224       quote = "'";
13225     }
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));
13230   } else {
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);
13237   }
13238 }
13239 static int __Pyx_BufFmt_ProcessTypeChunk(__Pyx_BufFmt_Context* ctx) {
13240   char group;
13241   size_t size, offset, arraysize = 1;
13242   if (ctx->enc_type == 0) return 0;
13243   if (ctx->head->field->type->arraysize[0]) {
13244     int i, ndim = 0;
13245     if (ctx->enc_type == 's' || ctx->enc_type == 'p') {
13246         ctx->is_valid_array = ctx->head->field->type->ndim == 1;
13247         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);
13252             return -1;
13253         }
13254     }
13255     if (!ctx->is_valid_array) {
13256       PyErr_Format(PyExc_ValueError, "Expected %d dimensions, got %d",
13257                    ctx->head->field->type->ndim, ndim);
13258       return -1;
13259     }
13260     for (i = 0; i < ctx->head->field->type->ndim; i++) {
13261       arraysize *= ctx->head->field->type->arraysize[i];
13262     }
13263     ctx->is_valid_array = 0;
13264     ctx->enc_count = 1;
13265   }
13266   group = __Pyx_BufFmt_TypeCharToGroup(ctx->enc_type, ctx->is_complex);
13267   do {
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);
13272     } else {
13273       size = __Pyx_BufFmt_TypeCharToStandardSize(ctx->enc_type, ctx->is_complex);
13274     }
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,
13283                                                                  ctx->is_complex);
13284     }
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;
13288         ++ctx->head;
13289         ctx->head->field = type->fields;
13290         ctx->head->parent_offset = parent_offset;
13291         continue;
13292       }
13293       if ((type->typegroup == 'H' || group == 'H') && type->size == size) {
13294       } else {
13295           __Pyx_BufFmt_RaiseExpected(ctx);
13296           return -1;
13297       }
13298     }
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);
13304       return -1;
13305     }
13306     ctx->fmt_offset += size;
13307     if (arraysize)
13308       ctx->fmt_offset += (arraysize - 1) * size;
13309     --ctx->enc_count;
13310     while (1) {
13311       if (field == &ctx->root) {
13312         ctx->head = NULL;
13313         if (ctx->enc_count != 0) {
13314           __Pyx_BufFmt_RaiseExpected(ctx);
13315           return -1;
13316         }
13317         break;
13318       }
13319       ctx->head->field = ++field;
13320       if (field->type == NULL) {
13321         --ctx->head;
13322         field = ctx->head->field;
13323         continue;
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;
13328         ++ctx->head;
13329         ctx->head->field = field;
13330         ctx->head->parent_offset = parent_offset;
13331         break;
13332       } else {
13333         break;
13334       }
13335     }
13336   } while (ctx->enc_count);
13337   ctx->enc_type = 0;
13338   ctx->is_complex = 0;
13339   return 0;
13340 }
13341 static CYTHON_INLINE PyObject *
13342 __pyx_buffmt_parse_array(__Pyx_BufFmt_Context* ctx, const char** tsp)
13343 {
13344     const char *ts = *tsp;
13345     int i = 0, number;
13346     int ndim = ctx->head->field->type->ndim;
13347 ;
13348     ++ts;
13349     if (ctx->new_count != 1) {
13350         PyErr_SetString(PyExc_ValueError,
13351                         "Cannot handle repeated arrays in format string");
13352         return NULL;
13353     }
13354     if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
13355     while (*ts && *ts != ')') {
13356         switch (*ts) {
13357             case ' ': case '\f': case '\r': case '\n': case '\t': case '\v':  continue;
13358             default:  break;
13359         }
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++;
13370         i++;
13371     }
13372     if (i != ndim)
13373         return PyErr_Format(PyExc_ValueError, "Expected %d dimension(s), got %d",
13374                             ctx->head->field->type->ndim, i);
13375     if (!*ts) {
13376         PyErr_SetString(PyExc_ValueError,
13377                         "Unexpected end of format string, expected ')'");
13378         return NULL;
13379     }
13380     ctx->is_valid_array = 1;
13381     ctx->new_count = 1;
13382     *tsp = ++ts;
13383     return Py_None;
13384 }
13385 static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts) {
13386   int got_Z = 0;
13387   while (1) {
13388     switch(*ts) {
13389       case 0:
13390         if (ctx->enc_type != 0 && ctx->head == NULL) {
13391           __Pyx_BufFmt_RaiseExpected(ctx);
13392           return NULL;
13393         }
13394         if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
13395         if (ctx->head != NULL) {
13396           __Pyx_BufFmt_RaiseExpected(ctx);
13397           return NULL;
13398         }
13399         return ts;
13400       case ' ':
13401       case '\r':
13402       case '\n':
13403         ++ts;
13404         break;
13405       case '<':
13406         if (!__Pyx_IsLittleEndian()) {
13407           PyErr_SetString(PyExc_ValueError, "Little-endian buffer not supported on big-endian compiler");
13408           return NULL;
13409         }
13410         ctx->new_packmode = '=';
13411         ++ts;
13412         break;
13413       case '>':
13414       case '!':
13415         if (__Pyx_IsLittleEndian()) {
13416           PyErr_SetString(PyExc_ValueError, "Big-endian buffer not supported on little-endian compiler");
13417           return NULL;
13418         }
13419         ctx->new_packmode = '=';
13420         ++ts;
13421         break;
13422       case '=':
13423       case '@':
13424       case '^':
13425         ctx->new_packmode = *ts++;
13426         break;
13427       case 'T':
13428         {
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;
13433           ++ts;
13434           if (*ts != '{') {
13435             PyErr_SetString(PyExc_ValueError, "Buffer acquisition: Expected '{' after 'T'");
13436             return NULL;
13437           }
13438           if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
13439           ctx->enc_type = 0;
13440           ctx->enc_count = 0;
13441           ctx->struct_alignment = 0;
13442           ++ts;
13443           ts_after_sub = ts;
13444           for (i = 0; i != struct_count; ++i) {
13445             ts_after_sub = __Pyx_BufFmt_CheckString(ctx, ts);
13446             if (!ts_after_sub) return NULL;
13447           }
13448           ts = ts_after_sub;
13449           if (struct_alignment) ctx->struct_alignment = struct_alignment;
13450         }
13451         break;
13452       case '}':
13453         {
13454           size_t alignment = ctx->struct_alignment;
13455           ++ts;
13456           if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL;
13457           ctx->enc_type = 0;
13458           if (alignment && ctx->fmt_offset % alignment) {
13459             ctx->fmt_offset += alignment - (ctx->fmt_offset % alignment);
13460           }
13461         }
13462         return ts;
13463       case 'x':
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;
13468         ctx->enc_type = 0;
13469         ctx->enc_packmode = ctx->new_packmode;
13470         ++ts;
13471         break;
13472       case 'Z':
13473         got_Z = 1;
13474         ++ts;
13475         if (*ts != 'f' && *ts != 'd' && *ts != 'g') {
13476           __Pyx_BufFmt_RaiseUnexpectedChar('Z');
13477           return NULL;
13478         }
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;
13487           got_Z = 0;
13488           ++ts;
13489           break;
13490         }
13491       case 's':
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;
13497         ++ts;
13498         ctx->new_count = 1;
13499         got_Z = 0;
13500         break;
13501       case ':':
13502         ++ts;
13503         while(*ts != ':') ++ts;
13504         ++ts;
13505         break;
13506       case '(':
13507         if (!__pyx_buffmt_parse_array(ctx, &ts)) return NULL;
13508         break;
13509       default:
13510         {
13511           int number = __Pyx_BufFmt_ExpectNumber(&ts);
13512           if (number == -1) return NULL;
13513           ctx->new_count = (size_t)number;
13514         }
13515     }
13516   }
13517 }
13518 static CYTHON_INLINE void __Pyx_ZeroBuffer(Py_buffer* buf) {
13519   buf->buf = NULL;
13520   buf->obj = NULL;
13521   buf->strides = __Pyx_zeros;
13522   buf->shape = __Pyx_zeros;
13523   buf->suboffsets = __Pyx_minusones;
13524 }
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)
13528 {
13529   if (obj == Py_None || obj == NULL) {
13530     __Pyx_ZeroBuffer(buf);
13531     return 0;
13532   }
13533   buf->buf = NULL;
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)",
13538                  nd, buf->ndim);
13539     goto fail;
13540   }
13541   if (!cast) {
13542     __Pyx_BufFmt_Context ctx;
13543     __Pyx_BufFmt_Init(&ctx, stack, dtype);
13544     if (!__Pyx_BufFmt_CheckString(&ctx, buf->format)) goto fail;
13545   }
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" : "");
13551     goto fail;
13552   }
13553   if (buf->suboffsets == NULL) buf->suboffsets = __Pyx_minusones;
13554   return 0;
13555 fail:;
13556   __Pyx_ZeroBuffer(buf);
13557   return -1;
13558 }
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);
13563 }
13564
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);
13573     if (cached_type) {
13574         if (!PyType_Check((PyObject*)cached_type)) {
13575             PyErr_Format(PyExc_TypeError,
13576                 "Shared Cython type %.200s is not a type object",
13577                 type->tp_name);
13578             goto bad;
13579         }
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",
13583                 type->tp_name);
13584             goto bad;
13585         }
13586     } else {
13587         if (!PyErr_ExceptionMatches(PyExc_AttributeError)) goto bad;
13588         PyErr_Clear();
13589         if (PyType_Ready(type) < 0) goto bad;
13590         if (PyObject_SetAttrString(fake_module, type->tp_name, (PyObject*) type) < 0)
13591             goto bad;
13592         Py_INCREF(type);
13593         cached_type = type;
13594     }
13595 done:
13596     Py_DECREF(fake_module);
13597     return cached_type;
13598 bad:
13599     Py_XDECREF(cached_type);
13600     cached_type = NULL;
13601     goto done;
13602 }
13603
13604 /* CythonFunction */
13605         static PyObject *
13606 __Pyx_CyFunction_get_doc(__pyx_CyFunctionObject *op, CYTHON_UNUSED void *closure)
13607 {
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);
13612 #else
13613             op->func_doc = PyString_FromString(op->func.m_ml->ml_doc);
13614 #endif
13615             if (unlikely(op->func_doc == NULL))
13616                 return NULL;
13617         } else {
13618             Py_INCREF(Py_None);
13619             return Py_None;
13620         }
13621     }
13622     Py_INCREF(op->func_doc);
13623     return op->func_doc;
13624 }
13625 static int
13626 __Pyx_CyFunction_set_doc(__pyx_CyFunctionObject *op, PyObject *value)
13627 {
13628     PyObject *tmp = op->func_doc;
13629     if (value == NULL) {
13630         value = Py_None;
13631     }
13632     Py_INCREF(value);
13633     op->func_doc = value;
13634     Py_XDECREF(tmp);
13635     return 0;
13636 }
13637 static PyObject *
13638 __Pyx_CyFunction_get_name(__pyx_CyFunctionObject *op)
13639 {
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);
13643 #else
13644         op->func_name = PyString_InternFromString(op->func.m_ml->ml_name);
13645 #endif
13646         if (unlikely(op->func_name == NULL))
13647             return NULL;
13648     }
13649     Py_INCREF(op->func_name);
13650     return op->func_name;
13651 }
13652 static int
13653 __Pyx_CyFunction_set_name(__pyx_CyFunctionObject *op, PyObject *value)
13654 {
13655     PyObject *tmp;
13656 #if PY_MAJOR_VERSION >= 3
13657     if (unlikely(value == NULL || !PyUnicode_Check(value))) {
13658 #else
13659     if (unlikely(value == NULL || !PyString_Check(value))) {
13660 #endif
13661         PyErr_SetString(PyExc_TypeError,
13662                         "__name__ must be set to a string object");
13663         return -1;
13664     }
13665     tmp = op->func_name;
13666     Py_INCREF(value);
13667     op->func_name = value;
13668     Py_XDECREF(tmp);
13669     return 0;
13670 }
13671 static PyObject *
13672 __Pyx_CyFunction_get_qualname(__pyx_CyFunctionObject *op)
13673 {
13674     Py_INCREF(op->func_qualname);
13675     return op->func_qualname;
13676 }
13677 static int
13678 __Pyx_CyFunction_set_qualname(__pyx_CyFunctionObject *op, PyObject *value)
13679 {
13680     PyObject *tmp;
13681 #if PY_MAJOR_VERSION >= 3
13682     if (unlikely(value == NULL || !PyUnicode_Check(value))) {
13683 #else
13684     if (unlikely(value == NULL || !PyString_Check(value))) {
13685 #endif
13686         PyErr_SetString(PyExc_TypeError,
13687                         "__qualname__ must be set to a string object");
13688         return -1;
13689     }
13690     tmp = op->func_qualname;
13691     Py_INCREF(value);
13692     op->func_qualname = value;
13693     Py_XDECREF(tmp);
13694     return 0;
13695 }
13696 static PyObject *
13697 __Pyx_CyFunction_get_self(__pyx_CyFunctionObject *m, CYTHON_UNUSED void *closure)
13698 {
13699     PyObject *self;
13700     self = m->func_closure;
13701     if (self == NULL)
13702         self = Py_None;
13703     Py_INCREF(self);
13704     return self;
13705 }
13706 static PyObject *
13707 __Pyx_CyFunction_get_dict(__pyx_CyFunctionObject *op)
13708 {
13709     if (unlikely(op->func_dict == NULL)) {
13710         op->func_dict = PyDict_New();
13711         if (unlikely(op->func_dict == NULL))
13712             return NULL;
13713     }
13714     Py_INCREF(op->func_dict);
13715     return op->func_dict;
13716 }
13717 static int
13718 __Pyx_CyFunction_set_dict(__pyx_CyFunctionObject *op, PyObject *value)
13719 {
13720     PyObject *tmp;
13721     if (unlikely(value == NULL)) {
13722         PyErr_SetString(PyExc_TypeError,
13723                "function's dictionary may not be deleted");
13724         return -1;
13725     }
13726     if (unlikely(!PyDict_Check(value))) {
13727         PyErr_SetString(PyExc_TypeError,
13728                "setting function's dictionary to a non-dict");
13729         return -1;
13730     }
13731     tmp = op->func_dict;
13732     Py_INCREF(value);
13733     op->func_dict = value;
13734     Py_XDECREF(tmp);
13735     return 0;
13736 }
13737 static PyObject *
13738 __Pyx_CyFunction_get_globals(__pyx_CyFunctionObject *op)
13739 {
13740     Py_INCREF(op->func_globals);
13741     return op->func_globals;
13742 }
13743 static PyObject *
13744 __Pyx_CyFunction_get_closure(CYTHON_UNUSED __pyx_CyFunctionObject *op)
13745 {
13746     Py_INCREF(Py_None);
13747     return Py_None;
13748 }
13749 static PyObject *
13750 __Pyx_CyFunction_get_code(__pyx_CyFunctionObject *op)
13751 {
13752     PyObject* result = (op->func_code) ? op->func_code : Py_None;
13753     Py_INCREF(result);
13754     return result;
13755 }
13756 static int
13757 __Pyx_CyFunction_init_defaults(__pyx_CyFunctionObject *op) {
13758     int result = 0;
13759     PyObject *res = op->defaults_getter((PyObject *) op);
13760     if (unlikely(!res))
13761         return -1;
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);
13767     #else
13768     op->defaults_tuple = PySequence_ITEM(res, 0);
13769     if (unlikely(!op->defaults_tuple)) result = -1;
13770     else {
13771         op->defaults_kwdict = PySequence_ITEM(res, 1);
13772         if (unlikely(!op->defaults_kwdict)) result = -1;
13773     }
13774     #endif
13775     Py_DECREF(res);
13776     return result;
13777 }
13778 static int
13779 __Pyx_CyFunction_set_defaults(__pyx_CyFunctionObject *op, PyObject* value) {
13780     PyObject* tmp;
13781     if (!value) {
13782         value = Py_None;
13783     } else if (value != Py_None && !PyTuple_Check(value)) {
13784         PyErr_SetString(PyExc_TypeError,
13785                         "__defaults__ must be set to a tuple object");
13786         return -1;
13787     }
13788     Py_INCREF(value);
13789     tmp = op->defaults_tuple;
13790     op->defaults_tuple = value;
13791     Py_XDECREF(tmp);
13792     return 0;
13793 }
13794 static PyObject *
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;
13801         } else {
13802             result = Py_None;
13803         }
13804     }
13805     Py_INCREF(result);
13806     return result;
13807 }
13808 static int
13809 __Pyx_CyFunction_set_kwdefaults(__pyx_CyFunctionObject *op, PyObject* value) {
13810     PyObject* tmp;
13811     if (!value) {
13812         value = Py_None;
13813     } else if (value != Py_None && !PyDict_Check(value)) {
13814         PyErr_SetString(PyExc_TypeError,
13815                         "__kwdefaults__ must be set to a dict object");
13816         return -1;
13817     }
13818     Py_INCREF(value);
13819     tmp = op->defaults_kwdict;
13820     op->defaults_kwdict = value;
13821     Py_XDECREF(tmp);
13822     return 0;
13823 }
13824 static PyObject *
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;
13831         } else {
13832             result = Py_None;
13833         }
13834     }
13835     Py_INCREF(result);
13836     return result;
13837 }
13838 static int
13839 __Pyx_CyFunction_set_annotations(__pyx_CyFunctionObject *op, PyObject* value) {
13840     PyObject* tmp;
13841     if (!value || value == Py_None) {
13842         value = NULL;
13843     } else if (!PyDict_Check(value)) {
13844         PyErr_SetString(PyExc_TypeError,
13845                         "__annotations__ must be set to a dict object");
13846         return -1;
13847     }
13848     Py_XINCREF(value);
13849     tmp = op->func_annotations;
13850     op->func_annotations = value;
13851     Py_XDECREF(tmp);
13852     return 0;
13853 }
13854 static PyObject *
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;
13861     }
13862     Py_INCREF(result);
13863     return result;
13864 }
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},
13884     {0, 0, 0, 0, 0}
13885 };
13886 static PyMemberDef __pyx_CyFunction_members[] = {
13887     {(char *) "__module__", T_OBJECT, offsetof(__pyx_CyFunctionObject, func.m_module), PY_WRITE_RESTRICTED, 0},
13888     {0, 0, 0,  0, 0}
13889 };
13890 static PyObject *
13891 __Pyx_CyFunction_reduce(__pyx_CyFunctionObject *m, CYTHON_UNUSED PyObject *args)
13892 {
13893 #if PY_MAJOR_VERSION >= 3
13894     return PyUnicode_FromString(m->func.m_ml->ml_name);
13895 #else
13896     return PyString_FromString(m->func.m_ml->ml_name);
13897 #endif
13898 }
13899 static PyMethodDef __pyx_CyFunction_methods[] = {
13900     {"__reduce__", (PyCFunction)__Pyx_CyFunction_reduce, METH_VARARGS, 0},
13901     {0, 0, 0, 0}
13902 };
13903 #if PY_VERSION_HEX < 0x030500A0
13904 #define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func_weakreflist)
13905 #else
13906 #define __Pyx_CyFunction_weakreflist(cyfunc) ((cyfunc)->func.m_weakreflist)
13907 #endif
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);
13911     if (op == NULL)
13912         return NULL;
13913     op->flags = flags;
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);
13929     Py_XINCREF(code);
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;
13939 }
13940 static int
13941 __Pyx_CyFunction_clear(__pyx_CyFunctionObject *m)
13942 {
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);
13955     if (m->defaults) {
13956         PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m);
13957         int i;
13958         for (i = 0; i < m->defaults_pyobjects; i++)
13959             Py_XDECREF(pydefaults[i]);
13960         PyObject_Free(m->defaults);
13961         m->defaults = NULL;
13962     }
13963     return 0;
13964 }
13965 static void __Pyx_CyFunction_dealloc(__pyx_CyFunctionObject *m)
13966 {
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);
13972 }
13973 static int __Pyx_CyFunction_traverse(__pyx_CyFunctionObject *m, visitproc visit, void *arg)
13974 {
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);
13986     if (m->defaults) {
13987         PyObject **pydefaults = __Pyx_CyFunction_Defaults(PyObject *, m);
13988         int i;
13989         for (i = 0; i < m->defaults_pyobjects; i++)
13990             Py_VISIT(pydefaults[i]);
13991     }
13992     return 0;
13993 }
13994 static PyObject *__Pyx_CyFunction_descr_get(PyObject *func, PyObject *obj, PyObject *type)
13995 {
13996     __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
13997     if (m->flags & __Pyx_CYFUNCTION_STATICMETHOD) {
13998         Py_INCREF(func);
13999         return func;
14000     }
14001     if (m->flags & __Pyx_CYFUNCTION_CLASSMETHOD) {
14002         if (type == NULL)
14003             type = (PyObject *)(Py_TYPE(obj));
14004         return __Pyx_PyMethod_New(func, type, (PyObject *)(Py_TYPE(type)));
14005     }
14006     if (obj == Py_None)
14007         obj = NULL;
14008     return __Pyx_PyMethod_New(func, obj, type);
14009 }
14010 static PyObject*
14011 __Pyx_CyFunction_repr(__pyx_CyFunctionObject *op)
14012 {
14013 #if PY_MAJOR_VERSION >= 3
14014     return PyUnicode_FromFormat("<cyfunction %U at %p>",
14015                                 op->func_qualname, (void *)op);
14016 #else
14017     return PyString_FromFormat("<cyfunction %s at %p>",
14018                                PyString_AsString(op->func_qualname), (void *)op);
14019 #endif
14020 }
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;
14024     Py_ssize_t size;
14025     switch (f->m_ml->ml_flags & (METH_VARARGS | METH_KEYWORDS | METH_NOARGS | METH_O)) {
14026     case METH_VARARGS:
14027         if (likely(kw == NULL || PyDict_Size(kw) == 0))
14028             return (*meth)(self, arg);
14029         break;
14030     case METH_VARARGS | METH_KEYWORDS:
14031         return (*(PyCFunctionWithKeywords)meth)(self, arg, kw);
14032     case METH_NOARGS:
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);
14040             return NULL;
14041         }
14042         break;
14043     case METH_O:
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);
14050                 Py_DECREF(arg0);
14051                 return result;
14052             }
14053             PyErr_Format(PyExc_TypeError,
14054                 "%.200s() takes exactly one argument (%" CYTHON_FORMAT_SSIZE_T "d given)",
14055                 f->m_ml->ml_name, size);
14056             return NULL;
14057         }
14058         break;
14059     default:
14060         PyErr_SetString(PyExc_SystemError, "Bad call flags in "
14061                         "__Pyx_CyFunction_Call. METH_OLDARGS is no "
14062                         "longer supported!");
14063         return NULL;
14064     }
14065     PyErr_Format(PyExc_TypeError, "%.200s() takes no keyword arguments",
14066                  f->m_ml->ml_name);
14067     return NULL;
14068 }
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);
14071 }
14072 static PyObject *__Pyx_CyFunction_CallAsMethod(PyObject *func, PyObject *args, PyObject *kw) {
14073     PyObject *result;
14074     __pyx_CyFunctionObject *cyfunc = (__pyx_CyFunctionObject *) func;
14075     if ((cyfunc->flags & __Pyx_CYFUNCTION_CCLASS) && !(cyfunc->flags & __Pyx_CYFUNCTION_STATICMETHOD)) {
14076         Py_ssize_t argc;
14077         PyObject *new_args;
14078         PyObject *self;
14079         argc = PyTuple_GET_SIZE(args);
14080         new_args = PyTuple_GetSlice(args, 1, argc);
14081         if (unlikely(!new_args))
14082             return NULL;
14083         self = PyTuple_GetItem(args, 0);
14084         if (unlikely(!self)) {
14085             Py_DECREF(new_args);
14086             return NULL;
14087         }
14088         result = __Pyx_CyFunction_CallMethod(func, self, new_args, kw);
14089         Py_DECREF(new_args);
14090     } else {
14091         result = __Pyx_CyFunction_Call(func, args, kw);
14092     }
14093     return result;
14094 }
14095 static PyTypeObject __pyx_CyFunctionType_type = {
14096     PyVarObject_HEAD_INIT(0, 0)
14097     "cython_function_or_method",
14098     sizeof(__pyx_CyFunctionObject),
14099     0,
14100     (destructor) __Pyx_CyFunction_dealloc,
14101     0,
14102     0,
14103     0,
14104 #if PY_MAJOR_VERSION < 3
14105     0,
14106 #else
14107     0,
14108 #endif
14109     (reprfunc) __Pyx_CyFunction_repr,
14110     0,
14111     0,
14112     0,
14113     0,
14114     __Pyx_CyFunction_CallAsMethod,
14115     0,
14116     0,
14117     0,
14118     0,
14119     Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC,
14120     0,
14121     (traverseproc) __Pyx_CyFunction_traverse,
14122     (inquiry) __Pyx_CyFunction_clear,
14123     0,
14124 #if PY_VERSION_HEX < 0x030500A0
14125     offsetof(__pyx_CyFunctionObject, func_weakreflist),
14126 #else
14127     offsetof(PyCFunctionObject, m_weakreflist),
14128 #endif
14129     0,
14130     0,
14131     __pyx_CyFunction_methods,
14132     __pyx_CyFunction_members,
14133     __pyx_CyFunction_getsets,
14134     0,
14135     0,
14136     __Pyx_CyFunction_descr_get,
14137     0,
14138     offsetof(__pyx_CyFunctionObject, func_dict),
14139     0,
14140     0,
14141     0,
14142     0,
14143     0,
14144     0,
14145     0,
14146     0,
14147     0,
14148     0,
14149     0,
14150     0,
14151 #if PY_VERSION_HEX >= 0x030400a1
14152     0,
14153 #endif
14154 };
14155 static int __pyx_CyFunction_init(void) {
14156     __pyx_CyFunctionType = __Pyx_FetchCommonType(&__pyx_CyFunctionType_type);
14157     if (__pyx_CyFunctionType == NULL) {
14158         return -1;
14159     }
14160     return 0;
14161 }
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);
14165     if (!m->defaults)
14166         return PyErr_NoMemory();
14167     memset(m->defaults, 0, size);
14168     m->defaults_pyobjects = pyobjects;
14169     return m->defaults;
14170 }
14171 static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *func, PyObject *tuple) {
14172     __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
14173     m->defaults_tuple = tuple;
14174     Py_INCREF(tuple);
14175 }
14176 static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *func, PyObject *dict) {
14177     __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
14178     m->defaults_kwdict = dict;
14179     Py_INCREF(dict);
14180 }
14181 static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *func, PyObject *dict) {
14182     __pyx_CyFunctionObject *m = (__pyx_CyFunctionObject *) func;
14183     m->func_annotations = dict;
14184     Py_INCREF(dict);
14185 }
14186
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!");
14191 }
14192
14193 /* None */
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));
14198     return q;
14199 }
14200
14201 /* BufferIndexError */
14202             static void __Pyx_RaiseBufferIndexError(int axis) {
14203   PyErr_Format(PyExc_IndexError,
14204      "Out of bounds on buffer access (axis %d)", axis);
14205 }
14206
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);
14211 }
14212
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");
14218 }
14219
14220 /* RaiseNoneIterError */
14221             static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) {
14222     PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
14223 }
14224
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;
14231     Py_XINCREF(*type);
14232     Py_XINCREF(*value);
14233     Py_XINCREF(*tb);
14234 }
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);
14246 }
14247 #endif
14248
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);
14256 }
14257 #endif
14258
14259 /* GetException */
14260             #if CYTHON_FAST_THREAD_STATE
14261 static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) {
14262 #else
14263 static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) {
14264 #endif
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;
14274 #else
14275     PyErr_Fetch(&local_type, &local_value, &local_tb);
14276 #endif
14277     PyErr_NormalizeException(&local_type, &local_value, &local_tb);
14278 #if CYTHON_FAST_THREAD_STATE
14279     if (unlikely(tstate->curexc_type))
14280 #else
14281     if (unlikely(PyErr_Occurred()))
14282 #endif
14283         goto bad;
14284     #if PY_MAJOR_VERSION >= 3
14285     if (local_tb) {
14286         if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0))
14287             goto bad;
14288     }
14289     #endif
14290     Py_XINCREF(local_tb);
14291     Py_XINCREF(local_type);
14292     Py_XINCREF(local_value);
14293     *type = local_type;
14294     *value = local_value;
14295     *tb = local_tb;
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);
14306 #else
14307     PyErr_SetExcInfo(local_type, local_value, local_tb);
14308 #endif
14309     return 0;
14310 bad:
14311     *type = 0;
14312     *value = 0;
14313     *tb = 0;
14314     Py_XDECREF(local_type);
14315     Py_XDECREF(local_value);
14316     Py_XDECREF(local_tb);
14317     return -1;
14318 }
14319
14320 /* Import */
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;
14326     PyObject *list;
14327     #if PY_VERSION_HEX < 0x03030000
14328     PyObject *py_import;
14329     py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import);
14330     if (!py_import)
14331         goto bad;
14332     #endif
14333     if (from_list)
14334         list = from_list;
14335     else {
14336         empty_list = PyList_New(0);
14337         if (!empty_list)
14338             goto bad;
14339         list = empty_list;
14340     }
14341     global_dict = PyModule_GetDict(__pyx_m);
14342     if (!global_dict)
14343         goto bad;
14344     empty_dict = PyDict_New();
14345     if (!empty_dict)
14346         goto bad;
14347     {
14348         #if PY_MAJOR_VERSION >= 3
14349         if (level == -1) {
14350             if (strchr(__Pyx_MODULE_NAME, '.')) {
14351                 #if PY_VERSION_HEX < 0x03030000
14352                 PyObject *py_level = PyInt_FromLong(1);
14353                 if (!py_level)
14354                     goto bad;
14355                 module = PyObject_CallFunctionObjArgs(py_import,
14356                     name, global_dict, empty_dict, list, py_level, NULL);
14357                 Py_DECREF(py_level);
14358                 #else
14359                 module = PyImport_ImportModuleLevelObject(
14360                     name, global_dict, empty_dict, list, 1);
14361                 #endif
14362                 if (!module) {
14363                     if (!PyErr_ExceptionMatches(PyExc_ImportError))
14364                         goto bad;
14365                     PyErr_Clear();
14366                 }
14367             }
14368             level = 0;
14369         }
14370         #endif
14371         if (!module) {
14372             #if PY_VERSION_HEX < 0x03030000
14373             PyObject *py_level = PyInt_FromLong(level);
14374             if (!py_level)
14375                 goto bad;
14376             module = PyObject_CallFunctionObjArgs(py_import,
14377                 name, global_dict, empty_dict, list, py_level, NULL);
14378             Py_DECREF(py_level);
14379             #else
14380             module = PyImport_ImportModuleLevelObject(
14381                 name, global_dict, empty_dict, list, level);
14382             #endif
14383         }
14384     }
14385 bad:
14386     #if PY_VERSION_HEX < 0x03030000
14387     Py_XDECREF(py_import);
14388     #endif
14389     Py_XDECREF(empty_list);
14390     Py_XDECREF(empty_dict);
14391     return module;
14392 }
14393
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) {
14398         return count;
14399     }
14400     while (start < end) {
14401         mid = start + (end - start) / 2;
14402         if (code_line < entries[mid].code_line) {
14403             end = mid;
14404         } else if (code_line > entries[mid].code_line) {
14405              start = mid + 1;
14406         } else {
14407             return mid;
14408         }
14409     }
14410     if (code_line <= entries[mid].code_line) {
14411         return mid;
14412     } else {
14413         return mid + 1;
14414     }
14415 }
14416 static PyCodeObject *__pyx_find_code_object(int code_line) {
14417     PyCodeObject* code_object;
14418     int pos;
14419     if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) {
14420         return NULL;
14421     }
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)) {
14424         return NULL;
14425     }
14426     code_object = __pyx_code_cache.entries[pos].code_object;
14427     Py_INCREF(code_object);
14428     return code_object;
14429 }
14430 static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) {
14431     int pos, i;
14432     __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries;
14433     if (unlikely(!code_line)) {
14434         return;
14435     }
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);
14445         }
14446         return;
14447     }
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;
14452         Py_DECREF(tmp);
14453         return;
14454     }
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)) {
14460             return;
14461         }
14462         __pyx_code_cache.entries = entries;
14463         __pyx_code_cache.max_count = new_max;
14464     }
14465     for (i=__pyx_code_cache.count; i>pos; i--) {
14466         entries[i] = entries[i-1];
14467     }
14468     entries[pos].code_line = code_line;
14469     entries[pos].code_object = code_object;
14470     __pyx_code_cache.count++;
14471     Py_INCREF(code_object);
14472 }
14473
14474 /* AddTraceback */
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);
14486     #else
14487     py_srcfile = PyUnicode_FromString(filename);
14488     #endif
14489     if (!py_srcfile) goto bad;
14490     if (c_line) {
14491         #if PY_MAJOR_VERSION < 3
14492         py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
14493         #else
14494         py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line);
14495         #endif
14496     }
14497     else {
14498         #if PY_MAJOR_VERSION < 3
14499         py_funcname = PyString_FromString(funcname);
14500         #else
14501         py_funcname = PyUnicode_FromString(funcname);
14502         #endif
14503     }
14504     if (!py_funcname) goto bad;
14505     py_code = __Pyx_PyCode_New(
14506         0,
14507         0,
14508         0,
14509         0,
14510         0,
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,*/
14519         py_line,
14520         __pyx_empty_bytes  /*PyObject *lnotab*/
14521     );
14522     Py_DECREF(py_srcfile);
14523     Py_DECREF(py_funcname);
14524     return py_code;
14525 bad:
14526     Py_XDECREF(py_srcfile);
14527     Py_XDECREF(py_funcname);
14528     return NULL;
14529 }
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);
14535     if (!py_code) {
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);
14540     }
14541     py_frame = PyFrame_New(
14542         PyThreadState_GET(), /*PyThreadState *tstate,*/
14543         py_code,             /*PyCodeObject *code,*/
14544         __pyx_d,      /*PyObject *globals,*/
14545         0                    /*PyObject *locals*/
14546     );
14547     if (!py_frame) goto bad;
14548     __Pyx_PyFrame_SetLineNumber(py_frame, py_line);
14549     PyTraceBack_Here(py_frame);
14550 bad:
14551     Py_XDECREF(py_code);
14552     Py_XDECREF(py_frame);
14553 }
14554
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);
14560     return -1;
14561 }
14562 static void __Pyx_ReleaseBuffer(Py_buffer *view) {
14563     PyObject *obj = view->obj;
14564     if (!obj) return;
14565     if (PyObject_CheckBuffer(obj)) {
14566         PyBuffer_Release(view);
14567         return;
14568     }
14569         if (PyObject_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) { __pyx_pw_5numpy_7ndarray_3__releasebuffer__(obj, view); return; }
14570     Py_DECREF(obj);
14571     view->obj = NULL;
14572 }
14573 #endif
14574
14575
14576               /* CIntToPy */
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;
14580     if (is_unsigned) {
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);
14588 #endif
14589         }
14590     } else {
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);
14596 #endif
14597         }
14598     }
14599     {
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);
14604     }
14605 }
14606
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)\
14613     {\
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;\
14622                 else\
14623                     goto raise_overflow;\
14624             }\
14625         }\
14626         return (target_type) value;\
14627     }
14628
14629 /* CIntToPy */
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;
14633     if (is_unsigned) {
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);
14641 #endif
14642         }
14643     } else {
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);
14649 #endif
14650         }
14651     }
14652     {
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);
14657     }
14658 }
14659
14660 /* CIntToPy */
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;
14664     if (is_unsigned) {
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);
14672 #endif
14673         }
14674     } else {
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);
14680 #endif
14681         }
14682     }
14683     {
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);
14688     }
14689 }
14690
14691 /* Declarations */
14692               #if CYTHON_CCOMPLEX
14693   #ifdef __cplusplus
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);
14696     }
14697   #else
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;
14700     }
14701   #endif
14702 #else
14703     static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) {
14704       __pyx_t_float_complex z;
14705       z.real = x;
14706       z.imag = y;
14707       return z;
14708     }
14709 #endif
14710
14711 /* Arithmetic */
14712               #if CYTHON_CCOMPLEX
14713 #else
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);
14716     }
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;
14721         return z;
14722     }
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;
14727         return z;
14728     }
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;
14733         return z;
14734     }
14735     #if 1
14736     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
14737         if (b.imag == 0) {
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);
14742             } else {
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);
14747             }
14748         } else {
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);
14753         }
14754     }
14755     #else
14756     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quot_float(__pyx_t_float_complex a, __pyx_t_float_complex b) {
14757         if (b.imag == 0) {
14758             return __pyx_t_float_complex_from_parts(a.real / b.real, a.imag / b.real);
14759         } else {
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);
14764         }
14765     }
14766     #endif
14767     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_neg_float(__pyx_t_float_complex a) {
14768         __pyx_t_float_complex z;
14769         z.real = -a.real;
14770         z.imag = -a.imag;
14771         return z;
14772     }
14773     static CYTHON_INLINE int __Pyx_c_is_zero_float(__pyx_t_float_complex a) {
14774        return (a.real == 0) && (a.imag == 0);
14775     }
14776     static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conj_float(__pyx_t_float_complex a) {
14777         __pyx_t_float_complex z;
14778         z.real =  a.real;
14779         z.imag = -a.imag;
14780         return z;
14781     }
14782     #if 1
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);
14786           #else
14787             return hypotf(z.real, z.imag);
14788           #endif
14789         }
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) {
14794                 if (b.real < 0) {
14795                     float denom = a.real * a.real + a.imag * a.imag;
14796                     a.real = a.real / denom;
14797                     a.imag = -a.imag / denom;
14798                     b.real = -b.real;
14799                 }
14800                 switch ((int)b.real) {
14801                     case 0:
14802                         z.real = 1;
14803                         z.imag = 0;
14804                         return z;
14805                     case 1:
14806                         return a;
14807                     case 2:
14808                         z = __Pyx_c_prod_float(a, a);
14809                         return __Pyx_c_prod_float(a, a);
14810                     case 3:
14811                         z = __Pyx_c_prod_float(a, a);
14812                         return __Pyx_c_prod_float(z, a);
14813                     case 4:
14814                         z = __Pyx_c_prod_float(a, a);
14815                         return __Pyx_c_prod_float(z, z);
14816                 }
14817             }
14818             if (a.imag == 0) {
14819                 if (a.real == 0) {
14820                     return a;
14821                 } else if (b.imag == 0) {
14822                     z.real = powf(a.real, b.real);
14823                     z.imag = 0;
14824                     return z;
14825                 } else if (a.real > 0) {
14826                     r = a.real;
14827                     theta = 0;
14828                 } else {
14829                     r = -a.real;
14830                     theta = atan2f(0, -1);
14831                 }
14832             } else {
14833                 r = __Pyx_c_abs_float(a);
14834                 theta = atan2f(a.imag, a.real);
14835             }
14836             lnr = logf(r);
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);
14841             return z;
14842         }
14843     #endif
14844 #endif
14845
14846 /* Declarations */
14847               #if CYTHON_CCOMPLEX
14848   #ifdef __cplusplus
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);
14851     }
14852   #else
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;
14855     }
14856   #endif
14857 #else
14858     static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) {
14859       __pyx_t_double_complex z;
14860       z.real = x;
14861       z.imag = y;
14862       return z;
14863     }
14864 #endif
14865
14866 /* Arithmetic */
14867               #if CYTHON_CCOMPLEX
14868 #else
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);
14871     }
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;
14876         return z;
14877     }
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;
14882         return z;
14883     }
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;
14888         return z;
14889     }
14890     #if 1
14891     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
14892         if (b.imag == 0) {
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);
14897             } else {
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);
14902             }
14903         } else {
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);
14908         }
14909     }
14910     #else
14911     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot_double(__pyx_t_double_complex a, __pyx_t_double_complex b) {
14912         if (b.imag == 0) {
14913             return __pyx_t_double_complex_from_parts(a.real / b.real, a.imag / b.real);
14914         } else {
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);
14919         }
14920     }
14921     #endif
14922     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg_double(__pyx_t_double_complex a) {
14923         __pyx_t_double_complex z;
14924         z.real = -a.real;
14925         z.imag = -a.imag;
14926         return z;
14927     }
14928     static CYTHON_INLINE int __Pyx_c_is_zero_double(__pyx_t_double_complex a) {
14929        return (a.real == 0) && (a.imag == 0);
14930     }
14931     static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj_double(__pyx_t_double_complex a) {
14932         __pyx_t_double_complex z;
14933         z.real =  a.real;
14934         z.imag = -a.imag;
14935         return z;
14936     }
14937     #if 1
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);
14941           #else
14942             return hypot(z.real, z.imag);
14943           #endif
14944         }
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) {
14949                 if (b.real < 0) {
14950                     double denom = a.real * a.real + a.imag * a.imag;
14951                     a.real = a.real / denom;
14952                     a.imag = -a.imag / denom;
14953                     b.real = -b.real;
14954                 }
14955                 switch ((int)b.real) {
14956                     case 0:
14957                         z.real = 1;
14958                         z.imag = 0;
14959                         return z;
14960                     case 1:
14961                         return a;
14962                     case 2:
14963                         z = __Pyx_c_prod_double(a, a);
14964                         return __Pyx_c_prod_double(a, a);
14965                     case 3:
14966                         z = __Pyx_c_prod_double(a, a);
14967                         return __Pyx_c_prod_double(z, a);
14968                     case 4:
14969                         z = __Pyx_c_prod_double(a, a);
14970                         return __Pyx_c_prod_double(z, z);
14971                 }
14972             }
14973             if (a.imag == 0) {
14974                 if (a.real == 0) {
14975                     return a;
14976                 } else if (b.imag == 0) {
14977                     z.real = pow(a.real, b.real);
14978                     z.imag = 0;
14979                     return z;
14980                 } else if (a.real > 0) {
14981                     r = a.real;
14982                     theta = 0;
14983                 } else {
14984                     r = -a.real;
14985                     theta = atan2(0, -1);
14986                 }
14987             } else {
14988                 r = __Pyx_c_abs_double(a);
14989                 theta = atan2(a.imag, a.real);
14990             }
14991             lnr = log(r);
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);
14996             return z;
14997         }
14998     #endif
14999 #endif
15000
15001 /* CIntToPy */
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;
15005     if (is_unsigned) {
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);
15013 #endif
15014         }
15015     } else {
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);
15021 #endif
15022         }
15023     }
15024     {
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);
15029     }
15030 }
15031
15032 /* CIntToPy */
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;
15036     if (is_unsigned) {
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);
15044 #endif
15045         }
15046     } else {
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);
15052 #endif
15053         }
15054     }
15055     {
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);
15060     }
15061 }
15062
15063 /* CIntFromPy */
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))
15071         } else {
15072             long val = PyInt_AS_LONG(x);
15073             if (is_unsigned && unlikely(val < 0)) {
15074                 goto raise_neg_overflow;
15075             }
15076             return (siz) val;
15077         }
15078     } else
15079 #endif
15080     if (likely(PyLong_Check(x))) {
15081         if (is_unsigned) {
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])
15087                 case 2:
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]));
15093                         }
15094                     }
15095                     break;
15096                 case 3:
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]));
15102                         }
15103                     }
15104                     break;
15105                 case 4:
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]));
15111                         }
15112                     }
15113                     break;
15114             }
15115 #endif
15116 #if CYTHON_COMPILING_IN_CPYTHON
15117             if (unlikely(Py_SIZE(x) < 0)) {
15118                 goto raise_neg_overflow;
15119             }
15120 #else
15121             {
15122                 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
15123                 if (unlikely(result < 0))
15124                     return (siz) -1;
15125                 if (unlikely(result == 1))
15126                     goto raise_neg_overflow;
15127             }
15128 #endif
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))
15134 #endif
15135             }
15136         } else {
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])
15143                 case -2:
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])));
15149                         }
15150                     }
15151                     break;
15152                 case 2:
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])));
15158                         }
15159                     }
15160                     break;
15161                 case -3:
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])));
15167                         }
15168                     }
15169                     break;
15170                 case 3:
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])));
15176                         }
15177                     }
15178                     break;
15179                 case -4:
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])));
15185                         }
15186                     }
15187                     break;
15188                 case 4:
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])));
15194                         }
15195                     }
15196                     break;
15197             }
15198 #endif
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))
15204 #endif
15205             }
15206         }
15207         {
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");
15211 #else
15212             siz val;
15213             PyObject *v = __Pyx_PyNumber_IntOrLong(x);
15214  #if PY_MAJOR_VERSION < 3
15215             if (likely(v) && !PyLong_Check(v)) {
15216                 PyObject *tmp = v;
15217                 v = PyNumber_Long(tmp);
15218                 Py_DECREF(tmp);
15219             }
15220  #endif
15221             if (likely(v)) {
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);
15227                 Py_DECREF(v);
15228                 if (likely(!ret))
15229                     return val;
15230             }
15231 #endif
15232             return (siz) -1;
15233         }
15234     } else {
15235         siz val;
15236         PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
15237         if (!tmp) return (siz) -1;
15238         val = __Pyx_PyInt_As_siz(tmp);
15239         Py_DECREF(tmp);
15240         return val;
15241     }
15242 raise_overflow:
15243     PyErr_SetString(PyExc_OverflowError,
15244         "value too large to convert to siz");
15245     return (siz) -1;
15246 raise_neg_overflow:
15247     PyErr_SetString(PyExc_OverflowError,
15248         "can't convert negative value to siz");
15249     return (siz) -1;
15250 }
15251
15252 /* CIntFromPy */
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))
15260         } else {
15261             long val = PyInt_AS_LONG(x);
15262             if (is_unsigned && unlikely(val < 0)) {
15263                 goto raise_neg_overflow;
15264             }
15265             return (size_t) val;
15266         }
15267     } else
15268 #endif
15269     if (likely(PyLong_Check(x))) {
15270         if (is_unsigned) {
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])
15276                 case 2:
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]));
15282                         }
15283                     }
15284                     break;
15285                 case 3:
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]));
15291                         }
15292                     }
15293                     break;
15294                 case 4:
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]));
15300                         }
15301                     }
15302                     break;
15303             }
15304 #endif
15305 #if CYTHON_COMPILING_IN_CPYTHON
15306             if (unlikely(Py_SIZE(x) < 0)) {
15307                 goto raise_neg_overflow;
15308             }
15309 #else
15310             {
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;
15316             }
15317 #endif
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))
15323 #endif
15324             }
15325         } else {
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])
15332                 case -2:
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])));
15338                         }
15339                     }
15340                     break;
15341                 case 2:
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])));
15347                         }
15348                     }
15349                     break;
15350                 case -3:
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])));
15356                         }
15357                     }
15358                     break;
15359                 case 3:
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])));
15365                         }
15366                     }
15367                     break;
15368                 case -4:
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])));
15374                         }
15375                     }
15376                     break;
15377                 case 4:
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])));
15383                         }
15384                     }
15385                     break;
15386             }
15387 #endif
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))
15393 #endif
15394             }
15395         }
15396         {
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");
15400 #else
15401             size_t val;
15402             PyObject *v = __Pyx_PyNumber_IntOrLong(x);
15403  #if PY_MAJOR_VERSION < 3
15404             if (likely(v) && !PyLong_Check(v)) {
15405                 PyObject *tmp = v;
15406                 v = PyNumber_Long(tmp);
15407                 Py_DECREF(tmp);
15408             }
15409  #endif
15410             if (likely(v)) {
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);
15416                 Py_DECREF(v);
15417                 if (likely(!ret))
15418                     return val;
15419             }
15420 #endif
15421             return (size_t) -1;
15422         }
15423     } else {
15424         size_t val;
15425         PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
15426         if (!tmp) return (size_t) -1;
15427         val = __Pyx_PyInt_As_size_t(tmp);
15428         Py_DECREF(tmp);
15429         return val;
15430     }
15431 raise_overflow:
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;
15439 }
15440
15441 /* CIntFromPy */
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))
15449         } else {
15450             long val = PyInt_AS_LONG(x);
15451             if (is_unsigned && unlikely(val < 0)) {
15452                 goto raise_neg_overflow;
15453             }
15454             return (int) val;
15455         }
15456     } else
15457 #endif
15458     if (likely(PyLong_Check(x))) {
15459         if (is_unsigned) {
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])
15465                 case 2:
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]));
15471                         }
15472                     }
15473                     break;
15474                 case 3:
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]));
15480                         }
15481                     }
15482                     break;
15483                 case 4:
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]));
15489                         }
15490                     }
15491                     break;
15492             }
15493 #endif
15494 #if CYTHON_COMPILING_IN_CPYTHON
15495             if (unlikely(Py_SIZE(x) < 0)) {
15496                 goto raise_neg_overflow;
15497             }
15498 #else
15499             {
15500                 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
15501                 if (unlikely(result < 0))
15502                     return (int) -1;
15503                 if (unlikely(result == 1))
15504                     goto raise_neg_overflow;
15505             }
15506 #endif
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))
15512 #endif
15513             }
15514         } else {
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])
15521                 case -2:
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])));
15527                         }
15528                     }
15529                     break;
15530                 case 2:
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])));
15536                         }
15537                     }
15538                     break;
15539                 case -3:
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])));
15545                         }
15546                     }
15547                     break;
15548                 case 3:
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])));
15554                         }
15555                     }
15556                     break;
15557                 case -4:
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])));
15563                         }
15564                     }
15565                     break;
15566                 case 4:
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])));
15572                         }
15573                     }
15574                     break;
15575             }
15576 #endif
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))
15582 #endif
15583             }
15584         }
15585         {
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");
15589 #else
15590             int val;
15591             PyObject *v = __Pyx_PyNumber_IntOrLong(x);
15592  #if PY_MAJOR_VERSION < 3
15593             if (likely(v) && !PyLong_Check(v)) {
15594                 PyObject *tmp = v;
15595                 v = PyNumber_Long(tmp);
15596                 Py_DECREF(tmp);
15597             }
15598  #endif
15599             if (likely(v)) {
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);
15605                 Py_DECREF(v);
15606                 if (likely(!ret))
15607                     return val;
15608             }
15609 #endif
15610             return (int) -1;
15611         }
15612     } else {
15613         int val;
15614         PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
15615         if (!tmp) return (int) -1;
15616         val = __Pyx_PyInt_As_int(tmp);
15617         Py_DECREF(tmp);
15618         return val;
15619     }
15620 raise_overflow:
15621     PyErr_SetString(PyExc_OverflowError,
15622         "value too large to convert to int");
15623     return (int) -1;
15624 raise_neg_overflow:
15625     PyErr_SetString(PyExc_OverflowError,
15626         "can't convert negative value to int");
15627     return (int) -1;
15628 }
15629
15630 /* CIntFromPy */
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))
15638         } else {
15639             long val = PyInt_AS_LONG(x);
15640             if (is_unsigned && unlikely(val < 0)) {
15641                 goto raise_neg_overflow;
15642             }
15643             return (long) val;
15644         }
15645     } else
15646 #endif
15647     if (likely(PyLong_Check(x))) {
15648         if (is_unsigned) {
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])
15654                 case 2:
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]));
15660                         }
15661                     }
15662                     break;
15663                 case 3:
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]));
15669                         }
15670                     }
15671                     break;
15672                 case 4:
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]));
15678                         }
15679                     }
15680                     break;
15681             }
15682 #endif
15683 #if CYTHON_COMPILING_IN_CPYTHON
15684             if (unlikely(Py_SIZE(x) < 0)) {
15685                 goto raise_neg_overflow;
15686             }
15687 #else
15688             {
15689                 int result = PyObject_RichCompareBool(x, Py_False, Py_LT);
15690                 if (unlikely(result < 0))
15691                     return (long) -1;
15692                 if (unlikely(result == 1))
15693                     goto raise_neg_overflow;
15694             }
15695 #endif
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))
15701 #endif
15702             }
15703         } else {
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])
15710                 case -2:
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])));
15716                         }
15717                     }
15718                     break;
15719                 case 2:
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])));
15725                         }
15726                     }
15727                     break;
15728                 case -3:
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])));
15734                         }
15735                     }
15736                     break;
15737                 case 3:
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])));
15743                         }
15744                     }
15745                     break;
15746                 case -4:
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])));
15752                         }
15753                     }
15754                     break;
15755                 case 4:
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])));
15761                         }
15762                     }
15763                     break;
15764             }
15765 #endif
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))
15771 #endif
15772             }
15773         }
15774         {
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");
15778 #else
15779             long val;
15780             PyObject *v = __Pyx_PyNumber_IntOrLong(x);
15781  #if PY_MAJOR_VERSION < 3
15782             if (likely(v) && !PyLong_Check(v)) {
15783                 PyObject *tmp = v;
15784                 v = PyNumber_Long(tmp);
15785                 Py_DECREF(tmp);
15786             }
15787  #endif
15788             if (likely(v)) {
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);
15794                 Py_DECREF(v);
15795                 if (likely(!ret))
15796                     return val;
15797             }
15798 #endif
15799             return (long) -1;
15800         }
15801     } else {
15802         long val;
15803         PyObject *tmp = __Pyx_PyNumber_IntOrLong(x);
15804         if (!tmp) return (long) -1;
15805         val = __Pyx_PyInt_As_long(tmp);
15806         Py_DECREF(tmp);
15807         return val;
15808     }
15809 raise_overflow:
15810     PyErr_SetString(PyExc_OverflowError,
15811         "value too large to convert to long");
15812     return (long) -1;
15813 raise_neg_overflow:
15814     PyErr_SetString(PyExc_OverflowError,
15815         "can't convert negative value to long");
15816     return (long) -1;
15817 }
15818
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]) {
15825         char message[200];
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);
15831     }
15832     return 0;
15833 }
15834
15835 /* ModuleImport */
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);
15842     if (!py_name)
15843         goto bad;
15844     py_module = PyImport_Import(py_name);
15845     Py_DECREF(py_name);
15846     return py_module;
15847 bad:
15848     Py_XDECREF(py_name);
15849     return 0;
15850 }
15851 #endif
15852
15853 /* TypeImport */
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)
15858 {
15859     PyObject *py_module = 0;
15860     PyObject *result = 0;
15861     PyObject *py_name = 0;
15862     char warning[200];
15863     Py_ssize_t basicsize;
15864 #ifdef Py_LIMITED_API
15865     PyObject *py_basicsize;
15866 #endif
15867     py_module = __Pyx_ImportModule(module_name);
15868     if (!py_module)
15869         goto bad;
15870     py_name = __Pyx_PyIdentifier_FromString(class_name);
15871     if (!py_name)
15872         goto bad;
15873     result = PyObject_GetAttr(py_module, py_name);
15874     Py_DECREF(py_name);
15875     py_name = 0;
15876     Py_DECREF(py_module);
15877     py_module = 0;
15878     if (!result)
15879         goto bad;
15880     if (!PyType_Check(result)) {
15881         PyErr_Format(PyExc_TypeError,
15882             "%.200s.%.200s is not a type object",
15883             module_name, class_name);
15884         goto bad;
15885     }
15886 #ifndef Py_LIMITED_API
15887     basicsize = ((PyTypeObject *)result)->tp_basicsize;
15888 #else
15889     py_basicsize = PyObject_GetAttrString(result, "__basicsize__");
15890     if (!py_basicsize)
15891         goto bad;
15892     basicsize = PyLong_AsSsize_t(py_basicsize);
15893     Py_DECREF(py_basicsize);
15894     py_basicsize = 0;
15895     if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred())
15896         goto bad;
15897 #endif
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;
15903     }
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);
15908         goto bad;
15909     }
15910     return (PyTypeObject *)result;
15911 bad:
15912     Py_XDECREF(py_module);
15913     Py_XDECREF(result);
15914     return NULL;
15915 }
15916 #endif
15917
15918 /* InitStrings */
15919               static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
15920     while (t->p) {
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);
15926         } else {
15927             *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
15928         }
15929         #else
15930         if (t->is_unicode | t->is_str) {
15931             if (t->intern) {
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);
15935             } else {
15936                 *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1);
15937             }
15938         } else {
15939             *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1);
15940         }
15941         #endif
15942         if (!*t->p)
15943             return -1;
15944         ++t;
15945     }
15946     return 0;
15947 }
15948
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));
15951 }
15952 static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject* o) {
15953     Py_ssize_t ignore;
15954     return __Pyx_PyObject_AsStringAndSize(o, &ignore);
15955 }
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)
15958     if (
15959 #if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
15960             __Pyx_sys_getdefaultencoding_not_ascii &&
15961 #endif
15962             PyUnicode_Check(o)) {
15963 #if PY_VERSION_HEX < 0x03030000
15964         char* defenc_c;
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
15969         {
15970             char* end = defenc_c + PyBytes_GET_SIZE(defenc);
15971             char* c;
15972             for (c = defenc_c; c < end; c++) {
15973                 if ((unsigned char) (*c) >= 128) {
15974                     PyUnicode_AsASCIIString(o);
15975                     return NULL;
15976                 }
15977             }
15978         }
15979 #endif
15980         *length = PyBytes_GET_SIZE(defenc);
15981         return defenc_c;
15982 #else
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);
15988         } else {
15989             PyUnicode_AsASCIIString(o);
15990             return NULL;
15991         }
15992 #else
15993         return PyUnicode_AsUTF8AndSize(o, length);
15994 #endif
15995 #endif
15996     } else
15997 #endif
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);
16002     } else
16003 #endif
16004     {
16005         char* result;
16006         int r = PyBytes_AsStringAndSize(o, &result, length);
16007         if (unlikely(r < 0)) {
16008             return NULL;
16009         } else {
16010             return result;
16011         }
16012     }
16013 }
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);
16018 }
16019 static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x) {
16020 #if CYTHON_USE_TYPE_SLOTS
16021   PyNumberMethods *m;
16022 #endif
16023   const char *name = NULL;
16024   PyObject *res = NULL;
16025 #if PY_MAJOR_VERSION < 3
16026   if (PyInt_Check(x) || PyLong_Check(x))
16027 #else
16028   if (PyLong_Check(x))
16029 #endif
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) {
16035     name = "int";
16036     res = PyNumber_Int(x);
16037   }
16038   else if (m && m->nb_long) {
16039     name = "long";
16040     res = PyNumber_Long(x);
16041   }
16042   #else
16043   if (m && m->nb_int) {
16044     name = "int";
16045     res = PyNumber_Long(x);
16046   }
16047   #endif
16048 #else
16049   res = PyNumber_Int(x);
16050 #endif
16051   if (res) {
16052 #if PY_MAJOR_VERSION < 3
16053     if (!PyInt_Check(res) && !PyLong_Check(res)) {
16054 #else
16055     if (!PyLong_Check(res)) {
16056 #endif
16057       PyErr_Format(PyExc_TypeError,
16058                    "__%.4s__ returned non-%.4s (type %.200s)",
16059                    name, name, Py_TYPE(res)->tp_name);
16060       Py_DECREF(res);
16061       return NULL;
16062     }
16063   }
16064   else if (!PyErr_Occurred()) {
16065     PyErr_SetString(PyExc_TypeError,
16066                     "an integer is required");
16067   }
16068   return res;
16069 }
16070 static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) {
16071   Py_ssize_t ival;
16072   PyObject *x;
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);
16077     else
16078         return PyInt_AsSsize_t(x);
16079   }
16080 #endif
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;
16088         return ival;
16089     } else {
16090       switch (size) {
16091          case 2:
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]));
16094            }
16095            break;
16096          case -2:
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]));
16099            }
16100            break;
16101          case 3:
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]));
16104            }
16105            break;
16106          case -3:
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]));
16109            }
16110            break;
16111          case 4:
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]));
16114            }
16115            break;
16116          case -4:
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]));
16119            }
16120            break;
16121       }
16122     }
16123     #endif
16124     return PyLong_AsSsize_t(b);
16125   }
16126   x = PyNumber_Index(b);
16127   if (!x) return -1;
16128   ival = PyInt_AsSsize_t(x);
16129   Py_DECREF(x);
16130   return ival;
16131 }
16132 static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) {
16133     return PyInt_FromSize_t(ival);
16134 }
16135
16136
16137 #endif /* Py_PYTHON_H */