From 59ccb531e55d6b51b8f44c88644c62febb3efb18 Mon Sep 17 00:00:00 2001 From: Theelgirl <43764914+Theelgirl@users.noreply.github.com> Date: Sat, 17 Oct 2020 15:34:01 +0000 Subject: [PATCH] Update and rename fvid_cython.cpp to fvid_cython.c --- fvid/{fvid_cython.cpp => fvid_cython.c} | 1446 +++++++---------------- 1 file changed, 408 insertions(+), 1038 deletions(-) rename fvid/{fvid_cython.cpp => fvid_cython.c} (83%) diff --git a/fvid/fvid_cython.cpp b/fvid/fvid_cython.c similarity index 83% rename from fvid/fvid_cython.cpp rename to fvid/fvid_cython.c index 09c102e..f49f81c 100644 --- a/fvid/fvid_cython.cpp +++ b/fvid/fvid_cython.c @@ -3,7 +3,7 @@ /* BEGIN: Cython Metadata { "distutils": { - "language": "c++", + "language": "c", "name": "fvid_cython", "sources": [ "fvid_cython.pyx" @@ -392,33 +392,19 @@ END: Cython Metadata */ #endif #endif -#ifndef __cplusplus - #error "Cython files generated with the C++ option must be compiled with a C++ compiler." -#endif #ifndef CYTHON_INLINE #if defined(__clang__) #define CYTHON_INLINE __inline__ __attribute__ ((__unused__)) - #else + #elif defined(__GNUC__) + #define CYTHON_INLINE __inline__ + #elif defined(_MSC_VER) + #define CYTHON_INLINE __inline + #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L #define CYTHON_INLINE inline + #else + #define CYTHON_INLINE #endif #endif -template -void __Pyx_call_destructor(T& x) { - x.~T(); -} -template -class __Pyx_FakeReference { - public: - __Pyx_FakeReference() : ptr(NULL) { } - __Pyx_FakeReference(const T& ref) : ptr(const_cast(&ref)) { } - T *operator->() { return ptr; } - T *operator&() { return ptr; } - operator T&() { return *ptr; } - template bool operator ==(U other) { return *ptr == other; } - template bool operator !=(U other) { return *ptr != other; } - private: - T *ptr; -}; #if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag) #define Py_OptimizeFlag 0 @@ -1042,6 +1028,21 @@ static const char *__pyx_f[] = { /* #### Code section: type_declarations ### */ /*--- Type declarations ---*/ +struct __pyx_ctuple_int__and_int__and_int; +typedef struct __pyx_ctuple_int__and_int__and_int __pyx_ctuple_int__and_int__and_int; + +/* "fvid_cython.pyx":9 + * cdef int width, height, x, y + * cdef str pixel_bin_rep + * cdef (int, int, int) pixel, white_diff, black_diff # <<<<<<<<<<<<<< + * cdef (bint, bint, bint) truth_tuple + * + */ +struct __pyx_ctuple_int__and_int__and_int { + int f0; + int f1; + int f2; +}; /* #### Code section: utility_code_proto ### */ /* --- Runtime support code (head) --- */ @@ -1225,56 +1226,6 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject #define __Pyx_PyObject_FastCall(func, args, nargs) __Pyx_PyObject_FastCallDict(func, args, nargs, NULL) static CYTHON_INLINE PyObject* __Pyx_PyObject_FastCallDict(PyObject *func, PyObject **args, Py_ssize_t nargs, PyObject *kwargs); -/* PyDictVersioning.proto */ -#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS -#define __PYX_DICT_VERSION_INIT ((PY_UINT64_T) -1) -#define __PYX_GET_DICT_VERSION(dict) (((PyDictObject*)(dict))->ma_version_tag) -#define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\ - (version_var) = __PYX_GET_DICT_VERSION(dict);\ - (cache_var) = (value); -#define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) {\ - static PY_UINT64_T __pyx_dict_version = 0;\ - static PyObject *__pyx_dict_cached_value = NULL;\ - if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) {\ - (VAR) = __pyx_dict_cached_value;\ - } else {\ - (VAR) = __pyx_dict_cached_value = (LOOKUP);\ - __pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\ - }\ -} -static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj); -static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj); -static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version); -#else -#define __PYX_GET_DICT_VERSION(dict) (0) -#define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var) -#define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) (VAR) = (LOOKUP); -#endif - -/* GetModuleGlobalName.proto */ -#if CYTHON_USE_DICT_VERSIONS -#define __Pyx_GetModuleGlobalName(var, name) {\ - static PY_UINT64_T __pyx_dict_version = 0;\ - static PyObject *__pyx_dict_cached_value = NULL;\ - (var) = (likely(__pyx_dict_version == __PYX_GET_DICT_VERSION(__pyx_d))) ?\ - (likely(__pyx_dict_cached_value) ? __Pyx_NewRef(__pyx_dict_cached_value) : __Pyx_GetBuiltinName(name)) :\ - __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\ -} -#define __Pyx_GetModuleGlobalNameUncached(var, name) {\ - PY_UINT64_T __pyx_dict_version;\ - PyObject *__pyx_dict_cached_value;\ - (var) = __Pyx__GetModuleGlobalName(name, &__pyx_dict_version, &__pyx_dict_cached_value);\ -} -static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value); -#else -#define __Pyx_GetModuleGlobalName(var, name) (var) = __Pyx__GetModuleGlobalName(name) -#define __Pyx_GetModuleGlobalNameUncached(var, name) (var) = __Pyx__GetModuleGlobalName(name) -static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name); -#endif - -/* PyObjectCallOneArg.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg); - /* GetItemInt.proto */ #define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\ (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\ @@ -1297,6 +1248,9 @@ static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j); static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list, int wraparound, int boundscheck); +/* PyObjectCallOneArg.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg); + /* ObjectGetItem.proto */ #if CYTHON_USE_TYPE_SLOTS static CYTHON_INLINE PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject *key); @@ -1304,31 +1258,6 @@ static CYTHON_INLINE PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject *k #define __Pyx_PyObject_GetItem(obj, key) PyObject_GetItem(obj, key) #endif -/* RaiseUnexpectedTypeError.proto */ -static int __Pyx_RaiseUnexpectedTypeError(const char *expected, PyObject *obj); - -/* PyIntCompare.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyInt_EqObjC(PyObject *op1, PyObject *op2, long intval, long inplace); - -/* py_abs.proto */ -#if CYTHON_USE_PYLONG_INTERNALS -static PyObject *__Pyx_PyLong_AbsNeg(PyObject *num); -#define __Pyx_PyNumber_Absolute(x)\ - ((likely(PyLong_CheckExact(x))) ?\ - (likely(Py_SIZE(x) >= 0) ? (Py_INCREF(x), (x)) : __Pyx_PyLong_AbsNeg(x)) :\ - PyNumber_Absolute(x)) -#else -#define __Pyx_PyNumber_Absolute(x) PyNumber_Absolute(x) -#endif - -/* PyIntBinop.proto */ -#if !CYTHON_COMPILING_IN_PYPY -static PyObject* __Pyx_PyInt_SubtractObjC(PyObject *op1, PyObject *op2, long intval, int inplace, int zerodivision_check); -#else -#define __Pyx_PyInt_SubtractObjC(op1, op2, intval, inplace, zerodivision_check)\ - (inplace ? PyNumber_InPlaceSubtract(op1, op2) : PyNumber_Subtract(op1, op2)) -#endif - /* UnicodeConcatInPlace.proto */ # if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 #if CYTHON_REFNANNY @@ -1402,12 +1331,6 @@ static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject *const *kwvalues static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); -/* Import.proto */ -static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level); - -/* ImportFrom.proto */ -static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name); - /* FetchCommonType.proto */ static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type); #if CYTHON_COMPILING_IN_LIMITED_API @@ -1507,6 +1430,32 @@ static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml, PyObject *module, PyObject *globals, PyObject* code); +/* PyDictVersioning.proto */ +#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS +#define __PYX_DICT_VERSION_INIT ((PY_UINT64_T) -1) +#define __PYX_GET_DICT_VERSION(dict) (((PyDictObject*)(dict))->ma_version_tag) +#define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var)\ + (version_var) = __PYX_GET_DICT_VERSION(dict);\ + (cache_var) = (value); +#define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) {\ + static PY_UINT64_T __pyx_dict_version = 0;\ + static PyObject *__pyx_dict_cached_value = NULL;\ + if (likely(__PYX_GET_DICT_VERSION(DICT) == __pyx_dict_version)) {\ + (VAR) = __pyx_dict_cached_value;\ + } else {\ + (VAR) = __pyx_dict_cached_value = (LOOKUP);\ + __pyx_dict_version = __PYX_GET_DICT_VERSION(DICT);\ + }\ +} +static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj); +static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj); +static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version); +#else +#define __PYX_GET_DICT_VERSION(dict) (0) +#define __PYX_UPDATE_DICT_CACHE(dict, value, cache_var, version_var) +#define __PYX_PY_DICT_LOOKUP_IF_MODIFIED(VAR, DICT, LOOKUP) (VAR) = (LOOKUP); +#endif + /* CLineInTraceback.proto */ #ifdef CYTHON_CLINE_IN_TRACEBACK #define __Pyx_CLineForTraceback(tstate, c_line) (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0) @@ -1538,8 +1487,11 @@ static void __Pyx_AddTraceback(const char *funcname, int c_line, /* CIntToPy.proto */ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value); -/* CIntToPy.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value); +/* FromPyCTupleUtility.proto */ +static __pyx_ctuple_int__and_int__and_int __pyx_convert__from_py___pyx_ctuple_int__and_int__and_int(PyObject *); + +/* ToPyCTupleUtility.proto */ +static PyObject* __pyx_convert__to_py___pyx_ctuple_int__and_int__and_int(__pyx_ctuple_int__and_int__and_int); /* CIntFromPy.proto */ static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *); @@ -1557,6 +1509,9 @@ typedef const char *__Pyx_TypeName; #define __Pyx_DECREF_TypeName(obj) #endif +/* CIntToPy.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value); + /* CIntFromPy.proto */ static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *); @@ -1609,54 +1564,40 @@ static const char __pyx_k_0[] = "0"; static const char __pyx_k_1[] = "1"; static const char __pyx_k__4[] = "?"; static const char __pyx_k_all[] = "all"; -static const char __pyx_k_sub[] = "sub"; -static const char __pyx_k_desc[] = "desc"; static const char __pyx_k_load[] = "load"; static const char __pyx_k_main[] = "__main__"; static const char __pyx_k_name[] = "__name__"; static const char __pyx_k_size[] = "size"; static const char __pyx_k_test[] = "__test__"; -static const char __pyx_k_tqdm[] = "tqdm"; static const char __pyx_k_image[] = "image"; static const char __pyx_k_range[] = "range"; -static const char __pyx_k_import[] = "__import__"; -static const char __pyx_k_operator[] = "operator"; static const char __pyx_k_fvid_cython[] = "fvid_cython"; static const char __pyx_k_class_getitem[] = "__class_getitem__"; static const char __pyx_k_fvid_cython_pyx[] = "fvid_cython.pyx"; static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback"; static const char __pyx_k_cy_get_bits_from_image[] = "cy_get_bits_from_image"; -static const char __pyx_k_Getting_bits_from_frame[] = "Getting bits from frame"; #if !CYTHON_COMPILING_IN_LIMITED_API static PyObject *__pyx_kp_u_; static PyObject *__pyx_kp_u_0; static PyObject *__pyx_kp_u_1; -static PyObject *__pyx_kp_u_Getting_bits_from_frame; static PyObject *__pyx_n_s__4; static PyObject *__pyx_n_s_all; static PyObject *__pyx_n_s_class_getitem; static PyObject *__pyx_n_s_cline_in_traceback; static PyObject *__pyx_n_s_cy_get_bits_from_image; -static PyObject *__pyx_n_s_desc; static PyObject *__pyx_n_s_fvid_cython; static PyObject *__pyx_kp_s_fvid_cython_pyx; static PyObject *__pyx_n_s_image; -static PyObject *__pyx_n_s_import; static PyObject *__pyx_n_s_load; static PyObject *__pyx_n_s_main; static PyObject *__pyx_n_s_name; -static PyObject *__pyx_n_s_operator; static PyObject *__pyx_n_s_range; static PyObject *__pyx_n_s_size; -static PyObject *__pyx_n_s_sub; static PyObject *__pyx_n_s_test; -static PyObject *__pyx_n_s_tqdm; #endif /* #### Code section: decls ### */ static PyObject *__pyx_pf_11fvid_cython_cy_get_bits_from_image(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_image); /* proto */ #if !CYTHON_COMPILING_IN_LIMITED_API -static PyObject *__pyx_int_0; -static PyObject *__pyx_int_255; #endif #if !CYTHON_COMPILING_IN_LIMITED_API static PyObject *__pyx_tuple__2; @@ -1681,28 +1622,20 @@ typedef struct { PyObject *__pyx_kp_u_; PyObject *__pyx_kp_u_0; PyObject *__pyx_kp_u_1; - PyObject *__pyx_kp_u_Getting_bits_from_frame; PyObject *__pyx_n_s__4; PyObject *__pyx_n_s_all; PyObject *__pyx_n_s_class_getitem; PyObject *__pyx_n_s_cline_in_traceback; PyObject *__pyx_n_s_cy_get_bits_from_image; - PyObject *__pyx_n_s_desc; PyObject *__pyx_n_s_fvid_cython; PyObject *__pyx_kp_s_fvid_cython_pyx; PyObject *__pyx_n_s_image; - PyObject *__pyx_n_s_import; PyObject *__pyx_n_s_load; PyObject *__pyx_n_s_main; PyObject *__pyx_n_s_name; - PyObject *__pyx_n_s_operator; PyObject *__pyx_n_s_range; PyObject *__pyx_n_s_size; - PyObject *__pyx_n_s_sub; PyObject *__pyx_n_s_test; - PyObject *__pyx_n_s_tqdm; - PyObject *__pyx_int_0; - PyObject *__pyx_int_255; PyObject *__pyx_tuple__2; PyObject *__pyx_codeobj__3; } __pyx_mstate; @@ -1741,28 +1674,20 @@ static int __pyx_m_clear(PyObject *m) { Py_CLEAR(clear_module_state->__pyx_kp_u_); Py_CLEAR(clear_module_state->__pyx_kp_u_0); Py_CLEAR(clear_module_state->__pyx_kp_u_1); - Py_CLEAR(clear_module_state->__pyx_kp_u_Getting_bits_from_frame); Py_CLEAR(clear_module_state->__pyx_n_s__4); Py_CLEAR(clear_module_state->__pyx_n_s_all); Py_CLEAR(clear_module_state->__pyx_n_s_class_getitem); Py_CLEAR(clear_module_state->__pyx_n_s_cline_in_traceback); Py_CLEAR(clear_module_state->__pyx_n_s_cy_get_bits_from_image); - Py_CLEAR(clear_module_state->__pyx_n_s_desc); Py_CLEAR(clear_module_state->__pyx_n_s_fvid_cython); Py_CLEAR(clear_module_state->__pyx_kp_s_fvid_cython_pyx); Py_CLEAR(clear_module_state->__pyx_n_s_image); - Py_CLEAR(clear_module_state->__pyx_n_s_import); Py_CLEAR(clear_module_state->__pyx_n_s_load); Py_CLEAR(clear_module_state->__pyx_n_s_main); Py_CLEAR(clear_module_state->__pyx_n_s_name); - Py_CLEAR(clear_module_state->__pyx_n_s_operator); Py_CLEAR(clear_module_state->__pyx_n_s_range); Py_CLEAR(clear_module_state->__pyx_n_s_size); - Py_CLEAR(clear_module_state->__pyx_n_s_sub); Py_CLEAR(clear_module_state->__pyx_n_s_test); - Py_CLEAR(clear_module_state->__pyx_n_s_tqdm); - Py_CLEAR(clear_module_state->__pyx_int_0); - Py_CLEAR(clear_module_state->__pyx_int_255); Py_CLEAR(clear_module_state->__pyx_tuple__2); Py_CLEAR(clear_module_state->__pyx_codeobj__3); return 0; @@ -1788,28 +1713,20 @@ static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) { Py_VISIT(traverse_module_state->__pyx_kp_u_); Py_VISIT(traverse_module_state->__pyx_kp_u_0); Py_VISIT(traverse_module_state->__pyx_kp_u_1); - Py_VISIT(traverse_module_state->__pyx_kp_u_Getting_bits_from_frame); Py_VISIT(traverse_module_state->__pyx_n_s__4); Py_VISIT(traverse_module_state->__pyx_n_s_all); Py_VISIT(traverse_module_state->__pyx_n_s_class_getitem); Py_VISIT(traverse_module_state->__pyx_n_s_cline_in_traceback); Py_VISIT(traverse_module_state->__pyx_n_s_cy_get_bits_from_image); - Py_VISIT(traverse_module_state->__pyx_n_s_desc); Py_VISIT(traverse_module_state->__pyx_n_s_fvid_cython); Py_VISIT(traverse_module_state->__pyx_kp_s_fvid_cython_pyx); Py_VISIT(traverse_module_state->__pyx_n_s_image); - Py_VISIT(traverse_module_state->__pyx_n_s_import); Py_VISIT(traverse_module_state->__pyx_n_s_load); Py_VISIT(traverse_module_state->__pyx_n_s_main); Py_VISIT(traverse_module_state->__pyx_n_s_name); - Py_VISIT(traverse_module_state->__pyx_n_s_operator); Py_VISIT(traverse_module_state->__pyx_n_s_range); Py_VISIT(traverse_module_state->__pyx_n_s_size); - Py_VISIT(traverse_module_state->__pyx_n_s_sub); Py_VISIT(traverse_module_state->__pyx_n_s_test); - Py_VISIT(traverse_module_state->__pyx_n_s_tqdm); - Py_VISIT(traverse_module_state->__pyx_int_0); - Py_VISIT(traverse_module_state->__pyx_int_255); Py_VISIT(traverse_module_state->__pyx_tuple__2); Py_VISIT(traverse_module_state->__pyx_codeobj__3); return 0; @@ -1832,35 +1749,27 @@ static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) { #define __pyx_kp_u_ __pyx_mstate_global->__pyx_kp_u_ #define __pyx_kp_u_0 __pyx_mstate_global->__pyx_kp_u_0 #define __pyx_kp_u_1 __pyx_mstate_global->__pyx_kp_u_1 -#define __pyx_kp_u_Getting_bits_from_frame __pyx_mstate_global->__pyx_kp_u_Getting_bits_from_frame #define __pyx_n_s__4 __pyx_mstate_global->__pyx_n_s__4 #define __pyx_n_s_all __pyx_mstate_global->__pyx_n_s_all #define __pyx_n_s_class_getitem __pyx_mstate_global->__pyx_n_s_class_getitem #define __pyx_n_s_cline_in_traceback __pyx_mstate_global->__pyx_n_s_cline_in_traceback #define __pyx_n_s_cy_get_bits_from_image __pyx_mstate_global->__pyx_n_s_cy_get_bits_from_image -#define __pyx_n_s_desc __pyx_mstate_global->__pyx_n_s_desc #define __pyx_n_s_fvid_cython __pyx_mstate_global->__pyx_n_s_fvid_cython #define __pyx_kp_s_fvid_cython_pyx __pyx_mstate_global->__pyx_kp_s_fvid_cython_pyx #define __pyx_n_s_image __pyx_mstate_global->__pyx_n_s_image -#define __pyx_n_s_import __pyx_mstate_global->__pyx_n_s_import #define __pyx_n_s_load __pyx_mstate_global->__pyx_n_s_load #define __pyx_n_s_main __pyx_mstate_global->__pyx_n_s_main #define __pyx_n_s_name __pyx_mstate_global->__pyx_n_s_name -#define __pyx_n_s_operator __pyx_mstate_global->__pyx_n_s_operator #define __pyx_n_s_range __pyx_mstate_global->__pyx_n_s_range #define __pyx_n_s_size __pyx_mstate_global->__pyx_n_s_size -#define __pyx_n_s_sub __pyx_mstate_global->__pyx_n_s_sub #define __pyx_n_s_test __pyx_mstate_global->__pyx_n_s_test -#define __pyx_n_s_tqdm __pyx_mstate_global->__pyx_n_s_tqdm -#define __pyx_int_0 __pyx_mstate_global->__pyx_int_0 -#define __pyx_int_255 __pyx_mstate_global->__pyx_int_255 #define __pyx_tuple__2 __pyx_mstate_global->__pyx_tuple__2 #define __pyx_codeobj__3 __pyx_mstate_global->__pyx_codeobj__3 #endif /* #### Code section: module_code ### */ -/* "fvid_cython.pyx":8 - * from tqdm import tqdm +/* "fvid_cython.pyx":6 + * # cython: wraparound=False * * cpdef cy_get_bits_from_image(image): # <<<<<<<<<<<<<< * cdef int width, height, x, y @@ -1880,12 +1789,12 @@ static PyObject *__pyx_f_11fvid_cython_cy_get_bits_from_image(PyObject *__pyx_v_ int __pyx_v_x; int __pyx_v_y; PyObject *__pyx_v_pixel_bin_rep = 0; - PyObject *__pyx_v_white_diff = 0; - PyObject *__pyx_v_black_diff = 0; - PyObject *__pyx_v_pixel = 0; + __pyx_ctuple_int__and_int__and_int __pyx_v_pixel; + __pyx_ctuple_int__and_int__and_int __pyx_v_white_diff; + __pyx_ctuple_int__and_int__and_int __pyx_v_black_diff; + __pyx_ctuple_int__and_int__and_int __pyx_v_truth_tuple; PyObject *__pyx_v_px = NULL; PyObject *__pyx_v_bits = NULL; - PyObject *__pyx_v_pbar = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -1895,25 +1804,29 @@ static PyObject *__pyx_f_11fvid_cython_cy_get_bits_from_image(PyObject *__pyx_v_ PyObject *(*__pyx_t_5)(PyObject *); int __pyx_t_6; int __pyx_t_7; - Py_ssize_t __pyx_t_8; - PyObject *(*__pyx_t_9)(PyObject *); + int __pyx_t_8; + int __pyx_t_9; int __pyx_t_10; int __pyx_t_11; - int __pyx_t_12; - PyObject *__pyx_t_13 = NULL; + __pyx_ctuple_int__and_int__and_int __pyx_t_12; + int __pyx_t_13; + int __pyx_t_14; + long __pyx_t_15; + long __pyx_t_16; + long __pyx_t_17; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("cy_get_bits_from_image", 0); - /* "fvid_cython.pyx":13 - * cdef tuple white_diff, black_diff, pixel + /* "fvid_cython.pyx":12 + * cdef (bint, bint, bint) truth_tuple * * width, height = image.size # <<<<<<<<<<<<<< * * px = image.load() */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_image, __pyx_n_s_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 13, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_image, __pyx_n_s_size); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 12, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) { PyObject* sequence = __pyx_t_1; @@ -1921,7 +1834,7 @@ static PyObject *__pyx_f_11fvid_cython_cy_get_bits_from_image(PyObject *__pyx_v_ if (unlikely(size != 2)) { if (size > 2) __Pyx_RaiseTooManyValuesError(2); else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - __PYX_ERR(0, 13, __pyx_L1_error) + __PYX_ERR(0, 12, __pyx_L1_error) } #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS if (likely(PyTuple_CheckExact(sequence))) { @@ -1934,15 +1847,15 @@ static PyObject *__pyx_f_11fvid_cython_cy_get_bits_from_image(PyObject *__pyx_v_ __Pyx_INCREF(__pyx_t_2); __Pyx_INCREF(__pyx_t_3); #else - __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 13, __pyx_L1_error) + __pyx_t_2 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 12, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 13, __pyx_L1_error) + __pyx_t_3 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 12, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); #endif __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } else { Py_ssize_t index = -1; - __pyx_t_4 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 13, __pyx_L1_error) + __pyx_t_4 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 12, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_5 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_4); @@ -1950,7 +1863,7 @@ static PyObject *__pyx_f_11fvid_cython_cy_get_bits_from_image(PyObject *__pyx_v_ __Pyx_GOTREF(__pyx_t_2); index = 1; __pyx_t_3 = __pyx_t_5(__pyx_t_4); if (unlikely(!__pyx_t_3)) goto __pyx_L3_unpacking_failed; __Pyx_GOTREF(__pyx_t_3); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_4), 2) < 0) __PYX_ERR(0, 13, __pyx_L1_error) + if (__Pyx_IternextUnpackEndCheck(__pyx_t_5(__pyx_t_4), 2) < 0) __PYX_ERR(0, 12, __pyx_L1_error) __pyx_t_5 = NULL; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; goto __pyx_L4_unpacking_done; @@ -1958,24 +1871,24 @@ static PyObject *__pyx_f_11fvid_cython_cy_get_bits_from_image(PyObject *__pyx_v_ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_5 = NULL; if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); - __PYX_ERR(0, 13, __pyx_L1_error) + __PYX_ERR(0, 12, __pyx_L1_error) __pyx_L4_unpacking_done:; } - __pyx_t_6 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 13, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 12, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_7 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 13, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 12, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_width = __pyx_t_6; __pyx_v_height = __pyx_t_7; - /* "fvid_cython.pyx":15 + /* "fvid_cython.pyx":14 * width, height = image.size * * px = image.load() # <<<<<<<<<<<<<< * bits = "" * */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_image, __pyx_n_s_load); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 15, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_image, __pyx_n_s_load); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 14, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_2 = NULL; __pyx_t_7 = 0; @@ -1993,465 +1906,290 @@ static PyObject *__pyx_f_11fvid_cython_cy_get_bits_from_image(PyObject *__pyx_v_ PyObject *__pyx_callargs[1] = {__pyx_t_2, }; __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_7, 0+__pyx_t_7); __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 15, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 14, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } __pyx_v_px = __pyx_t_1; __pyx_t_1 = 0; - /* "fvid_cython.pyx":16 + /* "fvid_cython.pyx":15 * * px = image.load() * bits = "" # <<<<<<<<<<<<<< * - * pbar = tqdm(range(height), desc="Getting bits from frame") + * for y in range(height): */ __Pyx_INCREF(__pyx_kp_u_); __pyx_v_bits = __pyx_kp_u_; - /* "fvid_cython.pyx":18 + /* "fvid_cython.pyx":17 * bits = "" * - * pbar = tqdm(range(height), desc="Getting bits from frame") # <<<<<<<<<<<<<< - * - * for y in pbar: - */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_tqdm); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 18, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_height); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 18, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_range, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 18, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 18, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); - __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 18, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_desc, __pyx_kp_u_Getting_bits_from_frame) < 0) __PYX_ERR(0, 18, __pyx_L1_error) - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 18, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_v_pbar = __pyx_t_4; - __pyx_t_4 = 0; - - /* "fvid_cython.pyx":20 - * pbar = tqdm(range(height), desc="Getting bits from frame") - * - * for y in pbar: # <<<<<<<<<<<<<< + * for y in range(height): # <<<<<<<<<<<<<< * for x in range(width): * pixel = px[x, y] */ - if (likely(PyList_CheckExact(__pyx_v_pbar)) || PyTuple_CheckExact(__pyx_v_pbar)) { - __pyx_t_4 = __pyx_v_pbar; __Pyx_INCREF(__pyx_t_4); __pyx_t_8 = 0; - __pyx_t_9 = NULL; - } else { - __pyx_t_8 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_pbar); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 20, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_9 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_4); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 20, __pyx_L1_error) - } - for (;;) { - if (likely(!__pyx_t_9)) { - if (likely(PyList_CheckExact(__pyx_t_4))) { - if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_4)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_2 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_8); __Pyx_INCREF(__pyx_t_2); __pyx_t_8++; if (unlikely(0 < 0)) __PYX_ERR(0, 20, __pyx_L1_error) - #else - __pyx_t_2 = PySequence_ITEM(__pyx_t_4, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 20, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - #endif - } else { - if (__pyx_t_8 >= PyTuple_GET_SIZE(__pyx_t_4)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_8); __Pyx_INCREF(__pyx_t_2); __pyx_t_8++; if (unlikely(0 < 0)) __PYX_ERR(0, 20, __pyx_L1_error) - #else - __pyx_t_2 = PySequence_ITEM(__pyx_t_4, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 20, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - #endif - } - } else { - __pyx_t_2 = __pyx_t_9(__pyx_t_4); - if (unlikely(!__pyx_t_2)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 20, __pyx_L1_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_2); - } - __pyx_t_7 = __Pyx_PyInt_As_int(__pyx_t_2); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 20, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_v_y = __pyx_t_7; + __pyx_t_7 = __pyx_v_height; + __pyx_t_6 = __pyx_t_7; + for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_6; __pyx_t_8+=1) { + __pyx_v_y = __pyx_t_8; - /* "fvid_cython.pyx":21 + /* "fvid_cython.pyx":18 * - * for y in pbar: + * for y in range(height): * for x in range(width): # <<<<<<<<<<<<<< * pixel = px[x, y] * */ - __pyx_t_7 = __pyx_v_width; - __pyx_t_6 = __pyx_t_7; - for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_6; __pyx_t_10+=1) { - __pyx_v_x = __pyx_t_10; + __pyx_t_9 = __pyx_v_width; + __pyx_t_10 = __pyx_t_9; + for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_10; __pyx_t_11+=1) { + __pyx_v_x = __pyx_t_11; - /* "fvid_cython.pyx":22 - * for y in pbar: + /* "fvid_cython.pyx":19 + * for y in range(height): * for x in range(width): * pixel = px[x, y] # <<<<<<<<<<<<<< * - * pixel_bin_rep = "0" + * pixel_bin_rep = "0" */ - __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_x); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 22, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_y); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 22, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 22, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_x); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 19, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_3); - __pyx_t_2 = 0; - __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_GetItem(__pyx_v_px, __pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 22, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_y); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 19, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (!(likely(PyTuple_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None) || __Pyx_RaiseUnexpectedTypeError("tuple", __pyx_t_3))) __PYX_ERR(0, 22, __pyx_L1_error) - __Pyx_XDECREF_SET(__pyx_v_pixel, ((PyObject*)__pyx_t_3)); + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 19, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GIVEREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_3); + __pyx_t_1 = 0; + __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyObject_GetItem(__pyx_v_px, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 19, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_12 = __pyx_convert__from_py___pyx_ctuple_int__and_int__and_int(__pyx_t_3); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 19, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_pixel = __pyx_t_12; + + /* "fvid_cython.pyx":21 + * pixel = px[x, y] + * + * pixel_bin_rep = "0" # <<<<<<<<<<<<<< + * + * # for exact matches, indexing each pixel individually is faster in cython for some reason + */ + __pyx_t_3 = __pyx_kp_u_0; + __Pyx_INCREF(__pyx_t_3); + __Pyx_XDECREF_SET(__pyx_v_pixel_bin_rep, ((PyObject*)__pyx_t_3)); __pyx_t_3 = 0; /* "fvid_cython.pyx":24 - * pixel = px[x, y] * - * pixel_bin_rep = "0" # <<<<<<<<<<<<<< - * - * # for exact matches - */ - __Pyx_INCREF(__pyx_kp_u_0); - __Pyx_XDECREF_SET(__pyx_v_pixel_bin_rep, __pyx_kp_u_0); - - /* "fvid_cython.pyx":27 - * - * # for exact matches + * # for exact matches, indexing each pixel individually is faster in cython for some reason * if pixel[0] == 255 and pixel[1] == 255 and pixel[2] == 255: # <<<<<<<<<<<<<< - * pixel_bin_rep = "1" + * pixel_bin_rep = "1" * elif pixel[0] == 0 and pixel[1] == 0 and pixel[2] == 0: */ - if (unlikely(__pyx_v_pixel == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(0, 27, __pyx_L1_error) - } - __pyx_t_3 = __Pyx_PyInt_EqObjC(PyTuple_GET_ITEM(__pyx_v_pixel, 0), __pyx_int_255, 0xFF, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 27, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_12 < 0)) __PYX_ERR(0, 27, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_12) { + __pyx_t_14 = ((__pyx_v_pixel.f0 == 0xFF) != 0); + if (__pyx_t_14) { } else { - __pyx_t_11 = __pyx_t_12; + __pyx_t_13 = __pyx_t_14; goto __pyx_L10_bool_binop_done; } - if (unlikely(__pyx_v_pixel == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(0, 27, __pyx_L1_error) - } - __pyx_t_3 = __Pyx_PyInt_EqObjC(PyTuple_GET_ITEM(__pyx_v_pixel, 1), __pyx_int_255, 0xFF, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 27, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_12 < 0)) __PYX_ERR(0, 27, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_12) { + __pyx_t_14 = ((__pyx_v_pixel.f1 == 0xFF) != 0); + if (__pyx_t_14) { } else { - __pyx_t_11 = __pyx_t_12; + __pyx_t_13 = __pyx_t_14; goto __pyx_L10_bool_binop_done; } - if (unlikely(__pyx_v_pixel == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(0, 27, __pyx_L1_error) - } - __pyx_t_3 = __Pyx_PyInt_EqObjC(PyTuple_GET_ITEM(__pyx_v_pixel, 2), __pyx_int_255, 0xFF, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 27, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_12 < 0)) __PYX_ERR(0, 27, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_11 = __pyx_t_12; + __pyx_t_14 = ((__pyx_v_pixel.f2 == 0xFF) != 0); + __pyx_t_13 = __pyx_t_14; __pyx_L10_bool_binop_done:; - if (__pyx_t_11) { + if (__pyx_t_13) { - /* "fvid_cython.pyx":28 - * # for exact matches + /* "fvid_cython.pyx":25 + * # for exact matches, indexing each pixel individually is faster in cython for some reason * if pixel[0] == 255 and pixel[1] == 255 and pixel[2] == 255: - * pixel_bin_rep = "1" # <<<<<<<<<<<<<< + * pixel_bin_rep = "1" # <<<<<<<<<<<<<< * elif pixel[0] == 0 and pixel[1] == 0 and pixel[2] == 0: - * pixel_bin_rep = "0" + * pixel_bin_rep = "0" */ - __Pyx_INCREF(__pyx_kp_u_1); - __Pyx_DECREF_SET(__pyx_v_pixel_bin_rep, __pyx_kp_u_1); + __pyx_t_3 = __pyx_kp_u_1; + __Pyx_INCREF(__pyx_t_3); + __Pyx_DECREF_SET(__pyx_v_pixel_bin_rep, ((PyObject*)__pyx_t_3)); + __pyx_t_3 = 0; + + /* "fvid_cython.pyx":24 + * + * # for exact matches, indexing each pixel individually is faster in cython for some reason + * if pixel[0] == 255 and pixel[1] == 255 and pixel[2] == 255: # <<<<<<<<<<<<<< + * pixel_bin_rep = "1" + * elif pixel[0] == 0 and pixel[1] == 0 and pixel[2] == 0: + */ + goto __pyx_L9; + } + + /* "fvid_cython.pyx":26 + * if pixel[0] == 255 and pixel[1] == 255 and pixel[2] == 255: + * pixel_bin_rep = "1" + * elif pixel[0] == 0 and pixel[1] == 0 and pixel[2] == 0: # <<<<<<<<<<<<<< + * pixel_bin_rep = "0" + * else: + */ + __pyx_t_14 = ((__pyx_v_pixel.f0 == 0) != 0); + if (__pyx_t_14) { + } else { + __pyx_t_13 = __pyx_t_14; + goto __pyx_L13_bool_binop_done; + } + __pyx_t_14 = ((__pyx_v_pixel.f1 == 0) != 0); + if (__pyx_t_14) { + } else { + __pyx_t_13 = __pyx_t_14; + goto __pyx_L13_bool_binop_done; + } + __pyx_t_14 = ((__pyx_v_pixel.f2 == 0) != 0); + __pyx_t_13 = __pyx_t_14; + __pyx_L13_bool_binop_done:; + if (__pyx_t_13) { /* "fvid_cython.pyx":27 - * - * # for exact matches - * if pixel[0] == 255 and pixel[1] == 255 and pixel[2] == 255: # <<<<<<<<<<<<<< - * pixel_bin_rep = "1" + * pixel_bin_rep = "1" * elif pixel[0] == 0 and pixel[1] == 0 and pixel[2] == 0: + * pixel_bin_rep = "0" # <<<<<<<<<<<<<< + * else: + * white_diff = (abs(pixel[0] - 255), abs(pixel[1] - 255), abs(pixel[2] - 255)) + */ + __pyx_t_3 = __pyx_kp_u_0; + __Pyx_INCREF(__pyx_t_3); + __Pyx_DECREF_SET(__pyx_v_pixel_bin_rep, ((PyObject*)__pyx_t_3)); + __pyx_t_3 = 0; + + /* "fvid_cython.pyx":26 + * if pixel[0] == 255 and pixel[1] == 255 and pixel[2] == 255: + * pixel_bin_rep = "1" + * elif pixel[0] == 0 and pixel[1] == 0 and pixel[2] == 0: # <<<<<<<<<<<<<< + * pixel_bin_rep = "0" + * else: */ goto __pyx_L9; } /* "fvid_cython.pyx":29 - * if pixel[0] == 255 and pixel[1] == 255 and pixel[2] == 255: - * pixel_bin_rep = "1" - * elif pixel[0] == 0 and pixel[1] == 0 and pixel[2] == 0: # <<<<<<<<<<<<<< - * pixel_bin_rep = "0" - * else: - */ - if (unlikely(__pyx_v_pixel == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(0, 29, __pyx_L1_error) - } - __pyx_t_3 = __Pyx_PyInt_EqObjC(PyTuple_GET_ITEM(__pyx_v_pixel, 0), __pyx_int_0, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 29, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_12 < 0)) __PYX_ERR(0, 29, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_12) { - } else { - __pyx_t_11 = __pyx_t_12; - goto __pyx_L13_bool_binop_done; - } - if (unlikely(__pyx_v_pixel == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(0, 29, __pyx_L1_error) - } - __pyx_t_3 = __Pyx_PyInt_EqObjC(PyTuple_GET_ITEM(__pyx_v_pixel, 1), __pyx_int_0, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 29, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_12 < 0)) __PYX_ERR(0, 29, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_12) { - } else { - __pyx_t_11 = __pyx_t_12; - goto __pyx_L13_bool_binop_done; - } - if (unlikely(__pyx_v_pixel == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(0, 29, __pyx_L1_error) - } - __pyx_t_3 = __Pyx_PyInt_EqObjC(PyTuple_GET_ITEM(__pyx_v_pixel, 2), __pyx_int_0, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 29, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_12 < 0)) __PYX_ERR(0, 29, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_11 = __pyx_t_12; - __pyx_L13_bool_binop_done:; - if (__pyx_t_11) { - - /* "fvid_cython.pyx":30 - * pixel_bin_rep = "1" - * elif pixel[0] == 0 and pixel[1] == 0 and pixel[2] == 0: - * pixel_bin_rep = "0" # <<<<<<<<<<<<<< - * else: - * white_diff = (abs(pixel[0] - 255), abs(pixel[1] - 255), abs(pixel[2] - 255)) - */ - __Pyx_INCREF(__pyx_kp_u_0); - __Pyx_DECREF_SET(__pyx_v_pixel_bin_rep, __pyx_kp_u_0); - - /* "fvid_cython.pyx":29 - * if pixel[0] == 255 and pixel[1] == 255 and pixel[2] == 255: - * pixel_bin_rep = "1" - * elif pixel[0] == 0 and pixel[1] == 0 and pixel[2] == 0: # <<<<<<<<<<<<<< - * pixel_bin_rep = "0" - * else: - */ - goto __pyx_L9; - } - - /* "fvid_cython.pyx":32 - * pixel_bin_rep = "0" + * pixel_bin_rep = "0" * else: * white_diff = (abs(pixel[0] - 255), abs(pixel[1] - 255), abs(pixel[2] - 255)) # <<<<<<<<<<<<<< * # min_diff = white_diff * black_diff = (abs(pixel[0] - 0), abs(pixel[1] - 0), abs(pixel[2] - 0)) */ /*else*/ { - if (unlikely(__pyx_v_pixel == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(0, 32, __pyx_L1_error) - } - __pyx_t_3 = __Pyx_PyInt_SubtractObjC(PyTuple_GET_ITEM(__pyx_v_pixel, 0), __pyx_int_255, 0xFF, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 32, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = __Pyx_PyNumber_Absolute(__pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 32, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(__pyx_v_pixel == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(0, 32, __pyx_L1_error) - } - __pyx_t_3 = __Pyx_PyInt_SubtractObjC(PyTuple_GET_ITEM(__pyx_v_pixel, 1), __pyx_int_255, 0xFF, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 32, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = __Pyx_PyNumber_Absolute(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 32, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(__pyx_v_pixel == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(0, 32, __pyx_L1_error) - } - __pyx_t_3 = __Pyx_PyInt_SubtractObjC(PyTuple_GET_ITEM(__pyx_v_pixel, 2), __pyx_int_255, 0xFF, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 32, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_13 = __Pyx_PyNumber_Absolute(__pyx_t_3); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 32, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_13); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 32, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_13); - PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_13); - __pyx_t_1 = 0; - __pyx_t_2 = 0; - __pyx_t_13 = 0; - __Pyx_XDECREF_SET(__pyx_v_white_diff, ((PyObject*)__pyx_t_3)); - __pyx_t_3 = 0; + __pyx_t_15 = labs((__pyx_v_pixel.f0 - 0xFF)); if (unlikely(__pyx_t_15 == ((long)-1))) __PYX_ERR(0, 29, __pyx_L1_error) + __pyx_t_16 = labs((__pyx_v_pixel.f1 - 0xFF)); if (unlikely(__pyx_t_16 == ((long)-1))) __PYX_ERR(0, 29, __pyx_L1_error) + __pyx_t_17 = labs((__pyx_v_pixel.f2 - 0xFF)); if (unlikely(__pyx_t_17 == ((long)-1))) __PYX_ERR(0, 29, __pyx_L1_error) + __pyx_t_12.f0 = __pyx_t_15; + __pyx_t_12.f1 = __pyx_t_16; + __pyx_t_12.f2 = __pyx_t_17; + __pyx_v_white_diff = __pyx_t_12; - /* "fvid_cython.pyx":34 + /* "fvid_cython.pyx":31 * white_diff = (abs(pixel[0] - 255), abs(pixel[1] - 255), abs(pixel[2] - 255)) * # min_diff = white_diff * black_diff = (abs(pixel[0] - 0), abs(pixel[1] - 0), abs(pixel[2] - 0)) # <<<<<<<<<<<<<< * * # if the white difference is smaller, that means the pixel is closer */ - if (unlikely(__pyx_v_pixel == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(0, 34, __pyx_L1_error) - } - __pyx_t_3 = __Pyx_PyInt_SubtractObjC(PyTuple_GET_ITEM(__pyx_v_pixel, 0), __pyx_int_0, 0, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 34, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_13 = __Pyx_PyNumber_Absolute(__pyx_t_3); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 34, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_13); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(__pyx_v_pixel == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(0, 34, __pyx_L1_error) - } - __pyx_t_3 = __Pyx_PyInt_SubtractObjC(PyTuple_GET_ITEM(__pyx_v_pixel, 1), __pyx_int_0, 0, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 34, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = __Pyx_PyNumber_Absolute(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 34, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(__pyx_v_pixel == Py_None)) { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - __PYX_ERR(0, 34, __pyx_L1_error) - } - __pyx_t_3 = __Pyx_PyInt_SubtractObjC(PyTuple_GET_ITEM(__pyx_v_pixel, 2), __pyx_int_0, 0, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 34, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = __Pyx_PyNumber_Absolute(__pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 34, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 34, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GIVEREF(__pyx_t_13); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_13); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_1); - __pyx_t_13 = 0; - __pyx_t_2 = 0; - __pyx_t_1 = 0; - __Pyx_XDECREF_SET(__pyx_v_black_diff, ((PyObject*)__pyx_t_3)); - __pyx_t_3 = 0; + __pyx_t_17 = labs((__pyx_v_pixel.f0 - 0)); if (unlikely(__pyx_t_17 == ((long)-1))) __PYX_ERR(0, 31, __pyx_L1_error) + __pyx_t_16 = labs((__pyx_v_pixel.f1 - 0)); if (unlikely(__pyx_t_16 == ((long)-1))) __PYX_ERR(0, 31, __pyx_L1_error) + __pyx_t_15 = labs((__pyx_v_pixel.f2 - 0)); if (unlikely(__pyx_t_15 == ((long)-1))) __PYX_ERR(0, 31, __pyx_L1_error) + __pyx_t_12.f0 = __pyx_t_17; + __pyx_t_12.f1 = __pyx_t_16; + __pyx_t_12.f2 = __pyx_t_15; + __pyx_v_black_diff = __pyx_t_12; - /* "fvid_cython.pyx":38 + /* "fvid_cython.pyx":35 * # if the white difference is smaller, that means the pixel is closer * # to white, otherwise, the pixel must be black - * if all((white_diff[0] < black_diff[0], white_diff[1] < black_diff[1], white_diff[2] < black_diff[2])): # <<<<<<<<<<<<<< - * pixel_bin_rep = "1" + * truth_tuple = (white_diff[0] < black_diff[0], white_diff[1] < black_diff[1], white_diff[2] < black_diff[2]) # <<<<<<<<<<<<<< + * if all(truth_tuple): + * pixel_bin_rep = "1" + */ + __pyx_t_12.f0 = (__pyx_v_white_diff.f0 < __pyx_v_black_diff.f0); + __pyx_t_12.f1 = (__pyx_v_white_diff.f1 < __pyx_v_black_diff.f1); + __pyx_t_12.f2 = (__pyx_v_white_diff.f2 < __pyx_v_black_diff.f2); + __pyx_v_truth_tuple = __pyx_t_12; + + /* "fvid_cython.pyx":36 + * # to white, otherwise, the pixel must be black + * truth_tuple = (white_diff[0] < black_diff[0], white_diff[1] < black_diff[1], white_diff[2] < black_diff[2]) + * if all(truth_tuple): # <<<<<<<<<<<<<< + * pixel_bin_rep = "1" * else: */ - __pyx_t_3 = PyObject_RichCompare(PyTuple_GET_ITEM(__pyx_v_white_diff, 0), PyTuple_GET_ITEM(__pyx_v_black_diff, 0), Py_LT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 38, __pyx_L1_error) - __pyx_t_1 = PyObject_RichCompare(PyTuple_GET_ITEM(__pyx_v_white_diff, 1), PyTuple_GET_ITEM(__pyx_v_black_diff, 1), Py_LT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 38, __pyx_L1_error) - __pyx_t_2 = PyObject_RichCompare(PyTuple_GET_ITEM(__pyx_v_white_diff, 2), PyTuple_GET_ITEM(__pyx_v_black_diff, 2), Py_LT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 38, __pyx_L1_error) - __pyx_t_13 = PyTuple_New(3); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 38, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_13); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_13, 1, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_13, 2, __pyx_t_2); - __pyx_t_3 = 0; - __pyx_t_1 = 0; - __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_all, __pyx_t_13); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 38, __pyx_L1_error) + __pyx_t_3 = __pyx_convert__to_py___pyx_ctuple_int__and_int__and_int(__pyx_v_truth_tuple); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 36, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_all, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 36, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - __pyx_t_11 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_11 < 0)) __PYX_ERR(0, 38, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_13 < 0)) __PYX_ERR(0, 36, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (__pyx_t_11) { + if (__pyx_t_13) { - /* "fvid_cython.pyx":39 - * # to white, otherwise, the pixel must be black - * if all((white_diff[0] < black_diff[0], white_diff[1] < black_diff[1], white_diff[2] < black_diff[2])): - * pixel_bin_rep = "1" # <<<<<<<<<<<<<< + /* "fvid_cython.pyx":37 + * truth_tuple = (white_diff[0] < black_diff[0], white_diff[1] < black_diff[1], white_diff[2] < black_diff[2]) + * if all(truth_tuple): + * pixel_bin_rep = "1" # <<<<<<<<<<<<<< * else: - * pixel_bin_rep = "0" + * pixel_bin_rep = "0" */ - __Pyx_INCREF(__pyx_kp_u_1); - __Pyx_DECREF_SET(__pyx_v_pixel_bin_rep, __pyx_kp_u_1); + __pyx_t_2 = __pyx_kp_u_1; + __Pyx_INCREF(__pyx_t_2); + __Pyx_DECREF_SET(__pyx_v_pixel_bin_rep, ((PyObject*)__pyx_t_2)); + __pyx_t_2 = 0; - /* "fvid_cython.pyx":38 - * # if the white difference is smaller, that means the pixel is closer + /* "fvid_cython.pyx":36 * # to white, otherwise, the pixel must be black - * if all((white_diff[0] < black_diff[0], white_diff[1] < black_diff[1], white_diff[2] < black_diff[2])): # <<<<<<<<<<<<<< - * pixel_bin_rep = "1" + * truth_tuple = (white_diff[0] < black_diff[0], white_diff[1] < black_diff[1], white_diff[2] < black_diff[2]) + * if all(truth_tuple): # <<<<<<<<<<<<<< + * pixel_bin_rep = "1" * else: */ goto __pyx_L16; } - /* "fvid_cython.pyx":41 - * pixel_bin_rep = "1" + /* "fvid_cython.pyx":39 + * pixel_bin_rep = "1" * else: - * pixel_bin_rep = "0" # <<<<<<<<<<<<<< + * pixel_bin_rep = "0" # <<<<<<<<<<<<<< * * # adding bits */ /*else*/ { - __Pyx_INCREF(__pyx_kp_u_0); - __Pyx_DECREF_SET(__pyx_v_pixel_bin_rep, __pyx_kp_u_0); + __pyx_t_2 = __pyx_kp_u_0; + __Pyx_INCREF(__pyx_t_2); + __Pyx_DECREF_SET(__pyx_v_pixel_bin_rep, ((PyObject*)__pyx_t_2)); + __pyx_t_2 = 0; } __pyx_L16:; } __pyx_L9:; - /* "fvid_cython.pyx":44 + /* "fvid_cython.pyx":42 * * # adding bits * bits += pixel_bin_rep # <<<<<<<<<<<<<< * * return bits */ - __pyx_t_2 = __Pyx_PyUnicode_ConcatInPlace(__pyx_v_bits, __pyx_v_pixel_bin_rep); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 44, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyUnicode_ConcatInPlaceSafe(__pyx_v_bits, __pyx_v_pixel_bin_rep); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 42, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF_SET(__pyx_v_bits, ((PyObject*)__pyx_t_2)); __pyx_t_2 = 0; } - - /* "fvid_cython.pyx":20 - * pbar = tqdm(range(height), desc="Getting bits from frame") - * - * for y in pbar: # <<<<<<<<<<<<<< - * for x in range(width): - * pixel = px[x, y] - */ } - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "fvid_cython.pyx":46 + /* "fvid_cython.pyx":44 * bits += pixel_bin_rep * * return bits # <<<<<<<<<<<<<< @@ -2461,8 +2199,8 @@ static PyObject *__pyx_f_11fvid_cython_cy_get_bits_from_image(PyObject *__pyx_v_ __pyx_r = __pyx_v_bits; goto __pyx_L0; - /* "fvid_cython.pyx":8 - * from tqdm import tqdm + /* "fvid_cython.pyx":6 + * # cython: wraparound=False * * cpdef cy_get_bits_from_image(image): # <<<<<<<<<<<<<< * cdef int width, height, x, y @@ -2475,17 +2213,12 @@ static PyObject *__pyx_f_11fvid_cython_cy_get_bits_from_image(PyObject *__pyx_v_ __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_13); __Pyx_AddTraceback("fvid_cython.cy_get_bits_from_image", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XDECREF(__pyx_v_pixel_bin_rep); - __Pyx_XDECREF(__pyx_v_white_diff); - __Pyx_XDECREF(__pyx_v_black_diff); - __Pyx_XDECREF(__pyx_v_pixel); __Pyx_XDECREF(__pyx_v_px); __Pyx_XDECREF(__pyx_v_bits); - __Pyx_XDECREF(__pyx_v_pbar); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; @@ -2537,12 +2270,12 @@ PyObject *__pyx_args, PyObject *__pyx_kwds switch (__pyx_nargs) { case 0: if (likely((values[0] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_image)) != 0)) kw_args--; - else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 8, __pyx_L3_error) + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 6, __pyx_L3_error) else goto __pyx_L5_argtuple_error; } if (unlikely(kw_args > 0)) { const Py_ssize_t kwd_pos_args = __pyx_nargs; - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "cy_get_bits_from_image") < 0)) __PYX_ERR(0, 8, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "cy_get_bits_from_image") < 0)) __PYX_ERR(0, 6, __pyx_L3_error) } } else if (unlikely(__pyx_nargs != 1)) { goto __pyx_L5_argtuple_error; @@ -2553,7 +2286,7 @@ PyObject *__pyx_args, PyObject *__pyx_kwds } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("cy_get_bits_from_image", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 8, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("cy_get_bits_from_image", 1, 1, 1, __pyx_nargs); __PYX_ERR(0, 6, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("fvid_cython.cy_get_bits_from_image", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -2575,7 +2308,7 @@ static PyObject *__pyx_pf_11fvid_cython_cy_get_bits_from_image(CYTHON_UNUSED PyO int __pyx_clineno = 0; __Pyx_RefNannySetupContext("cy_get_bits_from_image", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __pyx_f_11fvid_cython_cy_get_bits_from_image(__pyx_v_image, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 8, __pyx_L1_error) + __pyx_t_1 = __pyx_f_11fvid_cython_cy_get_bits_from_image(__pyx_v_image, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 6, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -2611,57 +2344,45 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {0, __pyx_k_, sizeof(__pyx_k_), 0, 1, 0, 0}, {0, __pyx_k_0, sizeof(__pyx_k_0), 0, 1, 0, 0}, {0, __pyx_k_1, sizeof(__pyx_k_1), 0, 1, 0, 0}, - {0, __pyx_k_Getting_bits_from_frame, sizeof(__pyx_k_Getting_bits_from_frame), 0, 1, 0, 0}, {0, __pyx_k__4, sizeof(__pyx_k__4), 0, 0, 1, 1}, {0, __pyx_k_all, sizeof(__pyx_k_all), 0, 0, 1, 1}, {0, __pyx_k_class_getitem, sizeof(__pyx_k_class_getitem), 0, 0, 1, 1}, {0, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1}, {0, __pyx_k_cy_get_bits_from_image, sizeof(__pyx_k_cy_get_bits_from_image), 0, 0, 1, 1}, - {0, __pyx_k_desc, sizeof(__pyx_k_desc), 0, 0, 1, 1}, {0, __pyx_k_fvid_cython, sizeof(__pyx_k_fvid_cython), 0, 0, 1, 1}, {0, __pyx_k_fvid_cython_pyx, sizeof(__pyx_k_fvid_cython_pyx), 0, 0, 1, 0}, {0, __pyx_k_image, sizeof(__pyx_k_image), 0, 0, 1, 1}, - {0, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1}, {0, __pyx_k_load, sizeof(__pyx_k_load), 0, 0, 1, 1}, {0, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1}, {0, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1}, - {0, __pyx_k_operator, sizeof(__pyx_k_operator), 0, 0, 1, 1}, {0, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1}, {0, __pyx_k_size, sizeof(__pyx_k_size), 0, 0, 1, 1}, - {0, __pyx_k_sub, sizeof(__pyx_k_sub), 0, 0, 1, 1}, {0, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1}, - {0, __pyx_k_tqdm, sizeof(__pyx_k_tqdm), 0, 0, 1, 1}, #else {&__pyx_kp_u_, __pyx_k_, sizeof(__pyx_k_), 0, 1, 0, 0}, {&__pyx_kp_u_0, __pyx_k_0, sizeof(__pyx_k_0), 0, 1, 0, 0}, {&__pyx_kp_u_1, __pyx_k_1, sizeof(__pyx_k_1), 0, 1, 0, 0}, - {&__pyx_kp_u_Getting_bits_from_frame, __pyx_k_Getting_bits_from_frame, sizeof(__pyx_k_Getting_bits_from_frame), 0, 1, 0, 0}, {&__pyx_n_s__4, __pyx_k__4, sizeof(__pyx_k__4), 0, 0, 1, 1}, {&__pyx_n_s_all, __pyx_k_all, sizeof(__pyx_k_all), 0, 0, 1, 1}, {&__pyx_n_s_class_getitem, __pyx_k_class_getitem, sizeof(__pyx_k_class_getitem), 0, 0, 1, 1}, {&__pyx_n_s_cline_in_traceback, __pyx_k_cline_in_traceback, sizeof(__pyx_k_cline_in_traceback), 0, 0, 1, 1}, {&__pyx_n_s_cy_get_bits_from_image, __pyx_k_cy_get_bits_from_image, sizeof(__pyx_k_cy_get_bits_from_image), 0, 0, 1, 1}, - {&__pyx_n_s_desc, __pyx_k_desc, sizeof(__pyx_k_desc), 0, 0, 1, 1}, {&__pyx_n_s_fvid_cython, __pyx_k_fvid_cython, sizeof(__pyx_k_fvid_cython), 0, 0, 1, 1}, {&__pyx_kp_s_fvid_cython_pyx, __pyx_k_fvid_cython_pyx, sizeof(__pyx_k_fvid_cython_pyx), 0, 0, 1, 0}, {&__pyx_n_s_image, __pyx_k_image, sizeof(__pyx_k_image), 0, 0, 1, 1}, - {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1}, {&__pyx_n_s_load, __pyx_k_load, sizeof(__pyx_k_load), 0, 0, 1, 1}, {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1}, {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1}, - {&__pyx_n_s_operator, __pyx_k_operator, sizeof(__pyx_k_operator), 0, 0, 1, 1}, {&__pyx_n_s_range, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1}, {&__pyx_n_s_size, __pyx_k_size, sizeof(__pyx_k_size), 0, 0, 1, 1}, - {&__pyx_n_s_sub, __pyx_k_sub, sizeof(__pyx_k_sub), 0, 0, 1, 1}, {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1}, - {&__pyx_n_s_tqdm, __pyx_k_tqdm, sizeof(__pyx_k_tqdm), 0, 0, 1, 1}, #endif {0, 0, 0, 0, 0, 0, 0} }; /* #### Code section: cached_builtins ### */ static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) { - __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 18, __pyx_L1_error) - __pyx_builtin_all = __Pyx_GetBuiltinName(__pyx_n_s_all); if (!__pyx_builtin_all) __PYX_ERR(0, 38, __pyx_L1_error) + __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 17, __pyx_L1_error) + __pyx_builtin_all = __Pyx_GetBuiltinName(__pyx_n_s_all); if (!__pyx_builtin_all) __PYX_ERR(0, 36, __pyx_L1_error) return 0; __pyx_L1_error:; return -1; @@ -2672,17 +2393,17 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); - /* "fvid_cython.pyx":8 - * from tqdm import tqdm + /* "fvid_cython.pyx":6 + * # cython: wraparound=False * * cpdef cy_get_bits_from_image(image): # <<<<<<<<<<<<<< * cdef int width, height, x, y * cdef str pixel_bin_rep */ - __pyx_tuple__2 = PyTuple_Pack(1, __pyx_n_s_image); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(0, 8, __pyx_L1_error) + __pyx_tuple__2 = PyTuple_Pack(1, __pyx_n_s_image); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(0, 6, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__2); __Pyx_GIVEREF(__pyx_tuple__2); - __pyx_codeobj__3 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__2, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_fvid_cython_pyx, __pyx_n_s_cy_get_bits_from_image, 8, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__3)) __PYX_ERR(0, 8, __pyx_L1_error) + __pyx_codeobj__3 = (PyObject*)__Pyx_PyCode_New(1, 0, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__2, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_fvid_cython_pyx, __pyx_n_s_cy_get_bits_from_image, 6, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__3)) __PYX_ERR(0, 6, __pyx_L1_error) __Pyx_RefNannyFinishContext(); return 0; __pyx_L1_error:; @@ -2696,32 +2417,24 @@ static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) { if (__Pyx_InitString(__pyx_string_tab[0], &__pyx_kp_u_) < 0) __PYX_ERR(0, 1, __pyx_L1_error); if (__Pyx_InitString(__pyx_string_tab[1], &__pyx_kp_u_0) < 0) __PYX_ERR(0, 1, __pyx_L1_error); if (__Pyx_InitString(__pyx_string_tab[2], &__pyx_kp_u_1) < 0) __PYX_ERR(0, 1, __pyx_L1_error); - if (__Pyx_InitString(__pyx_string_tab[3], &__pyx_kp_u_Getting_bits_from_frame) < 0) __PYX_ERR(0, 1, __pyx_L1_error); - if (__Pyx_InitString(__pyx_string_tab[4], &__pyx_n_s__4) < 0) __PYX_ERR(0, 1, __pyx_L1_error); - if (__Pyx_InitString(__pyx_string_tab[5], &__pyx_n_s_all) < 0) __PYX_ERR(0, 1, __pyx_L1_error); - if (__Pyx_InitString(__pyx_string_tab[6], &__pyx_n_s_class_getitem) < 0) __PYX_ERR(0, 1, __pyx_L1_error); - if (__Pyx_InitString(__pyx_string_tab[7], &__pyx_n_s_cline_in_traceback) < 0) __PYX_ERR(0, 1, __pyx_L1_error); - if (__Pyx_InitString(__pyx_string_tab[8], &__pyx_n_s_cy_get_bits_from_image) < 0) __PYX_ERR(0, 1, __pyx_L1_error); - if (__Pyx_InitString(__pyx_string_tab[9], &__pyx_n_s_desc) < 0) __PYX_ERR(0, 1, __pyx_L1_error); - if (__Pyx_InitString(__pyx_string_tab[10], &__pyx_n_s_fvid_cython) < 0) __PYX_ERR(0, 1, __pyx_L1_error); - if (__Pyx_InitString(__pyx_string_tab[11], &__pyx_kp_s_fvid_cython_pyx) < 0) __PYX_ERR(0, 1, __pyx_L1_error); - if (__Pyx_InitString(__pyx_string_tab[12], &__pyx_n_s_image) < 0) __PYX_ERR(0, 1, __pyx_L1_error); - if (__Pyx_InitString(__pyx_string_tab[13], &__pyx_n_s_import) < 0) __PYX_ERR(0, 1, __pyx_L1_error); - if (__Pyx_InitString(__pyx_string_tab[14], &__pyx_n_s_load) < 0) __PYX_ERR(0, 1, __pyx_L1_error); - if (__Pyx_InitString(__pyx_string_tab[15], &__pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error); - if (__Pyx_InitString(__pyx_string_tab[16], &__pyx_n_s_name) < 0) __PYX_ERR(0, 1, __pyx_L1_error); - if (__Pyx_InitString(__pyx_string_tab[17], &__pyx_n_s_operator) < 0) __PYX_ERR(0, 1, __pyx_L1_error); - if (__Pyx_InitString(__pyx_string_tab[18], &__pyx_n_s_range) < 0) __PYX_ERR(0, 1, __pyx_L1_error); - if (__Pyx_InitString(__pyx_string_tab[19], &__pyx_n_s_size) < 0) __PYX_ERR(0, 1, __pyx_L1_error); - if (__Pyx_InitString(__pyx_string_tab[20], &__pyx_n_s_sub) < 0) __PYX_ERR(0, 1, __pyx_L1_error); - if (__Pyx_InitString(__pyx_string_tab[21], &__pyx_n_s_test) < 0) __PYX_ERR(0, 1, __pyx_L1_error); - if (__Pyx_InitString(__pyx_string_tab[22], &__pyx_n_s_tqdm) < 0) __PYX_ERR(0, 1, __pyx_L1_error); + if (__Pyx_InitString(__pyx_string_tab[3], &__pyx_n_s__4) < 0) __PYX_ERR(0, 1, __pyx_L1_error); + if (__Pyx_InitString(__pyx_string_tab[4], &__pyx_n_s_all) < 0) __PYX_ERR(0, 1, __pyx_L1_error); + if (__Pyx_InitString(__pyx_string_tab[5], &__pyx_n_s_class_getitem) < 0) __PYX_ERR(0, 1, __pyx_L1_error); + if (__Pyx_InitString(__pyx_string_tab[6], &__pyx_n_s_cline_in_traceback) < 0) __PYX_ERR(0, 1, __pyx_L1_error); + if (__Pyx_InitString(__pyx_string_tab[7], &__pyx_n_s_cy_get_bits_from_image) < 0) __PYX_ERR(0, 1, __pyx_L1_error); + if (__Pyx_InitString(__pyx_string_tab[8], &__pyx_n_s_fvid_cython) < 0) __PYX_ERR(0, 1, __pyx_L1_error); + if (__Pyx_InitString(__pyx_string_tab[9], &__pyx_kp_s_fvid_cython_pyx) < 0) __PYX_ERR(0, 1, __pyx_L1_error); + if (__Pyx_InitString(__pyx_string_tab[10], &__pyx_n_s_image) < 0) __PYX_ERR(0, 1, __pyx_L1_error); + if (__Pyx_InitString(__pyx_string_tab[11], &__pyx_n_s_load) < 0) __PYX_ERR(0, 1, __pyx_L1_error); + if (__Pyx_InitString(__pyx_string_tab[12], &__pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error); + if (__Pyx_InitString(__pyx_string_tab[13], &__pyx_n_s_name) < 0) __PYX_ERR(0, 1, __pyx_L1_error); + if (__Pyx_InitString(__pyx_string_tab[14], &__pyx_n_s_range) < 0) __PYX_ERR(0, 1, __pyx_L1_error); + if (__Pyx_InitString(__pyx_string_tab[15], &__pyx_n_s_size) < 0) __PYX_ERR(0, 1, __pyx_L1_error); + if (__Pyx_InitString(__pyx_string_tab[16], &__pyx_n_s_test) < 0) __PYX_ERR(0, 1, __pyx_L1_error); #endif #if !CYTHON_COMPILING_IN_LIMITED_API if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error); #endif - __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_int_255 = PyInt_FromLong(255); if (unlikely(!__pyx_int_255)) __PYX_ERR(0, 1, __pyx_L1_error) return 0; __pyx_L1_error:; return -1; @@ -2949,7 +2662,6 @@ static CYTHON_SMALL_CODE int __pyx_pymod_exec_fvid_cython(PyObject *__pyx_pyinit #endif { PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -3061,62 +2773,20 @@ if (!__Pyx_RefNanny) { if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error) #endif - /* "fvid_cython.pyx":5 - * # cython: cdivision=True - * # cython: wraparound=False - * from operator import sub # <<<<<<<<<<<<<< - * from tqdm import tqdm - * - */ - __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(__pyx_n_s_sub); - __Pyx_GIVEREF(__pyx_n_s_sub); - PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_sub); - __pyx_t_2 = __Pyx_Import(__pyx_n_s_operator, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 5, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_sub); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 5, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_sub, __pyx_t_1) < 0) __PYX_ERR(0, 5, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "fvid_cython.pyx":6 * # cython: wraparound=False - * from operator import sub - * from tqdm import tqdm # <<<<<<<<<<<<<< - * - * cpdef cy_get_bits_from_image(image): - */ - __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 6, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_INCREF(__pyx_n_s_tqdm); - __Pyx_GIVEREF(__pyx_n_s_tqdm); - PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_tqdm); - __pyx_t_1 = __Pyx_Import(__pyx_n_s_tqdm, __pyx_t_2, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 6, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_1, __pyx_n_s_tqdm); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 6, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_tqdm, __pyx_t_2) < 0) __PYX_ERR(0, 6, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "fvid_cython.pyx":8 - * from tqdm import tqdm * * cpdef cy_get_bits_from_image(image): # <<<<<<<<<<<<<< * cdef int width, height, x, y * cdef str pixel_bin_rep */ - __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_11fvid_cython_1cy_get_bits_from_image, 0, __pyx_n_s_cy_get_bits_from_image, NULL, __pyx_n_s_fvid_cython, __pyx_d, ((PyObject *)__pyx_codeobj__3)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 8, __pyx_L1_error) + __pyx_t_1 = __Pyx_CyFunction_New(&__pyx_mdef_11fvid_cython_1cy_get_bits_from_image, 0, __pyx_n_s_cy_get_bits_from_image, NULL, __pyx_n_s_fvid_cython, __pyx_d, ((PyObject *)__pyx_codeobj__3)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 6, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_cy_get_bits_from_image, __pyx_t_1) < 0) __PYX_ERR(0, 8, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_cy_get_bits_from_image, __pyx_t_1) < 0) __PYX_ERR(0, 6, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "fvid_cython.pyx":1 - * # distutils: language=c++ # <<<<<<<<<<<<<< + * # distutils: language=c # <<<<<<<<<<<<<< * # cython: boundscheck=False * # cython: cdivision=True */ @@ -3130,7 +2800,6 @@ if (!__Pyx_RefNanny) { goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); if (__pyx_m) { if (__pyx_d) { __Pyx_AddTraceback("init fvid_cython", __pyx_clineno, __pyx_lineno, __pyx_filename); @@ -3567,81 +3236,6 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_FastCallDict(PyObject *func, PyObj return __Pyx_PyObject_FastCall_fallback(func, args, nargs, kwargs); } -/* PyDictVersioning */ -#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS -static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) { - PyObject *dict = Py_TYPE(obj)->tp_dict; - return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0; -} -static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) { - PyObject **dictptr = NULL; - Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset; - if (offset) { -#if CYTHON_COMPILING_IN_CPYTHON - dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj); -#else - dictptr = _PyObject_GetDictPtr(obj); -#endif - } - return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0; -} -static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) { - PyObject *dict = Py_TYPE(obj)->tp_dict; - if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict))) - return 0; - return obj_dict_version == __Pyx_get_object_dict_version(obj); -} -#endif - -/* GetModuleGlobalName */ -#if CYTHON_USE_DICT_VERSIONS -static PyObject *__Pyx__GetModuleGlobalName(PyObject *name, PY_UINT64_T *dict_version, PyObject **dict_cached_value) -#else -static CYTHON_INLINE PyObject *__Pyx__GetModuleGlobalName(PyObject *name) -#endif -{ - PyObject *result; -#if !CYTHON_AVOID_BORROWED_REFS -#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x030500A1 - result = _PyDict_GetItem_KnownHash(__pyx_d, name, ((PyASCIIObject *) name)->hash); - __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version) - if (likely(result)) { - return __Pyx_NewRef(result); - } else if (unlikely(PyErr_Occurred())) { - return NULL; - } -#elif CYTHON_COMPILING_IN_LIMITED_API - if (unlikely(!__pyx_m)) { - return NULL; - } - result = PyObject_GetAttr(__pyx_m, name); - if (likely(result)) { - return result; - } -#else - result = PyDict_GetItem(__pyx_d, name); - __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version) - if (likely(result)) { - return __Pyx_NewRef(result); - } -#endif -#else - result = PyObject_GetItem(__pyx_d, name); - __PYX_UPDATE_DICT_CACHE(__pyx_d, result, *dict_cached_value, *dict_version) - if (likely(result)) { - return __Pyx_NewRef(result); - } - PyErr_Clear(); -#endif - return __Pyx_GetBuiltinName(name); -} - -/* PyObjectCallOneArg */ -static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) { - PyObject *args[2] = {NULL, arg}; - return __Pyx_PyObject_FastCall(func, args+1, 1 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET); -} - /* GetItemInt */ static PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) { PyObject *r; @@ -3737,6 +3331,12 @@ static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); } +/* PyObjectCallOneArg */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg) { + PyObject *args[2] = {NULL, arg}; + return __Pyx_PyObject_FastCall(func, args+1, 1 | __Pyx_PY_VECTORCALL_ARGUMENTS_OFFSET); +} + /* ObjectGetItem */ #if CYTHON_USE_TYPE_SLOTS static PyObject *__Pyx_PyObject_GetIndex(PyObject *obj, PyObject *index) { @@ -3785,240 +3385,6 @@ static PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject *key) { } #endif -/* RaiseUnexpectedTypeError */ -static int -__Pyx_RaiseUnexpectedTypeError(const char *expected, PyObject *obj) -{ - __Pyx_TypeName obj_type_name = __Pyx_PyType_GetName(Py_TYPE(obj)); - PyErr_Format(PyExc_TypeError, "Expected %s, got " __Pyx_FMT_TYPENAME, - expected, obj_type_name); - __Pyx_DECREF_TypeName(obj_type_name); - return 0; -} - -/* PyIntCompare */ -static CYTHON_INLINE PyObject* __Pyx_PyInt_EqObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, CYTHON_UNUSED long inplace) { - if (op1 == op2) { - Py_RETURN_TRUE; - } - #if PY_MAJOR_VERSION < 3 - if (likely(PyInt_CheckExact(op1))) { - const long b = intval; - long a = PyInt_AS_LONG(op1); - if (a == b) Py_RETURN_TRUE; else Py_RETURN_FALSE; - } - #endif - #if CYTHON_USE_PYLONG_INTERNALS - if (likely(PyLong_CheckExact(op1))) { - int unequal; - unsigned long uintval; - Py_ssize_t size = Py_SIZE(op1); - const digit* digits = ((PyLongObject*)op1)->ob_digit; - if (intval == 0) { - if (size == 0) Py_RETURN_TRUE; else Py_RETURN_FALSE; - } else if (intval < 0) { - if (size >= 0) - Py_RETURN_FALSE; - intval = -intval; - size = -size; - } else { - if (size <= 0) - Py_RETURN_FALSE; - } - uintval = (unsigned long) intval; -#if PyLong_SHIFT * 4 < SIZEOF_LONG*8 - if (uintval >> (PyLong_SHIFT * 4)) { - unequal = (size != 5) || (digits[0] != (uintval & (unsigned long) PyLong_MASK)) - | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[3] != ((uintval >> (3 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[4] != ((uintval >> (4 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)); - } else -#endif -#if PyLong_SHIFT * 3 < SIZEOF_LONG*8 - if (uintval >> (PyLong_SHIFT * 3)) { - unequal = (size != 4) || (digits[0] != (uintval & (unsigned long) PyLong_MASK)) - | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[3] != ((uintval >> (3 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)); - } else -#endif -#if PyLong_SHIFT * 2 < SIZEOF_LONG*8 - if (uintval >> (PyLong_SHIFT * 2)) { - unequal = (size != 3) || (digits[0] != (uintval & (unsigned long) PyLong_MASK)) - | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)) | (digits[2] != ((uintval >> (2 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)); - } else -#endif -#if PyLong_SHIFT * 1 < SIZEOF_LONG*8 - if (uintval >> (PyLong_SHIFT * 1)) { - unequal = (size != 2) || (digits[0] != (uintval & (unsigned long) PyLong_MASK)) - | (digits[1] != ((uintval >> (1 * PyLong_SHIFT)) & (unsigned long) PyLong_MASK)); - } else -#endif - unequal = (size != 1) || (((unsigned long) digits[0]) != (uintval & (unsigned long) PyLong_MASK)); - if (unequal == 0) Py_RETURN_TRUE; else Py_RETURN_FALSE; - } - #endif - if (PyFloat_CheckExact(op1)) { - const long b = intval; -#if CYTHON_COMPILING_IN_LIMITED_API - double a = __pyx_PyFloat_AsDouble(op1); -#else - double a = PyFloat_AS_DOUBLE(op1); -#endif - if ((double)a == (double)b) Py_RETURN_TRUE; else Py_RETURN_FALSE; - } - return ( - PyObject_RichCompare(op1, op2, Py_EQ)); -} - -/* py_abs */ -#if CYTHON_USE_PYLONG_INTERNALS -static PyObject *__Pyx_PyLong_AbsNeg(PyObject *n) { - if (likely(Py_SIZE(n) == -1)) { - return PyLong_FromLong(((PyLongObject*)n)->ob_digit[0]); - } -#if CYTHON_COMPILING_IN_CPYTHON - { - PyObject *copy = _PyLong_Copy((PyLongObject*)n); - if (likely(copy)) { - __Pyx_SET_SIZE(copy, -Py_SIZE(copy)); - } - return copy; - } -#else - return PyNumber_Negative(n); -#endif -} -#endif - -/* PyIntBinop */ -#if !CYTHON_COMPILING_IN_PYPY -static PyObject* __Pyx_PyInt_SubtractObjC(PyObject *op1, PyObject *op2, CYTHON_UNUSED long intval, int inplace, int zerodivision_check) { - (void)inplace; (void)zerodivision_check; - #if PY_MAJOR_VERSION < 3 - if (likely(PyInt_CheckExact(op1))) { - const long b = intval; - long x; - long a = PyInt_AS_LONG(op1); - - x = (long)((unsigned long)a - b); - if (likely((x^a) >= 0 || (x^~b) >= 0)) - return PyInt_FromLong(x); - return PyLong_Type.tp_as_number->nb_subtract(op1, op2); - } - #endif - #if CYTHON_USE_PYLONG_INTERNALS - if (likely(PyLong_CheckExact(op1))) { - const long b = intval; - long a, x; -#ifdef HAVE_LONG_LONG - const PY_LONG_LONG llb = intval; - PY_LONG_LONG lla, llx; -#endif - const digit* digits = ((PyLongObject*)op1)->ob_digit; - const Py_ssize_t size = Py_SIZE(op1); - if (unlikely(size == 0)) { - return PyLong_FromLong(-intval); - } - if (likely(__Pyx_sst_abs(size) <= 1)) { - a = likely(size) ? digits[0] : 0; - if (size == -1) a = -a; - } else { - switch (size) { - case -2: - if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { - a = -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; - #ifdef HAVE_LONG_LONG - } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) { - lla = -(PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); - goto long_long; - #endif - } - CYTHON_FALLTHROUGH; - case 2: - if (8 * sizeof(long) - 1 > 2 * PyLong_SHIFT) { - a = (long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; - #ifdef HAVE_LONG_LONG - } else if (8 * sizeof(PY_LONG_LONG) - 1 > 2 * PyLong_SHIFT) { - lla = (PY_LONG_LONG) (((((unsigned PY_LONG_LONG)digits[1]) << PyLong_SHIFT) | (unsigned PY_LONG_LONG)digits[0])); - goto long_long; - #endif - } - CYTHON_FALLTHROUGH; - case -3: - if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { - a = -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; - #ifdef HAVE_LONG_LONG - } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) { - 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])); - goto long_long; - #endif - } - CYTHON_FALLTHROUGH; - case 3: - if (8 * sizeof(long) - 1 > 3 * PyLong_SHIFT) { - a = (long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; - #ifdef HAVE_LONG_LONG - } else if (8 * sizeof(PY_LONG_LONG) - 1 > 3 * PyLong_SHIFT) { - 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])); - goto long_long; - #endif - } - CYTHON_FALLTHROUGH; - case -4: - if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { - a = -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; - #ifdef HAVE_LONG_LONG - } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) { - 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])); - goto long_long; - #endif - } - CYTHON_FALLTHROUGH; - case 4: - if (8 * sizeof(long) - 1 > 4 * PyLong_SHIFT) { - a = (long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0])); - break; - #ifdef HAVE_LONG_LONG - } else if (8 * sizeof(PY_LONG_LONG) - 1 > 4 * PyLong_SHIFT) { - 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])); - goto long_long; - #endif - } - CYTHON_FALLTHROUGH; - default: return PyLong_Type.tp_as_number->nb_subtract(op1, op2); - } - } - x = a - b; - return PyLong_FromLong(x); -#ifdef HAVE_LONG_LONG - long_long: - llx = lla - llb; - return PyLong_FromLongLong(llx); -#endif - - - } - #endif - if (PyFloat_CheckExact(op1)) { - const long b = intval; -#if CYTHON_COMPILING_IN_LIMITED_API - double a = __pyx_PyFloat_AsDouble(op1); -#else - double a = PyFloat_AS_DOUBLE(op1); -#endif - double result; - - PyFPE_START_PROTECT("subtract", return NULL) - result = ((double)a) - (double)b; - PyFPE_END_PROTECT(result) - return PyFloat_FromDouble(result); - } - return (inplace ? PyNumber_InPlaceSubtract : PyNumber_Subtract)(op1, op2); -} -#endif - /* UnicodeConcatInPlace */ # if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 static int @@ -4440,88 +3806,6 @@ static void __Pyx_RaiseArgtupleInvalid( (num_expected == 1) ? "" : "s", num_found); } -/* Import */ -static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) { - PyObject *module = 0; - PyObject *empty_dict = 0; - PyObject *empty_list = 0; - #if PY_MAJOR_VERSION < 3 - PyObject *py_import; - py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s_import); - if (unlikely(!py_import)) - goto bad; - if (!from_list) { - empty_list = PyList_New(0); - if (unlikely(!empty_list)) - goto bad; - from_list = empty_list; - } - #endif - empty_dict = PyDict_New(); - if (unlikely(!empty_dict)) - goto bad; - { - #if PY_MAJOR_VERSION >= 3 - if (level == -1) { - if ((1) && (strchr(__Pyx_MODULE_NAME, '.'))) { - #if CYTHON_COMPILING_IN_LIMITED_API - module = PyImport_ImportModuleLevelObject( - name, empty_dict, empty_dict, from_list, 1); - #else - module = PyImport_ImportModuleLevelObject( - name, __pyx_d, empty_dict, from_list, 1); - #endif - if (unlikely(!module)) { - if (unlikely(!PyErr_ExceptionMatches(PyExc_ImportError))) - goto bad; - PyErr_Clear(); - } - } - level = 0; - } - #endif - if (!module) { - #if PY_MAJOR_VERSION < 3 - PyObject *py_level = PyInt_FromLong(level); - if (unlikely(!py_level)) - goto bad; - module = PyObject_CallFunctionObjArgs(py_import, - name, __pyx_d, empty_dict, from_list, py_level, (PyObject *)NULL); - Py_DECREF(py_level); - #else - #if CYTHON_COMPILING_IN_LIMITED_API - module = PyImport_ImportModuleLevelObject( - name, empty_dict, empty_dict, from_list, level); - #else - module = PyImport_ImportModuleLevelObject( - name, __pyx_d, empty_dict, from_list, level); - #endif - #endif - } - } -bad: - Py_XDECREF(empty_dict); - Py_XDECREF(empty_list); - #if PY_MAJOR_VERSION < 3 - Py_XDECREF(py_import); - #endif - return module; -} - -/* ImportFrom */ -static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) { - PyObject* value = __Pyx_PyObject_GetAttrStr(module, name); - if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) { - PyErr_Format(PyExc_ImportError, - #if PY_MAJOR_VERSION < 3 - "cannot import name %.230s", PyString_AS_STRING(name)); - #else - "cannot import name %S", name); - #endif - } - return value; -} - /* FetchCommonType */ static PyObject *__Pyx_FetchSharedCythonABIModule(void) { PyObject *abi_module = PyImport_AddModule((char*) __PYX_ABI_MODULE_NAME); @@ -5433,6 +4717,32 @@ static PyObject *__Pyx_CyFunction_New(PyMethodDef *ml, int flags, PyObject* qual return op; } +/* PyDictVersioning */ +#if CYTHON_USE_DICT_VERSIONS && CYTHON_USE_TYPE_SLOTS +static CYTHON_INLINE PY_UINT64_T __Pyx_get_tp_dict_version(PyObject *obj) { + PyObject *dict = Py_TYPE(obj)->tp_dict; + return likely(dict) ? __PYX_GET_DICT_VERSION(dict) : 0; +} +static CYTHON_INLINE PY_UINT64_T __Pyx_get_object_dict_version(PyObject *obj) { + PyObject **dictptr = NULL; + Py_ssize_t offset = Py_TYPE(obj)->tp_dictoffset; + if (offset) { +#if CYTHON_COMPILING_IN_CPYTHON + dictptr = (likely(offset > 0)) ? (PyObject **) ((char *)obj + offset) : _PyObject_GetDictPtr(obj); +#else + dictptr = _PyObject_GetDictPtr(obj); +#endif + } + return (dictptr && *dictptr) ? __PYX_GET_DICT_VERSION(*dictptr) : 0; +} +static CYTHON_INLINE int __Pyx_object_dict_version_matches(PyObject* obj, PY_UINT64_T tp_dict_version, PY_UINT64_T obj_dict_version) { + PyObject *dict = Py_TYPE(obj)->tp_dict; + if (unlikely(!dict) || unlikely(tp_dict_version != __PYX_GET_DICT_VERSION(dict))) + return 0; + return obj_dict_version == __Pyx_get_object_dict_version(obj); +} +#endif + /* CLineInTraceback */ #ifndef CYTHON_CLINE_IN_TRACEBACK static int __Pyx_CLineForTraceback(CYTHON_NCP_UNUSED PyThreadState *tstate, int c_line) { @@ -5707,35 +5017,64 @@ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) { } } -/* CIntToPy */ -static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) { - const long neg_one = (long) ((long) 0 - (long) 1), const_zero = (long) 0; - const int is_unsigned = neg_one > const_zero; - if (is_unsigned) { - if (sizeof(long) < sizeof(long)) { - return PyInt_FromLong((long) value); - } else if (sizeof(long) <= sizeof(unsigned long)) { - return PyLong_FromUnsignedLong((unsigned long) value); -#ifdef HAVE_LONG_LONG - } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) { - return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); -#endif - } - } else { - if (sizeof(long) <= sizeof(long)) { - return PyInt_FromLong((long) value); -#ifdef HAVE_LONG_LONG - } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) { - return PyLong_FromLongLong((PY_LONG_LONG) value); -#endif - } +/* FromPyCTupleUtility */ +static __pyx_ctuple_int__and_int__and_int __pyx_convert__from_py___pyx_ctuple_int__and_int__and_int(PyObject * o) { + __pyx_ctuple_int__and_int__and_int result; + if (!PyTuple_Check(o) || PyTuple_GET_SIZE(o) != 3) { + __Pyx_TypeName o_type_name = __Pyx_PyType_GetName(Py_TYPE(o)); + PyErr_Format(PyExc_TypeError, + "Expected a tuple of size %d, got " __Pyx_FMT_TYPENAME, 3, o_type_name); + __Pyx_DECREF_TypeName(o_type_name); + goto bad; } +#if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + result.f0 = __Pyx_PyInt_As_int(PyTuple_GET_ITEM(o, 0)); + if ((result.f0 == (int)-1) && PyErr_Occurred()) goto bad; + result.f1 = __Pyx_PyInt_As_int(PyTuple_GET_ITEM(o, 1)); + if ((result.f1 == (int)-1) && PyErr_Occurred()) goto bad; + result.f2 = __Pyx_PyInt_As_int(PyTuple_GET_ITEM(o, 2)); + if ((result.f2 == (int)-1) && PyErr_Occurred()) goto bad; +#else { - int one = 1; int little = (int)*(unsigned char *)&one; - unsigned char *bytes = (unsigned char *)&value; - return _PyLong_FromByteArray(bytes, sizeof(long), - little, !is_unsigned); + PyObject *item; + item = PySequence_ITEM(o, 0); if (unlikely(!item)) goto bad; + result.f0 = __Pyx_PyInt_As_int(item); + Py_DECREF(item); + if ((result.f0 == (int)-1) && PyErr_Occurred()) goto bad; + item = PySequence_ITEM(o, 1); if (unlikely(!item)) goto bad; + result.f1 = __Pyx_PyInt_As_int(item); + Py_DECREF(item); + if ((result.f1 == (int)-1) && PyErr_Occurred()) goto bad; + item = PySequence_ITEM(o, 2); if (unlikely(!item)) goto bad; + result.f2 = __Pyx_PyInt_As_int(item); + Py_DECREF(item); + if ((result.f2 == (int)-1) && PyErr_Occurred()) goto bad; } +#endif + return result; +bad: + return result; +} + +/* ToPyCTupleUtility */ +static PyObject* __pyx_convert__to_py___pyx_ctuple_int__and_int__and_int(__pyx_ctuple_int__and_int__and_int value) { + PyObject* item = NULL; + PyObject* result = PyTuple_New(3); + if (!result) goto bad; + item = __Pyx_PyInt_From_int(value.f0); + if (!item) goto bad; + PyTuple_SET_ITEM(result, 0, item); + item = __Pyx_PyInt_From_int(value.f1); + if (!item) goto bad; + PyTuple_SET_ITEM(result, 1, item); + item = __Pyx_PyInt_From_int(value.f2); + if (!item) goto bad; + PyTuple_SET_ITEM(result, 2, item); + return result; +bad: + Py_XDECREF(item); + Py_XDECREF(result); + return NULL; } /* CIntFromPy */ @@ -5942,6 +5281,37 @@ __Pyx_PyType_GetName(PyTypeObject* tp) } #endif +/* CIntToPy */ +static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) { + const long neg_one = (long) ((long) 0 - (long) 1), const_zero = (long) 0; + const int is_unsigned = neg_one > const_zero; + if (is_unsigned) { + if (sizeof(long) < sizeof(long)) { + return PyInt_FromLong((long) value); + } else if (sizeof(long) <= sizeof(unsigned long)) { + return PyLong_FromUnsignedLong((unsigned long) value); +#ifdef HAVE_LONG_LONG + } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) { + return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); +#endif + } + } else { + if (sizeof(long) <= sizeof(long)) { + return PyInt_FromLong((long) value); +#ifdef HAVE_LONG_LONG + } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) { + return PyLong_FromLongLong((PY_LONG_LONG) value); +#endif + } + } + { + int one = 1; int little = (int)*(unsigned char *)&one; + unsigned char *bytes = (unsigned char *)&value; + return _PyLong_FromByteArray(bytes, sizeof(long), + little, !is_unsigned); + } +} + /* CIntFromPy */ static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) { const long neg_one = (long) ((long) 0 - (long) 1), const_zero = (long) 0;