diff --git a/src/DracoPy.cpp b/src/DracoPy.cpp index 2fd918f..a7dfad3 100644 --- a/src/DracoPy.cpp +++ b/src/DracoPy.cpp @@ -1,14 +1,16 @@ -/* Generated by Cython 0.29.22 */ +/* Generated by Cython 0.29.25 */ +#ifndef PY_SSIZE_T_CLEAN #define PY_SSIZE_T_CLEAN +#endif /* PY_SSIZE_T_CLEAN */ #include "Python.h" #ifndef Py_PYTHON_H #error Python headers needed to compile C extensions, please install development version of Python. #elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000) #error Cython requires Python 2.6+ or Python 3.3+. #else -#define CYTHON_ABI "0_29_22" -#define CYTHON_HEX_VERSION 0x001D16F0 +#define CYTHON_ABI "0_29_25" +#define CYTHON_HEX_VERSION 0x001D19F0 #define CYTHON_FUTURE_DIVISION 1 #include #ifndef offsetof @@ -155,7 +157,7 @@ #ifndef CYTHON_USE_UNICODE_INTERNALS #define CYTHON_USE_UNICODE_INTERNALS 1 #endif - #if PY_VERSION_HEX < 0x030300F0 + #if PY_VERSION_HEX < 0x030300F0 || PY_VERSION_HEX >= 0x030B00A2 #undef CYTHON_USE_UNICODE_WRITER #define CYTHON_USE_UNICODE_WRITER 0 #elif !defined(CYTHON_USE_UNICODE_WRITER) @@ -174,7 +176,7 @@ #define CYTHON_FAST_THREAD_STATE 1 #endif #ifndef CYTHON_FAST_PYCALL - #define CYTHON_FAST_PYCALL 1 + #define CYTHON_FAST_PYCALL (PY_VERSION_HEX < 0x030B00A1) #endif #ifndef CYTHON_PEP489_MULTI_PHASE_INIT #define CYTHON_PEP489_MULTI_PHASE_INIT (PY_VERSION_HEX >= 0x03050000) @@ -193,7 +195,9 @@ #define CYTHON_FAST_PYCCALL (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1) #endif #if CYTHON_USE_PYLONG_INTERNALS - #include "longintrepr.h" + #if PY_MAJOR_VERSION < 3 + #include "longintrepr.h" + #endif #undef SHIFT #undef BASE #undef MASK @@ -324,9 +328,68 @@ class __Pyx_FakeReference { #define __Pyx_DefaultClassType PyClass_Type #else #define __Pyx_BUILTIN_MODULE_NAME "builtins" -#if PY_VERSION_HEX >= 0x030800A4 && PY_VERSION_HEX < 0x030800B2 - #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ - PyCode_New(a, 0, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) + #define __Pyx_DefaultClassType PyType_Type +#if PY_VERSION_HEX >= 0x030B00A1 + static CYTHON_INLINE PyCodeObject* __Pyx_PyCode_New(int a, int k, int l, int s, int f, + PyObject *code, PyObject *c, PyObject* n, PyObject *v, + PyObject *fv, PyObject *cell, PyObject* fn, + PyObject *name, int fline, PyObject *lnos) { + PyObject *kwds=NULL, *argcount=NULL, *posonlyargcount=NULL, *kwonlyargcount=NULL; + PyObject *nlocals=NULL, *stacksize=NULL, *flags=NULL, *replace=NULL, *call_result=NULL, *empty=NULL; + const char *fn_cstr=NULL; + const char *name_cstr=NULL; + PyCodeObject* co=NULL; + PyObject *type, *value, *traceback; + PyErr_Fetch(&type, &value, &traceback); + if (!(kwds=PyDict_New())) goto end; + if (!(argcount=PyLong_FromLong(a))) goto end; + if (PyDict_SetItemString(kwds, "co_argcount", argcount) != 0) goto end; + if (!(posonlyargcount=PyLong_FromLong(0))) goto end; + if (PyDict_SetItemString(kwds, "co_posonlyargcount", posonlyargcount) != 0) goto end; + if (!(kwonlyargcount=PyLong_FromLong(k))) goto end; + if (PyDict_SetItemString(kwds, "co_kwonlyargcount", kwonlyargcount) != 0) goto end; + if (!(nlocals=PyLong_FromLong(l))) goto end; + if (PyDict_SetItemString(kwds, "co_nlocals", nlocals) != 0) goto end; + if (!(stacksize=PyLong_FromLong(s))) goto end; + if (PyDict_SetItemString(kwds, "co_stacksize", stacksize) != 0) goto end; + if (!(flags=PyLong_FromLong(f))) goto end; + if (PyDict_SetItemString(kwds, "co_flags", flags) != 0) goto end; + if (PyDict_SetItemString(kwds, "co_code", code) != 0) goto end; + if (PyDict_SetItemString(kwds, "co_consts", c) != 0) goto end; + if (PyDict_SetItemString(kwds, "co_names", n) != 0) goto end; + if (PyDict_SetItemString(kwds, "co_varnames", v) != 0) goto end; + if (PyDict_SetItemString(kwds, "co_freevars", fv) != 0) goto end; + if (PyDict_SetItemString(kwds, "co_cellvars", cell) != 0) goto end; + if (PyDict_SetItemString(kwds, "co_linetable", lnos) != 0) goto end; + if (!(fn_cstr=PyUnicode_AsUTF8AndSize(fn, NULL))) goto end; + if (!(name_cstr=PyUnicode_AsUTF8AndSize(name, NULL))) goto end; + if (!(co = PyCode_NewEmpty(fn_cstr, name_cstr, fline))) goto end; + if (!(replace = PyObject_GetAttrString((PyObject*)co, "replace"))) goto cleanup_code_too; + if (!(empty = PyTuple_New(0))) goto cleanup_code_too; // unfortunately __pyx_empty_tuple isn't available here + if (!(call_result = PyObject_Call(replace, empty, kwds))) goto cleanup_code_too; + Py_XDECREF((PyObject*)co); + co = (PyCodeObject*)call_result; + call_result = NULL; + if (0) { + cleanup_code_too: + Py_XDECREF((PyObject*)co); + co = NULL; + } + end: + Py_XDECREF(kwds); + Py_XDECREF(argcount); + Py_XDECREF(posonlyargcount); + Py_XDECREF(kwonlyargcount); + Py_XDECREF(nlocals); + Py_XDECREF(stacksize); + Py_XDECREF(replace); + Py_XDECREF(call_result); + Py_XDECREF(empty); + if (type) { + PyErr_Restore(type, value, traceback); + } + return co; + } #else #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) @@ -440,8 +503,12 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { #endif #if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND) #define CYTHON_PEP393_ENABLED 1 + #if defined(PyUnicode_IS_READY) #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ?\ 0 : _PyUnicode_Ready((PyObject *)(op))) + #else + #define __Pyx_PyUnicode_READY(op) (0) + #endif #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u) #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i) #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) PyUnicode_MAX_CHAR_VALUE(u) @@ -450,7 +517,11 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i) #define __Pyx_PyUnicode_WRITE(k, d, i, ch) PyUnicode_WRITE(k, d, i, ch) #if defined(PyUnicode_IS_READY) && defined(PyUnicode_GET_SIZE) + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03090000 + #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : ((PyCompactUnicodeObject *)(u))->wstr_length)) + #else #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u))) + #endif #else #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_LENGTH(u)) #endif @@ -556,10 +627,10 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { #if PY_VERSION_HEX < 0x030200A4 typedef long Py_hash_t; #define __Pyx_PyInt_FromHash_t PyInt_FromLong - #define __Pyx_PyInt_AsHash_t PyInt_AsLong + #define __Pyx_PyInt_AsHash_t __Pyx_PyIndex_AsHash_t #else #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t - #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t + #define __Pyx_PyInt_AsHash_t __Pyx_PyIndex_AsSsize_t #endif #if PY_MAJOR_VERSION >= 3 #define __Pyx_PyMethod_New(func, self, klass) ((self) ? ((void)(klass), PyMethod_New(func, self)) : __Pyx_NewRef(func)) @@ -624,9 +695,24 @@ static CYTHON_INLINE float __PYX_NAN() { #include "stdexcept" #include "typeinfo" #include +#include +#include +#include + + #if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1600) + // move should be defined for these versions of MSVC, but __cplusplus isn't set usefully + #include + + namespace cython_std { + template typename std::remove_reference::type&& move(T& t) noexcept { return std::move(t); } + template typename std::remove_reference::type&& move(T&& t) noexcept { return std::move(t); } + } + + #endif + +#include #include #include "DracoPy.h" -#include #ifdef _OPENMP #include #endif /* _OPENMP */ @@ -723,6 +809,7 @@ static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x); (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj)) static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); +static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject*); #if CYTHON_ASSUME_SAFE_MACROS #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) #else @@ -835,11 +922,38 @@ static const char *__pyx_filename; static const char *__pyx_f[] = { - "src/DracoPy.pyx", + "src\\DracoPy.pyx", "stringsource", }; /*--- Type declarations ---*/ +struct __pyx_obj_7DracoPy_Encoder; +struct __pyx_obj___Pyx_EnumMeta; + +/* "DracoPy.pyx":10 + * + * + * cdef class Encoder: # <<<<<<<<<<<<<< + * """ + * Python wrapper for draco::Encoder + */ +struct __pyx_obj_7DracoPy_Encoder { + PyObject_HEAD + draco::Encoder this_encoder; +}; + + +/* "EnumBase":15 + * + * @cython.internal + * cdef class __Pyx_EnumMeta(type): # <<<<<<<<<<<<<< + * def __init__(cls, name, parents, dct): + * type.__init__(cls, name, parents, dct) + */ +struct __pyx_obj___Pyx_EnumMeta { + PyHeapTypeObject __pyx_base; +}; + /* --- Runtime support code (head) --- */ /* Refnanny.proto */ @@ -919,6 +1033,9 @@ static PyObject *__Pyx_GetBuiltinName(PyObject *name); 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); +/* KeywordStringCheck.proto */ +static int __Pyx_CheckKeywordStrings(PyObject *kwdict, const char* function_name, int kw_allowed); + /* RaiseDoubleKeywords.proto */ static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name); @@ -927,6 +1044,52 @@ static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],\ PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,\ const char* function_name); +/* PyObjectCall.proto */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw); +#else +#define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw) +#endif + +/* PyThreadStateGet.proto */ +#if CYTHON_FAST_THREAD_STATE +#define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate; +#define __Pyx_PyThreadState_assign __pyx_tstate = __Pyx_PyThreadState_Current; +#define __Pyx_PyErr_Occurred() __pyx_tstate->curexc_type +#else +#define __Pyx_PyThreadState_declare +#define __Pyx_PyThreadState_assign +#define __Pyx_PyErr_Occurred() PyErr_Occurred() +#endif + +/* PyErrFetchRestore.proto */ +#if CYTHON_FAST_THREAD_STATE +#define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL) +#define __Pyx_ErrRestoreWithState(type, value, tb) __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb) +#define __Pyx_ErrFetchWithState(type, value, tb) __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb) +#define __Pyx_ErrRestore(type, value, tb) __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb) +#define __Pyx_ErrFetch(type, value, tb) __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb) +static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb); +static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); +#if CYTHON_COMPILING_IN_CPYTHON +#define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL)) +#else +#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc) +#endif +#else +#define __Pyx_PyErr_Clear() PyErr_Clear() +#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc) +#define __Pyx_ErrRestoreWithState(type, value, tb) PyErr_Restore(type, value, tb) +#define __Pyx_ErrFetchWithState(type, value, tb) PyErr_Fetch(type, value, tb) +#define __Pyx_ErrRestoreInState(tstate, type, value, tb) PyErr_Restore(type, value, tb) +#define __Pyx_ErrFetchInState(tstate, type, value, tb) PyErr_Fetch(type, value, tb) +#define __Pyx_ErrRestore(type, value, tb) PyErr_Restore(type, value, tb) +#define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb) +#endif + +/* RaiseException.proto */ +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); + /* PyObjectSetAttrStr.proto */ #if CYTHON_USE_TYPE_SLOTS #define __Pyx_PyObject_DelAttrStr(o,n) __Pyx_PyObject_SetAttrStr(o, n, NULL) @@ -1008,6 +1171,7 @@ static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, #ifndef Py_MEMBER_SIZE #define Py_MEMBER_SIZE(type, member) sizeof(((type *)0)->member) #endif +#if CYTHON_FAST_PYCALL static size_t __pyx_pyframe_localsplus_offset = 0; #include "frameobject.h" #define __Pxy_PyFrame_Initialize_Offsets()\ @@ -1015,6 +1179,7 @@ static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, (void)(__pyx_pyframe_localsplus_offset = ((size_t)PyFrame_Type.tp_basicsize) - Py_MEMBER_SIZE(PyFrameObject, f_localsplus))) #define __Pyx_PyFrame_GetLocalsplus(frame)\ (assert(__pyx_pyframe_localsplus_offset), (PyObject **)(((char *)(frame)) + __pyx_pyframe_localsplus_offset)) +#endif // CYTHON_FAST_PYCALL #endif /* PyCFunctionFastCall.proto */ @@ -1024,13 +1189,6 @@ static CYTHON_INLINE PyObject *__Pyx_PyCFunction_FastCall(PyObject *func, PyObje #define __Pyx_PyCFunction_FastCall(func, args, nargs) (assert(0), NULL) #endif -/* PyObjectCall.proto */ -#if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw); -#else -#define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw) -#endif - /* PyObjectCall2Args.proto */ static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2); @@ -1084,45 +1242,6 @@ static CYTHON_INLINE PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* k #define __Pyx_PyObject_GetItem(obj, key) PyObject_GetItem(obj, key) #endif -/* PyThreadStateGet.proto */ -#if CYTHON_FAST_THREAD_STATE -#define __Pyx_PyThreadState_declare PyThreadState *__pyx_tstate; -#define __Pyx_PyThreadState_assign __pyx_tstate = __Pyx_PyThreadState_Current; -#define __Pyx_PyErr_Occurred() __pyx_tstate->curexc_type -#else -#define __Pyx_PyThreadState_declare -#define __Pyx_PyThreadState_assign -#define __Pyx_PyErr_Occurred() PyErr_Occurred() -#endif - -/* PyErrFetchRestore.proto */ -#if CYTHON_FAST_THREAD_STATE -#define __Pyx_PyErr_Clear() __Pyx_ErrRestore(NULL, NULL, NULL) -#define __Pyx_ErrRestoreWithState(type, value, tb) __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb) -#define __Pyx_ErrFetchWithState(type, value, tb) __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb) -#define __Pyx_ErrRestore(type, value, tb) __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb) -#define __Pyx_ErrFetch(type, value, tb) __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb) -static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb); -static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb); -#if CYTHON_COMPILING_IN_CPYTHON -#define __Pyx_PyErr_SetNone(exc) (Py_INCREF(exc), __Pyx_ErrRestore((exc), NULL, NULL)) -#else -#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc) -#endif -#else -#define __Pyx_PyErr_Clear() PyErr_Clear() -#define __Pyx_PyErr_SetNone(exc) PyErr_SetNone(exc) -#define __Pyx_ErrRestoreWithState(type, value, tb) PyErr_Restore(type, value, tb) -#define __Pyx_ErrFetchWithState(type, value, tb) PyErr_Fetch(type, value, tb) -#define __Pyx_ErrRestoreInState(tstate, type, value, tb) PyErr_Restore(type, value, tb) -#define __Pyx_ErrFetchInState(tstate, type, value, tb) PyErr_Fetch(type, value, tb) -#define __Pyx_ErrRestore(type, value, tb) PyErr_Restore(type, value, tb) -#define __Pyx_ErrFetch(type, value, tb) PyErr_Fetch(type, value, tb) -#endif - -/* RaiseException.proto */ -static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); - /* PyFloatBinop.proto */ #if !CYTHON_COMPILING_IN_PYPY static PyObject* __Pyx_PyFloat_AddObjC(PyObject *op1, PyObject *op2, double floatval, int inplace, int zerodivision_check); @@ -1148,6 +1267,19 @@ static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) { #define __Pyx_PyList_Append(L,x) PyList_Append(L,x) #endif +/* PyObjectCallNoArg.proto */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func); +#else +#define __Pyx_PyObject_CallNoArg(func) __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL) +#endif + +/* ArgTypeTest.proto */ +#define __Pyx_ArgTypeTest(obj, type, none_allowed, name, exact)\ + ((likely((Py_TYPE(obj) == type) | (none_allowed && (obj == Py_None)))) ? 1 :\ + __Pyx__ArgTypeTest(obj, type, name, exact)) +static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact); + /* GetTopmostException.proto */ #if CYTHON_USE_EXC_INFO_STACK static _PyErr_StackItem * __Pyx_PyErr_GetTopmostException(PyThreadState *tstate); @@ -1202,12 +1334,91 @@ static CYTHON_INLINE int __Pyx_ListComp_Append(PyObject* list, PyObject* x) { #define __Pyx_ListComp_Append(L,x) PyList_Append(L,x) #endif +/* IterFinish.proto */ +static CYTHON_INLINE int __Pyx_IterFinish(void); + +/* PyObjectGetMethod.proto */ +static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method); + +/* PyObjectCallMethod0.proto */ +static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name); + +/* RaiseNeedMoreValuesToUnpack.proto */ +static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); + +/* RaiseTooManyValuesToUnpack.proto */ +static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected); + +/* UnpackItemEndCheck.proto */ +static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected); + +/* RaiseNoneIterError.proto */ +static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void); + +/* UnpackTupleError.proto */ +static void __Pyx_UnpackTupleError(PyObject *, Py_ssize_t index); + +/* UnpackTuple2.proto */ +#define __Pyx_unpack_tuple2(tuple, value1, value2, is_tuple, has_known_size, decref_tuple)\ + (likely(is_tuple || PyTuple_Check(tuple)) ?\ + (likely(has_known_size || PyTuple_GET_SIZE(tuple) == 2) ?\ + __Pyx_unpack_tuple2_exact(tuple, value1, value2, decref_tuple) :\ + (__Pyx_UnpackTupleError(tuple, 2), -1)) :\ + __Pyx_unpack_tuple2_generic(tuple, value1, value2, has_known_size, decref_tuple)) +static CYTHON_INLINE int __Pyx_unpack_tuple2_exact( + PyObject* tuple, PyObject** value1, PyObject** value2, int decref_tuple); +static int __Pyx_unpack_tuple2_generic( + PyObject* tuple, PyObject** value1, PyObject** value2, int has_known_size, int decref_tuple); + +/* dict_iter.proto */ +static CYTHON_INLINE PyObject* __Pyx_dict_iterator(PyObject* dict, int is_dict, PyObject* method_name, + Py_ssize_t* p_orig_length, int* p_is_dict); +static CYTHON_INLINE int __Pyx_dict_iter_next(PyObject* dict_or_iter, Py_ssize_t orig_length, Py_ssize_t* ppos, + PyObject** pkey, PyObject** pvalue, PyObject** pitem, int is_dict); + +/* PyErrExceptionMatches.proto */ +#if CYTHON_FAST_THREAD_STATE +#define __Pyx_PyErr_ExceptionMatches(err) __Pyx_PyErr_ExceptionMatchesInState(__pyx_tstate, err) +static CYTHON_INLINE int __Pyx_PyErr_ExceptionMatchesInState(PyThreadState* tstate, PyObject* err); +#else +#define __Pyx_PyErr_ExceptionMatches(err) PyErr_ExceptionMatches(err) +#endif + +/* GetAttr.proto */ +static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *, PyObject *); + +/* GetAttr3.proto */ +static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *, PyObject *, PyObject *); + /* Import.proto */ static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level); /* ImportFrom.proto */ static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name); +/* HasAttr.proto */ +static CYTHON_INLINE int __Pyx_HasAttr(PyObject *, PyObject *); + +/* PyObject_GenericGetAttrNoDict.proto */ +#if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000 +static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name); +#else +#define __Pyx_PyObject_GenericGetAttrNoDict PyObject_GenericGetAttr +#endif + +/* PyObject_GenericGetAttr.proto */ +#if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000 +static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name); +#else +#define __Pyx_PyObject_GenericGetAttr PyObject_GenericGetAttr +#endif + +/* PyObjectGetAttrStrNoError.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name); + +/* SetupReduce.proto */ +static int __Pyx_setup_reduce(PyObject* type_obj); + /* CalculateMetaclass.proto */ static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bases); @@ -1291,6 +1502,9 @@ static PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, static PyObject *__Pyx_Py3ClassCreate(PyObject *metaclass, PyObject *name, PyObject *bases, PyObject *dict, PyObject *mkw, int calculate_metaclass, int allow_py2_metaclass); +/* Globals.proto */ +static PyObject* __Pyx_Globals(void); + /* CLineInTraceback.proto */ #ifdef CYTHON_CLINE_IN_TRACEBACK #define __Pyx_CLineForTraceback(tstate, c_line) (((CYTHON_CLINE_IN_TRACEBACK)) ? c_line : 0) @@ -1317,6 +1531,9 @@ static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object); static void __Pyx_AddTraceback(const char *funcname, int c_line, int py_line, const char *filename); +/* None.proto */ +#include + /* GCCDiagnostics.proto */ #if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) #define __Pyx_HAS_GCC_DIAGNOSTIC @@ -1364,31 +1581,49 @@ static void __Pyx_CppExn2PyErr() { } #endif +static PyObject* __pyx_convert__to_py_struct__DracoFunctions_3a__3a_MetadataObject(struct DracoFunctions::MetadataObject s); +static PyObject* __pyx_convert__to_py_struct__DracoFunctions_3a__3a_PointAttributeObject(struct DracoFunctions::PointAttributeObject s); +static PyObject* __pyx_convert__to_py_struct__DracoFunctions_3a__3a_GeometryMetadataObject(struct DracoFunctions::GeometryMetadataObject s); static PyObject* __pyx_convert__to_py_struct__DracoFunctions_3a__3a_MeshObject(struct DracoFunctions::MeshObject s); static PyObject* __pyx_convert__to_py_struct__DracoFunctions_3a__3a_PointCloudObject(struct DracoFunctions::PointCloudObject s); /* CIntFromPy.proto */ -static CYTHON_INLINE size_t __Pyx_PyInt_As_size_t(PyObject *); +static CYTHON_INLINE enum draco::GeometryAttribute::Type __Pyx_PyInt_As_enum__draco_3a__3a_GeometryAttribute_3a__3a_Type(PyObject *); + +/* CIntFromPy.proto */ +static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *); + +/* CIntToPy.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value); + +/* CIntToPy.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value); + +/* CIntToPy.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum__draco_3a__3a_GeometryAttribute_3a__3a_Type(enum draco::GeometryAttribute::Type value); /* CIntFromPy.proto */ static CYTHON_INLINE uint32_t __Pyx_PyInt_As_uint32_t(PyObject *); /* CIntFromPy.proto */ -static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *); +static CYTHON_INLINE enum draco::DataType __Pyx_PyInt_As_enum__draco_3a__3a_DataType(PyObject *); /* CIntToPy.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyInt_From_unsigned_char(unsigned char value); +static CYTHON_INLINE PyObject* __Pyx_PyInt_From_uint32_t(uint32_t value); /* CIntToPy.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum__DracoFunctions_3a__3a_decoding_status(enum DracoFunctions::decoding_status value); +static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum__draco_3a__3a_DataType(enum draco::DataType value); /* CIntToPy.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyInt_From_unsigned_int(unsigned int value); +static CYTHON_INLINE PyObject* __Pyx_PyInt_From_unsigned_char(unsigned char value); /* CIntToPy.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value); +static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum__DracoFunctions_3a__3a_decoding_status(enum DracoFunctions::decoding_status value); /* CIntToPy.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value); +static CYTHON_INLINE PyObject* __Pyx_PyInt_From_unsigned_int(unsigned int value); + +/* CIntFromPy.proto */ +static CYTHON_INLINE size_t __Pyx_PyInt_As_size_t(PyObject *); /* CIntFromPy.proto */ static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *); @@ -1402,21 +1637,54 @@ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /* Module declarations from 'libcpp.vector' */ +/* Module declarations from 'libc.string' */ + +/* Module declarations from 'libcpp.string' */ + +/* Module declarations from 'libcpp.utility' */ + +/* Module declarations from 'libcpp.unordered_map' */ + /* Module declarations from 'libc.stdint' */ /* Module declarations from 'libcpp' */ /* Module declarations from 'cpython.mem' */ -/* Module declarations from 'libc.string' */ - /* Module declarations from 'DracoPy' */ +static PyTypeObject *__pyx_ptype_7DracoPy_Encoder = 0; +static PyTypeObject *__pyx_ptype___Pyx_EnumMeta = 0; +static PyObject *__Pyx_OrderedDict = 0; +static PyObject *__Pyx_EnumBase = 0; +static PyObject *__Pyx_globals = 0; +static struct __pyx_obj_7DracoPy_Encoder *__pyx_f_7DracoPy__generate_encoder_and_update_metadata(int, int, double, std::vector , std::vector &, struct DracoFunctions::GeometryMetadataObject &); /*proto*/ static std::vector __pyx_convert_vector_from_py_float(PyObject *); /*proto*/ +static std::string __pyx_convert_string_from_py_std__in_string(PyObject *); /*proto*/ +static PyObject *__pyx_convert_vector_to_py_double(const std::vector &); /*proto*/ +static std::unordered_map __pyx_convert_unordered_map_from_py_uint32_t__and_std_3a__3a_string(PyObject *); /*proto*/ +static struct DracoFunctions::PointAttributeObject __pyx_convert__from_py_struct__DracoFunctions_3a__3a_PointAttributeObject(PyObject *); /*proto*/ +static std::vector __pyx_convert_vector_from_py_struct__DracoFunctions_3a__3a_PointAttributeObject(PyObject *); /*proto*/ +static struct DracoFunctions::GeometryMetadataObject __pyx_convert__from_py_struct__DracoFunctions_3a__3a_GeometryMetadataObject(PyObject *); /*proto*/ +static std::unordered_map __pyx_convert_unordered_map_from_py_std_3a__3a_string__and_std_3a__3a_string(PyObject *); /*proto*/ +static std::unordered_map __pyx_convert_unordered_map_from_py_std_3a__3a_string__and_uint32_t(PyObject *); /*proto*/ +static struct DracoFunctions::MetadataObject __pyx_convert__from_py_struct__DracoFunctions_3a__3a_MetadataObject(PyObject *); /*proto*/ +static std::vector __pyx_convert_vector_from_py_double(PyObject *); /*proto*/ +static CYTHON_INLINE PyObject *__pyx_convert_PyObject_string_to_py_std__in_string(std::string const &); /*proto*/ +static CYTHON_INLINE PyObject *__pyx_convert_PyUnicode_string_to_py_std__in_string(std::string const &); /*proto*/ +static CYTHON_INLINE PyObject *__pyx_convert_PyStr_string_to_py_std__in_string(std::string const &); /*proto*/ +static CYTHON_INLINE PyObject *__pyx_convert_PyBytes_string_to_py_std__in_string(std::string const &); /*proto*/ +static CYTHON_INLINE PyObject *__pyx_convert_PyByteArray_string_to_py_std__in_string(std::string const &); /*proto*/ +static PyObject *__pyx_convert_unordered_map_to_py_std_3a__3a_string____std_3a__3a_string(std::unordered_map const &); /*proto*/ +static PyObject *__pyx_convert_unordered_map_to_py_std_3a__3a_string____uint32_t(std::unordered_map const &); /*proto*/ +static PyObject *__pyx_convert_vector_to_py_struct__DracoFunctions_3a__3a_MetadataObject(const std::vector &); /*proto*/ +static PyObject *__pyx_convert_unordered_map_to_py_uint32_t____std_3a__3a_string(std::unordered_map const &); /*proto*/ +static PyObject *__pyx_convert_vector_to_py_struct__DracoFunctions_3a__3a_PointAttributeObject(const std::vector &); /*proto*/ static std::vector __pyx_convert_vector_from_py_uint32_t(PyObject *); /*proto*/ +static std::vector __pyx_convert_vector_from_py_struct__DracoFunctions_3a__3a_MetadataObject(PyObject *); /*proto*/ static PyObject *__pyx_convert_vector_to_py_unsigned_char(const std::vector &); /*proto*/ static PyObject *__pyx_convert_vector_to_py_float(const std::vector &); /*proto*/ static PyObject *__pyx_convert_vector_to_py_unsigned_int(const std::vector &); /*proto*/ -static PyObject *__pyx_convert_vector_to_py_double(const std::vector &); /*proto*/ +static PyObject *__pyx_unpickle___Pyx_EnumMeta__set_state(struct __pyx_obj___Pyx_EnumMeta *, PyObject *); /*proto*/ #define __Pyx_MODULE_NAME "DracoPy" extern int __pyx_module_is_main_DracoPy; int __pyx_module_is_main_DracoPy = 0; @@ -1424,213 +1692,465 @@ int __pyx_module_is_main_DracoPy = 0; /* Implementation of 'DracoPy' */ static PyObject *__pyx_builtin_object; static PyObject *__pyx_builtin_property; +static PyObject *__pyx_builtin_TypeError; static PyObject *__pyx_builtin_ValueError; static PyObject *__pyx_builtin_range; -static PyObject *__pyx_builtin_TypeError; -static const char __pyx_k_dim[] = "dim"; +static PyObject *__pyx_builtin_RuntimeError; +static PyObject *__pyx_builtin_KeyError; +static const char __pyx_k_d[] = "=d"; +static const char __pyx_k_i[] = "=i"; +static const char __pyx_k_v[] = "v"; +static const char __pyx_k_cls[] = "cls"; +static const char __pyx_k_dct[] = "dct"; +static const char __pyx_k_ddd[] = "=ddd"; static const char __pyx_k_doc[] = "__doc__"; +static const char __pyx_k_new[] = "__new__"; +static const char __pyx_k_res[] = "res"; +static const char __pyx_k_s_s[] = "%s.%s"; +static const char __pyx_k_str[] = "__str__"; +static const char __pyx_k_Dict[] = "Dict"; +static const char __pyx_k_List[] = "List"; static const char __pyx_k_axis[] = "axis"; +static const char __pyx_k_data[] = "data"; +static const char __pyx_k_dict[] = "__dict__"; +static const char __pyx_k_enum[] = "enum"; static const char __pyx_k_init[] = "__init__"; static const char __pyx_k_main[] = "__main__"; static const char __pyx_k_math[] = "math"; -static const char __pyx_k_name[] = "__name__"; +static const char __pyx_k_name[] = "name"; +static const char __pyx_k_pack[] = "pack"; +static const char __pyx_k_repr[] = "__repr__"; static const char __pyx_k_self[] = "self"; static const char __pyx_k_test[] = "__test__"; +static const char __pyx_k_COLOR[] = "COLOR"; +static const char __pyx_k_class[] = "__class__"; static const char __pyx_k_faces[] = "faces"; static const char __pyx_k_floor[] = "floor"; static const char __pyx_k_point[] = "point"; static const char __pyx_k_range[] = "range"; +static const char __pyx_k_s_s_d[] = "<%s.%s: %d>"; static const char __pyx_k_value[] = "value"; +static const char __pyx_k_NORMAL[] = "NORMAL"; static const char __pyx_k_buffer[] = "buffer"; static const char __pyx_k_import[] = "__import__"; static const char __pyx_k_module[] = "__module__"; +static const char __pyx_k_name_2[] = "__name__"; static const char __pyx_k_object[] = "object"; +static const char __pyx_k_pickle[] = "pickle"; static const char __pyx_k_points[] = "points"; +static const char __pyx_k_reduce[] = "__reduce__"; +static const char __pyx_k_return[] = "return"; static const char __pyx_k_struct[] = "struct"; +static const char __pyx_k_typing[] = "typing"; +static const char __pyx_k_update[] = "update"; +static const char __pyx_k_values[] = "values"; +static const char __pyx_k_DT_BOOL[] = "DT_BOOL"; +static const char __pyx_k_DT_INT8[] = "DT_INT8"; static const char __pyx_k_DracoPy[] = "DracoPy"; +static const char __pyx_k_Encoder[] = "Encoder"; +static const char __pyx_k_GENERIC[] = "GENERIC"; +static const char __pyx_k_INVALID[] = "INVALID"; +static const char __pyx_k_IntEnum[] = "IntEnum"; +static const char __pyx_k_encoder[] = "encoder"; +static const char __pyx_k_entries[] = "entries"; +static const char __pyx_k_is_mesh[] = "is_mesh"; +static const char __pyx_k_members[] = "__members__"; static const char __pyx_k_normals[] = "normals"; +static const char __pyx_k_parents[] = "parents"; static const char __pyx_k_prepare[] = "__prepare__"; +static const char __pyx_k_DT_INT16[] = "DT_INT16"; +static const char __pyx_k_DT_INT32[] = "DT_INT32"; +static const char __pyx_k_DT_INT64[] = "DT_INT64"; +static const char __pyx_k_DT_UINT8[] = "DT_UINT8"; +static const char __pyx_k_DataType[] = "DataType"; +static const char __pyx_k_EnumBase[] = "EnumBase"; +static const char __pyx_k_EnumType[] = "EnumType"; +static const char __pyx_k_KeyError[] = "KeyError"; +static const char __pyx_k_Optional[] = "Optional"; +static const char __pyx_k_POSITION[] = "POSITION"; +static const char __pyx_k_datatype[] = "datatype"; +static const char __pyx_k_getstate[] = "__getstate__"; static const char __pyx_k_num_axes[] = "num_axes"; -static const char __pyx_k_num_dims[] = "num_dims"; static const char __pyx_k_property[] = "property"; +static const char __pyx_k_pyx_type[] = "__pyx_type"; static const char __pyx_k_qualname[] = "__qualname__"; +static const char __pyx_k_setstate[] = "__setstate__"; +static const char __pyx_k_DT_UINT16[] = "DT_UINT16"; +static const char __pyx_k_DT_UINT32[] = "DT_UINT32"; +static const char __pyx_k_DT_UINT64[] = "DT_UINT64"; static const char __pyx_k_DracoMesh[] = "DracoMesh"; +static const char __pyx_k_TEX_COORD[] = "TEX_COORD"; static const char __pyx_k_TypeError[] = "TypeError"; +static const char __pyx_k_attr_type[] = "attr_type"; +static const char __pyx_k_dimension[] = "dimension"; +static const char __pyx_k_iteritems[] = "iteritems"; static const char __pyx_k_metaclass[] = "__metaclass__"; +static const char __pyx_k_metadatas[] = "metadatas"; +static const char __pyx_k_pyx_state[] = "__pyx_state"; +static const char __pyx_k_reduce_ex[] = "__reduce_ex__"; +static const char __pyx_k_DT_FLOAT32[] = "DT_FLOAT32"; +static const char __pyx_k_DT_FLOAT64[] = "DT_FLOAT64"; +static const char __pyx_k_DT_INVALID[] = "DT_INVALID"; static const char __pyx_k_ValueError[] = "ValueError"; static const char __pyx_k_difference[] = "difference"; +static const char __pyx_k_pyx_result[] = "__pyx_result"; +static const char __pyx_k_OrderedDict[] = "OrderedDict"; +static const char __pyx_k_PickleError[] = "PickleError"; +static const char __pyx_k_collections[] = "collections"; static const char __pyx_k_data_struct[] = "data_struct"; +static const char __pyx_k_deduplicate[] = "deduplicate"; static const char __pyx_k_mesh_struct[] = "mesh_struct"; -static const char __pyx_k_Invalid_mesh[] = "Invalid mesh"; -static const char __pyx_k_encoded_mesh[] = "encoded_mesh"; +static const char __pyx_k_metadata_id[] = "metadata_id"; +static const char __pyx_k_Pyx_EnumBase[] = "__Pyx_EnumBase"; +static const char __pyx_k_RuntimeError[] = "RuntimeError"; +static const char __pyx_k_pyx_checksum[] = "__pyx_checksum"; static const char __pyx_k_quant_origin[] = "quant_origin"; +static const char __pyx_k_stringsource[] = "stringsource"; static const char __pyx_k_Input_invalid[] = "Input invalid"; static const char __pyx_k_decode_status[] = "decode_status"; +static const char __pyx_k_draco_encoded[] = "draco_encoded"; static const char __pyx_k_encoded_point[] = "encoded_point"; static const char __pyx_k_inverse_alpha[] = "inverse_alpha"; +static const char __pyx_k_reduce_cython[] = "__reduce_cython__"; +static const char __pyx_k_DT_TYPES_COUNT[] = "DT_TYPES_COUNT"; +static const char __pyx_k_decoding_speed[] = "decoding_speed"; +static const char __pyx_k_encoding_speed[] = "encoding_speed"; static const char __pyx_k_DracoMesh_faces[] = "DracoMesh.faces"; static const char __pyx_k_DracoPointCloud[] = "DracoPointCloud"; static const char __pyx_k_EncodingOptions[] = "EncodingOptions"; +static const char __pyx_k_SetSpeedOptions[] = "SetSpeedOptions"; static const char __pyx_k_create_metadata[] = "create_metadata"; static const char __pyx_k_decoding_status[] = "decoding_status"; +static const char __pyx_k_pyx_PickleError[] = "__pyx_PickleError"; static const char __pyx_k_quantized_index[] = "quantized_index"; -static const char __pyx_k_src_DracoPy_pyx[] = "src/DracoPy.pyx"; +static const char __pyx_k_setstate_cython[] = "__setstate_cython__"; +static const char __pyx_k_src_DracoPy_pyx[] = "src\\DracoPy.pyx"; +static const char __pyx_k_encode_to_buffer[] = "encode_to_buffer"; static const char __pyx_k_encoding_options[] = "encoding_options"; +static const char __pyx_k_sub_metadata_ids[] = "sub_metadata_ids"; static const char __pyx_k_DracoMesh_normals[] = "DracoMesh.normals"; static const char __pyx_k_FileTypeException[] = "FileTypeException"; static const char __pyx_k_compression_level[] = "compression_level"; +static const char __pyx_k_geometry_metadata[] = "geometry_metadata"; static const char __pyx_k_get_encoded_point[] = "get_encoded_point"; static const char __pyx_k_quantization_bits[] = "quantization_bits"; +static const char __pyx_k_Pyx_EnumBase___new[] = "__Pyx_EnumBase.__new__"; +static const char __pyx_k_Pyx_EnumBase___str[] = "__Pyx_EnumBase.__str__"; static const char __pyx_k_cline_in_traceback[] = "cline_in_traceback"; +static const char __pyx_k_generic_attributes[] = "generic_attributes"; static const char __pyx_k_point_cloud_struct[] = "point_cloud_struct"; static const char __pyx_k_quantization_range[] = "quantization_range"; -static const char __pyx_k_Invalid_point_cloud[] = "Invalid point cloud"; -static const char __pyx_k_encoded_point_cloud[] = "encoded_point_cloud"; +static const char __pyx_k_Pyx_EnumBase___repr[] = "__Pyx_EnumBase.__repr__"; static const char __pyx_k_quantization_origin[] = "quantization_origin"; +static const char __pyx_k_Unknown_enum_value_s[] = "Unknown enum value: '%s'"; static const char __pyx_k_encoding_options_set[] = "encoding_options_set"; static const char __pyx_k_raise_decoding_error[] = "raise_decoding_error"; +static const char __pyx_k_GeometryAttributeType[] = "GeometryAttributeType"; +static const char __pyx_k_create_empty_metadata[] = "_create_empty_metadata"; static const char __pyx_k_decode_buffer_to_mesh[] = "decode_buffer_to_mesh"; static const char __pyx_k_encode_mesh_to_buffer[] = "encode_mesh_to_buffer"; static const char __pyx_k_DracoPointCloud___init[] = "DracoPointCloud.__init__"; static const char __pyx_k_DracoPointCloud_points[] = "DracoPointCloud.points"; static const char __pyx_k_EncodingOptions___init[] = "EncodingOptions.__init__"; +static const char __pyx_k_NAMED_ATTRIBUTES_COUNT[] = "NAMED_ATTRIBUTES_COUNT"; static const char __pyx_k_get_encoded_coordinate[] = "get_encoded_coordinate"; static const char __pyx_k_EncodingFailedException[] = "EncodingFailedException"; +static const char __pyx_k_Invalid_draco_structure[] = "Invalid draco structure"; static const char __pyx_k_DracoPointCloud_num_axes[] = "DracoPointCloud.num_axes"; static const char __pyx_k_EncodingOptions_num_axes[] = "EncodingOptions.num_axes"; +static const char __pyx_k_SetAttributeQuantization[] = "SetAttributeQuantization"; +static const char __pyx_k_DracoPointCloud_metadatas[] = "DracoPointCloud.metadatas"; static const char __pyx_k_decode_point_cloud_buffer[] = "decode_point_cloud_buffer"; +static const char __pyx_k_pyx_unpickle___Pyx_EnumMeta[] = "__pyx_unpickle___Pyx_EnumMeta"; static const char __pyx_k_encode_point_cloud_to_buffer[] = "encode_point_cloud_to_buffer"; +static const char __pyx_k_create_empty_geometry_metadata[] = "_create_empty_geometry_metadata"; static const char __pyx_k_Input_mesh_is_not_draco_encoded[] = "Input mesh is not draco encoded"; +static const char __pyx_k_DracoPointCloud_geometry_metadat[] = "DracoPointCloud.geometry_metadata"; static const char __pyx_k_DracoPointCloud_get_encoded_coor[] = "DracoPointCloud.get_encoded_coordinate"; static const char __pyx_k_DracoPointCloud_get_encoded_poin[] = "DracoPointCloud.get_encoded_point"; static const char __pyx_k_DracoPy_only_supports_meshes_wit[] = "DracoPy only supports meshes with position attributes"; static const char __pyx_k_EncodingOptions_get_encoded_coor[] = "EncodingOptions.get_encoded_coordinate"; static const char __pyx_k_EncodingOptions_get_encoded_poin[] = "EncodingOptions.get_encoded_point"; static const char __pyx_k_Failed_to_decode_input_mesh_Data[] = "Failed to decode input mesh. Data might be corrupted"; +static const char __pyx_k_Incompatible_checksums_s_vs_0xd4[] = "Incompatible checksums (%s vs 0xd41d8cd = ())"; +static const char __pyx_k_No_value_specified_for_struct_at[] = "No value specified for struct attribute 'data'"; +static const char __pyx_k_SetAttributeExplicitQuantization[] = "SetAttributeExplicitQuantization"; static const char __pyx_k_Specified_value_out_of_encoded_r[] = "Specified value out of encoded range"; +static const char __pyx_k_generic_attributes_encoding_deco[] = "generic attributes encoding/decoding is not supported for point cloud"; +static const char __pyx_k_no_default___reduce___due_to_non[] = "no default __reduce__ due to non-trivial __cinit__"; +static const char __pyx_k_No_value_specified_for_struct_at_2[] = "No value specified for struct attribute 'datatype'"; +static const char __pyx_k_No_value_specified_for_struct_at_3[] = "No value specified for struct attribute 'dimension'"; +static const char __pyx_k_No_value_specified_for_struct_at_4[] = "No value specified for struct attribute 'metadata_id'"; +static const char __pyx_k_No_value_specified_for_struct_at_5[] = "No value specified for struct attribute 'generic_attributes'"; +static const char __pyx_k_No_value_specified_for_struct_at_6[] = "No value specified for struct attribute 'entries'"; +static const char __pyx_k_No_value_specified_for_struct_at_7[] = "No value specified for struct attribute 'sub_metadata_ids'"; +static PyObject *__pyx_n_s_COLOR; +static PyObject *__pyx_n_s_DT_BOOL; +static PyObject *__pyx_n_s_DT_FLOAT32; +static PyObject *__pyx_n_s_DT_FLOAT64; +static PyObject *__pyx_n_s_DT_INT16; +static PyObject *__pyx_n_s_DT_INT32; +static PyObject *__pyx_n_s_DT_INT64; +static PyObject *__pyx_n_s_DT_INT8; +static PyObject *__pyx_n_s_DT_INVALID; +static PyObject *__pyx_n_s_DT_TYPES_COUNT; +static PyObject *__pyx_n_s_DT_UINT16; +static PyObject *__pyx_n_s_DT_UINT32; +static PyObject *__pyx_n_s_DT_UINT64; +static PyObject *__pyx_n_s_DT_UINT8; +static PyObject *__pyx_n_s_DataType; +static PyObject *__pyx_n_s_Dict; static PyObject *__pyx_n_s_DracoMesh; static PyObject *__pyx_n_s_DracoMesh_faces; static PyObject *__pyx_n_s_DracoMesh_normals; static PyObject *__pyx_n_s_DracoPointCloud; static PyObject *__pyx_n_s_DracoPointCloud___init; +static PyObject *__pyx_n_s_DracoPointCloud_geometry_metadat; static PyObject *__pyx_n_s_DracoPointCloud_get_encoded_coor; static PyObject *__pyx_n_s_DracoPointCloud_get_encoded_poin; +static PyObject *__pyx_n_s_DracoPointCloud_metadatas; static PyObject *__pyx_n_s_DracoPointCloud_num_axes; static PyObject *__pyx_n_s_DracoPointCloud_points; static PyObject *__pyx_n_s_DracoPy; static PyObject *__pyx_kp_u_DracoPy_only_supports_meshes_wit; +static PyObject *__pyx_n_s_Encoder; static PyObject *__pyx_n_s_EncodingFailedException; static PyObject *__pyx_n_s_EncodingOptions; static PyObject *__pyx_n_s_EncodingOptions___init; static PyObject *__pyx_n_s_EncodingOptions_get_encoded_coor; static PyObject *__pyx_n_s_EncodingOptions_get_encoded_poin; static PyObject *__pyx_n_s_EncodingOptions_num_axes; +static PyObject *__pyx_n_s_EnumBase; +static PyObject *__pyx_n_s_EnumType; static PyObject *__pyx_kp_u_Failed_to_decode_input_mesh_Data; static PyObject *__pyx_n_s_FileTypeException; +static PyObject *__pyx_n_s_GENERIC; +static PyObject *__pyx_n_s_GeometryAttributeType; +static PyObject *__pyx_n_s_INVALID; +static PyObject *__pyx_kp_s_Incompatible_checksums_s_vs_0xd4; static PyObject *__pyx_kp_u_Input_invalid; static PyObject *__pyx_kp_u_Input_mesh_is_not_draco_encoded; -static PyObject *__pyx_kp_u_Invalid_mesh; -static PyObject *__pyx_kp_u_Invalid_point_cloud; +static PyObject *__pyx_n_s_IntEnum; +static PyObject *__pyx_kp_u_Invalid_draco_structure; +static PyObject *__pyx_n_s_KeyError; +static PyObject *__pyx_n_s_List; +static PyObject *__pyx_n_s_NAMED_ATTRIBUTES_COUNT; +static PyObject *__pyx_n_s_NORMAL; +static PyObject *__pyx_kp_s_No_value_specified_for_struct_at; +static PyObject *__pyx_kp_s_No_value_specified_for_struct_at_2; +static PyObject *__pyx_kp_s_No_value_specified_for_struct_at_3; +static PyObject *__pyx_kp_s_No_value_specified_for_struct_at_4; +static PyObject *__pyx_kp_s_No_value_specified_for_struct_at_5; +static PyObject *__pyx_kp_s_No_value_specified_for_struct_at_6; +static PyObject *__pyx_kp_s_No_value_specified_for_struct_at_7; +static PyObject *__pyx_n_s_Optional; +static PyObject *__pyx_n_s_OrderedDict; +static PyObject *__pyx_n_s_POSITION; +static PyObject *__pyx_n_s_PickleError; +static PyObject *__pyx_n_s_Pyx_EnumBase; +static PyObject *__pyx_n_s_Pyx_EnumBase___new; +static PyObject *__pyx_n_s_Pyx_EnumBase___repr; +static PyObject *__pyx_n_s_Pyx_EnumBase___str; +static PyObject *__pyx_n_s_RuntimeError; +static PyObject *__pyx_n_s_SetAttributeExplicitQuantization; +static PyObject *__pyx_n_s_SetAttributeQuantization; +static PyObject *__pyx_n_s_SetSpeedOptions; static PyObject *__pyx_kp_u_Specified_value_out_of_encoded_r; +static PyObject *__pyx_n_s_TEX_COORD; static PyObject *__pyx_n_s_TypeError; +static PyObject *__pyx_kp_s_Unknown_enum_value_s; static PyObject *__pyx_n_s_ValueError; +static PyObject *__pyx_n_s_attr_type; static PyObject *__pyx_n_s_axis; static PyObject *__pyx_n_s_buffer; +static PyObject *__pyx_n_s_class; static PyObject *__pyx_n_s_cline_in_traceback; +static PyObject *__pyx_n_s_cls; +static PyObject *__pyx_n_s_collections; static PyObject *__pyx_n_s_compression_level; +static PyObject *__pyx_n_s_create_empty_geometry_metadata; +static PyObject *__pyx_n_s_create_empty_metadata; static PyObject *__pyx_n_s_create_metadata; +static PyObject *__pyx_kp_u_d; +static PyObject *__pyx_n_s_data; static PyObject *__pyx_n_s_data_struct; +static PyObject *__pyx_n_s_datatype; +static PyObject *__pyx_n_s_dct; +static PyObject *__pyx_kp_u_ddd; static PyObject *__pyx_n_s_decode_buffer_to_mesh; static PyObject *__pyx_n_s_decode_point_cloud_buffer; static PyObject *__pyx_n_s_decode_status; +static PyObject *__pyx_n_s_decoding_speed; static PyObject *__pyx_n_s_decoding_status; +static PyObject *__pyx_n_s_deduplicate; +static PyObject *__pyx_n_s_dict; static PyObject *__pyx_n_s_difference; -static PyObject *__pyx_n_s_dim; +static PyObject *__pyx_n_s_dimension; static PyObject *__pyx_n_s_doc; +static PyObject *__pyx_n_s_draco_encoded; static PyObject *__pyx_n_s_encode_mesh_to_buffer; static PyObject *__pyx_n_s_encode_point_cloud_to_buffer; -static PyObject *__pyx_n_s_encoded_mesh; +static PyObject *__pyx_n_s_encode_to_buffer; static PyObject *__pyx_n_s_encoded_point; -static PyObject *__pyx_n_s_encoded_point_cloud; +static PyObject *__pyx_n_s_encoder; static PyObject *__pyx_n_s_encoding_options; static PyObject *__pyx_n_s_encoding_options_set; static PyObject *__pyx_n_u_encoding_options_set; +static PyObject *__pyx_n_s_encoding_speed; +static PyObject *__pyx_n_s_entries; +static PyObject *__pyx_n_u_entries; +static PyObject *__pyx_n_s_enum; static PyObject *__pyx_n_s_faces; static PyObject *__pyx_n_u_faces; static PyObject *__pyx_n_s_floor; +static PyObject *__pyx_n_s_generic_attributes; +static PyObject *__pyx_n_u_generic_attributes; +static PyObject *__pyx_kp_u_generic_attributes_encoding_deco; +static PyObject *__pyx_n_s_geometry_metadata; +static PyObject *__pyx_n_u_geometry_metadata; static PyObject *__pyx_n_s_get_encoded_coordinate; static PyObject *__pyx_n_s_get_encoded_point; +static PyObject *__pyx_n_s_getstate; +static PyObject *__pyx_kp_u_i; static PyObject *__pyx_n_s_import; static PyObject *__pyx_n_s_init; static PyObject *__pyx_n_s_inverse_alpha; +static PyObject *__pyx_n_s_is_mesh; +static PyObject *__pyx_n_s_iteritems; static PyObject *__pyx_n_s_main; static PyObject *__pyx_n_s_math; +static PyObject *__pyx_n_s_members; static PyObject *__pyx_n_s_mesh_struct; static PyObject *__pyx_n_s_metaclass; +static PyObject *__pyx_n_s_metadata_id; +static PyObject *__pyx_n_u_metadata_id; +static PyObject *__pyx_n_s_metadatas; +static PyObject *__pyx_n_u_metadatas; static PyObject *__pyx_n_s_module; static PyObject *__pyx_n_s_name; +static PyObject *__pyx_n_s_name_2; +static PyObject *__pyx_n_s_new; +static PyObject *__pyx_kp_s_no_default___reduce___due_to_non; static PyObject *__pyx_n_s_normals; static PyObject *__pyx_n_u_normals; static PyObject *__pyx_n_s_num_axes; -static PyObject *__pyx_n_s_num_dims; static PyObject *__pyx_n_s_object; +static PyObject *__pyx_n_s_pack; +static PyObject *__pyx_n_s_parents; +static PyObject *__pyx_n_s_pickle; static PyObject *__pyx_n_s_point; static PyObject *__pyx_n_s_point_cloud_struct; static PyObject *__pyx_n_s_points; static PyObject *__pyx_n_u_points; static PyObject *__pyx_n_s_prepare; static PyObject *__pyx_n_s_property; +static PyObject *__pyx_n_s_pyx_PickleError; +static PyObject *__pyx_n_s_pyx_checksum; +static PyObject *__pyx_n_s_pyx_result; +static PyObject *__pyx_n_s_pyx_state; +static PyObject *__pyx_n_s_pyx_type; +static PyObject *__pyx_n_s_pyx_unpickle___Pyx_EnumMeta; static PyObject *__pyx_n_s_qualname; static PyObject *__pyx_n_s_quant_origin; +static PyObject *__pyx_n_b_quantization_bits; static PyObject *__pyx_n_s_quantization_bits; static PyObject *__pyx_n_u_quantization_bits; +static PyObject *__pyx_n_b_quantization_origin; static PyObject *__pyx_n_s_quantization_origin; static PyObject *__pyx_n_u_quantization_origin; +static PyObject *__pyx_n_b_quantization_range; static PyObject *__pyx_n_s_quantization_range; static PyObject *__pyx_n_u_quantization_range; static PyObject *__pyx_n_s_quantized_index; static PyObject *__pyx_n_s_raise_decoding_error; static PyObject *__pyx_n_s_range; +static PyObject *__pyx_n_s_reduce; +static PyObject *__pyx_n_s_reduce_cython; +static PyObject *__pyx_n_s_reduce_ex; +static PyObject *__pyx_n_s_repr; +static PyObject *__pyx_n_s_res; +static PyObject *__pyx_n_s_return; +static PyObject *__pyx_kp_s_s_s; +static PyObject *__pyx_kp_s_s_s_d; static PyObject *__pyx_n_s_self; +static PyObject *__pyx_n_s_setstate; +static PyObject *__pyx_n_s_setstate_cython; static PyObject *__pyx_kp_s_src_DracoPy_pyx; +static PyObject *__pyx_n_s_str; +static PyObject *__pyx_kp_s_stringsource; static PyObject *__pyx_n_s_struct; +static PyObject *__pyx_n_s_sub_metadata_ids; +static PyObject *__pyx_n_u_sub_metadata_ids; static PyObject *__pyx_n_s_test; +static PyObject *__pyx_n_s_typing; +static PyObject *__pyx_n_s_update; +static PyObject *__pyx_n_s_v; static PyObject *__pyx_n_s_value; +static PyObject *__pyx_n_s_values; +static int __pyx_pf_7DracoPy_7Encoder___cinit__(struct __pyx_obj_7DracoPy_Encoder *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_7DracoPy_7Encoder_2SetSpeedOptions(struct __pyx_obj_7DracoPy_Encoder *__pyx_v_self, PyObject *__pyx_v_encoding_speed, PyObject *__pyx_v_decoding_speed); /* proto */ +static PyObject *__pyx_pf_7DracoPy_7Encoder_4SetAttributeQuantization(struct __pyx_obj_7DracoPy_Encoder *__pyx_v_self, enum draco::GeometryAttribute::Type __pyx_v_attr_type, PyObject *__pyx_v_quantization_bits); /* proto */ +static PyObject *__pyx_pf_7DracoPy_7Encoder_6SetAttributeExplicitQuantization(struct __pyx_obj_7DracoPy_Encoder *__pyx_v_self, enum draco::GeometryAttribute::Type __pyx_v_attr_type, PyObject *__pyx_v_quantization_bits, double __pyx_v_quantization_range, std::vector __pyx_v_quantization_origin); /* proto */ +static PyObject *__pyx_pf_7DracoPy_7Encoder_8__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_7DracoPy_Encoder *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_7DracoPy_7Encoder_10__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_7DracoPy_Encoder *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state); /* proto */ static PyObject *__pyx_pf_7DracoPy_15DracoPointCloud___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_data_struct); /* proto */ static PyObject *__pyx_pf_7DracoPy_15DracoPointCloud_2get_encoded_coordinate(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_value, PyObject *__pyx_v_axis); /* proto */ static PyObject *__pyx_pf_7DracoPy_15DracoPointCloud_4get_encoded_point(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_point); /* proto */ static PyObject *__pyx_pf_7DracoPy_15DracoPointCloud_6num_axes(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_7DracoPy_15DracoPointCloud_8points(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_7DracoPy_15DracoPointCloud_10geometry_metadata(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_7DracoPy_15DracoPointCloud_12metadatas(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_7DracoPy_9DracoMesh_faces(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_7DracoPy_9DracoMesh_2normals(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_7DracoPy_15EncodingOptions___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_quantization_bits, PyObject *__pyx_v_quantization_range, PyObject *__pyx_v_quantization_origin); /* proto */ static PyObject *__pyx_pf_7DracoPy_15EncodingOptions_2get_encoded_coordinate(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_value, PyObject *__pyx_v_axis); /* proto */ static PyObject *__pyx_pf_7DracoPy_15EncodingOptions_4get_encoded_point(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_point); /* proto */ static PyObject *__pyx_pf_7DracoPy_15EncodingOptions_6num_axes(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_7DracoPy_encode_mesh_to_buffer(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_points, PyObject *__pyx_v_faces, PyObject *__pyx_v_quantization_bits, PyObject *__pyx_v_compression_level, PyObject *__pyx_v_quantization_range, PyObject *__pyx_v_quantization_origin, PyObject *__pyx_v_create_metadata); /* proto */ -static PyObject *__pyx_pf_7DracoPy_2encode_point_cloud_to_buffer(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_points, PyObject *__pyx_v_quantization_bits, PyObject *__pyx_v_compression_level, PyObject *__pyx_v_quantization_range, PyObject *__pyx_v_quantization_origin, PyObject *__pyx_v_create_metadata); /* proto */ -static PyObject *__pyx_pf_7DracoPy_4raise_decoding_error(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_decoding_status); /* proto */ -static PyObject *__pyx_pf_7DracoPy_6decode_buffer_to_mesh(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_buffer); /* proto */ -static PyObject *__pyx_pf_7DracoPy_8decode_point_cloud_buffer(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_buffer); /* proto */ +static PyObject *__pyx_pf_7DracoPy__create_empty_geometry_metadata(CYTHON_UNUSED PyObject *__pyx_self); /* proto */ +static PyObject *__pyx_pf_7DracoPy_2_create_empty_metadata(CYTHON_UNUSED PyObject *__pyx_self); /* proto */ +static PyObject *__pyx_pf_7DracoPy_4encode_mesh_to_buffer(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_points, PyObject *__pyx_v_faces, PyObject *__pyx_v_quantization_bits, PyObject *__pyx_v_compression_level, PyObject *__pyx_v_quantization_range, PyObject *__pyx_v_quantization_origin, PyObject *__pyx_v_create_metadata); /* proto */ +static PyObject *__pyx_pf_7DracoPy_6encode_point_cloud_to_buffer(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_points, PyObject *__pyx_v_quantization_bits, PyObject *__pyx_v_compression_level, PyObject *__pyx_v_quantization_range, PyObject *__pyx_v_quantization_origin, PyObject *__pyx_v_create_metadata); /* proto */ +static PyObject *__pyx_pf_7DracoPy_8encode_to_buffer(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_points, PyObject *__pyx_v_faces, struct __pyx_obj_7DracoPy_Encoder *__pyx_v_encoder, PyObject *__pyx_v_metadatas, PyObject *__pyx_v_geometry_metadata); /* proto */ +static PyObject *__pyx_pf_7DracoPy_10raise_decoding_error(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_decoding_status); /* proto */ +static PyObject *__pyx_pf_7DracoPy_12decode_buffer_to_mesh(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_buffer, PyObject *__pyx_v_deduplicate); /* proto */ +static PyObject *__pyx_pf_7DracoPy_14decode_point_cloud_buffer(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_buffer, PyObject *__pyx_v_deduplicate); /* proto */ +static int __pyx_pf_8EnumBase_14__Pyx_EnumMeta___init__(struct __pyx_obj___Pyx_EnumMeta *__pyx_v_cls, PyObject *__pyx_v_name, PyObject *__pyx_v_parents, PyObject *__pyx_v_dct); /* proto */ +static PyObject *__pyx_pf_8EnumBase_14__Pyx_EnumMeta_2__iter__(struct __pyx_obj___Pyx_EnumMeta *__pyx_v_cls); /* proto */ +static PyObject *__pyx_pf_8EnumBase_14__Pyx_EnumMeta_4__getitem__(struct __pyx_obj___Pyx_EnumMeta *__pyx_v_cls, PyObject *__pyx_v_name); /* proto */ +static PyObject *__pyx_pf_8EnumBase_14__Pyx_EnumMeta_6__reduce_cython__(struct __pyx_obj___Pyx_EnumMeta *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_8EnumBase_14__Pyx_EnumMeta_8__setstate_cython__(struct __pyx_obj___Pyx_EnumMeta *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */ +static PyObject *__pyx_pf_8EnumBase_14__Pyx_EnumBase___new__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_cls, PyObject *__pyx_v_value, PyObject *__pyx_v_name); /* proto */ +static PyObject *__pyx_pf_8EnumBase_14__Pyx_EnumBase_2__repr__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_8EnumBase_14__Pyx_EnumBase_4__str__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_8EnumBase___pyx_unpickle___Pyx_EnumMeta(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state); /* proto */ +static PyObject *__pyx_tp_new_7DracoPy_Encoder(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new___Pyx_EnumMeta(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ static PyObject *__pyx_float_0_5; +static PyObject *__pyx_int_0; static PyObject *__pyx_int_1; static PyObject *__pyx_int_2; static PyObject *__pyx_int_3; static PyObject *__pyx_int_14; +static PyObject *__pyx_int_222419149; static PyObject *__pyx_int_neg_1; +static struct __pyx_obj_7DracoPy_Encoder *__pyx_k__4; static PyObject *__pyx_tuple_; static PyObject *__pyx_tuple__2; static PyObject *__pyx_tuple__3; -static PyObject *__pyx_tuple__4; static PyObject *__pyx_tuple__5; static PyObject *__pyx_tuple__6; +static PyObject *__pyx_tuple__7; static PyObject *__pyx_tuple__8; +static PyObject *__pyx_tuple__9; static PyObject *__pyx_tuple__10; +static PyObject *__pyx_tuple__11; static PyObject *__pyx_tuple__12; +static PyObject *__pyx_tuple__13; static PyObject *__pyx_tuple__14; +static PyObject *__pyx_tuple__15; static PyObject *__pyx_tuple__16; -static PyObject *__pyx_tuple__18; -static PyObject *__pyx_tuple__20; +static PyObject *__pyx_tuple__17; +static PyObject *__pyx_tuple__19; static PyObject *__pyx_tuple__21; static PyObject *__pyx_tuple__23; static PyObject *__pyx_tuple__25; @@ -1639,14 +2159,23 @@ static PyObject *__pyx_tuple__29; static PyObject *__pyx_tuple__31; static PyObject *__pyx_tuple__33; static PyObject *__pyx_tuple__35; -static PyObject *__pyx_tuple__37; -static PyObject *__pyx_codeobj__7; -static PyObject *__pyx_codeobj__9; -static PyObject *__pyx_codeobj__11; -static PyObject *__pyx_codeobj__13; -static PyObject *__pyx_codeobj__15; -static PyObject *__pyx_codeobj__17; -static PyObject *__pyx_codeobj__19; +static PyObject *__pyx_tuple__36; +static PyObject *__pyx_tuple__38; +static PyObject *__pyx_tuple__40; +static PyObject *__pyx_tuple__42; +static PyObject *__pyx_tuple__46; +static PyObject *__pyx_tuple__48; +static PyObject *__pyx_tuple__50; +static PyObject *__pyx_tuple__52; +static PyObject *__pyx_tuple__54; +static PyObject *__pyx_tuple__56; +static PyObject *__pyx_tuple__58; +static PyObject *__pyx_tuple__60; +static PyObject *__pyx_tuple__61; +static PyObject *__pyx_tuple__63; +static PyObject *__pyx_tuple__65; +static PyObject *__pyx_codeobj__18; +static PyObject *__pyx_codeobj__20; static PyObject *__pyx_codeobj__22; static PyObject *__pyx_codeobj__24; static PyObject *__pyx_codeobj__26; @@ -1654,32 +2183,112 @@ static PyObject *__pyx_codeobj__28; static PyObject *__pyx_codeobj__30; static PyObject *__pyx_codeobj__32; static PyObject *__pyx_codeobj__34; -static PyObject *__pyx_codeobj__36; -static PyObject *__pyx_codeobj__38; +static PyObject *__pyx_codeobj__37; +static PyObject *__pyx_codeobj__39; +static PyObject *__pyx_codeobj__41; +static PyObject *__pyx_codeobj__43; +static PyObject *__pyx_codeobj__44; +static PyObject *__pyx_codeobj__45; +static PyObject *__pyx_codeobj__47; +static PyObject *__pyx_codeobj__49; +static PyObject *__pyx_codeobj__51; +static PyObject *__pyx_codeobj__53; +static PyObject *__pyx_codeobj__55; +static PyObject *__pyx_codeobj__57; +static PyObject *__pyx_codeobj__59; +static PyObject *__pyx_codeobj__62; +static PyObject *__pyx_codeobj__64; +static PyObject *__pyx_codeobj__66; /* Late includes */ -/* "DracoPy.pyx":10 +/* "DracoPy.pyx":18 + * cdef DracoPy.CppEncoder this_encoder + * + * def __cinit__(self): # <<<<<<<<<<<<<< + * self.this_encoder = CppEncoder() * - * class DracoPointCloud(object): - * def __init__(self, data_struct): # <<<<<<<<<<<<<< - * self.data_struct = data_struct - * if data_struct['encoding_options_set']: */ /* Python wrapper */ -static PyObject *__pyx_pw_7DracoPy_15DracoPointCloud_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_7DracoPy_15DracoPointCloud_1__init__ = {"__init__", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7DracoPy_15DracoPointCloud_1__init__, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_7DracoPy_15DracoPointCloud_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_self = 0; - PyObject *__pyx_v_data_struct = 0; +static int __pyx_pw_7DracoPy_7Encoder_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_7DracoPy_7Encoder_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); + if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) { + __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;} + if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 0))) return -1; + __pyx_r = __pyx_pf_7DracoPy_7Encoder___cinit__(((struct __pyx_obj_7DracoPy_Encoder *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_7DracoPy_7Encoder___cinit__(struct __pyx_obj_7DracoPy_Encoder *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + draco::Encoder __pyx_t_1; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__cinit__", 0); + + /* "DracoPy.pyx":19 + * + * def __cinit__(self): + * self.this_encoder = CppEncoder() # <<<<<<<<<<<<<< + * + * def SetSpeedOptions(self, encoding_speed: int, decoding_speed: int): + */ + try { + __pyx_t_1 = draco::Encoder(); + } catch(...) { + __Pyx_CppExn2PyErr(); + __PYX_ERR(0, 19, __pyx_L1_error) + } + __pyx_v_self->this_encoder = __pyx_t_1; + + /* "DracoPy.pyx":18 + * cdef DracoPy.CppEncoder this_encoder + * + * def __cinit__(self): # <<<<<<<<<<<<<< + * self.this_encoder = CppEncoder() + * + */ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("DracoPy.Encoder.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "DracoPy.pyx":21 + * self.this_encoder = CppEncoder() + * + * def SetSpeedOptions(self, encoding_speed: int, decoding_speed: int): # <<<<<<<<<<<<<< + * self.this_encoder.SetSpeedOptions(encoding_speed, decoding_speed) + * + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_7DracoPy_7Encoder_3SetSpeedOptions(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_7DracoPy_7Encoder_3SetSpeedOptions(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_encoding_speed = 0; + PyObject *__pyx_v_decoding_speed = 0; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); + __Pyx_RefNannySetupContext("SetSpeedOptions (wrapper)", 0); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_data_struct,0}; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_encoding_speed,&__pyx_n_s_decoding_speed,0}; PyObject* values[2] = {0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; @@ -1695,17 +2304,17 @@ static PyObject *__pyx_pw_7DracoPy_15DracoPointCloud_1__init__(PyObject *__pyx_s kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--; + if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_encoding_speed)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_data_struct)) != 0)) kw_args--; + if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_decoding_speed)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, 1); __PYX_ERR(0, 10, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("SetSpeedOptions", 1, 2, 2, 1); __PYX_ERR(0, 21, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 10, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "SetSpeedOptions") < 0)) __PYX_ERR(0, 21, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; @@ -1713,193 +2322,179 @@ static PyObject *__pyx_pw_7DracoPy_15DracoPointCloud_1__init__(PyObject *__pyx_s values[0] = PyTuple_GET_ITEM(__pyx_args, 0); values[1] = PyTuple_GET_ITEM(__pyx_args, 1); } - __pyx_v_self = values[0]; - __pyx_v_data_struct = values[1]; + __pyx_v_encoding_speed = values[0]; + __pyx_v_decoding_speed = values[1]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 10, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("SetSpeedOptions", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 21, __pyx_L3_error) __pyx_L3_error:; - __Pyx_AddTraceback("DracoPy.DracoPointCloud.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("DracoPy.Encoder.SetSpeedOptions", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_7DracoPy_15DracoPointCloud___init__(__pyx_self, __pyx_v_self, __pyx_v_data_struct); + __pyx_r = __pyx_pf_7DracoPy_7Encoder_2SetSpeedOptions(((struct __pyx_obj_7DracoPy_Encoder *)__pyx_v_self), __pyx_v_encoding_speed, __pyx_v_decoding_speed); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_7DracoPy_15DracoPointCloud___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_data_struct) { +static PyObject *__pyx_pf_7DracoPy_7Encoder_2SetSpeedOptions(struct __pyx_obj_7DracoPy_Encoder *__pyx_v_self, PyObject *__pyx_v_encoding_speed, PyObject *__pyx_v_decoding_speed) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; + int __pyx_t_1; int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - int __pyx_t_8; - PyObject *__pyx_t_9 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__init__", 0); + __Pyx_RefNannySetupContext("SetSpeedOptions", 0); - /* "DracoPy.pyx":11 - * class DracoPointCloud(object): - * def __init__(self, data_struct): - * self.data_struct = data_struct # <<<<<<<<<<<<<< - * if data_struct['encoding_options_set']: - * self.encoding_options = EncodingOptions(data_struct['quantization_bits'], + /* "DracoPy.pyx":22 + * + * def SetSpeedOptions(self, encoding_speed: int, decoding_speed: int): + * self.this_encoder.SetSpeedOptions(encoding_speed, decoding_speed) # <<<<<<<<<<<<<< + * + * def SetAttributeQuantization(self, */ - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_data_struct, __pyx_v_data_struct) < 0) __PYX_ERR(0, 11, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_encoding_speed); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 22, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyInt_As_int(__pyx_v_decoding_speed); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 22, __pyx_L1_error) + try { + __pyx_v_self->this_encoder.SetSpeedOptions(__pyx_t_1, __pyx_t_2); + } catch(...) { + __Pyx_CppExn2PyErr(); + __PYX_ERR(0, 22, __pyx_L1_error) + } - /* "DracoPy.pyx":12 - * def __init__(self, data_struct): - * self.data_struct = data_struct - * if data_struct['encoding_options_set']: # <<<<<<<<<<<<<< - * self.encoding_options = EncodingOptions(data_struct['quantization_bits'], - * data_struct['quantization_range'], data_struct['quantization_origin']) + /* "DracoPy.pyx":21 + * self.this_encoder = CppEncoder() + * + * def SetSpeedOptions(self, encoding_speed: int, decoding_speed: int): # <<<<<<<<<<<<<< + * self.this_encoder.SetSpeedOptions(encoding_speed, decoding_speed) + * */ - __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_v_data_struct, __pyx_n_u_encoding_options_set); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 12, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 12, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_t_2) { - /* "DracoPy.pyx":13 - * self.data_struct = data_struct - * if data_struct['encoding_options_set']: - * self.encoding_options = EncodingOptions(data_struct['quantization_bits'], # <<<<<<<<<<<<<< - * data_struct['quantization_range'], data_struct['quantization_origin']) - * else: - */ - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_EncodingOptions); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 13, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyObject_Dict_GetItem(__pyx_v_data_struct, __pyx_n_u_quantization_bits); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 13, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("DracoPy.Encoder.SetSpeedOptions", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "DracoPy.pyx":14 - * if data_struct['encoding_options_set']: - * self.encoding_options = EncodingOptions(data_struct['quantization_bits'], - * data_struct['quantization_range'], data_struct['quantization_origin']) # <<<<<<<<<<<<<< - * else: - * self.encoding_options = None +/* "DracoPy.pyx":24 + * self.this_encoder.SetSpeedOptions(encoding_speed, decoding_speed) + * + * def SetAttributeQuantization(self, # <<<<<<<<<<<<<< + * attr_type: GeometryAttributeType, + * quantization_bits: int): */ - __pyx_t_5 = __Pyx_PyObject_Dict_GetItem(__pyx_v_data_struct, __pyx_n_u_quantization_range); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 14, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = __Pyx_PyObject_Dict_GetItem(__pyx_v_data_struct, __pyx_n_u_quantization_origin); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 14, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = NULL; - __pyx_t_8 = 0; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_7)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_7); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); - __pyx_t_8 = 1; + +/* Python wrapper */ +static PyObject *__pyx_pw_7DracoPy_7Encoder_5SetAttributeQuantization(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_7DracoPy_7Encoder_5SetAttributeQuantization(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + enum draco::GeometryAttribute::Type __pyx_v_attr_type; + PyObject *__pyx_v_quantization_bits = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("SetAttributeQuantization (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_attr_type,&__pyx_n_s_quantization_bits,0}; + PyObject* values[2] = {0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_3)) { - PyObject *__pyx_temp[4] = {__pyx_t_7, __pyx_t_4, __pyx_t_5, __pyx_t_6}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_8, 3+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 13, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { - PyObject *__pyx_temp[4] = {__pyx_t_7, __pyx_t_4, __pyx_t_5, __pyx_t_6}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_8, 3+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 13, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - } else - #endif - { - __pyx_t_9 = PyTuple_New(3+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 13, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - if (__pyx_t_7) { - __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7); __pyx_t_7 = NULL; + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_attr_type)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_quantization_bits)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("SetAttributeQuantization", 1, 2, 2, 1); __PYX_ERR(0, 24, __pyx_L3_error) + } } - __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_t_4); - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_t_5); - __Pyx_GIVEREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_9, 2+__pyx_t_8, __pyx_t_6); - __pyx_t_4 = 0; - __pyx_t_5 = 0; - __pyx_t_6 = 0; - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_9, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 13, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "SetAttributeQuantization") < 0)) __PYX_ERR(0, 24, __pyx_L3_error) + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_attr_type = ((enum draco::GeometryAttribute::Type)__Pyx_PyInt_As_enum__draco_3a__3a_GeometryAttribute_3a__3a_Type(values[0])); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 25, __pyx_L3_error) + __pyx_v_quantization_bits = values[1]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("SetAttributeQuantization", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 24, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("DracoPy.Encoder.SetAttributeQuantization", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_7DracoPy_7Encoder_4SetAttributeQuantization(((struct __pyx_obj_7DracoPy_Encoder *)__pyx_v_self), __pyx_v_attr_type, __pyx_v_quantization_bits); - /* "DracoPy.pyx":13 - * self.data_struct = data_struct - * if data_struct['encoding_options_set']: - * self.encoding_options = EncodingOptions(data_struct['quantization_bits'], # <<<<<<<<<<<<<< - * data_struct['quantization_range'], data_struct['quantization_origin']) - * else: - */ - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_encoding_options, __pyx_t_1) < 0) __PYX_ERR(0, 13, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "DracoPy.pyx":12 - * def __init__(self, data_struct): - * self.data_struct = data_struct - * if data_struct['encoding_options_set']: # <<<<<<<<<<<<<< - * self.encoding_options = EncodingOptions(data_struct['quantization_bits'], - * data_struct['quantization_range'], data_struct['quantization_origin']) - */ - goto __pyx_L3; - } +static PyObject *__pyx_pf_7DracoPy_7Encoder_4SetAttributeQuantization(struct __pyx_obj_7DracoPy_Encoder *__pyx_v_self, enum draco::GeometryAttribute::Type __pyx_v_attr_type, PyObject *__pyx_v_quantization_bits) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("SetAttributeQuantization", 0); - /* "DracoPy.pyx":16 - * data_struct['quantization_range'], data_struct['quantization_origin']) - * else: - * self.encoding_options = None # <<<<<<<<<<<<<< + /* "DracoPy.pyx":27 + * attr_type: GeometryAttributeType, + * quantization_bits: int): + * self.this_encoder.SetAttributeQuantization(attr_type, quantization_bits) # <<<<<<<<<<<<<< * - * def get_encoded_coordinate(self, value, axis): + * def SetAttributeExplicitQuantization(self, */ - /*else*/ { - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_encoding_options, Py_None) < 0) __PYX_ERR(0, 16, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_quantization_bits); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 27, __pyx_L1_error) + try { + __pyx_v_self->this_encoder.SetAttributeQuantization(__pyx_v_attr_type, __pyx_t_1); + } catch(...) { + __Pyx_CppExn2PyErr(); + __PYX_ERR(0, 27, __pyx_L1_error) } - __pyx_L3:; - /* "DracoPy.pyx":10 + /* "DracoPy.pyx":24 + * self.this_encoder.SetSpeedOptions(encoding_speed, decoding_speed) * - * class DracoPointCloud(object): - * def __init__(self, data_struct): # <<<<<<<<<<<<<< - * self.data_struct = data_struct - * if data_struct['encoding_options_set']: + * def SetAttributeQuantization(self, # <<<<<<<<<<<<<< + * attr_type: GeometryAttributeType, + * quantization_bits: int): */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_9); - __Pyx_AddTraceback("DracoPy.DracoPointCloud.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("DracoPy.Encoder.SetAttributeQuantization", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -1907,34 +2502,36 @@ static PyObject *__pyx_pf_7DracoPy_15DracoPointCloud___init__(CYTHON_UNUSED PyOb return __pyx_r; } -/* "DracoPy.pyx":18 - * self.encoding_options = None +/* "DracoPy.pyx":29 + * self.this_encoder.SetAttributeQuantization(attr_type, quantization_bits) * - * def get_encoded_coordinate(self, value, axis): # <<<<<<<<<<<<<< - * if self.encoding_options is not None: - * return self.encoding_options.get_encoded_coordinate(value, axis) + * def SetAttributeExplicitQuantization(self, # <<<<<<<<<<<<<< + * attr_type: GeometryAttributeType, + * quantization_bits: int, */ /* Python wrapper */ -static PyObject *__pyx_pw_7DracoPy_15DracoPointCloud_3get_encoded_coordinate(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_7DracoPy_15DracoPointCloud_3get_encoded_coordinate = {"get_encoded_coordinate", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7DracoPy_15DracoPointCloud_3get_encoded_coordinate, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_7DracoPy_15DracoPointCloud_3get_encoded_coordinate(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_self = 0; - PyObject *__pyx_v_value = 0; - PyObject *__pyx_v_axis = 0; +static PyObject *__pyx_pw_7DracoPy_7Encoder_7SetAttributeExplicitQuantization(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_7DracoPy_7Encoder_7SetAttributeExplicitQuantization(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + enum draco::GeometryAttribute::Type __pyx_v_attr_type; + PyObject *__pyx_v_quantization_bits = 0; + double __pyx_v_quantization_range; + std::vector __pyx_v_quantization_origin; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("get_encoded_coordinate (wrapper)", 0); + __Pyx_RefNannySetupContext("SetAttributeExplicitQuantization (wrapper)", 0); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_value,&__pyx_n_s_axis,0}; - PyObject* values[3] = {0,0,0}; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_attr_type,&__pyx_n_s_quantization_bits,&__pyx_n_s_quantization_range,&__pyx_n_s_quantization_origin,0}; + PyObject* values[4] = {0,0,0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + CYTHON_FALLTHROUGH; case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); CYTHON_FALLTHROUGH; case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); @@ -1947,167 +2544,103 @@ static PyObject *__pyx_pw_7DracoPy_15DracoPointCloud_3get_encoded_coordinate(PyO kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--; + if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_attr_type)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_value)) != 0)) kw_args--; + if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_quantization_bits)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("get_encoded_coordinate", 1, 3, 3, 1); __PYX_ERR(0, 18, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("SetAttributeExplicitQuantization", 1, 4, 4, 1); __PYX_ERR(0, 29, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: - if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_axis)) != 0)) kw_args--; + if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_quantization_range)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("SetAttributeExplicitQuantization", 1, 4, 4, 2); __PYX_ERR(0, 29, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 3: + if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_quantization_origin)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("get_encoded_coordinate", 1, 3, 3, 2); __PYX_ERR(0, 18, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("SetAttributeExplicitQuantization", 1, 4, 4, 3); __PYX_ERR(0, 29, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "get_encoded_coordinate") < 0)) __PYX_ERR(0, 18, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "SetAttributeExplicitQuantization") < 0)) __PYX_ERR(0, 29, __pyx_L3_error) } - } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { + } else if (PyTuple_GET_SIZE(__pyx_args) != 4) { goto __pyx_L5_argtuple_error; } else { values[0] = PyTuple_GET_ITEM(__pyx_args, 0); values[1] = PyTuple_GET_ITEM(__pyx_args, 1); values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + values[3] = PyTuple_GET_ITEM(__pyx_args, 3); } - __pyx_v_self = values[0]; - __pyx_v_value = values[1]; - __pyx_v_axis = values[2]; + __pyx_v_attr_type = ((enum draco::GeometryAttribute::Type)__Pyx_PyInt_As_enum__draco_3a__3a_GeometryAttribute_3a__3a_Type(values[0])); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 30, __pyx_L3_error) + __pyx_v_quantization_bits = values[1]; + __pyx_v_quantization_range = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_quantization_range == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 32, __pyx_L3_error) + __pyx_v_quantization_origin = __pyx_convert_vector_from_py_float(values[3]); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 33, __pyx_L3_error) } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("get_encoded_coordinate", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 18, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("SetAttributeExplicitQuantization", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 29, __pyx_L3_error) __pyx_L3_error:; - __Pyx_AddTraceback("DracoPy.DracoPointCloud.get_encoded_coordinate", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("DracoPy.Encoder.SetAttributeExplicitQuantization", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_7DracoPy_15DracoPointCloud_2get_encoded_coordinate(__pyx_self, __pyx_v_self, __pyx_v_value, __pyx_v_axis); + __pyx_r = __pyx_pf_7DracoPy_7Encoder_6SetAttributeExplicitQuantization(((struct __pyx_obj_7DracoPy_Encoder *)__pyx_v_self), __pyx_v_attr_type, __pyx_v_quantization_bits, __pyx_v_quantization_range, __pyx_v_quantization_origin); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_7DracoPy_15DracoPointCloud_2get_encoded_coordinate(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_value, PyObject *__pyx_v_axis) { +static PyObject *__pyx_pf_7DracoPy_7Encoder_6SetAttributeExplicitQuantization(struct __pyx_obj_7DracoPy_Encoder *__pyx_v_self, enum draco::GeometryAttribute::Type __pyx_v_attr_type, PyObject *__pyx_v_quantization_bits, double __pyx_v_quantization_range, std::vector __pyx_v_quantization_origin) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - int __pyx_t_2; - int __pyx_t_3; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; - int __pyx_t_6; - PyObject *__pyx_t_7 = NULL; + int __pyx_t_1; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("get_encoded_coordinate", 0); + __Pyx_RefNannySetupContext("SetAttributeExplicitQuantization", 0); - /* "DracoPy.pyx":19 - * - * def get_encoded_coordinate(self, value, axis): - * if self.encoding_options is not None: # <<<<<<<<<<<<<< - * return self.encoding_options.get_encoded_coordinate(value, axis) + /* "DracoPy.pyx":35 + * quantization_origin: vector[float]): + * self.this_encoder.SetAttributeExplicitQuantization( + * attr_type, quantization_bits, quantization_origin.size(), # <<<<<<<<<<<<<< + * &quantization_origin[0], quantization_range) * */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_encoding_options); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 19, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = (__pyx_t_1 != Py_None); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_3 = (__pyx_t_2 != 0); - if (__pyx_t_3) { + __pyx_t_1 = __Pyx_PyInt_As_int(__pyx_v_quantization_bits); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 35, __pyx_L1_error) - /* "DracoPy.pyx":20 - * def get_encoded_coordinate(self, value, axis): - * if self.encoding_options is not None: - * return self.encoding_options.get_encoded_coordinate(value, axis) # <<<<<<<<<<<<<< - * - * def get_encoded_point(self, point): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_encoding_options); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 20, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_get_encoded_coordinate); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 20, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = NULL; - __pyx_t_6 = 0; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5); - if (likely(__pyx_t_4)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); - __Pyx_INCREF(__pyx_t_4); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_5, function); - __pyx_t_6 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_5)) { - PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_value, __pyx_v_axis}; - __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 20, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) { - PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_value, __pyx_v_axis}; - __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 20, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GOTREF(__pyx_t_1); - } else - #endif - { - __pyx_t_7 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 20, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - if (__pyx_t_4) { - __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_4); __pyx_t_4 = NULL; - } - __Pyx_INCREF(__pyx_v_value); - __Pyx_GIVEREF(__pyx_v_value); - PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_v_value); - __Pyx_INCREF(__pyx_v_axis); - __Pyx_GIVEREF(__pyx_v_axis); - PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_v_axis); - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 20, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - } - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "DracoPy.pyx":19 - * - * def get_encoded_coordinate(self, value, axis): - * if self.encoding_options is not None: # <<<<<<<<<<<<<< - * return self.encoding_options.get_encoded_coordinate(value, axis) - * + /* "DracoPy.pyx":34 + * quantization_range: float, + * quantization_origin: vector[float]): + * self.this_encoder.SetAttributeExplicitQuantization( # <<<<<<<<<<<<<< + * attr_type, quantization_bits, quantization_origin.size(), + * &quantization_origin[0], quantization_range) */ + try { + __pyx_v_self->this_encoder.SetAttributeExplicitQuantization(__pyx_v_attr_type, __pyx_t_1, __pyx_v_quantization_origin.size(), (&(__pyx_v_quantization_origin[0])), __pyx_v_quantization_range); + } catch(...) { + __Pyx_CppExn2PyErr(); + __PYX_ERR(0, 34, __pyx_L1_error) } - /* "DracoPy.pyx":18 - * self.encoding_options = None + /* "DracoPy.pyx":29 + * self.this_encoder.SetAttributeQuantization(attr_type, quantization_bits) * - * def get_encoded_coordinate(self, value, axis): # <<<<<<<<<<<<<< - * if self.encoding_options is not None: - * return self.encoding_options.get_encoded_coordinate(value, axis) + * def SetAttributeExplicitQuantization(self, # <<<<<<<<<<<<<< + * attr_type: GeometryAttributeType, + * quantization_bits: int, */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_AddTraceback("DracoPy.DracoPointCloud.get_encoded_coordinate", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("DracoPy.Encoder.SetAttributeExplicitQuantization", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -2115,28 +2648,141 @@ static PyObject *__pyx_pf_7DracoPy_15DracoPointCloud_2get_encoded_coordinate(CYT return __pyx_r; } -/* "DracoPy.pyx":22 - * return self.encoding_options.get_encoded_coordinate(value, axis) +/* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + * def __setstate_cython__(self, __pyx_state): + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_7DracoPy_7Encoder_9__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_7DracoPy_7Encoder_9__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0); + __pyx_r = __pyx_pf_7DracoPy_7Encoder_8__reduce_cython__(((struct __pyx_obj_7DracoPy_Encoder *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_7DracoPy_7Encoder_8__reduce_cython__(CYTHON_UNUSED struct __pyx_obj_7DracoPy_Encoder *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__reduce_cython__", 0); + + /* "(tree fragment)":2 + * def __reduce_cython__(self): + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< + * def __setstate_cython__(self, __pyx_state): + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + */ + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple_, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 2, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __PYX_ERR(1, 2, __pyx_L1_error) + + /* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + * def __setstate_cython__(self, __pyx_state): + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("DracoPy.Encoder.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":3 + * def __reduce_cython__(self): + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_7DracoPy_7Encoder_11__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/ +static PyObject *__pyx_pw_7DracoPy_7Encoder_11__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0); + __pyx_r = __pyx_pf_7DracoPy_7Encoder_10__setstate_cython__(((struct __pyx_obj_7DracoPy_Encoder *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_7DracoPy_7Encoder_10__setstate_cython__(CYTHON_UNUSED struct __pyx_obj_7DracoPy_Encoder *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__setstate_cython__", 0); + + /* "(tree fragment)":4 + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + * def __setstate_cython__(self, __pyx_state): + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< + */ + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __PYX_ERR(1, 4, __pyx_L1_error) + + /* "(tree fragment)":3 + * def __reduce_cython__(self): + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("DracoPy.Encoder.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "DracoPy.pyx":40 * - * def get_encoded_point(self, point): # <<<<<<<<<<<<<< - * if self.encoding_options is not None: - * return self.encoding_options.get_encoded_point(point) + * class DracoPointCloud(object): + * def __init__(self, data_struct): # <<<<<<<<<<<<<< + * self.data_struct = data_struct + * if data_struct['encoding_options_set']: */ /* Python wrapper */ -static PyObject *__pyx_pw_7DracoPy_15DracoPointCloud_5get_encoded_point(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_7DracoPy_15DracoPointCloud_5get_encoded_point = {"get_encoded_point", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7DracoPy_15DracoPointCloud_5get_encoded_point, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_7DracoPy_15DracoPointCloud_5get_encoded_point(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static PyObject *__pyx_pw_7DracoPy_15DracoPointCloud_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyMethodDef __pyx_mdef_7DracoPy_15DracoPointCloud_1__init__ = {"__init__", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7DracoPy_15DracoPointCloud_1__init__, METH_VARARGS|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_7DracoPy_15DracoPointCloud_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_self = 0; - PyObject *__pyx_v_point = 0; + PyObject *__pyx_v_data_struct = 0; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("get_encoded_point (wrapper)", 0); + __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_point,0}; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_data_struct,0}; PyObject* values[2] = {0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; @@ -2156,13 +2802,13 @@ static PyObject *__pyx_pw_7DracoPy_15DracoPointCloud_5get_encoded_point(PyObject else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_point)) != 0)) kw_args--; + if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_data_struct)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("get_encoded_point", 1, 2, 2, 1); __PYX_ERR(0, 22, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, 1); __PYX_ERR(0, 40, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "get_encoded_point") < 0)) __PYX_ERR(0, 22, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 40, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; @@ -2171,368 +2817,400 @@ static PyObject *__pyx_pw_7DracoPy_15DracoPointCloud_5get_encoded_point(PyObject values[1] = PyTuple_GET_ITEM(__pyx_args, 1); } __pyx_v_self = values[0]; - __pyx_v_point = values[1]; + __pyx_v_data_struct = values[1]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("get_encoded_point", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 22, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 40, __pyx_L3_error) __pyx_L3_error:; - __Pyx_AddTraceback("DracoPy.DracoPointCloud.get_encoded_point", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("DracoPy.DracoPointCloud.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_7DracoPy_15DracoPointCloud_4get_encoded_point(__pyx_self, __pyx_v_self, __pyx_v_point); + __pyx_r = __pyx_pf_7DracoPy_15DracoPointCloud___init__(__pyx_self, __pyx_v_self, __pyx_v_data_struct); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_7DracoPy_15DracoPointCloud_4get_encoded_point(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_point) { +static PyObject *__pyx_pf_7DracoPy_15DracoPointCloud___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_data_struct) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_t_2; - int __pyx_t_3; + PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + int __pyx_t_8; + PyObject *__pyx_t_9 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("get_encoded_point", 0); + __Pyx_RefNannySetupContext("__init__", 0); - /* "DracoPy.pyx":23 - * - * def get_encoded_point(self, point): - * if self.encoding_options is not None: # <<<<<<<<<<<<<< - * return self.encoding_options.get_encoded_point(point) - * + /* "DracoPy.pyx":41 + * class DracoPointCloud(object): + * def __init__(self, data_struct): + * self.data_struct = data_struct # <<<<<<<<<<<<<< + * if data_struct['encoding_options_set']: + * self.encoding_options = EncodingOptions(data_struct['quantization_bits'], + */ + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_data_struct, __pyx_v_data_struct) < 0) __PYX_ERR(0, 41, __pyx_L1_error) + + /* "DracoPy.pyx":42 + * def __init__(self, data_struct): + * self.data_struct = data_struct + * if data_struct['encoding_options_set']: # <<<<<<<<<<<<<< + * self.encoding_options = EncodingOptions(data_struct['quantization_bits'], + * data_struct['quantization_range'], data_struct['quantization_origin']) */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_encoding_options); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 23, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_Dict_GetItem(__pyx_v_data_struct, __pyx_n_u_encoding_options_set); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 42, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = (__pyx_t_1 != Py_None); + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) __PYX_ERR(0, 42, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_3 = (__pyx_t_2 != 0); - if (__pyx_t_3) { + if (__pyx_t_2) { - /* "DracoPy.pyx":24 - * def get_encoded_point(self, point): - * if self.encoding_options is not None: - * return self.encoding_options.get_encoded_point(point) # <<<<<<<<<<<<<< - * - * @property + /* "DracoPy.pyx":43 + * self.data_struct = data_struct + * if data_struct['encoding_options_set']: + * self.encoding_options = EncodingOptions(data_struct['quantization_bits'], # <<<<<<<<<<<<<< + * data_struct['quantization_range'], data_struct['quantization_origin']) + * else: */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_encoding_options); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 24, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_EncodingOptions); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 43, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyObject_Dict_GetItem(__pyx_v_data_struct, __pyx_n_u_quantization_bits); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 43, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_get_encoded_point); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 24, __pyx_L1_error) + + /* "DracoPy.pyx":44 + * if data_struct['encoding_options_set']: + * self.encoding_options = EncodingOptions(data_struct['quantization_bits'], + * data_struct['quantization_range'], data_struct['quantization_origin']) # <<<<<<<<<<<<<< + * else: + * self.encoding_options = None + */ + __pyx_t_5 = __Pyx_PyObject_Dict_GetItem(__pyx_v_data_struct, __pyx_n_u_quantization_range); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 44, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = NULL; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5); - if (likely(__pyx_t_4)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); - __Pyx_INCREF(__pyx_t_4); + __pyx_t_6 = __Pyx_PyObject_Dict_GetItem(__pyx_v_data_struct, __pyx_n_u_quantization_origin); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 44, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = NULL; + __pyx_t_8 = 0; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_7)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_7); __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_5, function); + __Pyx_DECREF_SET(__pyx_t_3, function); + __pyx_t_8 = 1; } } - __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_4, __pyx_v_point) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_point); - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 24, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - - /* "DracoPy.pyx":23 - * - * def get_encoded_point(self, point): - * if self.encoding_options is not None: # <<<<<<<<<<<<<< - * return self.encoding_options.get_encoded_point(point) - * - */ - } - - /* "DracoPy.pyx":22 - * return self.encoding_options.get_encoded_coordinate(value, axis) - * - * def get_encoded_point(self, point): # <<<<<<<<<<<<<< - * if self.encoding_options is not None: - * return self.encoding_options.get_encoded_point(point) - */ - - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("DracoPy.DracoPointCloud.get_encoded_point", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_3)) { + PyObject *__pyx_temp[4] = {__pyx_t_7, __pyx_t_4, __pyx_t_5, __pyx_t_6}; + __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_8, 3+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 43, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { + PyObject *__pyx_temp[4] = {__pyx_t_7, __pyx_t_4, __pyx_t_5, __pyx_t_6}; + __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_8, 3+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 43, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } else + #endif + { + __pyx_t_9 = PyTuple_New(3+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 43, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + if (__pyx_t_7) { + __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7); __pyx_t_7 = NULL; + } + __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_5); + PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_t_5); + __Pyx_GIVEREF(__pyx_t_6); + PyTuple_SET_ITEM(__pyx_t_9, 2+__pyx_t_8, __pyx_t_6); + __pyx_t_4 = 0; + __pyx_t_5 = 0; + __pyx_t_6 = 0; + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_9, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 43, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; -/* "DracoPy.pyx":27 - * - * @property - * def num_axes(self): # <<<<<<<<<<<<<< - * return 3 - * + /* "DracoPy.pyx":43 + * self.data_struct = data_struct + * if data_struct['encoding_options_set']: + * self.encoding_options = EncodingOptions(data_struct['quantization_bits'], # <<<<<<<<<<<<<< + * data_struct['quantization_range'], data_struct['quantization_origin']) + * else: */ + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_encoding_options, __pyx_t_1) < 0) __PYX_ERR(0, 43, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; -/* Python wrapper */ -static PyObject *__pyx_pw_7DracoPy_15DracoPointCloud_7num_axes(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ -static PyMethodDef __pyx_mdef_7DracoPy_15DracoPointCloud_7num_axes = {"num_axes", (PyCFunction)__pyx_pw_7DracoPy_15DracoPointCloud_7num_axes, METH_O, 0}; -static PyObject *__pyx_pw_7DracoPy_15DracoPointCloud_7num_axes(PyObject *__pyx_self, PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("num_axes (wrapper)", 0); - __pyx_r = __pyx_pf_7DracoPy_15DracoPointCloud_6num_axes(__pyx_self, ((PyObject *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_7DracoPy_15DracoPointCloud_6num_axes(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("num_axes", 0); + /* "DracoPy.pyx":42 + * def __init__(self, data_struct): + * self.data_struct = data_struct + * if data_struct['encoding_options_set']: # <<<<<<<<<<<<<< + * self.encoding_options = EncodingOptions(data_struct['quantization_bits'], + * data_struct['quantization_range'], data_struct['quantization_origin']) + */ + goto __pyx_L3; + } - /* "DracoPy.pyx":28 - * @property - * def num_axes(self): - * return 3 # <<<<<<<<<<<<<< + /* "DracoPy.pyx":46 + * data_struct['quantization_range'], data_struct['quantization_origin']) + * else: + * self.encoding_options = None # <<<<<<<<<<<<<< * - * @property + * def get_encoded_coordinate(self, value, axis): */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_int_3); - __pyx_r = __pyx_int_3; - goto __pyx_L0; + /*else*/ { + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_encoding_options, Py_None) < 0) __PYX_ERR(0, 46, __pyx_L1_error) + } + __pyx_L3:; - /* "DracoPy.pyx":27 - * - * @property - * def num_axes(self): # <<<<<<<<<<<<<< - * return 3 + /* "DracoPy.pyx":40 * + * class DracoPointCloud(object): + * def __init__(self, data_struct): # <<<<<<<<<<<<<< + * self.data_struct = data_struct + * if data_struct['encoding_options_set']: */ /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_AddTraceback("DracoPy.DracoPointCloud.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "DracoPy.pyx":31 - * - * @property - * def points(self): # <<<<<<<<<<<<<< - * return self.data_struct['points'] +/* "DracoPy.pyx":48 + * self.encoding_options = None * + * def get_encoded_coordinate(self, value, axis): # <<<<<<<<<<<<<< + * if self.encoding_options is not None: + * return self.encoding_options.get_encoded_coordinate(value, axis) */ /* Python wrapper */ -static PyObject *__pyx_pw_7DracoPy_15DracoPointCloud_9points(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ -static PyMethodDef __pyx_mdef_7DracoPy_15DracoPointCloud_9points = {"points", (PyCFunction)__pyx_pw_7DracoPy_15DracoPointCloud_9points, METH_O, 0}; -static PyObject *__pyx_pw_7DracoPy_15DracoPointCloud_9points(PyObject *__pyx_self, PyObject *__pyx_v_self) { +static PyObject *__pyx_pw_7DracoPy_15DracoPointCloud_3get_encoded_coordinate(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyMethodDef __pyx_mdef_7DracoPy_15DracoPointCloud_3get_encoded_coordinate = {"get_encoded_coordinate", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7DracoPy_15DracoPointCloud_3get_encoded_coordinate, METH_VARARGS|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_7DracoPy_15DracoPointCloud_3get_encoded_coordinate(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_self = 0; + PyObject *__pyx_v_value = 0; + PyObject *__pyx_v_axis = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("points (wrapper)", 0); - __pyx_r = __pyx_pf_7DracoPy_15DracoPointCloud_8points(__pyx_self, ((PyObject *)__pyx_v_self)); + __Pyx_RefNannySetupContext("get_encoded_coordinate (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_value,&__pyx_n_s_axis,0}; + PyObject* values[3] = {0,0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_value)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("get_encoded_coordinate", 1, 3, 3, 1); __PYX_ERR(0, 48, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_axis)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("get_encoded_coordinate", 1, 3, 3, 2); __PYX_ERR(0, 48, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "get_encoded_coordinate") < 0)) __PYX_ERR(0, 48, __pyx_L3_error) + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + } + __pyx_v_self = values[0]; + __pyx_v_value = values[1]; + __pyx_v_axis = values[2]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("get_encoded_coordinate", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 48, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("DracoPy.DracoPointCloud.get_encoded_coordinate", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_7DracoPy_15DracoPointCloud_2get_encoded_coordinate(__pyx_self, __pyx_v_self, __pyx_v_value, __pyx_v_axis); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_7DracoPy_15DracoPointCloud_8points(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) { +static PyObject *__pyx_pf_7DracoPy_15DracoPointCloud_2get_encoded_coordinate(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_value, PyObject *__pyx_v_axis) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; + int __pyx_t_2; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_t_6; + PyObject *__pyx_t_7 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("points", 0); + __Pyx_RefNannySetupContext("get_encoded_coordinate", 0); - /* "DracoPy.pyx":32 - * @property - * def points(self): - * return self.data_struct['points'] # <<<<<<<<<<<<<< + /* "DracoPy.pyx":49 + * + * def get_encoded_coordinate(self, value, axis): + * if self.encoding_options is not None: # <<<<<<<<<<<<<< + * return self.encoding_options.get_encoded_coordinate(value, axis) * - * class DracoMesh(DracoPointCloud): */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_data_struct); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 32, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_encoding_options); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 49, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_Dict_GetItem(__pyx_t_1, __pyx_n_u_points); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 32, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); + __pyx_t_2 = (__pyx_t_1 != Py_None); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; - - /* "DracoPy.pyx":31 - * - * @property - * def points(self): # <<<<<<<<<<<<<< - * return self.data_struct['points'] - * - */ - - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("DracoPy.DracoPointCloud.points", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + __pyx_t_3 = (__pyx_t_2 != 0); + if (__pyx_t_3) { -/* "DracoPy.pyx":36 - * class DracoMesh(DracoPointCloud): - * @property - * def faces(self): # <<<<<<<<<<<<<< - * return self.data_struct['faces'] + /* "DracoPy.pyx":50 + * def get_encoded_coordinate(self, value, axis): + * if self.encoding_options is not None: + * return self.encoding_options.get_encoded_coordinate(value, axis) # <<<<<<<<<<<<<< * + * def get_encoded_point(self, point): */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_encoding_options); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 50, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_get_encoded_coordinate); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 50, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = NULL; + __pyx_t_6 = 0; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_5, function); + __pyx_t_6 = 1; + } + } + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_5)) { + PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_value, __pyx_v_axis}; + __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 50, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_GOTREF(__pyx_t_1); + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) { + PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_v_value, __pyx_v_axis}; + __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 50, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_GOTREF(__pyx_t_1); + } else + #endif + { + __pyx_t_7 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 50, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + if (__pyx_t_4) { + __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_4); __pyx_t_4 = NULL; + } + __Pyx_INCREF(__pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_v_value); + __Pyx_INCREF(__pyx_v_axis); + __Pyx_GIVEREF(__pyx_v_axis); + PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_v_axis); + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 50, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + } + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; -/* Python wrapper */ -static PyObject *__pyx_pw_7DracoPy_9DracoMesh_1faces(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ -static PyMethodDef __pyx_mdef_7DracoPy_9DracoMesh_1faces = {"faces", (PyCFunction)__pyx_pw_7DracoPy_9DracoMesh_1faces, METH_O, 0}; -static PyObject *__pyx_pw_7DracoPy_9DracoMesh_1faces(PyObject *__pyx_self, PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("faces (wrapper)", 0); - __pyx_r = __pyx_pf_7DracoPy_9DracoMesh_faces(__pyx_self, ((PyObject *)__pyx_v_self)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_7DracoPy_9DracoMesh_faces(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("faces", 0); - - /* "DracoPy.pyx":37 - * @property - * def faces(self): - * return self.data_struct['faces'] # <<<<<<<<<<<<<< + /* "DracoPy.pyx":49 * - * @property - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_data_struct); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 37, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_Dict_GetItem(__pyx_t_1, __pyx_n_u_faces); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 37, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; - goto __pyx_L0; - - /* "DracoPy.pyx":36 - * class DracoMesh(DracoPointCloud): - * @property - * def faces(self): # <<<<<<<<<<<<<< - * return self.data_struct['faces'] + * def get_encoded_coordinate(self, value, axis): + * if self.encoding_options is not None: # <<<<<<<<<<<<<< + * return self.encoding_options.get_encoded_coordinate(value, axis) * */ + } - /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("DracoPy.DracoMesh.faces", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "DracoPy.pyx":40 - * - * @property - * def normals(self): # <<<<<<<<<<<<<< - * return self.data_struct['normals'] + /* "DracoPy.pyx":48 + * self.encoding_options = None * + * def get_encoded_coordinate(self, value, axis): # <<<<<<<<<<<<<< + * if self.encoding_options is not None: + * return self.encoding_options.get_encoded_coordinate(value, axis) */ -/* Python wrapper */ -static PyObject *__pyx_pw_7DracoPy_9DracoMesh_3normals(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ -static PyMethodDef __pyx_mdef_7DracoPy_9DracoMesh_3normals = {"normals", (PyCFunction)__pyx_pw_7DracoPy_9DracoMesh_3normals, METH_O, 0}; -static PyObject *__pyx_pw_7DracoPy_9DracoMesh_3normals(PyObject *__pyx_self, PyObject *__pyx_v_self) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("normals (wrapper)", 0); - __pyx_r = __pyx_pf_7DracoPy_9DracoMesh_2normals(__pyx_self, ((PyObject *)__pyx_v_self)); - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_7DracoPy_9DracoMesh_2normals(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) { - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("normals", 0); - - /* "DracoPy.pyx":41 - * @property - * def normals(self): - * return self.data_struct['normals'] # <<<<<<<<<<<<<< - * - * class EncodingOptions(object): - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_data_struct); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 41, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_Dict_GetItem(__pyx_t_1, __pyx_n_u_normals); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 41, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; + __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; - - /* "DracoPy.pyx":40 - * - * @property - * def normals(self): # <<<<<<<<<<<<<< - * return self.data_struct['normals'] - * - */ - - /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("DracoPy.DracoMesh.normals", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_AddTraceback("DracoPy.DracoPointCloud.get_encoded_coordinate", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -2540,39 +3218,33 @@ static PyObject *__pyx_pf_7DracoPy_9DracoMesh_2normals(CYTHON_UNUSED PyObject *_ return __pyx_r; } -/* "DracoPy.pyx":44 +/* "DracoPy.pyx":52 + * return self.encoding_options.get_encoded_coordinate(value, axis) * - * class EncodingOptions(object): - * def __init__(self, quantization_bits, quantization_range, quantization_origin): # <<<<<<<<<<<<<< - * self.quantization_bits = quantization_bits - * self.quantization_range = quantization_range + * def get_encoded_point(self, point): # <<<<<<<<<<<<<< + * if self.encoding_options is not None: + * return self.encoding_options.get_encoded_point(point) */ /* Python wrapper */ -static PyObject *__pyx_pw_7DracoPy_15EncodingOptions_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_7DracoPy_15EncodingOptions_1__init__ = {"__init__", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7DracoPy_15EncodingOptions_1__init__, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_7DracoPy_15EncodingOptions_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static PyObject *__pyx_pw_7DracoPy_15DracoPointCloud_5get_encoded_point(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyMethodDef __pyx_mdef_7DracoPy_15DracoPointCloud_5get_encoded_point = {"get_encoded_point", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7DracoPy_15DracoPointCloud_5get_encoded_point, METH_VARARGS|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_7DracoPy_15DracoPointCloud_5get_encoded_point(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_self = 0; - PyObject *__pyx_v_quantization_bits = 0; - PyObject *__pyx_v_quantization_range = 0; - PyObject *__pyx_v_quantization_origin = 0; + PyObject *__pyx_v_point = 0; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); + __Pyx_RefNannySetupContext("get_encoded_point (wrapper)", 0); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_quantization_bits,&__pyx_n_s_quantization_range,&__pyx_n_s_quantization_origin,0}; - PyObject* values[4] = {0,0,0,0}; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_point,0}; + PyObject* values[2] = {0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - CYTHON_FALLTHROUGH; case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); CYTHON_FALLTHROUGH; case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); @@ -2587,115 +3259,112 @@ static PyObject *__pyx_pw_7DracoPy_15EncodingOptions_1__init__(PyObject *__pyx_s else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_quantization_bits)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("__init__", 1, 4, 4, 1); __PYX_ERR(0, 44, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 2: - if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_quantization_range)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("__init__", 1, 4, 4, 2); __PYX_ERR(0, 44, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 3: - if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_quantization_origin)) != 0)) kw_args--; + if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_point)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("__init__", 1, 4, 4, 3); __PYX_ERR(0, 44, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("get_encoded_point", 1, 2, 2, 1); __PYX_ERR(0, 52, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 44, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "get_encoded_point") < 0)) __PYX_ERR(0, 52, __pyx_L3_error) } - } else if (PyTuple_GET_SIZE(__pyx_args) != 4) { + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; } else { values[0] = PyTuple_GET_ITEM(__pyx_args, 0); values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - values[3] = PyTuple_GET_ITEM(__pyx_args, 3); } __pyx_v_self = values[0]; - __pyx_v_quantization_bits = values[1]; - __pyx_v_quantization_range = values[2]; - __pyx_v_quantization_origin = values[3]; + __pyx_v_point = values[1]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__init__", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 44, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("get_encoded_point", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 52, __pyx_L3_error) __pyx_L3_error:; - __Pyx_AddTraceback("DracoPy.EncodingOptions.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("DracoPy.DracoPointCloud.get_encoded_point", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_7DracoPy_15EncodingOptions___init__(__pyx_self, __pyx_v_self, __pyx_v_quantization_bits, __pyx_v_quantization_range, __pyx_v_quantization_origin); + __pyx_r = __pyx_pf_7DracoPy_15DracoPointCloud_4get_encoded_point(__pyx_self, __pyx_v_self, __pyx_v_point); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_7DracoPy_15EncodingOptions___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_quantization_bits, PyObject *__pyx_v_quantization_range, PyObject *__pyx_v_quantization_origin) { +static PyObject *__pyx_pf_7DracoPy_15DracoPointCloud_4get_encoded_point(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_point) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; + int __pyx_t_2; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__init__", 0); - - /* "DracoPy.pyx":45 - * class EncodingOptions(object): - * def __init__(self, quantization_bits, quantization_range, quantization_origin): - * self.quantization_bits = quantization_bits # <<<<<<<<<<<<<< - * self.quantization_range = quantization_range - * self.quantization_origin = quantization_origin - */ - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_quantization_bits, __pyx_v_quantization_bits) < 0) __PYX_ERR(0, 45, __pyx_L1_error) - - /* "DracoPy.pyx":46 - * def __init__(self, quantization_bits, quantization_range, quantization_origin): - * self.quantization_bits = quantization_bits - * self.quantization_range = quantization_range # <<<<<<<<<<<<<< - * self.quantization_origin = quantization_origin - * self.inverse_alpha = quantization_range / ((2 ** quantization_bits) - 1) - */ - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_quantization_range, __pyx_v_quantization_range) < 0) __PYX_ERR(0, 46, __pyx_L1_error) + __Pyx_RefNannySetupContext("get_encoded_point", 0); - /* "DracoPy.pyx":47 - * self.quantization_bits = quantization_bits - * self.quantization_range = quantization_range - * self.quantization_origin = quantization_origin # <<<<<<<<<<<<<< - * self.inverse_alpha = quantization_range / ((2 ** quantization_bits) - 1) + /* "DracoPy.pyx":53 + * + * def get_encoded_point(self, point): + * if self.encoding_options is not None: # <<<<<<<<<<<<<< + * return self.encoding_options.get_encoded_point(point) * */ - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_quantization_origin, __pyx_v_quantization_origin) < 0) __PYX_ERR(0, 47, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_encoding_options); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 53, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = (__pyx_t_1 != Py_None); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_3 = (__pyx_t_2 != 0); + if (__pyx_t_3) { - /* "DracoPy.pyx":48 - * self.quantization_range = quantization_range - * self.quantization_origin = quantization_origin - * self.inverse_alpha = quantization_range / ((2 ** quantization_bits) - 1) # <<<<<<<<<<<<<< + /* "DracoPy.pyx":54 + * def get_encoded_point(self, point): + * if self.encoding_options is not None: + * return self.encoding_options.get_encoded_point(point) # <<<<<<<<<<<<<< * - * def get_encoded_coordinate(self, value, axis): + * @property */ - __pyx_t_1 = __Pyx_PyNumber_PowerOf2(__pyx_int_2, __pyx_v_quantization_bits, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 48, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyInt_SubtractObjC(__pyx_t_1, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 48, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyNumber_Divide(__pyx_v_quantization_range, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 48, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_inverse_alpha, __pyx_t_1) < 0) __PYX_ERR(0, 48, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(__pyx_r); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_encoding_options); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 54, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_get_encoded_point); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 54, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_5, function); + } + } + __pyx_t_1 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_4, __pyx_v_point) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_point); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 54, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; - /* "DracoPy.pyx":44 + /* "DracoPy.pyx":53 * - * class EncodingOptions(object): - * def __init__(self, quantization_bits, quantization_range, quantization_origin): # <<<<<<<<<<<<<< - * self.quantization_bits = quantization_bits - * self.quantization_range = quantization_range + * def get_encoded_point(self, point): + * if self.encoding_options is not None: # <<<<<<<<<<<<<< + * return self.encoding_options.get_encoded_point(point) + * + */ + } + + /* "DracoPy.pyx":52 + * return self.encoding_options.get_encoded_coordinate(value, axis) + * + * def get_encoded_point(self, point): # <<<<<<<<<<<<<< + * if self.encoding_options is not None: + * return self.encoding_options.get_encoded_point(point) */ /* function exit code */ @@ -2703,8 +3372,9 @@ static PyObject *__pyx_pf_7DracoPy_15EncodingOptions___init__(CYTHON_UNUSED PyOb goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("DracoPy.EncodingOptions.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("DracoPy.DracoPointCloud.get_encoded_point", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -2712,639 +3382,448 @@ static PyObject *__pyx_pf_7DracoPy_15EncodingOptions___init__(CYTHON_UNUSED PyOb return __pyx_r; } -/* "DracoPy.pyx":50 - * self.inverse_alpha = quantization_range / ((2 ** quantization_bits) - 1) +/* "DracoPy.pyx":57 + * + * @property + * def num_axes(self): # <<<<<<<<<<<<<< + * return 3 * - * def get_encoded_coordinate(self, value, axis): # <<<<<<<<<<<<<< - * if value < self.quantization_origin[axis] or value > (self.quantization_origin[axis] + self.quantization_range): - * raise ValueError('Specified value out of encoded range') */ /* Python wrapper */ -static PyObject *__pyx_pw_7DracoPy_15EncodingOptions_3get_encoded_coordinate(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_7DracoPy_15EncodingOptions_3get_encoded_coordinate = {"get_encoded_coordinate", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7DracoPy_15EncodingOptions_3get_encoded_coordinate, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_7DracoPy_15EncodingOptions_3get_encoded_coordinate(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_self = 0; - PyObject *__pyx_v_value = 0; - PyObject *__pyx_v_axis = 0; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; +static PyObject *__pyx_pw_7DracoPy_15DracoPointCloud_7num_axes(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ +static PyMethodDef __pyx_mdef_7DracoPy_15DracoPointCloud_7num_axes = {"num_axes", (PyCFunction)__pyx_pw_7DracoPy_15DracoPointCloud_7num_axes, METH_O, 0}; +static PyObject *__pyx_pw_7DracoPy_15DracoPointCloud_7num_axes(PyObject *__pyx_self, PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("get_encoded_coordinate (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_value,&__pyx_n_s_axis,0}; - PyObject* values[3] = {0,0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_value)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("get_encoded_coordinate", 1, 3, 3, 1); __PYX_ERR(0, 50, __pyx_L3_error) - } - CYTHON_FALLTHROUGH; - case 2: - if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_axis)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("get_encoded_coordinate", 1, 3, 3, 2); __PYX_ERR(0, 50, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "get_encoded_coordinate") < 0)) __PYX_ERR(0, 50, __pyx_L3_error) - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - } - __pyx_v_self = values[0]; - __pyx_v_value = values[1]; - __pyx_v_axis = values[2]; - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("get_encoded_coordinate", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 50, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("DracoPy.EncodingOptions.get_encoded_coordinate", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannySetupContext("num_axes (wrapper)", 0); + __pyx_r = __pyx_pf_7DracoPy_15DracoPointCloud_6num_axes(__pyx_self, ((PyObject *)__pyx_v_self)); + + /* function exit code */ __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_7DracoPy_15EncodingOptions_2get_encoded_coordinate(__pyx_self, __pyx_v_self, __pyx_v_value, __pyx_v_axis); + return __pyx_r; +} + +static PyObject *__pyx_pf_7DracoPy_15DracoPointCloud_6num_axes(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("num_axes", 0); + + /* "DracoPy.pyx":58 + * @property + * def num_axes(self): + * return 3 # <<<<<<<<<<<<<< + * + * @property + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_int_3); + __pyx_r = __pyx_int_3; + goto __pyx_L0; + + /* "DracoPy.pyx":57 + * + * @property + * def num_axes(self): # <<<<<<<<<<<<<< + * return 3 + * + */ /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_7DracoPy_15EncodingOptions_2get_encoded_coordinate(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_value, PyObject *__pyx_v_axis) { - PyObject *__pyx_v_difference = NULL; - PyObject *__pyx_v_quantized_index = NULL; +/* "DracoPy.pyx":61 + * + * @property + * def points(self) -> List[float]: # <<<<<<<<<<<<<< + * return self.data_struct['points'] + * + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_7DracoPy_15DracoPointCloud_9points(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ +static PyMethodDef __pyx_mdef_7DracoPy_15DracoPointCloud_9points = {"points", (PyCFunction)__pyx_pw_7DracoPy_15DracoPointCloud_9points, METH_O, 0}; +static PyObject *__pyx_pw_7DracoPy_15DracoPointCloud_9points(PyObject *__pyx_self, PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("points (wrapper)", 0); + __pyx_r = __pyx_pf_7DracoPy_15DracoPointCloud_8points(__pyx_self, ((PyObject *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_7DracoPy_15DracoPointCloud_8points(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - int __pyx_t_1; + PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - int __pyx_t_4; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("get_encoded_coordinate", 0); + __Pyx_RefNannySetupContext("points", 0); - /* "DracoPy.pyx":51 + /* "DracoPy.pyx":62 + * @property + * def points(self) -> List[float]: + * return self.data_struct['points'] # <<<<<<<<<<<<<< * - * def get_encoded_coordinate(self, value, axis): - * if value < self.quantization_origin[axis] or value > (self.quantization_origin[axis] + self.quantization_range): # <<<<<<<<<<<<<< - * raise ValueError('Specified value out of encoded range') - * difference = value - self.quantization_origin[axis] + * @property */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_quantization_origin); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 51, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_GetItem(__pyx_t_2, __pyx_v_axis); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 51, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyObject_RichCompare(__pyx_v_value, __pyx_t_3, Py_LT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 51, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 51, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (!__pyx_t_4) { - } else { - __pyx_t_1 = __pyx_t_4; - goto __pyx_L4_bool_binop_done; - } - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_quantization_origin); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 51, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_GetItem(__pyx_t_2, __pyx_v_axis); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 51, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_quantization_range); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 51, __pyx_L1_error) + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_data_struct); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 62, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_Dict_GetItem(__pyx_t_1, __pyx_n_u_points); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 62, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_5 = PyNumber_Add(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 51, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyObject_RichCompare(__pyx_v_value, __pyx_t_5, Py_GT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 51, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 51, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_1 = __pyx_t_4; - __pyx_L4_bool_binop_done:; - if (unlikely(__pyx_t_1)) { - - /* "DracoPy.pyx":52 - * def get_encoded_coordinate(self, value, axis): - * if value < self.quantization_origin[axis] or value > (self.quantization_origin[axis] + self.quantization_range): - * raise ValueError('Specified value out of encoded range') # <<<<<<<<<<<<<< - * difference = value - self.quantization_origin[axis] - * quantized_index = floor((difference / self.inverse_alpha) + 0.5) - */ - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple_, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 52, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_Raise(__pyx_t_2, 0, 0, 0); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __PYX_ERR(0, 52, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; - /* "DracoPy.pyx":51 + /* "DracoPy.pyx":61 + * + * @property + * def points(self) -> List[float]: # <<<<<<<<<<<<<< + * return self.data_struct['points'] * - * def get_encoded_coordinate(self, value, axis): - * if value < self.quantization_origin[axis] or value > (self.quantization_origin[axis] + self.quantization_range): # <<<<<<<<<<<<<< - * raise ValueError('Specified value out of encoded range') - * difference = value - self.quantization_origin[axis] */ - } - /* "DracoPy.pyx":53 - * if value < self.quantization_origin[axis] or value > (self.quantization_origin[axis] + self.quantization_range): - * raise ValueError('Specified value out of encoded range') - * difference = value - self.quantization_origin[axis] # <<<<<<<<<<<<<< - * quantized_index = floor((difference / self.inverse_alpha) + 0.5) - * return self.quantization_origin[axis] + (quantized_index * self.inverse_alpha) + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("DracoPy.DracoPointCloud.points", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "DracoPy.pyx":65 + * + * @property + * def geometry_metadata(self) -> Optional[Dict]: # <<<<<<<<<<<<<< + * return self.data_struct['geometry_metadata'] if self.metadatas else None + * + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_7DracoPy_15DracoPointCloud_11geometry_metadata(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ +static PyMethodDef __pyx_mdef_7DracoPy_15DracoPointCloud_11geometry_metadata = {"geometry_metadata", (PyCFunction)__pyx_pw_7DracoPy_15DracoPointCloud_11geometry_metadata, METH_O, 0}; +static PyObject *__pyx_pw_7DracoPy_15DracoPointCloud_11geometry_metadata(PyObject *__pyx_self, PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("geometry_metadata (wrapper)", 0); + __pyx_r = __pyx_pf_7DracoPy_15DracoPointCloud_10geometry_metadata(__pyx_self, ((PyObject *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_7DracoPy_15DracoPointCloud_10geometry_metadata(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("geometry_metadata", 0); + + /* "DracoPy.pyx":66 + * @property + * def geometry_metadata(self) -> Optional[Dict]: + * return self.data_struct['geometry_metadata'] if self.metadatas else None # <<<<<<<<<<<<<< + * + * @property */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_quantization_origin); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 53, __pyx_L1_error) + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_metadatas); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 66, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_t_2, __pyx_v_axis); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 53, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 66, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyNumber_Subtract(__pyx_v_value, __pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 53, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_v_difference = __pyx_t_2; - __pyx_t_2 = 0; + if (__pyx_t_3) { + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_data_struct); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 66, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = __Pyx_PyObject_Dict_GetItem(__pyx_t_2, __pyx_n_u_geometry_metadata); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 66, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_1 = __pyx_t_4; + __pyx_t_4 = 0; + } else { + __Pyx_INCREF(Py_None); + __pyx_t_1 = Py_None; + } + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; - /* "DracoPy.pyx":54 - * raise ValueError('Specified value out of encoded range') - * difference = value - self.quantization_origin[axis] - * quantized_index = floor((difference / self.inverse_alpha) + 0.5) # <<<<<<<<<<<<<< - * return self.quantization_origin[axis] + (quantized_index * self.inverse_alpha) + /* "DracoPy.pyx":65 + * + * @property + * def geometry_metadata(self) -> Optional[Dict]: # <<<<<<<<<<<<<< + * return self.data_struct['geometry_metadata'] if self.metadatas else None * */ - __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_floor); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 54, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_inverse_alpha); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 54, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_6 = __Pyx_PyNumber_Divide(__pyx_v_difference, __pyx_t_3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 54, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyFloat_AddObjC(__pyx_t_6, __pyx_float_0_5, 0.5, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 54, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5); - if (likely(__pyx_t_6)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); - __Pyx_INCREF(__pyx_t_6); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_5, function); - } - } - __pyx_t_2 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_3); - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 54, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_v_quantized_index = __pyx_t_2; - __pyx_t_2 = 0; - /* "DracoPy.pyx":55 - * difference = value - self.quantization_origin[axis] - * quantized_index = floor((difference / self.inverse_alpha) + 0.5) - * return self.quantization_origin[axis] + (quantized_index * self.inverse_alpha) # <<<<<<<<<<<<<< + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("DracoPy.DracoPointCloud.geometry_metadata", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "DracoPy.pyx":69 + * + * @property + * def metadatas(self) -> List[Dict]: # <<<<<<<<<<<<<< + * return self.data_struct['metadatas'] + * + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_7DracoPy_15DracoPointCloud_13metadatas(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ +static PyMethodDef __pyx_mdef_7DracoPy_15DracoPointCloud_13metadatas = {"metadatas", (PyCFunction)__pyx_pw_7DracoPy_15DracoPointCloud_13metadatas, METH_O, 0}; +static PyObject *__pyx_pw_7DracoPy_15DracoPointCloud_13metadatas(PyObject *__pyx_self, PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("metadatas (wrapper)", 0); + __pyx_r = __pyx_pf_7DracoPy_15DracoPointCloud_12metadatas(__pyx_self, ((PyObject *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_7DracoPy_15DracoPointCloud_12metadatas(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("metadatas", 0); + + /* "DracoPy.pyx":70 + * @property + * def metadatas(self) -> List[Dict]: + * return self.data_struct['metadatas'] # <<<<<<<<<<<<<< + * * - * def get_encoded_point(self, point): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_quantization_origin); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 55, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_t_2, __pyx_v_axis); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 55, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_inverse_alpha); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 55, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyNumber_Multiply(__pyx_v_quantized_index, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 55, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyNumber_Add(__pyx_t_5, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 55, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_data_struct); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 70, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_Dict_GetItem(__pyx_t_1, __pyx_n_u_metadatas); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 70, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_r = __pyx_t_2; __pyx_t_2 = 0; goto __pyx_L0; - /* "DracoPy.pyx":50 - * self.inverse_alpha = quantization_range / ((2 ** quantization_bits) - 1) + /* "DracoPy.pyx":69 + * + * @property + * def metadatas(self) -> List[Dict]: # <<<<<<<<<<<<<< + * return self.data_struct['metadatas'] * - * def get_encoded_coordinate(self, value, axis): # <<<<<<<<<<<<<< - * if value < self.quantization_origin[axis] or value > (self.quantization_origin[axis] + self.quantization_range): - * raise ValueError('Specified value out of encoded range') */ /* function exit code */ __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_AddTraceback("DracoPy.EncodingOptions.get_encoded_coordinate", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("DracoPy.DracoPointCloud.metadatas", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; - __Pyx_XDECREF(__pyx_v_difference); - __Pyx_XDECREF(__pyx_v_quantized_index); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "DracoPy.pyx":57 - * return self.quantization_origin[axis] + (quantized_index * self.inverse_alpha) +/* "DracoPy.pyx":75 + * class DracoMesh(DracoPointCloud): + * @property + * def faces(self) -> List[int]: # <<<<<<<<<<<<<< + * return self.data_struct['faces'] * - * def get_encoded_point(self, point): # <<<<<<<<<<<<<< - * encoded_point = [] - * for axis in range(self.num_axes): */ /* Python wrapper */ -static PyObject *__pyx_pw_7DracoPy_15EncodingOptions_5get_encoded_point(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyMethodDef __pyx_mdef_7DracoPy_15EncodingOptions_5get_encoded_point = {"get_encoded_point", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7DracoPy_15EncodingOptions_5get_encoded_point, METH_VARARGS|METH_KEYWORDS, 0}; -static PyObject *__pyx_pw_7DracoPy_15EncodingOptions_5get_encoded_point(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_self = 0; - PyObject *__pyx_v_point = 0; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; +static PyObject *__pyx_pw_7DracoPy_9DracoMesh_1faces(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ +static PyMethodDef __pyx_mdef_7DracoPy_9DracoMesh_1faces = {"faces", (PyCFunction)__pyx_pw_7DracoPy_9DracoMesh_1faces, METH_O, 0}; +static PyObject *__pyx_pw_7DracoPy_9DracoMesh_1faces(PyObject *__pyx_self, PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("get_encoded_point (wrapper)", 0); - { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_point,0}; - PyObject* values[2] = {0,0}; - if (unlikely(__pyx_kwds)) { - Py_ssize_t kw_args; - const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); - switch (pos_args) { - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - CYTHON_FALLTHROUGH; - case 0: break; - default: goto __pyx_L5_argtuple_error; - } - kw_args = PyDict_Size(__pyx_kwds); - switch (pos_args) { - case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--; - else goto __pyx_L5_argtuple_error; - CYTHON_FALLTHROUGH; - case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_point)) != 0)) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("get_encoded_point", 1, 2, 2, 1); __PYX_ERR(0, 57, __pyx_L3_error) - } - } - if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "get_encoded_point") < 0)) __PYX_ERR(0, 57, __pyx_L3_error) - } - } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { - goto __pyx_L5_argtuple_error; - } else { - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - } - __pyx_v_self = values[0]; - __pyx_v_point = values[1]; - } - goto __pyx_L4_argument_unpacking_done; - __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("get_encoded_point", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 57, __pyx_L3_error) - __pyx_L3_error:; - __Pyx_AddTraceback("DracoPy.EncodingOptions.get_encoded_point", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_RefNannyFinishContext(); - return NULL; - __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_7DracoPy_15EncodingOptions_4get_encoded_point(__pyx_self, __pyx_v_self, __pyx_v_point); + __Pyx_RefNannySetupContext("faces (wrapper)", 0); + __pyx_r = __pyx_pf_7DracoPy_9DracoMesh_faces(__pyx_self, ((PyObject *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_7DracoPy_15EncodingOptions_4get_encoded_point(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_point) { - PyObject *__pyx_v_encoded_point = NULL; - PyObject *__pyx_v_axis = NULL; +static PyObject *__pyx_pf_7DracoPy_9DracoMesh_faces(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; - Py_ssize_t __pyx_t_3; - PyObject *(*__pyx_t_4)(PyObject *); - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - int __pyx_t_8; - PyObject *__pyx_t_9 = NULL; - int __pyx_t_10; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("get_encoded_point", 0); + __Pyx_RefNannySetupContext("faces", 0); - /* "DracoPy.pyx":58 + /* "DracoPy.pyx":76 + * @property + * def faces(self) -> List[int]: + * return self.data_struct['faces'] # <<<<<<<<<<<<<< * - * def get_encoded_point(self, point): - * encoded_point = [] # <<<<<<<<<<<<<< - * for axis in range(self.num_axes): - * encoded_point.append(self.get_encoded_coordinate(point[axis], axis)) - */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 58, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_v_encoded_point = ((PyObject*)__pyx_t_1); - __pyx_t_1 = 0; - - /* "DracoPy.pyx":59 - * def get_encoded_point(self, point): - * encoded_point = [] - * for axis in range(self.num_axes): # <<<<<<<<<<<<<< - * encoded_point.append(self.get_encoded_coordinate(point[axis], axis)) - * return encoded_point + * @property */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_num_axes); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 59, __pyx_L1_error) + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_data_struct); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 76, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_range, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 59, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_Dict_GetItem(__pyx_t_1, __pyx_n_u_faces); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 76, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (likely(PyList_CheckExact(__pyx_t_2)) || PyTuple_CheckExact(__pyx_t_2)) { - __pyx_t_1 = __pyx_t_2; __Pyx_INCREF(__pyx_t_1); __pyx_t_3 = 0; - __pyx_t_4 = NULL; - } else { - __pyx_t_3 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 59, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 59, __pyx_L1_error) - } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - for (;;) { - if (likely(!__pyx_t_4)) { - if (likely(PyList_CheckExact(__pyx_t_1))) { - if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_1)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_2); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 59, __pyx_L1_error) - #else - __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 59, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - #endif - } else { - if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_1)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_2); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 59, __pyx_L1_error) - #else - __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 59, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - #endif - } - } else { - __pyx_t_2 = __pyx_t_4(__pyx_t_1); - 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, 59, __pyx_L1_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_2); - } - __Pyx_XDECREF_SET(__pyx_v_axis, __pyx_t_2); - __pyx_t_2 = 0; - - /* "DracoPy.pyx":60 - * encoded_point = [] - * for axis in range(self.num_axes): - * encoded_point.append(self.get_encoded_coordinate(point[axis], axis)) # <<<<<<<<<<<<<< - * return encoded_point - * - */ - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_get_encoded_coordinate); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 60, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = __Pyx_PyObject_GetItem(__pyx_v_point, __pyx_v_axis); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 60, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = NULL; - __pyx_t_8 = 0; - if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5); - if (likely(__pyx_t_7)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); - __Pyx_INCREF(__pyx_t_7); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_5, function); - __pyx_t_8 = 1; - } - } - #if CYTHON_FAST_PYCALL - if (PyFunction_Check(__pyx_t_5)) { - PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_t_6, __pyx_v_axis}; - __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 60, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - } else - #endif - #if CYTHON_FAST_PYCCALL - if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) { - PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_t_6, __pyx_v_axis}; - __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 60, __pyx_L1_error) - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - } else - #endif - { - __pyx_t_9 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 60, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_9); - if (__pyx_t_7) { - __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7); __pyx_t_7 = NULL; - } - __Pyx_GIVEREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_t_6); - __Pyx_INCREF(__pyx_v_axis); - __Pyx_GIVEREF(__pyx_v_axis); - PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_v_axis); - __pyx_t_6 = 0; - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_9, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 60, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - } - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_10 = __Pyx_PyList_Append(__pyx_v_encoded_point, __pyx_t_2); if (unlikely(__pyx_t_10 == ((int)-1))) __PYX_ERR(0, 60, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - - /* "DracoPy.pyx":59 - * def get_encoded_point(self, point): - * encoded_point = [] - * for axis in range(self.num_axes): # <<<<<<<<<<<<<< - * encoded_point.append(self.get_encoded_coordinate(point[axis], axis)) - * return encoded_point - */ - } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "DracoPy.pyx":61 - * for axis in range(self.num_axes): - * encoded_point.append(self.get_encoded_coordinate(point[axis], axis)) - * return encoded_point # <<<<<<<<<<<<<< - * - * @property - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_v_encoded_point); - __pyx_r = __pyx_v_encoded_point; + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; goto __pyx_L0; - /* "DracoPy.pyx":57 - * return self.quantization_origin[axis] + (quantized_index * self.inverse_alpha) + /* "DracoPy.pyx":75 + * class DracoMesh(DracoPointCloud): + * @property + * def faces(self) -> List[int]: # <<<<<<<<<<<<<< + * return self.data_struct['faces'] * - * def get_encoded_point(self, point): # <<<<<<<<<<<<<< - * encoded_point = [] - * for axis in range(self.num_axes): */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_9); - __Pyx_AddTraceback("DracoPy.EncodingOptions.get_encoded_point", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("DracoPy.DracoMesh.faces", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; - __Pyx_XDECREF(__pyx_v_encoded_point); - __Pyx_XDECREF(__pyx_v_axis); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "DracoPy.pyx":64 +/* "DracoPy.pyx":79 * * @property - * def num_axes(self): # <<<<<<<<<<<<<< - * return 3 + * def normals(self): # <<<<<<<<<<<<<< + * return self.data_struct['normals'] * */ /* Python wrapper */ -static PyObject *__pyx_pw_7DracoPy_15EncodingOptions_7num_axes(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ -static PyMethodDef __pyx_mdef_7DracoPy_15EncodingOptions_7num_axes = {"num_axes", (PyCFunction)__pyx_pw_7DracoPy_15EncodingOptions_7num_axes, METH_O, 0}; -static PyObject *__pyx_pw_7DracoPy_15EncodingOptions_7num_axes(PyObject *__pyx_self, PyObject *__pyx_v_self) { +static PyObject *__pyx_pw_7DracoPy_9DracoMesh_3normals(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ +static PyMethodDef __pyx_mdef_7DracoPy_9DracoMesh_3normals = {"normals", (PyCFunction)__pyx_pw_7DracoPy_9DracoMesh_3normals, METH_O, 0}; +static PyObject *__pyx_pw_7DracoPy_9DracoMesh_3normals(PyObject *__pyx_self, PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("num_axes (wrapper)", 0); - __pyx_r = __pyx_pf_7DracoPy_15EncodingOptions_6num_axes(__pyx_self, ((PyObject *)__pyx_v_self)); + __Pyx_RefNannySetupContext("normals (wrapper)", 0); + __pyx_r = __pyx_pf_7DracoPy_9DracoMesh_2normals(__pyx_self, ((PyObject *)__pyx_v_self)); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_7DracoPy_15EncodingOptions_6num_axes(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self) { +static PyObject *__pyx_pf_7DracoPy_9DracoMesh_2normals(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("num_axes", 0); + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("normals", 0); - /* "DracoPy.pyx":65 + /* "DracoPy.pyx":80 * @property - * def num_axes(self): - * return 3 # <<<<<<<<<<<<<< + * def normals(self): + * return self.data_struct['normals'] # <<<<<<<<<<<<<< + * * - * class FileTypeException(Exception): */ __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(__pyx_int_3); - __pyx_r = __pyx_int_3; + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_data_struct); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 80, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_Dict_GetItem(__pyx_t_1, __pyx_n_u_normals); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 80, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; goto __pyx_L0; - /* "DracoPy.pyx":64 + /* "DracoPy.pyx":79 * * @property - * def num_axes(self): # <<<<<<<<<<<<<< - * return 3 + * def normals(self): # <<<<<<<<<<<<<< + * return self.data_struct['normals'] * */ /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("DracoPy.DracoMesh.normals", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "DracoPy.pyx":73 - * pass +/* "DracoPy.pyx":84 * - * def encode_mesh_to_buffer(points, faces, quantization_bits=14, compression_level=1, quantization_range=-1, quantization_origin=None, create_metadata=False): # <<<<<<<<<<<<<< - * """ - * Encode a list or numpy array of points/vertices (float) and faces (unsigned int) to a draco buffer. + * class EncodingOptions(object): + * def __init__(self, quantization_bits, quantization_range, quantization_origin): # <<<<<<<<<<<<<< + * self.quantization_bits = quantization_bits + * self.quantization_range = quantization_range */ /* Python wrapper */ -static PyObject *__pyx_pw_7DracoPy_1encode_mesh_to_buffer(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_7DracoPy_encode_mesh_to_buffer[] = "\n Encode a list or numpy array of points/vertices (float) and faces (unsigned int) to a draco buffer.\n Quantization bits should be an integer between 0 and 31\n Compression level should be an integer between 0 and 10\n Quantization_range is a float representing the size of the bounding cube for the mesh.\n By default it is the range of the dimension of the input vertices with greatest range.\n Quantization_origin is the point in space where the bounding box begins. By default it is\n a point where each coordinate is the minimum of that coordinate among the input vertices.\n "; -static PyMethodDef __pyx_mdef_7DracoPy_1encode_mesh_to_buffer = {"encode_mesh_to_buffer", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7DracoPy_1encode_mesh_to_buffer, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7DracoPy_encode_mesh_to_buffer}; -static PyObject *__pyx_pw_7DracoPy_1encode_mesh_to_buffer(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_points = 0; - PyObject *__pyx_v_faces = 0; +static PyObject *__pyx_pw_7DracoPy_15EncodingOptions_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyMethodDef __pyx_mdef_7DracoPy_15EncodingOptions_1__init__ = {"__init__", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7DracoPy_15EncodingOptions_1__init__, METH_VARARGS|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_7DracoPy_15EncodingOptions_1__init__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_self = 0; PyObject *__pyx_v_quantization_bits = 0; - PyObject *__pyx_v_compression_level = 0; PyObject *__pyx_v_quantization_range = 0; PyObject *__pyx_v_quantization_origin = 0; - PyObject *__pyx_v_create_metadata = 0; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("encode_mesh_to_buffer (wrapper)", 0); + __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_points,&__pyx_n_s_faces,&__pyx_n_s_quantization_bits,&__pyx_n_s_compression_level,&__pyx_n_s_quantization_range,&__pyx_n_s_quantization_origin,&__pyx_n_s_create_metadata,0}; - PyObject* values[7] = {0,0,0,0,0,0,0}; - values[2] = ((PyObject *)__pyx_int_14); - values[3] = ((PyObject *)__pyx_int_1); - values[4] = ((PyObject *)__pyx_int_neg_1); - values[5] = ((PyObject *)Py_None); - values[6] = ((PyObject *)Py_False); + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_quantization_bits,&__pyx_n_s_quantization_range,&__pyx_n_s_quantization_origin,0}; + PyObject* values[4] = {0,0,0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { - case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); - CYTHON_FALLTHROUGH; - case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - CYTHON_FALLTHROUGH; - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - CYTHON_FALLTHROUGH; case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); CYTHON_FALLTHROUGH; case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); @@ -3359,611 +3838,163 @@ static PyObject *__pyx_pw_7DracoPy_1encode_mesh_to_buffer(PyObject *__pyx_self, kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_points)) != 0)) kw_args--; + if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: - if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_faces)) != 0)) kw_args--; + if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_quantization_bits)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("encode_mesh_to_buffer", 0, 2, 7, 1); __PYX_ERR(0, 73, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__init__", 1, 4, 4, 1); __PYX_ERR(0, 84, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: - if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_quantization_bits); - if (value) { values[2] = value; kw_args--; } + if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_quantization_range)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__init__", 1, 4, 4, 2); __PYX_ERR(0, 84, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 3: - if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_compression_level); - if (value) { values[3] = value; kw_args--; } - } - CYTHON_FALLTHROUGH; - case 4: - if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_quantization_range); - if (value) { values[4] = value; kw_args--; } - } - CYTHON_FALLTHROUGH; - case 5: - if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_quantization_origin); - if (value) { values[5] = value; kw_args--; } - } - CYTHON_FALLTHROUGH; - case 6: - if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_create_metadata); - if (value) { values[6] = value; kw_args--; } + if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_quantization_origin)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__init__", 1, 4, 4, 3); __PYX_ERR(0, 84, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "encode_mesh_to_buffer") < 0)) __PYX_ERR(0, 73, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 84, __pyx_L3_error) } + } else if (PyTuple_GET_SIZE(__pyx_args) != 4) { + goto __pyx_L5_argtuple_error; } else { - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); - CYTHON_FALLTHROUGH; - case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - CYTHON_FALLTHROUGH; - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - CYTHON_FALLTHROUGH; - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - break; - default: goto __pyx_L5_argtuple_error; - } + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + values[3] = PyTuple_GET_ITEM(__pyx_args, 3); } - __pyx_v_points = values[0]; - __pyx_v_faces = values[1]; - __pyx_v_quantization_bits = values[2]; - __pyx_v_compression_level = values[3]; - __pyx_v_quantization_range = values[4]; - __pyx_v_quantization_origin = values[5]; - __pyx_v_create_metadata = values[6]; + __pyx_v_self = values[0]; + __pyx_v_quantization_bits = values[1]; + __pyx_v_quantization_range = values[2]; + __pyx_v_quantization_origin = values[3]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("encode_mesh_to_buffer", 0, 2, 7, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 73, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__init__", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 84, __pyx_L3_error) __pyx_L3_error:; - __Pyx_AddTraceback("DracoPy.encode_mesh_to_buffer", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("DracoPy.EncodingOptions.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_7DracoPy_encode_mesh_to_buffer(__pyx_self, __pyx_v_points, __pyx_v_faces, __pyx_v_quantization_bits, __pyx_v_compression_level, __pyx_v_quantization_range, __pyx_v_quantization_origin, __pyx_v_create_metadata); + __pyx_r = __pyx_pf_7DracoPy_15EncodingOptions___init__(__pyx_self, __pyx_v_self, __pyx_v_quantization_bits, __pyx_v_quantization_range, __pyx_v_quantization_origin); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_7DracoPy_encode_mesh_to_buffer(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_points, PyObject *__pyx_v_faces, PyObject *__pyx_v_quantization_bits, PyObject *__pyx_v_compression_level, PyObject *__pyx_v_quantization_range, PyObject *__pyx_v_quantization_origin, PyObject *__pyx_v_create_metadata) { - float *__pyx_v_quant_origin; - PyObject *__pyx_v_num_dims = NULL; - PyObject *__pyx_v_dim = NULL; - struct DracoFunctions::EncodedObject __pyx_v_encoded_mesh; +static PyObject *__pyx_pf_7DracoPy_15EncodingOptions___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_quantization_bits, PyObject *__pyx_v_quantization_range, PyObject *__pyx_v_quantization_origin) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - int __pyx_t_4; - int __pyx_t_5; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - size_t __pyx_t_8; - Py_ssize_t __pyx_t_9; - PyObject *(*__pyx_t_10)(PyObject *); - float __pyx_t_11; - Py_ssize_t __pyx_t_12; - std::vector __pyx_t_13; - std::vector __pyx_t_14; - int __pyx_t_15; - int __pyx_t_16; - bool __pyx_t_17; - struct DracoFunctions::EncodedObject __pyx_t_18; - PyObject *__pyx_t_19 = NULL; - PyObject *__pyx_t_20 = NULL; - PyObject *__pyx_t_21 = NULL; - PyObject *__pyx_t_22 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("encode_mesh_to_buffer", 0); - - /* "DracoPy.pyx":83 - * a point where each coordinate is the minimum of that coordinate among the input vertices. - * """ - * cdef float* quant_origin = NULL # <<<<<<<<<<<<<< - * try: - * num_dims = 3 - */ - __pyx_v_quant_origin = NULL; - - /* "DracoPy.pyx":84 - * """ - * cdef float* quant_origin = NULL - * try: # <<<<<<<<<<<<<< - * num_dims = 3 - * if quantization_origin is not None: - */ - { - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3); - __Pyx_XGOTREF(__pyx_t_1); - __Pyx_XGOTREF(__pyx_t_2); - __Pyx_XGOTREF(__pyx_t_3); - /*try:*/ { - - /* "DracoPy.pyx":85 - * cdef float* quant_origin = NULL - * try: - * num_dims = 3 # <<<<<<<<<<<<<< - * if quantization_origin is not None: - * quant_origin = PyMem_Malloc(sizeof(float) * num_dims) - */ - __Pyx_INCREF(__pyx_int_3); - __pyx_v_num_dims = __pyx_int_3; - - /* "DracoPy.pyx":86 - * try: - * num_dims = 3 - * if quantization_origin is not None: # <<<<<<<<<<<<<< - * quant_origin = PyMem_Malloc(sizeof(float) * num_dims) - * for dim in range(num_dims): - */ - __pyx_t_4 = (__pyx_v_quantization_origin != Py_None); - __pyx_t_5 = (__pyx_t_4 != 0); - if (__pyx_t_5) { - - /* "DracoPy.pyx":87 - * num_dims = 3 - * if quantization_origin is not None: - * quant_origin = PyMem_Malloc(sizeof(float) * num_dims) # <<<<<<<<<<<<<< - * for dim in range(num_dims): - * quant_origin[dim] = quantization_origin[dim] - */ - __pyx_t_6 = __Pyx_PyInt_FromSize_t((sizeof(float))); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 87, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = PyNumber_Multiply(__pyx_t_6, __pyx_v_num_dims); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 87, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_8 = __Pyx_PyInt_As_size_t(__pyx_t_7); if (unlikely((__pyx_t_8 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 87, __pyx_L3_error) - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_v_quant_origin = ((float *)PyMem_Malloc(__pyx_t_8)); - - /* "DracoPy.pyx":88 - * if quantization_origin is not None: - * quant_origin = PyMem_Malloc(sizeof(float) * num_dims) - * for dim in range(num_dims): # <<<<<<<<<<<<<< - * quant_origin[dim] = quantization_origin[dim] - * encoded_mesh = DracoPy.encode_mesh(points, faces, quantization_bits, compression_level, quantization_range, quant_origin, create_metadata) - */ - __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_builtin_range, __pyx_v_num_dims); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 88, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_7); - if (likely(PyList_CheckExact(__pyx_t_7)) || PyTuple_CheckExact(__pyx_t_7)) { - __pyx_t_6 = __pyx_t_7; __Pyx_INCREF(__pyx_t_6); __pyx_t_9 = 0; - __pyx_t_10 = NULL; - } else { - __pyx_t_9 = -1; __pyx_t_6 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 88, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_10 = Py_TYPE(__pyx_t_6)->tp_iternext; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 88, __pyx_L3_error) - } - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - for (;;) { - if (likely(!__pyx_t_10)) { - if (likely(PyList_CheckExact(__pyx_t_6))) { - if (__pyx_t_9 >= PyList_GET_SIZE(__pyx_t_6)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_7 = PyList_GET_ITEM(__pyx_t_6, __pyx_t_9); __Pyx_INCREF(__pyx_t_7); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 88, __pyx_L3_error) - #else - __pyx_t_7 = PySequence_ITEM(__pyx_t_6, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 88, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_7); - #endif - } else { - if (__pyx_t_9 >= PyTuple_GET_SIZE(__pyx_t_6)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_9); __Pyx_INCREF(__pyx_t_7); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 88, __pyx_L3_error) - #else - __pyx_t_7 = PySequence_ITEM(__pyx_t_6, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 88, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_7); - #endif - } - } else { - __pyx_t_7 = __pyx_t_10(__pyx_t_6); - if (unlikely(!__pyx_t_7)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 88, __pyx_L3_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_7); - } - __Pyx_XDECREF_SET(__pyx_v_dim, __pyx_t_7); - __pyx_t_7 = 0; - - /* "DracoPy.pyx":89 - * quant_origin = PyMem_Malloc(sizeof(float) * num_dims) - * for dim in range(num_dims): - * quant_origin[dim] = quantization_origin[dim] # <<<<<<<<<<<<<< - * encoded_mesh = DracoPy.encode_mesh(points, faces, quantization_bits, compression_level, quantization_range, quant_origin, create_metadata) - * if quant_origin != NULL: - */ - __pyx_t_7 = __Pyx_PyObject_GetItem(__pyx_v_quantization_origin, __pyx_v_dim); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 89, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_11 = __pyx_PyFloat_AsFloat(__pyx_t_7); if (unlikely((__pyx_t_11 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 89, __pyx_L3_error) - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_v_dim); if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 89, __pyx_L3_error) - (__pyx_v_quant_origin[__pyx_t_12]) = __pyx_t_11; - - /* "DracoPy.pyx":88 - * if quantization_origin is not None: - * quant_origin = PyMem_Malloc(sizeof(float) * num_dims) - * for dim in range(num_dims): # <<<<<<<<<<<<<< - * quant_origin[dim] = quantization_origin[dim] - * encoded_mesh = DracoPy.encode_mesh(points, faces, quantization_bits, compression_level, quantization_range, quant_origin, create_metadata) - */ - } - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - - /* "DracoPy.pyx":86 - * try: - * num_dims = 3 - * if quantization_origin is not None: # <<<<<<<<<<<<<< - * quant_origin = PyMem_Malloc(sizeof(float) * num_dims) - * for dim in range(num_dims): - */ - } - - /* "DracoPy.pyx":90 - * for dim in range(num_dims): - * quant_origin[dim] = quantization_origin[dim] - * encoded_mesh = DracoPy.encode_mesh(points, faces, quantization_bits, compression_level, quantization_range, quant_origin, create_metadata) # <<<<<<<<<<<<<< - * if quant_origin != NULL: - * PyMem_Free(quant_origin) - */ - __pyx_t_13 = __pyx_convert_vector_from_py_float(__pyx_v_points); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 90, __pyx_L3_error) - __pyx_t_14 = __pyx_convert_vector_from_py_uint32_t(__pyx_v_faces); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 90, __pyx_L3_error) - __pyx_t_15 = __Pyx_PyInt_As_int(__pyx_v_quantization_bits); if (unlikely((__pyx_t_15 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 90, __pyx_L3_error) - __pyx_t_16 = __Pyx_PyInt_As_int(__pyx_v_compression_level); if (unlikely((__pyx_t_16 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 90, __pyx_L3_error) - __pyx_t_11 = __pyx_PyFloat_AsFloat(__pyx_v_quantization_range); if (unlikely((__pyx_t_11 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 90, __pyx_L3_error) - __pyx_t_17 = __Pyx_PyObject_IsTrue(__pyx_v_create_metadata); if (unlikely((__pyx_t_17 == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 90, __pyx_L3_error) - try { - __pyx_t_18 = DracoFunctions::encode_mesh(__pyx_t_13, __pyx_t_14, __pyx_t_15, __pyx_t_16, __pyx_t_11, __pyx_v_quant_origin, __pyx_t_17); - } catch(...) { - __Pyx_CppExn2PyErr(); - __PYX_ERR(0, 90, __pyx_L3_error) - } - __pyx_v_encoded_mesh = __pyx_t_18; - - /* "DracoPy.pyx":91 - * quant_origin[dim] = quantization_origin[dim] - * encoded_mesh = DracoPy.encode_mesh(points, faces, quantization_bits, compression_level, quantization_range, quant_origin, create_metadata) - * if quant_origin != NULL: # <<<<<<<<<<<<<< - * PyMem_Free(quant_origin) - * if encoded_mesh.encode_status == DracoPy.encoding_status.successful_encoding: - */ - __pyx_t_5 = ((__pyx_v_quant_origin != NULL) != 0); - if (__pyx_t_5) { - - /* "DracoPy.pyx":92 - * encoded_mesh = DracoPy.encode_mesh(points, faces, quantization_bits, compression_level, quantization_range, quant_origin, create_metadata) - * if quant_origin != NULL: - * PyMem_Free(quant_origin) # <<<<<<<<<<<<<< - * if encoded_mesh.encode_status == DracoPy.encoding_status.successful_encoding: - * return bytes(encoded_mesh.buffer) - */ - PyMem_Free(__pyx_v_quant_origin); - - /* "DracoPy.pyx":91 - * quant_origin[dim] = quantization_origin[dim] - * encoded_mesh = DracoPy.encode_mesh(points, faces, quantization_bits, compression_level, quantization_range, quant_origin, create_metadata) - * if quant_origin != NULL: # <<<<<<<<<<<<<< - * PyMem_Free(quant_origin) - * if encoded_mesh.encode_status == DracoPy.encoding_status.successful_encoding: - */ - } - - /* "DracoPy.pyx":93 - * if quant_origin != NULL: - * PyMem_Free(quant_origin) - * if encoded_mesh.encode_status == DracoPy.encoding_status.successful_encoding: # <<<<<<<<<<<<<< - * return bytes(encoded_mesh.buffer) - * elif encoded_mesh.encode_status == DracoPy.encoding_status.failed_during_encoding: - */ - switch (__pyx_v_encoded_mesh.encode_status) { - case DracoFunctions::successful_encoding: - - /* "DracoPy.pyx":94 - * PyMem_Free(quant_origin) - * if encoded_mesh.encode_status == DracoPy.encoding_status.successful_encoding: - * return bytes(encoded_mesh.buffer) # <<<<<<<<<<<<<< - * elif encoded_mesh.encode_status == DracoPy.encoding_status.failed_during_encoding: - * raise EncodingFailedException('Invalid mesh') - */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_6 = __pyx_convert_vector_to_py_unsigned_char(__pyx_v_encoded_mesh.buffer); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 94, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyBytes_Type)), __pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 94, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_r = __pyx_t_7; - __pyx_t_7 = 0; - goto __pyx_L7_try_return; - - /* "DracoPy.pyx":93 - * if quant_origin != NULL: - * PyMem_Free(quant_origin) - * if encoded_mesh.encode_status == DracoPy.encoding_status.successful_encoding: # <<<<<<<<<<<<<< - * return bytes(encoded_mesh.buffer) - * elif encoded_mesh.encode_status == DracoPy.encoding_status.failed_during_encoding: - */ - break; - case DracoFunctions::failed_during_encoding: - - /* "DracoPy.pyx":96 - * return bytes(encoded_mesh.buffer) - * elif encoded_mesh.encode_status == DracoPy.encoding_status.failed_during_encoding: - * raise EncodingFailedException('Invalid mesh') # <<<<<<<<<<<<<< - * except EncodingFailedException: - * raise EncodingFailedException('Invalid mesh') - */ - __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_EncodingFailedException); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 96, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_19 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) { - __pyx_t_19 = PyMethod_GET_SELF(__pyx_t_6); - if (likely(__pyx_t_19)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); - __Pyx_INCREF(__pyx_t_19); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_6, function); - } - } - __pyx_t_7 = (__pyx_t_19) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_19, __pyx_kp_u_Invalid_mesh) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_kp_u_Invalid_mesh); - __Pyx_XDECREF(__pyx_t_19); __pyx_t_19 = 0; - if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 96, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_Raise(__pyx_t_7, 0, 0, 0); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __PYX_ERR(0, 96, __pyx_L3_error) - - /* "DracoPy.pyx":95 - * if encoded_mesh.encode_status == DracoPy.encoding_status.successful_encoding: - * return bytes(encoded_mesh.buffer) - * elif encoded_mesh.encode_status == DracoPy.encoding_status.failed_during_encoding: # <<<<<<<<<<<<<< - * raise EncodingFailedException('Invalid mesh') - * except EncodingFailedException: - */ - break; - default: break; - } - - /* "DracoPy.pyx":84 - * """ - * cdef float* quant_origin = NULL - * try: # <<<<<<<<<<<<<< - * num_dims = 3 - * if quantization_origin is not None: - */ - } - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - goto __pyx_L8_try_end; - __pyx_L3_error:; - __Pyx_XDECREF(__pyx_t_19); __pyx_t_19 = 0; - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - - /* "DracoPy.pyx":97 - * elif encoded_mesh.encode_status == DracoPy.encoding_status.failed_during_encoding: - * raise EncodingFailedException('Invalid mesh') - * except EncodingFailedException: # <<<<<<<<<<<<<< - * raise EncodingFailedException('Invalid mesh') - * except: - */ - __Pyx_ErrFetch(&__pyx_t_7, &__pyx_t_6, &__pyx_t_19); - __Pyx_GetModuleGlobalName(__pyx_t_20, __pyx_n_s_EncodingFailedException); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 97, __pyx_L5_except_error) - __Pyx_GOTREF(__pyx_t_20); - __pyx_t_16 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_7, __pyx_t_20); - __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0; - __Pyx_ErrRestore(__pyx_t_7, __pyx_t_6, __pyx_t_19); - __pyx_t_7 = 0; __pyx_t_6 = 0; __pyx_t_19 = 0; - if (__pyx_t_16) { - __Pyx_AddTraceback("DracoPy.encode_mesh_to_buffer", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_19, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(0, 97, __pyx_L5_except_error) - __Pyx_GOTREF(__pyx_t_19); - __Pyx_GOTREF(__pyx_t_6); - __Pyx_GOTREF(__pyx_t_7); - - /* "DracoPy.pyx":98 - * raise EncodingFailedException('Invalid mesh') - * except EncodingFailedException: - * raise EncodingFailedException('Invalid mesh') # <<<<<<<<<<<<<< - * except: - * if quant_origin != NULL: - */ - __Pyx_GetModuleGlobalName(__pyx_t_21, __pyx_n_s_EncodingFailedException); if (unlikely(!__pyx_t_21)) __PYX_ERR(0, 98, __pyx_L5_except_error) - __Pyx_GOTREF(__pyx_t_21); - __pyx_t_22 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_21))) { - __pyx_t_22 = PyMethod_GET_SELF(__pyx_t_21); - if (likely(__pyx_t_22)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_21); - __Pyx_INCREF(__pyx_t_22); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_21, function); - } - } - __pyx_t_20 = (__pyx_t_22) ? __Pyx_PyObject_Call2Args(__pyx_t_21, __pyx_t_22, __pyx_kp_u_Invalid_mesh) : __Pyx_PyObject_CallOneArg(__pyx_t_21, __pyx_kp_u_Invalid_mesh); - __Pyx_XDECREF(__pyx_t_22); __pyx_t_22 = 0; - if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 98, __pyx_L5_except_error) - __Pyx_GOTREF(__pyx_t_20); - __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0; - __Pyx_Raise(__pyx_t_20, 0, 0, 0); - __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0; - __PYX_ERR(0, 98, __pyx_L5_except_error) - } + __Pyx_RefNannySetupContext("__init__", 0); - /* "DracoPy.pyx":99 - * except EncodingFailedException: - * raise EncodingFailedException('Invalid mesh') - * except: # <<<<<<<<<<<<<< - * if quant_origin != NULL: - * PyMem_Free(quant_origin) + /* "DracoPy.pyx":85 + * class EncodingOptions(object): + * def __init__(self, quantization_bits, quantization_range, quantization_origin): + * self.quantization_bits = quantization_bits # <<<<<<<<<<<<<< + * self.quantization_range = quantization_range + * self.quantization_origin = quantization_origin */ - /*except:*/ { - __Pyx_AddTraceback("DracoPy.encode_mesh_to_buffer", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_6, &__pyx_t_19) < 0) __PYX_ERR(0, 99, __pyx_L5_except_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_GOTREF(__pyx_t_6); - __Pyx_GOTREF(__pyx_t_19); + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_quantization_bits, __pyx_v_quantization_bits) < 0) __PYX_ERR(0, 85, __pyx_L1_error) - /* "DracoPy.pyx":100 - * raise EncodingFailedException('Invalid mesh') - * except: - * if quant_origin != NULL: # <<<<<<<<<<<<<< - * PyMem_Free(quant_origin) - * raise ValueError("Input invalid") + /* "DracoPy.pyx":86 + * def __init__(self, quantization_bits, quantization_range, quantization_origin): + * self.quantization_bits = quantization_bits + * self.quantization_range = quantization_range # <<<<<<<<<<<<<< + * self.quantization_origin = quantization_origin + * self.inverse_alpha = quantization_range / ((2 ** quantization_bits) - 1) */ - __pyx_t_5 = ((__pyx_v_quant_origin != NULL) != 0); - if (__pyx_t_5) { + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_quantization_range, __pyx_v_quantization_range) < 0) __PYX_ERR(0, 86, __pyx_L1_error) - /* "DracoPy.pyx":101 - * except: - * if quant_origin != NULL: - * PyMem_Free(quant_origin) # <<<<<<<<<<<<<< - * raise ValueError("Input invalid") + /* "DracoPy.pyx":87 + * self.quantization_bits = quantization_bits + * self.quantization_range = quantization_range + * self.quantization_origin = quantization_origin # <<<<<<<<<<<<<< + * self.inverse_alpha = quantization_range / ((2 ** quantization_bits) - 1) * */ - PyMem_Free(__pyx_v_quant_origin); - - /* "DracoPy.pyx":100 - * raise EncodingFailedException('Invalid mesh') - * except: - * if quant_origin != NULL: # <<<<<<<<<<<<<< - * PyMem_Free(quant_origin) - * raise ValueError("Input invalid") - */ - } + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_quantization_origin, __pyx_v_quantization_origin) < 0) __PYX_ERR(0, 87, __pyx_L1_error) - /* "DracoPy.pyx":102 - * if quant_origin != NULL: - * PyMem_Free(quant_origin) - * raise ValueError("Input invalid") # <<<<<<<<<<<<<< + /* "DracoPy.pyx":88 + * self.quantization_range = quantization_range + * self.quantization_origin = quantization_origin + * self.inverse_alpha = quantization_range / ((2 ** quantization_bits) - 1) # <<<<<<<<<<<<<< * - * def encode_point_cloud_to_buffer(points, quantization_bits=14, compression_level=1, quantization_range=-1, quantization_origin=None, create_metadata=False): - */ - __pyx_t_20 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 102, __pyx_L5_except_error) - __Pyx_GOTREF(__pyx_t_20); - __Pyx_Raise(__pyx_t_20, 0, 0, 0); - __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0; - __PYX_ERR(0, 102, __pyx_L5_except_error) - } - __pyx_L5_except_error:; - - /* "DracoPy.pyx":84 - * """ - * cdef float* quant_origin = NULL - * try: # <<<<<<<<<<<<<< - * num_dims = 3 - * if quantization_origin is not None: + * def get_encoded_coordinate(self, value, axis): */ - __Pyx_XGIVEREF(__pyx_t_1); - __Pyx_XGIVEREF(__pyx_t_2); - __Pyx_XGIVEREF(__pyx_t_3); - __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); - goto __pyx_L1_error; - __pyx_L7_try_return:; - __Pyx_XGIVEREF(__pyx_t_1); - __Pyx_XGIVEREF(__pyx_t_2); - __Pyx_XGIVEREF(__pyx_t_3); - __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); - goto __pyx_L0; - __pyx_L8_try_end:; - } + __pyx_t_1 = __Pyx_PyNumber_PowerOf2(__pyx_int_2, __pyx_v_quantization_bits, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 88, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyInt_SubtractObjC(__pyx_t_1, __pyx_int_1, 1, 0, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 88, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyNumber_Divide(__pyx_v_quantization_range, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 88, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (__Pyx_PyObject_SetAttrStr(__pyx_v_self, __pyx_n_s_inverse_alpha, __pyx_t_1) < 0) __PYX_ERR(0, 88, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "DracoPy.pyx":73 - * pass + /* "DracoPy.pyx":84 * - * def encode_mesh_to_buffer(points, faces, quantization_bits=14, compression_level=1, quantization_range=-1, quantization_origin=None, create_metadata=False): # <<<<<<<<<<<<<< - * """ - * Encode a list or numpy array of points/vertices (float) and faces (unsigned int) to a draco buffer. + * class EncodingOptions(object): + * def __init__(self, quantization_bits, quantization_range, quantization_origin): # <<<<<<<<<<<<<< + * self.quantization_bits = quantization_bits + * self.quantization_range = quantization_range */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_19); - __Pyx_XDECREF(__pyx_t_20); - __Pyx_XDECREF(__pyx_t_21); - __Pyx_XDECREF(__pyx_t_22); - __Pyx_AddTraceback("DracoPy.encode_mesh_to_buffer", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("DracoPy.EncodingOptions.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; - __Pyx_XDECREF(__pyx_v_num_dims); - __Pyx_XDECREF(__pyx_v_dim); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "DracoPy.pyx":104 - * raise ValueError("Input invalid") +/* "DracoPy.pyx":90 + * self.inverse_alpha = quantization_range / ((2 ** quantization_bits) - 1) * - * def encode_point_cloud_to_buffer(points, quantization_bits=14, compression_level=1, quantization_range=-1, quantization_origin=None, create_metadata=False): # <<<<<<<<<<<<<< - * """ - * Encode a list or numpy array of points/vertices (float) to a draco buffer. + * def get_encoded_coordinate(self, value, axis): # <<<<<<<<<<<<<< + * if value < self.quantization_origin[axis] or value > (self.quantization_origin[axis] + self.quantization_range): + * raise ValueError('Specified value out of encoded range') */ /* Python wrapper */ -static PyObject *__pyx_pw_7DracoPy_3encode_point_cloud_to_buffer(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_7DracoPy_2encode_point_cloud_to_buffer[] = "\n Encode a list or numpy array of points/vertices (float) to a draco buffer.\n Quantization bits should be an integer between 0 and 31\n Compression level should be an integer between 0 and 10\n Quantization_range is a float representing the size of the bounding cube for the mesh.\n By default it is the range of the dimension of the input vertices with greatest range.\n Quantization_origin is the point in space where the bounding box begins. By default it is\n a point where each coordinate is the minimum of that coordinate among the input vertices.\n "; -static PyMethodDef __pyx_mdef_7DracoPy_3encode_point_cloud_to_buffer = {"encode_point_cloud_to_buffer", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7DracoPy_3encode_point_cloud_to_buffer, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7DracoPy_2encode_point_cloud_to_buffer}; -static PyObject *__pyx_pw_7DracoPy_3encode_point_cloud_to_buffer(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - PyObject *__pyx_v_points = 0; - PyObject *__pyx_v_quantization_bits = 0; - PyObject *__pyx_v_compression_level = 0; - PyObject *__pyx_v_quantization_range = 0; - PyObject *__pyx_v_quantization_origin = 0; - PyObject *__pyx_v_create_metadata = 0; +static PyObject *__pyx_pw_7DracoPy_15EncodingOptions_3get_encoded_coordinate(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyMethodDef __pyx_mdef_7DracoPy_15EncodingOptions_3get_encoded_coordinate = {"get_encoded_coordinate", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7DracoPy_15EncodingOptions_3get_encoded_coordinate, METH_VARARGS|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_7DracoPy_15EncodingOptions_3get_encoded_coordinate(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_self = 0; + PyObject *__pyx_v_value = 0; + PyObject *__pyx_v_axis = 0; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("encode_point_cloud_to_buffer (wrapper)", 0); + __Pyx_RefNannySetupContext("get_encoded_coordinate (wrapper)", 0); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_points,&__pyx_n_s_quantization_bits,&__pyx_n_s_compression_level,&__pyx_n_s_quantization_range,&__pyx_n_s_quantization_origin,&__pyx_n_s_create_metadata,0}; - PyObject* values[6] = {0,0,0,0,0,0}; - values[1] = ((PyObject *)__pyx_int_14); - values[2] = ((PyObject *)__pyx_int_1); - values[3] = ((PyObject *)__pyx_int_neg_1); - values[4] = ((PyObject *)Py_None); - values[5] = ((PyObject *)Py_False); + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_value,&__pyx_n_s_axis,0}; + PyObject* values[3] = {0,0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { - case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - CYTHON_FALLTHROUGH; - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - CYTHON_FALLTHROUGH; - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - CYTHON_FALLTHROUGH; case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); CYTHON_FALLTHROUGH; case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); @@ -3976,734 +4007,635 @@ static PyObject *__pyx_pw_7DracoPy_3encode_point_cloud_to_buffer(PyObject *__pyx kw_args = PyDict_Size(__pyx_kwds); switch (pos_args) { case 0: - if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_points)) != 0)) kw_args--; + if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--; else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: - if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_quantization_bits); - if (value) { values[1] = value; kw_args--; } + if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_value)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("get_encoded_coordinate", 1, 3, 3, 1); __PYX_ERR(0, 90, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: - if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_compression_level); - if (value) { values[2] = value; kw_args--; } - } - CYTHON_FALLTHROUGH; - case 3: - if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_quantization_range); - if (value) { values[3] = value; kw_args--; } - } - CYTHON_FALLTHROUGH; - case 4: - if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_quantization_origin); - if (value) { values[4] = value; kw_args--; } - } - CYTHON_FALLTHROUGH; - case 5: - if (kw_args > 0) { - PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_create_metadata); - if (value) { values[5] = value; kw_args--; } + if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_axis)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("get_encoded_coordinate", 1, 3, 3, 2); __PYX_ERR(0, 90, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "encode_point_cloud_to_buffer") < 0)) __PYX_ERR(0, 104, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "get_encoded_coordinate") < 0)) __PYX_ERR(0, 90, __pyx_L3_error) } + } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { + goto __pyx_L5_argtuple_error; } else { - switch (PyTuple_GET_SIZE(__pyx_args)) { - case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); - CYTHON_FALLTHROUGH; - case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); - CYTHON_FALLTHROUGH; - case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); - CYTHON_FALLTHROUGH; - case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); - CYTHON_FALLTHROUGH; - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); - CYTHON_FALLTHROUGH; - case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); - break; - default: goto __pyx_L5_argtuple_error; - } + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[2] = PyTuple_GET_ITEM(__pyx_args, 2); } - __pyx_v_points = values[0]; - __pyx_v_quantization_bits = values[1]; - __pyx_v_compression_level = values[2]; - __pyx_v_quantization_range = values[3]; - __pyx_v_quantization_origin = values[4]; - __pyx_v_create_metadata = values[5]; + __pyx_v_self = values[0]; + __pyx_v_value = values[1]; + __pyx_v_axis = values[2]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("encode_point_cloud_to_buffer", 0, 1, 6, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 104, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("get_encoded_coordinate", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 90, __pyx_L3_error) __pyx_L3_error:; - __Pyx_AddTraceback("DracoPy.encode_point_cloud_to_buffer", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("DracoPy.EncodingOptions.get_encoded_coordinate", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_7DracoPy_2encode_point_cloud_to_buffer(__pyx_self, __pyx_v_points, __pyx_v_quantization_bits, __pyx_v_compression_level, __pyx_v_quantization_range, __pyx_v_quantization_origin, __pyx_v_create_metadata); + __pyx_r = __pyx_pf_7DracoPy_15EncodingOptions_2get_encoded_coordinate(__pyx_self, __pyx_v_self, __pyx_v_value, __pyx_v_axis); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_7DracoPy_2encode_point_cloud_to_buffer(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_points, PyObject *__pyx_v_quantization_bits, PyObject *__pyx_v_compression_level, PyObject *__pyx_v_quantization_range, PyObject *__pyx_v_quantization_origin, PyObject *__pyx_v_create_metadata) { - float *__pyx_v_quant_origin; - PyObject *__pyx_v_num_dims = NULL; - PyObject *__pyx_v_dim = NULL; - struct DracoFunctions::EncodedObject __pyx_v_encoded_point_cloud; +static PyObject *__pyx_pf_7DracoPy_15EncodingOptions_2get_encoded_coordinate(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_value, PyObject *__pyx_v_axis) { + PyObject *__pyx_v_difference = NULL; + PyObject *__pyx_v_quantized_index = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; + int __pyx_t_1; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; int __pyx_t_4; - int __pyx_t_5; + PyObject *__pyx_t_5 = NULL; PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - size_t __pyx_t_8; - Py_ssize_t __pyx_t_9; - PyObject *(*__pyx_t_10)(PyObject *); - float __pyx_t_11; - Py_ssize_t __pyx_t_12; - std::vector __pyx_t_13; - int __pyx_t_14; - int __pyx_t_15; - bool __pyx_t_16; - struct DracoFunctions::EncodedObject __pyx_t_17; - PyObject *__pyx_t_18 = NULL; - PyObject *__pyx_t_19 = NULL; - PyObject *__pyx_t_20 = NULL; - PyObject *__pyx_t_21 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("encode_point_cloud_to_buffer", 0); - - /* "DracoPy.pyx":114 - * a point where each coordinate is the minimum of that coordinate among the input vertices. - * """ - * cdef float* quant_origin = NULL # <<<<<<<<<<<<<< - * try: - * num_dims = 3 - */ - __pyx_v_quant_origin = NULL; - - /* "DracoPy.pyx":115 - * """ - * cdef float* quant_origin = NULL - * try: # <<<<<<<<<<<<<< - * num_dims = 3 - * if quantization_origin is not None: - */ - { - __Pyx_PyThreadState_declare - __Pyx_PyThreadState_assign - __Pyx_ExceptionSave(&__pyx_t_1, &__pyx_t_2, &__pyx_t_3); - __Pyx_XGOTREF(__pyx_t_1); - __Pyx_XGOTREF(__pyx_t_2); - __Pyx_XGOTREF(__pyx_t_3); - /*try:*/ { - - /* "DracoPy.pyx":116 - * cdef float* quant_origin = NULL - * try: - * num_dims = 3 # <<<<<<<<<<<<<< - * if quantization_origin is not None: - * quant_origin = PyMem_Malloc(sizeof(float) * num_dims) - */ - __Pyx_INCREF(__pyx_int_3); - __pyx_v_num_dims = __pyx_int_3; + __Pyx_RefNannySetupContext("get_encoded_coordinate", 0); - /* "DracoPy.pyx":117 - * try: - * num_dims = 3 - * if quantization_origin is not None: # <<<<<<<<<<<<<< - * quant_origin = PyMem_Malloc(sizeof(float) * num_dims) - * for dim in range(num_dims): - */ - __pyx_t_4 = (__pyx_v_quantization_origin != Py_None); - __pyx_t_5 = (__pyx_t_4 != 0); - if (__pyx_t_5) { - - /* "DracoPy.pyx":118 - * num_dims = 3 - * if quantization_origin is not None: - * quant_origin = PyMem_Malloc(sizeof(float) * num_dims) # <<<<<<<<<<<<<< - * for dim in range(num_dims): - * quant_origin[dim] = quantization_origin[dim] - */ - __pyx_t_6 = __Pyx_PyInt_FromSize_t((sizeof(float))); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 118, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = PyNumber_Multiply(__pyx_t_6, __pyx_v_num_dims); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 118, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_8 = __Pyx_PyInt_As_size_t(__pyx_t_7); if (unlikely((__pyx_t_8 == (size_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 118, __pyx_L3_error) - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_v_quant_origin = ((float *)PyMem_Malloc(__pyx_t_8)); - - /* "DracoPy.pyx":119 - * if quantization_origin is not None: - * quant_origin = PyMem_Malloc(sizeof(float) * num_dims) - * for dim in range(num_dims): # <<<<<<<<<<<<<< - * quant_origin[dim] = quantization_origin[dim] - * encoded_point_cloud = DracoPy.encode_point_cloud(points, quantization_bits, compression_level, quantization_range, quant_origin, create_metadata) - */ - __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_builtin_range, __pyx_v_num_dims); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 119, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_7); - if (likely(PyList_CheckExact(__pyx_t_7)) || PyTuple_CheckExact(__pyx_t_7)) { - __pyx_t_6 = __pyx_t_7; __Pyx_INCREF(__pyx_t_6); __pyx_t_9 = 0; - __pyx_t_10 = NULL; - } else { - __pyx_t_9 = -1; __pyx_t_6 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 119, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_10 = Py_TYPE(__pyx_t_6)->tp_iternext; if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 119, __pyx_L3_error) - } - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - for (;;) { - if (likely(!__pyx_t_10)) { - if (likely(PyList_CheckExact(__pyx_t_6))) { - if (__pyx_t_9 >= PyList_GET_SIZE(__pyx_t_6)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_7 = PyList_GET_ITEM(__pyx_t_6, __pyx_t_9); __Pyx_INCREF(__pyx_t_7); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 119, __pyx_L3_error) - #else - __pyx_t_7 = PySequence_ITEM(__pyx_t_6, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 119, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_7); - #endif - } else { - if (__pyx_t_9 >= PyTuple_GET_SIZE(__pyx_t_6)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_9); __Pyx_INCREF(__pyx_t_7); __pyx_t_9++; if (unlikely(0 < 0)) __PYX_ERR(0, 119, __pyx_L3_error) - #else - __pyx_t_7 = PySequence_ITEM(__pyx_t_6, __pyx_t_9); __pyx_t_9++; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 119, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_7); - #endif - } - } else { - __pyx_t_7 = __pyx_t_10(__pyx_t_6); - if (unlikely(!__pyx_t_7)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 119, __pyx_L3_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_7); - } - __Pyx_XDECREF_SET(__pyx_v_dim, __pyx_t_7); - __pyx_t_7 = 0; - - /* "DracoPy.pyx":120 - * quant_origin = PyMem_Malloc(sizeof(float) * num_dims) - * for dim in range(num_dims): - * quant_origin[dim] = quantization_origin[dim] # <<<<<<<<<<<<<< - * encoded_point_cloud = DracoPy.encode_point_cloud(points, quantization_bits, compression_level, quantization_range, quant_origin, create_metadata) - * if quant_origin != NULL: + /* "DracoPy.pyx":91 + * + * def get_encoded_coordinate(self, value, axis): + * if value < self.quantization_origin[axis] or value > (self.quantization_origin[axis] + self.quantization_range): # <<<<<<<<<<<<<< + * raise ValueError('Specified value out of encoded range') + * difference = value - self.quantization_origin[axis] */ - __pyx_t_7 = __Pyx_PyObject_GetItem(__pyx_v_quantization_origin, __pyx_v_dim); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 120, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_11 = __pyx_PyFloat_AsFloat(__pyx_t_7); if (unlikely((__pyx_t_11 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 120, __pyx_L3_error) - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_12 = __Pyx_PyIndex_AsSsize_t(__pyx_v_dim); if (unlikely((__pyx_t_12 == (Py_ssize_t)-1) && PyErr_Occurred())) __PYX_ERR(0, 120, __pyx_L3_error) - (__pyx_v_quant_origin[__pyx_t_12]) = __pyx_t_11; + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_quantization_origin); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 91, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyObject_GetItem(__pyx_t_2, __pyx_v_axis); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 91, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyObject_RichCompare(__pyx_v_value, __pyx_t_3, Py_LT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 91, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 91, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (!__pyx_t_4) { + } else { + __pyx_t_1 = __pyx_t_4; + goto __pyx_L4_bool_binop_done; + } + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_quantization_origin); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 91, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyObject_GetItem(__pyx_t_2, __pyx_v_axis); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 91, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_quantization_range); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 91, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = PyNumber_Add(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 91, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyObject_RichCompare(__pyx_v_value, __pyx_t_5, Py_GT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 91, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) __PYX_ERR(0, 91, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_1 = __pyx_t_4; + __pyx_L4_bool_binop_done:; + if (unlikely(__pyx_t_1)) { - /* "DracoPy.pyx":119 - * if quantization_origin is not None: - * quant_origin = PyMem_Malloc(sizeof(float) * num_dims) - * for dim in range(num_dims): # <<<<<<<<<<<<<< - * quant_origin[dim] = quantization_origin[dim] - * encoded_point_cloud = DracoPy.encode_point_cloud(points, quantization_bits, compression_level, quantization_range, quant_origin, create_metadata) + /* "DracoPy.pyx":92 + * def get_encoded_coordinate(self, value, axis): + * if value < self.quantization_origin[axis] or value > (self.quantization_origin[axis] + self.quantization_range): + * raise ValueError('Specified value out of encoded range') # <<<<<<<<<<<<<< + * difference = value - self.quantization_origin[axis] + * quantized_index = floor((difference / self.inverse_alpha) + 0.5) */ - } - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 92, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __PYX_ERR(0, 92, __pyx_L1_error) - /* "DracoPy.pyx":117 - * try: - * num_dims = 3 - * if quantization_origin is not None: # <<<<<<<<<<<<<< - * quant_origin = PyMem_Malloc(sizeof(float) * num_dims) - * for dim in range(num_dims): + /* "DracoPy.pyx":91 + * + * def get_encoded_coordinate(self, value, axis): + * if value < self.quantization_origin[axis] or value > (self.quantization_origin[axis] + self.quantization_range): # <<<<<<<<<<<<<< + * raise ValueError('Specified value out of encoded range') + * difference = value - self.quantization_origin[axis] */ - } + } - /* "DracoPy.pyx":121 - * for dim in range(num_dims): - * quant_origin[dim] = quantization_origin[dim] - * encoded_point_cloud = DracoPy.encode_point_cloud(points, quantization_bits, compression_level, quantization_range, quant_origin, create_metadata) # <<<<<<<<<<<<<< - * if quant_origin != NULL: - * PyMem_Free(quant_origin) + /* "DracoPy.pyx":93 + * if value < self.quantization_origin[axis] or value > (self.quantization_origin[axis] + self.quantization_range): + * raise ValueError('Specified value out of encoded range') + * difference = value - self.quantization_origin[axis] # <<<<<<<<<<<<<< + * quantized_index = floor((difference / self.inverse_alpha) + 0.5) + * return self.quantization_origin[axis] + (quantized_index * self.inverse_alpha) */ - __pyx_t_13 = __pyx_convert_vector_from_py_float(__pyx_v_points); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 121, __pyx_L3_error) - __pyx_t_14 = __Pyx_PyInt_As_int(__pyx_v_quantization_bits); if (unlikely((__pyx_t_14 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 121, __pyx_L3_error) - __pyx_t_15 = __Pyx_PyInt_As_int(__pyx_v_compression_level); if (unlikely((__pyx_t_15 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 121, __pyx_L3_error) - __pyx_t_11 = __pyx_PyFloat_AsFloat(__pyx_v_quantization_range); if (unlikely((__pyx_t_11 == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 121, __pyx_L3_error) - __pyx_t_16 = __Pyx_PyObject_IsTrue(__pyx_v_create_metadata); if (unlikely((__pyx_t_16 == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 121, __pyx_L3_error) - try { - __pyx_t_17 = DracoFunctions::encode_point_cloud(__pyx_t_13, __pyx_t_14, __pyx_t_15, __pyx_t_11, __pyx_v_quant_origin, __pyx_t_16); - } catch(...) { - __Pyx_CppExn2PyErr(); - __PYX_ERR(0, 121, __pyx_L3_error) - } - __pyx_v_encoded_point_cloud = __pyx_t_17; + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_quantization_origin); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 93, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_t_2, __pyx_v_axis); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 93, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyNumber_Subtract(__pyx_v_value, __pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 93, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_v_difference = __pyx_t_2; + __pyx_t_2 = 0; - /* "DracoPy.pyx":122 - * quant_origin[dim] = quantization_origin[dim] - * encoded_point_cloud = DracoPy.encode_point_cloud(points, quantization_bits, compression_level, quantization_range, quant_origin, create_metadata) - * if quant_origin != NULL: # <<<<<<<<<<<<<< - * PyMem_Free(quant_origin) - * if encoded_point_cloud.encode_status == DracoPy.encoding_status.successful_encoding: + /* "DracoPy.pyx":94 + * raise ValueError('Specified value out of encoded range') + * difference = value - self.quantization_origin[axis] + * quantized_index = floor((difference / self.inverse_alpha) + 0.5) # <<<<<<<<<<<<<< + * return self.quantization_origin[axis] + (quantized_index * self.inverse_alpha) + * */ - __pyx_t_5 = ((__pyx_v_quant_origin != NULL) != 0); - if (__pyx_t_5) { + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_floor); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 94, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_inverse_alpha); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 94, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_6 = __Pyx_PyNumber_Divide(__pyx_v_difference, __pyx_t_3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 94, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyFloat_AddObjC(__pyx_t_6, __pyx_float_0_5, 0.5, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 94, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_6)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_6); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_5, function); + } + } + __pyx_t_2 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_3); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 94, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_v_quantized_index = __pyx_t_2; + __pyx_t_2 = 0; - /* "DracoPy.pyx":123 - * encoded_point_cloud = DracoPy.encode_point_cloud(points, quantization_bits, compression_level, quantization_range, quant_origin, create_metadata) - * if quant_origin != NULL: - * PyMem_Free(quant_origin) # <<<<<<<<<<<<<< - * if encoded_point_cloud.encode_status == DracoPy.encoding_status.successful_encoding: - * return bytes(encoded_point_cloud.buffer) + /* "DracoPy.pyx":95 + * difference = value - self.quantization_origin[axis] + * quantized_index = floor((difference / self.inverse_alpha) + 0.5) + * return self.quantization_origin[axis] + (quantized_index * self.inverse_alpha) # <<<<<<<<<<<<<< + * + * def get_encoded_point(self, point): */ - PyMem_Free(__pyx_v_quant_origin); + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_quantization_origin); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 95, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_t_2, __pyx_v_axis); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 95, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_inverse_alpha); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 95, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyNumber_Multiply(__pyx_v_quantized_index, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 95, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyNumber_Add(__pyx_t_5, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 95, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; - /* "DracoPy.pyx":122 - * quant_origin[dim] = quantization_origin[dim] - * encoded_point_cloud = DracoPy.encode_point_cloud(points, quantization_bits, compression_level, quantization_range, quant_origin, create_metadata) - * if quant_origin != NULL: # <<<<<<<<<<<<<< - * PyMem_Free(quant_origin) - * if encoded_point_cloud.encode_status == DracoPy.encoding_status.successful_encoding: + /* "DracoPy.pyx":90 + * self.inverse_alpha = quantization_range / ((2 ** quantization_bits) - 1) + * + * def get_encoded_coordinate(self, value, axis): # <<<<<<<<<<<<<< + * if value < self.quantization_origin[axis] or value > (self.quantization_origin[axis] + self.quantization_range): + * raise ValueError('Specified value out of encoded range') */ - } - /* "DracoPy.pyx":124 - * if quant_origin != NULL: - * PyMem_Free(quant_origin) - * if encoded_point_cloud.encode_status == DracoPy.encoding_status.successful_encoding: # <<<<<<<<<<<<<< - * return bytes(encoded_point_cloud.buffer) - * elif encoded_point_cloud.encode_status == DracoPy.encoding_status.failed_during_encoding: - */ - switch (__pyx_v_encoded_point_cloud.encode_status) { - case DracoFunctions::successful_encoding: + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_AddTraceback("DracoPy.EncodingOptions.get_encoded_coordinate", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_difference); + __Pyx_XDECREF(__pyx_v_quantized_index); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} - /* "DracoPy.pyx":125 - * PyMem_Free(quant_origin) - * if encoded_point_cloud.encode_status == DracoPy.encoding_status.successful_encoding: - * return bytes(encoded_point_cloud.buffer) # <<<<<<<<<<<<<< - * elif encoded_point_cloud.encode_status == DracoPy.encoding_status.failed_during_encoding: - * raise EncodingFailedException('Invalid point cloud') +/* "DracoPy.pyx":97 + * return self.quantization_origin[axis] + (quantized_index * self.inverse_alpha) + * + * def get_encoded_point(self, point): # <<<<<<<<<<<<<< + * encoded_point = [] + * for axis in range(self.num_axes): */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_6 = __pyx_convert_vector_to_py_unsigned_char(__pyx_v_encoded_point_cloud.buffer); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 125, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyBytes_Type)), __pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 125, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_r = __pyx_t_7; - __pyx_t_7 = 0; - goto __pyx_L7_try_return; - /* "DracoPy.pyx":124 - * if quant_origin != NULL: - * PyMem_Free(quant_origin) - * if encoded_point_cloud.encode_status == DracoPy.encoding_status.successful_encoding: # <<<<<<<<<<<<<< - * return bytes(encoded_point_cloud.buffer) - * elif encoded_point_cloud.encode_status == DracoPy.encoding_status.failed_during_encoding: - */ - break; - case DracoFunctions::failed_during_encoding: - - /* "DracoPy.pyx":127 - * return bytes(encoded_point_cloud.buffer) - * elif encoded_point_cloud.encode_status == DracoPy.encoding_status.failed_during_encoding: - * raise EncodingFailedException('Invalid point cloud') # <<<<<<<<<<<<<< - * except EncodingFailedException: - * raise EncodingFailedException('Invalid point cloud') - */ - __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_EncodingFailedException); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 127, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_18 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) { - __pyx_t_18 = PyMethod_GET_SELF(__pyx_t_6); - if (likely(__pyx_t_18)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); - __Pyx_INCREF(__pyx_t_18); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_6, function); - } - } - __pyx_t_7 = (__pyx_t_18) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_18, __pyx_kp_u_Invalid_point_cloud) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_kp_u_Invalid_point_cloud); - __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0; - if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 127, __pyx_L3_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_Raise(__pyx_t_7, 0, 0, 0); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __PYX_ERR(0, 127, __pyx_L3_error) - - /* "DracoPy.pyx":126 - * if encoded_point_cloud.encode_status == DracoPy.encoding_status.successful_encoding: - * return bytes(encoded_point_cloud.buffer) - * elif encoded_point_cloud.encode_status == DracoPy.encoding_status.failed_during_encoding: # <<<<<<<<<<<<<< - * raise EncodingFailedException('Invalid point cloud') - * except EncodingFailedException: - */ - break; - default: break; +/* Python wrapper */ +static PyObject *__pyx_pw_7DracoPy_15EncodingOptions_5get_encoded_point(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyMethodDef __pyx_mdef_7DracoPy_15EncodingOptions_5get_encoded_point = {"get_encoded_point", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7DracoPy_15EncodingOptions_5get_encoded_point, METH_VARARGS|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_7DracoPy_15EncodingOptions_5get_encoded_point(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_self = 0; + PyObject *__pyx_v_point = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("get_encoded_point (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_self,&__pyx_n_s_point,0}; + PyObject* values[2] = {0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; } - - /* "DracoPy.pyx":115 - * """ - * cdef float* quant_origin = NULL - * try: # <<<<<<<<<<<<<< - * num_dims = 3 - * if quantization_origin is not None: - */ - } - __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - goto __pyx_L8_try_end; - __pyx_L3_error:; - __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0; - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - - /* "DracoPy.pyx":128 - * elif encoded_point_cloud.encode_status == DracoPy.encoding_status.failed_during_encoding: - * raise EncodingFailedException('Invalid point cloud') - * except EncodingFailedException: # <<<<<<<<<<<<<< - * raise EncodingFailedException('Invalid point cloud') - * except: - */ - __Pyx_ErrFetch(&__pyx_t_7, &__pyx_t_6, &__pyx_t_18); - __Pyx_GetModuleGlobalName(__pyx_t_19, __pyx_n_s_EncodingFailedException); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 128, __pyx_L5_except_error) - __Pyx_GOTREF(__pyx_t_19); - __pyx_t_15 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_7, __pyx_t_19); - __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; - __Pyx_ErrRestore(__pyx_t_7, __pyx_t_6, __pyx_t_18); - __pyx_t_7 = 0; __pyx_t_6 = 0; __pyx_t_18 = 0; - if (__pyx_t_15) { - __Pyx_AddTraceback("DracoPy.encode_point_cloud_to_buffer", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_18, &__pyx_t_6, &__pyx_t_7) < 0) __PYX_ERR(0, 128, __pyx_L5_except_error) - __Pyx_GOTREF(__pyx_t_18); - __Pyx_GOTREF(__pyx_t_6); - __Pyx_GOTREF(__pyx_t_7); - - /* "DracoPy.pyx":129 - * raise EncodingFailedException('Invalid point cloud') - * except EncodingFailedException: - * raise EncodingFailedException('Invalid point cloud') # <<<<<<<<<<<<<< - * except: - * if quant_origin != NULL: - */ - __Pyx_GetModuleGlobalName(__pyx_t_20, __pyx_n_s_EncodingFailedException); if (unlikely(!__pyx_t_20)) __PYX_ERR(0, 129, __pyx_L5_except_error) - __Pyx_GOTREF(__pyx_t_20); - __pyx_t_21 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_20))) { - __pyx_t_21 = PyMethod_GET_SELF(__pyx_t_20); - if (likely(__pyx_t_21)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_20); - __Pyx_INCREF(__pyx_t_21); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_20, function); + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_self)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_point)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("get_encoded_point", 1, 2, 2, 1); __PYX_ERR(0, 97, __pyx_L3_error) } } - __pyx_t_19 = (__pyx_t_21) ? __Pyx_PyObject_Call2Args(__pyx_t_20, __pyx_t_21, __pyx_kp_u_Invalid_point_cloud) : __Pyx_PyObject_CallOneArg(__pyx_t_20, __pyx_kp_u_Invalid_point_cloud); - __Pyx_XDECREF(__pyx_t_21); __pyx_t_21 = 0; - if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 129, __pyx_L5_except_error) - __Pyx_GOTREF(__pyx_t_19); - __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0; - __Pyx_Raise(__pyx_t_19, 0, 0, 0); - __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; - __PYX_ERR(0, 129, __pyx_L5_except_error) - } - - /* "DracoPy.pyx":130 - * except EncodingFailedException: - * raise EncodingFailedException('Invalid point cloud') - * except: # <<<<<<<<<<<<<< - * if quant_origin != NULL: - * PyMem_Free(quant_origin) - */ - /*except:*/ { - __Pyx_AddTraceback("DracoPy.encode_point_cloud_to_buffer", __pyx_clineno, __pyx_lineno, __pyx_filename); - if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_6, &__pyx_t_18) < 0) __PYX_ERR(0, 130, __pyx_L5_except_error) - __Pyx_GOTREF(__pyx_t_7); - __Pyx_GOTREF(__pyx_t_6); - __Pyx_GOTREF(__pyx_t_18); - - /* "DracoPy.pyx":131 - * raise EncodingFailedException('Invalid point cloud') - * except: - * if quant_origin != NULL: # <<<<<<<<<<<<<< - * PyMem_Free(quant_origin) - * raise ValueError("Input invalid") - */ - __pyx_t_5 = ((__pyx_v_quant_origin != NULL) != 0); - if (__pyx_t_5) { - - /* "DracoPy.pyx":132 - * except: - * if quant_origin != NULL: - * PyMem_Free(quant_origin) # <<<<<<<<<<<<<< - * raise ValueError("Input invalid") - * - */ - PyMem_Free(__pyx_v_quant_origin); - - /* "DracoPy.pyx":131 - * raise EncodingFailedException('Invalid point cloud') - * except: - * if quant_origin != NULL: # <<<<<<<<<<<<<< - * PyMem_Free(quant_origin) - * raise ValueError("Input invalid") - */ + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "get_encoded_point") < 0)) __PYX_ERR(0, 97, __pyx_L3_error) } - - /* "DracoPy.pyx":133 - * if quant_origin != NULL: - * PyMem_Free(quant_origin) - * raise ValueError("Input invalid") # <<<<<<<<<<<<<< - * - * def raise_decoding_error(decoding_status): - */ - __pyx_t_19 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__2, NULL); if (unlikely(!__pyx_t_19)) __PYX_ERR(0, 133, __pyx_L5_except_error) - __Pyx_GOTREF(__pyx_t_19); - __Pyx_Raise(__pyx_t_19, 0, 0, 0); - __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; - __PYX_ERR(0, 133, __pyx_L5_except_error) + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); } - __pyx_L5_except_error:; - - /* "DracoPy.pyx":115 - * """ - * cdef float* quant_origin = NULL - * try: # <<<<<<<<<<<<<< - * num_dims = 3 - * if quantization_origin is not None: - */ - __Pyx_XGIVEREF(__pyx_t_1); - __Pyx_XGIVEREF(__pyx_t_2); - __Pyx_XGIVEREF(__pyx_t_3); - __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); - goto __pyx_L1_error; - __pyx_L7_try_return:; - __Pyx_XGIVEREF(__pyx_t_1); - __Pyx_XGIVEREF(__pyx_t_2); - __Pyx_XGIVEREF(__pyx_t_3); - __Pyx_ExceptionReset(__pyx_t_1, __pyx_t_2, __pyx_t_3); - goto __pyx_L0; - __pyx_L8_try_end:; + __pyx_v_self = values[0]; + __pyx_v_point = values[1]; } - - /* "DracoPy.pyx":104 - * raise ValueError("Input invalid") - * - * def encode_point_cloud_to_buffer(points, quantization_bits=14, compression_level=1, quantization_range=-1, quantization_origin=None, create_metadata=False): # <<<<<<<<<<<<<< - * """ - * Encode a list or numpy array of points/vertices (float) to a draco buffer. - */ - - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_18); - __Pyx_XDECREF(__pyx_t_19); - __Pyx_XDECREF(__pyx_t_20); - __Pyx_XDECREF(__pyx_t_21); - __Pyx_AddTraceback("DracoPy.encode_point_cloud_to_buffer", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_num_dims); - __Pyx_XDECREF(__pyx_v_dim); - __Pyx_XGIVEREF(__pyx_r); + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("get_encoded_point", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 97, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("DracoPy.EncodingOptions.get_encoded_point", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -/* "DracoPy.pyx":135 - * raise ValueError("Input invalid") - * - * def raise_decoding_error(decoding_status): # <<<<<<<<<<<<<< - * if decoding_status == DracoPy.decoding_status.not_draco_encoded: - * raise FileTypeException('Input mesh is not draco encoded') - */ - -/* Python wrapper */ -static PyObject *__pyx_pw_7DracoPy_5raise_decoding_error(PyObject *__pyx_self, PyObject *__pyx_v_decoding_status); /*proto*/ -static PyMethodDef __pyx_mdef_7DracoPy_5raise_decoding_error = {"raise_decoding_error", (PyCFunction)__pyx_pw_7DracoPy_5raise_decoding_error, METH_O, 0}; -static PyObject *__pyx_pw_7DracoPy_5raise_decoding_error(PyObject *__pyx_self, PyObject *__pyx_v_decoding_status) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("raise_decoding_error (wrapper)", 0); - __pyx_r = __pyx_pf_7DracoPy_4raise_decoding_error(__pyx_self, ((PyObject *)__pyx_v_decoding_status)); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_7DracoPy_15EncodingOptions_4get_encoded_point(__pyx_self, __pyx_v_self, __pyx_v_point); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_7DracoPy_4raise_decoding_error(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_decoding_status) { +static PyObject *__pyx_pf_7DracoPy_15EncodingOptions_4get_encoded_point(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_point) { + PyObject *__pyx_v_encoded_point = NULL; + PyObject *__pyx_v_axis = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; - int __pyx_t_3; - PyObject *__pyx_t_4 = NULL; + Py_ssize_t __pyx_t_3; + PyObject *(*__pyx_t_4)(PyObject *); + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + int __pyx_t_8; + PyObject *__pyx_t_9 = NULL; + int __pyx_t_10; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("raise_decoding_error", 0); + __Pyx_RefNannySetupContext("get_encoded_point", 0); - /* "DracoPy.pyx":136 + /* "DracoPy.pyx":98 * - * def raise_decoding_error(decoding_status): - * if decoding_status == DracoPy.decoding_status.not_draco_encoded: # <<<<<<<<<<<<<< - * raise FileTypeException('Input mesh is not draco encoded') - * elif decoding_status == DracoPy.decoding_status.failed_during_decoding: + * def get_encoded_point(self, point): + * encoded_point = [] # <<<<<<<<<<<<<< + * for axis in range(self.num_axes): + * encoded_point.append(self.get_encoded_coordinate(point[axis], axis)) */ - __pyx_t_1 = __Pyx_PyInt_From_enum__DracoFunctions_3a__3a_decoding_status(DracoFunctions::not_draco_encoded); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 136, __pyx_L1_error) + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 98, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_RichCompare(__pyx_v_decoding_status, __pyx_t_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 136, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 136, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (unlikely(__pyx_t_3)) { + __pyx_v_encoded_point = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; - /* "DracoPy.pyx":137 - * def raise_decoding_error(decoding_status): - * if decoding_status == DracoPy.decoding_status.not_draco_encoded: - * raise FileTypeException('Input mesh is not draco encoded') # <<<<<<<<<<<<<< - * elif decoding_status == DracoPy.decoding_status.failed_during_decoding: - * raise TypeError('Failed to decode input mesh. Data might be corrupted') + /* "DracoPy.pyx":99 + * def get_encoded_point(self, point): + * encoded_point = [] + * for axis in range(self.num_axes): # <<<<<<<<<<<<<< + * encoded_point.append(self.get_encoded_coordinate(point[axis], axis)) + * return encoded_point */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_FileTypeException); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 137, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_num_axes); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 99, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_builtin_range, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 99, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (likely(PyList_CheckExact(__pyx_t_2)) || PyTuple_CheckExact(__pyx_t_2)) { + __pyx_t_1 = __pyx_t_2; __Pyx_INCREF(__pyx_t_1); __pyx_t_3 = 0; __pyx_t_4 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) { - __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1); - if (likely(__pyx_t_4)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); - __Pyx_INCREF(__pyx_t_4); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_1, function); + } else { + __pyx_t_3 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 99, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 99, __pyx_L1_error) + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + for (;;) { + if (likely(!__pyx_t_4)) { + if (likely(PyList_CheckExact(__pyx_t_1))) { + if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_1)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_2); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 99, __pyx_L1_error) + #else + __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 99, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + #endif + } else { + if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_1)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_2); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 99, __pyx_L1_error) + #else + __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 99, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + #endif + } + } else { + __pyx_t_2 = __pyx_t_4(__pyx_t_1); + 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, 99, __pyx_L1_error) + } + break; } + __Pyx_GOTREF(__pyx_t_2); } - __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_4, __pyx_kp_u_Input_mesh_is_not_draco_encoded) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_kp_u_Input_mesh_is_not_draco_encoded); - __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 137, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_Raise(__pyx_t_2, 0, 0, 0); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __PYX_ERR(0, 137, __pyx_L1_error) + __Pyx_XDECREF_SET(__pyx_v_axis, __pyx_t_2); + __pyx_t_2 = 0; - /* "DracoPy.pyx":136 - * - * def raise_decoding_error(decoding_status): - * if decoding_status == DracoPy.decoding_status.not_draco_encoded: # <<<<<<<<<<<<<< - * raise FileTypeException('Input mesh is not draco encoded') - * elif decoding_status == DracoPy.decoding_status.failed_during_decoding: + /* "DracoPy.pyx":100 + * encoded_point = [] + * for axis in range(self.num_axes): + * encoded_point.append(self.get_encoded_coordinate(point[axis], axis)) # <<<<<<<<<<<<<< + * return encoded_point + * */ - } + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_get_encoded_coordinate); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 100, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = __Pyx_PyObject_GetItem(__pyx_v_point, __pyx_v_axis); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 100, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = NULL; + __pyx_t_8 = 0; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_7)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_7); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_5, function); + __pyx_t_8 = 1; + } + } + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_5)) { + PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_t_6, __pyx_v_axis}; + __pyx_t_2 = __Pyx_PyFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 100, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_5)) { + PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_t_6, __pyx_v_axis}; + __pyx_t_2 = __Pyx_PyCFunction_FastCall(__pyx_t_5, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 100, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } else + #endif + { + __pyx_t_9 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 100, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + if (__pyx_t_7) { + __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7); __pyx_t_7 = NULL; + } + __Pyx_GIVEREF(__pyx_t_6); + PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_t_6); + __Pyx_INCREF(__pyx_v_axis); + __Pyx_GIVEREF(__pyx_v_axis); + PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_v_axis); + __pyx_t_6 = 0; + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_9, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 100, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + } + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_10 = __Pyx_PyList_Append(__pyx_v_encoded_point, __pyx_t_2); if (unlikely(__pyx_t_10 == ((int)-1))) __PYX_ERR(0, 100, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "DracoPy.pyx":138 - * if decoding_status == DracoPy.decoding_status.not_draco_encoded: - * raise FileTypeException('Input mesh is not draco encoded') - * elif decoding_status == DracoPy.decoding_status.failed_during_decoding: # <<<<<<<<<<<<<< - * raise TypeError('Failed to decode input mesh. Data might be corrupted') - * elif decoding_status == DracoPy.decoding_status.no_position_attribute: + /* "DracoPy.pyx":99 + * def get_encoded_point(self, point): + * encoded_point = [] + * for axis in range(self.num_axes): # <<<<<<<<<<<<<< + * encoded_point.append(self.get_encoded_coordinate(point[axis], axis)) + * return encoded_point */ - __pyx_t_2 = __Pyx_PyInt_From_enum__DracoFunctions_3a__3a_decoding_status(DracoFunctions::failed_during_decoding); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 138, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = PyObject_RichCompare(__pyx_v_decoding_status, __pyx_t_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 138, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 138, __pyx_L1_error) + } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (unlikely(__pyx_t_3)) { - /* "DracoPy.pyx":139 - * raise FileTypeException('Input mesh is not draco encoded') - * elif decoding_status == DracoPy.decoding_status.failed_during_decoding: - * raise TypeError('Failed to decode input mesh. Data might be corrupted') # <<<<<<<<<<<<<< - * elif decoding_status == DracoPy.decoding_status.no_position_attribute: - * raise ValueError('DracoPy only supports meshes with position attributes') + /* "DracoPy.pyx":101 + * for axis in range(self.num_axes): + * encoded_point.append(self.get_encoded_coordinate(point[axis], axis)) + * return encoded_point # <<<<<<<<<<<<<< + * + * @property */ - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 139, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_Raise(__pyx_t_1, 0, 0, 0); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __PYX_ERR(0, 139, __pyx_L1_error) + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_encoded_point); + __pyx_r = __pyx_v_encoded_point; + goto __pyx_L0; - /* "DracoPy.pyx":138 - * if decoding_status == DracoPy.decoding_status.not_draco_encoded: - * raise FileTypeException('Input mesh is not draco encoded') - * elif decoding_status == DracoPy.decoding_status.failed_during_decoding: # <<<<<<<<<<<<<< - * raise TypeError('Failed to decode input mesh. Data might be corrupted') - * elif decoding_status == DracoPy.decoding_status.no_position_attribute: + /* "DracoPy.pyx":97 + * return self.quantization_origin[axis] + (quantized_index * self.inverse_alpha) + * + * def get_encoded_point(self, point): # <<<<<<<<<<<<<< + * encoded_point = [] + * for axis in range(self.num_axes): */ - } - /* "DracoPy.pyx":140 - * elif decoding_status == DracoPy.decoding_status.failed_during_decoding: - * raise TypeError('Failed to decode input mesh. Data might be corrupted') - * elif decoding_status == DracoPy.decoding_status.no_position_attribute: # <<<<<<<<<<<<<< - * raise ValueError('DracoPy only supports meshes with position attributes') + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_AddTraceback("DracoPy.EncodingOptions.get_encoded_point", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_encoded_point); + __Pyx_XDECREF(__pyx_v_axis); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "DracoPy.pyx":104 + * + * @property + * def num_axes(self): # <<<<<<<<<<<<<< + * return 3 * */ - __pyx_t_1 = __Pyx_PyInt_From_enum__DracoFunctions_3a__3a_decoding_status(DracoFunctions::no_position_attribute); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 140, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_RichCompare(__pyx_v_decoding_status, __pyx_t_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 140, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 140, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (unlikely(__pyx_t_3)) { - /* "DracoPy.pyx":141 - * raise TypeError('Failed to decode input mesh. Data might be corrupted') - * elif decoding_status == DracoPy.decoding_status.no_position_attribute: - * raise ValueError('DracoPy only supports meshes with position attributes') # <<<<<<<<<<<<<< +/* Python wrapper */ +static PyObject *__pyx_pw_7DracoPy_15EncodingOptions_7num_axes(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ +static PyMethodDef __pyx_mdef_7DracoPy_15EncodingOptions_7num_axes = {"num_axes", (PyCFunction)__pyx_pw_7DracoPy_15EncodingOptions_7num_axes, METH_O, 0}; +static PyObject *__pyx_pw_7DracoPy_15EncodingOptions_7num_axes(PyObject *__pyx_self, PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("num_axes (wrapper)", 0); + __pyx_r = __pyx_pf_7DracoPy_15EncodingOptions_6num_axes(__pyx_self, ((PyObject *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_7DracoPy_15EncodingOptions_6num_axes(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("num_axes", 0); + + /* "DracoPy.pyx":105 + * @property + * def num_axes(self): + * return 3 # <<<<<<<<<<<<<< + * * - * def decode_buffer_to_mesh(buffer): */ - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__4, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 141, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_Raise(__pyx_t_2, 0, 0, 0); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __PYX_ERR(0, 141, __pyx_L1_error) + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_int_3); + __pyx_r = __pyx_int_3; + goto __pyx_L0; - /* "DracoPy.pyx":140 - * elif decoding_status == DracoPy.decoding_status.failed_during_decoding: - * raise TypeError('Failed to decode input mesh. Data might be corrupted') - * elif decoding_status == DracoPy.decoding_status.no_position_attribute: # <<<<<<<<<<<<<< - * raise ValueError('DracoPy only supports meshes with position attributes') + /* "DracoPy.pyx":104 + * + * @property + * def num_axes(self): # <<<<<<<<<<<<<< + * return 3 * */ - } - /* "DracoPy.pyx":135 - * raise ValueError("Input invalid") + /* function exit code */ + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "DracoPy.pyx":116 * - * def raise_decoding_error(decoding_status): # <<<<<<<<<<<<<< - * if decoding_status == DracoPy.decoding_status.not_draco_encoded: - * raise FileTypeException('Input mesh is not draco encoded') + * + * def _create_empty_geometry_metadata() -> GeometryMetadataObject: # <<<<<<<<<<<<<< + * return { + * "metadata_id": 0, */ +/* Python wrapper */ +static PyObject *__pyx_pw_7DracoPy_1_create_empty_geometry_metadata(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyMethodDef __pyx_mdef_7DracoPy_1_create_empty_geometry_metadata = {"_create_empty_geometry_metadata", (PyCFunction)__pyx_pw_7DracoPy_1_create_empty_geometry_metadata, METH_NOARGS, 0}; +static PyObject *__pyx_pw_7DracoPy_1_create_empty_geometry_metadata(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("_create_empty_geometry_metadata (wrapper)", 0); + __pyx_r = __pyx_pf_7DracoPy__create_empty_geometry_metadata(__pyx_self); + /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_7DracoPy__create_empty_geometry_metadata(CYTHON_UNUSED PyObject *__pyx_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_create_empty_geometry_metadata", 0); + + /* "DracoPy.pyx":117 + * + * def _create_empty_geometry_metadata() -> GeometryMetadataObject: + * return { # <<<<<<<<<<<<<< + * "metadata_id": 0, + * "generic_attributes": [], + */ + __Pyx_XDECREF(__pyx_r); + + /* "DracoPy.pyx":118 + * def _create_empty_geometry_metadata() -> GeometryMetadataObject: + * return { + * "metadata_id": 0, # <<<<<<<<<<<<<< + * "generic_attributes": [], + * } + */ + __pyx_t_1 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 118, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_metadata_id, __pyx_int_0) < 0) __PYX_ERR(0, 118, __pyx_L1_error) + + /* "DracoPy.pyx":119 + * return { + * "metadata_id": 0, + * "generic_attributes": [], # <<<<<<<<<<<<<< + * } + * + */ + __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 119, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_generic_attributes, __pyx_t_2) < 0) __PYX_ERR(0, 118, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; goto __pyx_L0; + + /* "DracoPy.pyx":116 + * + * + * def _create_empty_geometry_metadata() -> GeometryMetadataObject: # <<<<<<<<<<<<<< + * return { + * "metadata_id": 0, + */ + + /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("DracoPy.raise_decoding_error", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("DracoPy._create_empty_geometry_metadata", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -4711,161 +4643,89 @@ static PyObject *__pyx_pf_7DracoPy_4raise_decoding_error(CYTHON_UNUSED PyObject return __pyx_r; } -/* "DracoPy.pyx":143 - * raise ValueError('DracoPy only supports meshes with position attributes') +/* "DracoPy.pyx":123 * - * def decode_buffer_to_mesh(buffer): # <<<<<<<<<<<<<< - * mesh_struct = DracoPy.decode_buffer(buffer, len(buffer)) - * if mesh_struct.decode_status == DracoPy.decoding_status.successful: + * + * def _create_empty_metadata() -> MetadataObject: # <<<<<<<<<<<<<< + * return { + * "entries": {}, */ /* Python wrapper */ -static PyObject *__pyx_pw_7DracoPy_7decode_buffer_to_mesh(PyObject *__pyx_self, PyObject *__pyx_v_buffer); /*proto*/ -static PyMethodDef __pyx_mdef_7DracoPy_7decode_buffer_to_mesh = {"decode_buffer_to_mesh", (PyCFunction)__pyx_pw_7DracoPy_7decode_buffer_to_mesh, METH_O, 0}; -static PyObject *__pyx_pw_7DracoPy_7decode_buffer_to_mesh(PyObject *__pyx_self, PyObject *__pyx_v_buffer) { +static PyObject *__pyx_pw_7DracoPy_3_create_empty_metadata(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyMethodDef __pyx_mdef_7DracoPy_3_create_empty_metadata = {"_create_empty_metadata", (PyCFunction)__pyx_pw_7DracoPy_3_create_empty_metadata, METH_NOARGS, 0}; +static PyObject *__pyx_pw_7DracoPy_3_create_empty_metadata(PyObject *__pyx_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("decode_buffer_to_mesh (wrapper)", 0); - __pyx_r = __pyx_pf_7DracoPy_6decode_buffer_to_mesh(__pyx_self, ((PyObject *)__pyx_v_buffer)); + __Pyx_RefNannySetupContext("_create_empty_metadata (wrapper)", 0); + __pyx_r = __pyx_pf_7DracoPy_2_create_empty_metadata(__pyx_self); /* function exit code */ __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_pf_7DracoPy_6decode_buffer_to_mesh(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_buffer) { - struct DracoFunctions::MeshObject __pyx_v_mesh_struct; +static PyObject *__pyx_pf_7DracoPy_2_create_empty_metadata(CYTHON_UNUSED PyObject *__pyx_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - char const *__pyx_t_1; - Py_ssize_t __pyx_t_2; - struct DracoFunctions::MeshObject __pyx_t_3; - int __pyx_t_4; - PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; - PyObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("decode_buffer_to_mesh", 0); + __Pyx_RefNannySetupContext("_create_empty_metadata", 0); - /* "DracoPy.pyx":144 + /* "DracoPy.pyx":124 * - * def decode_buffer_to_mesh(buffer): - * mesh_struct = DracoPy.decode_buffer(buffer, len(buffer)) # <<<<<<<<<<<<<< - * if mesh_struct.decode_status == DracoPy.decoding_status.successful: - * return DracoMesh(mesh_struct) + * def _create_empty_metadata() -> MetadataObject: + * return { # <<<<<<<<<<<<<< + * "entries": {}, + * "sub_metadata_ids": {} */ - __pyx_t_1 = __Pyx_PyObject_AsString(__pyx_v_buffer); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) __PYX_ERR(0, 144, __pyx_L1_error) - __pyx_t_2 = PyObject_Length(__pyx_v_buffer); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 144, __pyx_L1_error) - try { - __pyx_t_3 = DracoFunctions::decode_buffer(__pyx_t_1, __pyx_t_2); - } catch(...) { - __Pyx_CppExn2PyErr(); - __PYX_ERR(0, 144, __pyx_L1_error) - } - __pyx_v_mesh_struct = __pyx_t_3; + __Pyx_XDECREF(__pyx_r); - /* "DracoPy.pyx":145 - * def decode_buffer_to_mesh(buffer): - * mesh_struct = DracoPy.decode_buffer(buffer, len(buffer)) - * if mesh_struct.decode_status == DracoPy.decoding_status.successful: # <<<<<<<<<<<<<< - * return DracoMesh(mesh_struct) - * else: + /* "DracoPy.pyx":125 + * def _create_empty_metadata() -> MetadataObject: + * return { + * "entries": {}, # <<<<<<<<<<<<<< + * "sub_metadata_ids": {} + * } */ - __pyx_t_4 = ((__pyx_v_mesh_struct.decode_status == DracoFunctions::successful) != 0); - if (__pyx_t_4) { + __pyx_t_1 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 125, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 125, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_entries, __pyx_t_2) < 0) __PYX_ERR(0, 125, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "DracoPy.pyx":146 - * mesh_struct = DracoPy.decode_buffer(buffer, len(buffer)) - * if mesh_struct.decode_status == DracoPy.decoding_status.successful: - * return DracoMesh(mesh_struct) # <<<<<<<<<<<<<< - * else: - * raise_decoding_error(mesh_struct.decode_status) - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_DracoMesh); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 146, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = __pyx_convert__to_py_struct__DracoFunctions_3a__3a_MeshObject(__pyx_v_mesh_struct); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 146, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_8 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) { - __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_6); - if (likely(__pyx_t_8)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); - __Pyx_INCREF(__pyx_t_8); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_6, function); - } - } - __pyx_t_5 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_8, __pyx_t_7) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_7); - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 146, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_r = __pyx_t_5; - __pyx_t_5 = 0; - goto __pyx_L0; - - /* "DracoPy.pyx":145 - * def decode_buffer_to_mesh(buffer): - * mesh_struct = DracoPy.decode_buffer(buffer, len(buffer)) - * if mesh_struct.decode_status == DracoPy.decoding_status.successful: # <<<<<<<<<<<<<< - * return DracoMesh(mesh_struct) - * else: - */ - } - - /* "DracoPy.pyx":148 - * return DracoMesh(mesh_struct) - * else: - * raise_decoding_error(mesh_struct.decode_status) # <<<<<<<<<<<<<< + /* "DracoPy.pyx":126 + * return { + * "entries": {}, + * "sub_metadata_ids": {} # <<<<<<<<<<<<<< + * } * - * def decode_point_cloud_buffer(buffer): */ - /*else*/ { - __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_raise_decoding_error); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 148, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = __Pyx_PyInt_From_enum__DracoFunctions_3a__3a_decoding_status(__pyx_v_mesh_struct.decode_status); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 148, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_8 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) { - __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_6); - if (likely(__pyx_t_8)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); - __Pyx_INCREF(__pyx_t_8); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_6, function); - } - } - __pyx_t_5 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_8, __pyx_t_7) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_7); - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 148, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } + __pyx_t_2 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 126, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_1, __pyx_n_u_sub_metadata_ids, __pyx_t_2) < 0) __PYX_ERR(0, 125, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; - /* "DracoPy.pyx":143 - * raise ValueError('DracoPy only supports meshes with position attributes') + /* "DracoPy.pyx":123 * - * def decode_buffer_to_mesh(buffer): # <<<<<<<<<<<<<< - * mesh_struct = DracoPy.decode_buffer(buffer, len(buffer)) - * if mesh_struct.decode_status == DracoPy.decoding_status.successful: + * + * def _create_empty_metadata() -> MetadataObject: # <<<<<<<<<<<<<< + * return { + * "entries": {}, */ /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_AddTraceback("DracoPy.decode_buffer_to_mesh", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("DracoPy._create_empty_metadata", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -4873,1767 +4733,11232 @@ static PyObject *__pyx_pf_7DracoPy_6decode_buffer_to_mesh(CYTHON_UNUSED PyObject return __pyx_r; } -/* "DracoPy.pyx":150 - * raise_decoding_error(mesh_struct.decode_status) +/* "DracoPy.pyx":130 * - * def decode_point_cloud_buffer(buffer): # <<<<<<<<<<<<<< - * point_cloud_struct = DracoPy.decode_buffer_to_point_cloud(buffer, len(buffer)) - * if point_cloud_struct.decode_status == DracoPy.decoding_status.successful: + * + * cdef Encoder _generate_encoder_and_update_metadata( # <<<<<<<<<<<<<< + * int quantization_bits, + * int compression_level, */ -/* Python wrapper */ -static PyObject *__pyx_pw_7DracoPy_9decode_point_cloud_buffer(PyObject *__pyx_self, PyObject *__pyx_v_buffer); /*proto*/ -static PyMethodDef __pyx_mdef_7DracoPy_9decode_point_cloud_buffer = {"decode_point_cloud_buffer", (PyCFunction)__pyx_pw_7DracoPy_9decode_point_cloud_buffer, METH_O, 0}; -static PyObject *__pyx_pw_7DracoPy_9decode_point_cloud_buffer(PyObject *__pyx_self, PyObject *__pyx_v_buffer) { - PyObject *__pyx_r = 0; - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("decode_point_cloud_buffer (wrapper)", 0); - __pyx_r = __pyx_pf_7DracoPy_8decode_point_cloud_buffer(__pyx_self, ((PyObject *)__pyx_v_buffer)); - - /* function exit code */ - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - -static PyObject *__pyx_pf_7DracoPy_8decode_point_cloud_buffer(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_buffer) { - struct DracoFunctions::PointCloudObject __pyx_v_point_cloud_struct; - PyObject *__pyx_r = NULL; +static struct __pyx_obj_7DracoPy_Encoder *__pyx_f_7DracoPy__generate_encoder_and_update_metadata(int __pyx_v_quantization_bits, int __pyx_v_compression_level, double __pyx_v_quantization_range, std::vector __pyx_v_quantization_origin, std::vector &__pyx_v_metadatas, struct DracoFunctions::GeometryMetadataObject &__pyx_v_geometry_metadata) { + struct __pyx_obj_7DracoPy_Encoder *__pyx_v_encoder = NULL; + long __pyx_v_speed; + int __pyx_v_to_create_quantization_metadata; + struct DracoFunctions::MetadataObject *__pyx_v_metadata; + struct __pyx_obj_7DracoPy_Encoder *__pyx_r = NULL; __Pyx_RefNannyDeclarations - char const *__pyx_t_1; - Py_ssize_t __pyx_t_2; - struct DracoFunctions::PointCloudObject __pyx_t_3; - int __pyx_t_4; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; - PyObject *__pyx_t_6 = NULL; + int __pyx_t_6; PyObject *__pyx_t_7 = NULL; - PyObject *__pyx_t_8 = NULL; + int __pyx_t_8; + std::string __pyx_t_9; + std::string __pyx_t_10; + int __pyx_t_11; + PyObject *__pyx_t_12 = NULL; + PyObject *__pyx_t_13 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("decode_point_cloud_buffer", 0); + __Pyx_RefNannySetupContext("_generate_encoder_and_update_metadata", 0); + + /* "DracoPy.pyx":137 + * vector[MetadataObject]& metadatas, + * GeometryMetadataObject& geometry_metadata): + * encoder = Encoder() # <<<<<<<<<<<<<< + * speed = 10 - compression_level + * encoder.SetSpeedOptions(speed, speed) + */ + __pyx_t_1 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_7DracoPy_Encoder)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 137, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_encoder = ((struct __pyx_obj_7DracoPy_Encoder *)__pyx_t_1); + __pyx_t_1 = 0; - /* "DracoPy.pyx":151 - * - * def decode_point_cloud_buffer(buffer): - * point_cloud_struct = DracoPy.decode_buffer_to_point_cloud(buffer, len(buffer)) # <<<<<<<<<<<<<< - * if point_cloud_struct.decode_status == DracoPy.decoding_status.successful: - * return DracoPointCloud(point_cloud_struct) + /* "DracoPy.pyx":138 + * GeometryMetadataObject& geometry_metadata): + * encoder = Encoder() + * speed = 10 - compression_level # <<<<<<<<<<<<<< + * encoder.SetSpeedOptions(speed, speed) + * to_create_quantization_metadata = not metadatas.empty() */ - __pyx_t_1 = __Pyx_PyObject_AsString(__pyx_v_buffer); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) __PYX_ERR(0, 151, __pyx_L1_error) - __pyx_t_2 = PyObject_Length(__pyx_v_buffer); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 151, __pyx_L1_error) - try { - __pyx_t_3 = DracoFunctions::decode_buffer_to_point_cloud(__pyx_t_1, __pyx_t_2); - } catch(...) { - __Pyx_CppExn2PyErr(); - __PYX_ERR(0, 151, __pyx_L1_error) + __pyx_v_speed = (10 - __pyx_v_compression_level); + + /* "DracoPy.pyx":139 + * encoder = Encoder() + * speed = 10 - compression_level + * encoder.SetSpeedOptions(speed, speed) # <<<<<<<<<<<<<< + * to_create_quantization_metadata = not metadatas.empty() + * cdef MetadataObject *metadata = NULL; + */ + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_encoder), __pyx_n_s_SetSpeedOptions); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 139, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyInt_From_long(__pyx_v_speed); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 139, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyInt_From_long(__pyx_v_speed); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 139, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = NULL; + __pyx_t_6 = 0; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + __pyx_t_6 = 1; + } } - __pyx_v_point_cloud_struct = __pyx_t_3; + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_2)) { + PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_3, __pyx_t_4}; + __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 139, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { + PyObject *__pyx_temp[3] = {__pyx_t_5, __pyx_t_3, __pyx_t_4}; + __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 139, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } else + #endif + { + __pyx_t_7 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 139, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + if (__pyx_t_5) { + __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __pyx_t_5 = NULL; + } + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_t_4); + __pyx_t_3 = 0; + __pyx_t_4 = 0; + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 139, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "DracoPy.pyx":152 - * def decode_point_cloud_buffer(buffer): - * point_cloud_struct = DracoPy.decode_buffer_to_point_cloud(buffer, len(buffer)) - * if point_cloud_struct.decode_status == DracoPy.decoding_status.successful: # <<<<<<<<<<<<<< - * return DracoPointCloud(point_cloud_struct) - * else: + /* "DracoPy.pyx":140 + * speed = 10 - compression_level + * encoder.SetSpeedOptions(speed, speed) + * to_create_quantization_metadata = not metadatas.empty() # <<<<<<<<<<<<<< + * cdef MetadataObject *metadata = NULL; + * if to_create_quantization_metadata: */ - __pyx_t_4 = ((__pyx_v_point_cloud_struct.decode_status == DracoFunctions::successful) != 0); - if (__pyx_t_4) { + __pyx_v_to_create_quantization_metadata = (!(__pyx_v_metadatas.empty() != 0)); - /* "DracoPy.pyx":153 - * point_cloud_struct = DracoPy.decode_buffer_to_point_cloud(buffer, len(buffer)) - * if point_cloud_struct.decode_status == DracoPy.decoding_status.successful: - * return DracoPointCloud(point_cloud_struct) # <<<<<<<<<<<<<< - * else: - * raise_decoding_error(point_cloud_struct.decode_status) + /* "DracoPy.pyx":141 + * encoder.SetSpeedOptions(speed, speed) + * to_create_quantization_metadata = not metadatas.empty() + * cdef MetadataObject *metadata = NULL; # <<<<<<<<<<<<<< + * if to_create_quantization_metadata: + * metadata = &metadatas[geometry_metadata.metadata_id] */ - __Pyx_XDECREF(__pyx_r); - __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_DracoPointCloud); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 153, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = __pyx_convert__to_py_struct__DracoFunctions_3a__3a_PointCloudObject(__pyx_v_point_cloud_struct); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 153, __pyx_L1_error) + __pyx_v_metadata = NULL; + + /* "DracoPy.pyx":142 + * to_create_quantization_metadata = not metadatas.empty() + * cdef MetadataObject *metadata = NULL; + * if to_create_quantization_metadata: # <<<<<<<<<<<<<< + * metadata = &metadatas[geometry_metadata.metadata_id] + * metadata.entries[b"quantization_bits"] = struct.pack( + */ + __pyx_t_8 = (__pyx_v_to_create_quantization_metadata != 0); + if (__pyx_t_8) { + + /* "DracoPy.pyx":143 + * cdef MetadataObject *metadata = NULL; + * if to_create_quantization_metadata: + * metadata = &metadatas[geometry_metadata.metadata_id] # <<<<<<<<<<<<<< + * metadata.entries[b"quantization_bits"] = struct.pack( + * "=i", quantization_bits) + */ + __pyx_v_metadata = (&(__pyx_v_metadatas[__pyx_v_geometry_metadata.metadata_id])); + + /* "DracoPy.pyx":144 + * if to_create_quantization_metadata: + * metadata = &metadatas[geometry_metadata.metadata_id] + * metadata.entries[b"quantization_bits"] = struct.pack( # <<<<<<<<<<<<<< + * "=i", quantization_bits) + * if quantization_origin.empty() or quantization_range == -1: + */ + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_struct); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 144, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_pack); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 144, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); - __pyx_t_8 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) { - __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_6); - if (likely(__pyx_t_8)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); - __Pyx_INCREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "DracoPy.pyx":145 + * metadata = &metadatas[geometry_metadata.metadata_id] + * metadata.entries[b"quantization_bits"] = struct.pack( + * "=i", quantization_bits) # <<<<<<<<<<<<<< + * if quantization_origin.empty() or quantization_range == -1: + * encoder.SetAttributeQuantization( + */ + __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_quantization_bits); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 145, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = NULL; + __pyx_t_6 = 0; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_7); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7); + __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_6, function); + __Pyx_DECREF_SET(__pyx_t_7, function); + __pyx_t_6 = 1; } } - __pyx_t_5 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_8, __pyx_t_7) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_7); - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_7)) { + PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_kp_u_i, __pyx_t_2}; + __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 144, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) { + PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_kp_u_i, __pyx_t_2}; + __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 144, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + } else + #endif + { + __pyx_t_3 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 144, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (__pyx_t_4) { + __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4); __pyx_t_4 = NULL; + } + __Pyx_INCREF(__pyx_kp_u_i); + __Pyx_GIVEREF(__pyx_kp_u_i); + PyTuple_SET_ITEM(__pyx_t_3, 0+__pyx_t_6, __pyx_kp_u_i); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_3, 1+__pyx_t_6, __pyx_t_2); + __pyx_t_2 = 0; + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 144, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 153, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_r = __pyx_t_5; - __pyx_t_5 = 0; - goto __pyx_L0; - /* "DracoPy.pyx":152 - * def decode_point_cloud_buffer(buffer): - * point_cloud_struct = DracoPy.decode_buffer_to_point_cloud(buffer, len(buffer)) - * if point_cloud_struct.decode_status == DracoPy.decoding_status.successful: # <<<<<<<<<<<<<< - * return DracoPointCloud(point_cloud_struct) - * else: + /* "DracoPy.pyx":144 + * if to_create_quantization_metadata: + * metadata = &metadatas[geometry_metadata.metadata_id] + * metadata.entries[b"quantization_bits"] = struct.pack( # <<<<<<<<<<<<<< + * "=i", quantization_bits) + * if quantization_origin.empty() or quantization_range == -1: + */ + __pyx_t_9 = __pyx_convert_string_from_py_std__in_string(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 144, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_10 = __pyx_convert_string_from_py_std__in_string(__pyx_n_b_quantization_bits); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 144, __pyx_L1_error) + (__pyx_v_metadata->entries[__pyx_t_10]) = __pyx_t_9; + + /* "DracoPy.pyx":142 + * to_create_quantization_metadata = not metadatas.empty() + * cdef MetadataObject *metadata = NULL; + * if to_create_quantization_metadata: # <<<<<<<<<<<<<< + * metadata = &metadatas[geometry_metadata.metadata_id] + * metadata.entries[b"quantization_bits"] = struct.pack( */ } - /* "DracoPy.pyx":155 - * return DracoPointCloud(point_cloud_struct) + /* "DracoPy.pyx":146 + * metadata.entries[b"quantization_bits"] = struct.pack( + * "=i", quantization_bits) + * if quantization_origin.empty() or quantization_range == -1: # <<<<<<<<<<<<<< + * encoder.SetAttributeQuantization( + * GeometryAttributeType.POSITION, quantization_bits) + */ + __pyx_t_11 = (__pyx_v_quantization_origin.empty() != 0); + if (!__pyx_t_11) { + } else { + __pyx_t_8 = __pyx_t_11; + goto __pyx_L5_bool_binop_done; + } + __pyx_t_11 = ((__pyx_v_quantization_range == -1.0) != 0); + __pyx_t_8 = __pyx_t_11; + __pyx_L5_bool_binop_done:; + if (__pyx_t_8) { + + /* "DracoPy.pyx":147 + * "=i", quantization_bits) + * if quantization_origin.empty() or quantization_range == -1: + * encoder.SetAttributeQuantization( # <<<<<<<<<<<<<< + * GeometryAttributeType.POSITION, quantization_bits) * else: - * raise_decoding_error(point_cloud_struct.decode_status) # <<<<<<<<<<<<<< */ - /*else*/ { - __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_raise_decoding_error); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 155, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = __Pyx_PyInt_From_enum__DracoFunctions_3a__3a_decoding_status(__pyx_v_point_cloud_struct.decode_status); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 155, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_encoder), __pyx_n_s_SetAttributeQuantization); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 147, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); - __pyx_t_8 = NULL; - if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) { - __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_6); - if (likely(__pyx_t_8)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); - __Pyx_INCREF(__pyx_t_8); + + /* "DracoPy.pyx":148 + * if quantization_origin.empty() or quantization_range == -1: + * encoder.SetAttributeQuantization( + * GeometryAttributeType.POSITION, quantization_bits) # <<<<<<<<<<<<<< + * else: + * encoder.SetAttributeExplicitQuantization( + */ + __pyx_t_3 = __Pyx_PyInt_From_enum__draco_3a__3a_GeometryAttribute_3a__3a_Type(draco::GeometryAttribute::POSITION); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 148, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_quantization_bits); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 148, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = NULL; + __pyx_t_6 = 0; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_7); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7); + __Pyx_INCREF(__pyx_t_4); __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_6, function); + __Pyx_DECREF_SET(__pyx_t_7, function); + __pyx_t_6 = 1; } } - __pyx_t_5 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_6, __pyx_t_8, __pyx_t_7) : __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_7); - __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_7)) { + PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_3, __pyx_t_2}; + __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 147, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) { + PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_t_3, __pyx_t_2}; + __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 147, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + } else + #endif + { + __pyx_t_5 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 147, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (__pyx_t_4) { + __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); __pyx_t_4 = NULL; + } + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_6, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_6, __pyx_t_2); + __pyx_t_3 = 0; + __pyx_t_2 = 0; + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 147, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 155, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "DracoPy.pyx":146 + * metadata.entries[b"quantization_bits"] = struct.pack( + * "=i", quantization_bits) + * if quantization_origin.empty() or quantization_range == -1: # <<<<<<<<<<<<<< + * encoder.SetAttributeQuantization( + * GeometryAttributeType.POSITION, quantization_bits) + */ + goto __pyx_L4; } /* "DracoPy.pyx":150 - * raise_decoding_error(mesh_struct.decode_status) - * - * def decode_point_cloud_buffer(buffer): # <<<<<<<<<<<<<< - * point_cloud_struct = DracoPy.decode_buffer_to_point_cloud(buffer, len(buffer)) - * if point_cloud_struct.decode_status == DracoPy.decoding_status.successful: + * GeometryAttributeType.POSITION, quantization_bits) + * else: + * encoder.SetAttributeExplicitQuantization( # <<<<<<<<<<<<<< + * GeometryAttributeType.POSITION, quantization_bits, + * quantization_range, quantization_origin) */ + /*else*/ { + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_encoder), __pyx_n_s_SetAttributeExplicitQuantization); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 150, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); - /* function exit code */ - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - goto __pyx_L0; - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_8); - __Pyx_AddTraceback("DracoPy.decode_point_cloud_buffer", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = NULL; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} + /* "DracoPy.pyx":151 + * else: + * encoder.SetAttributeExplicitQuantization( + * GeometryAttributeType.POSITION, quantization_bits, # <<<<<<<<<<<<<< + * quantization_range, quantization_origin) + * if to_create_quantization_metadata: + */ + __pyx_t_5 = __Pyx_PyInt_From_enum__draco_3a__3a_GeometryAttribute_3a__3a_Type(draco::GeometryAttribute::POSITION); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 151, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_2 = __Pyx_PyInt_From_int(__pyx_v_quantization_bits); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 151, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); -/* "vector.from_py":45 - * - * @cname("__pyx_convert_vector_from_py_float") - * cdef vector[X] __pyx_convert_vector_from_py_float(object o) except *: # <<<<<<<<<<<<<< - * cdef vector[X] v - * for item in o: + /* "DracoPy.pyx":152 + * encoder.SetAttributeExplicitQuantization( + * GeometryAttributeType.POSITION, quantization_bits, + * quantization_range, quantization_origin) # <<<<<<<<<<<<<< + * if to_create_quantization_metadata: + * metadata.entries[b"quantization_range"] = struct.pack( */ + __pyx_t_3 = PyFloat_FromDouble(__pyx_v_quantization_range); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 152, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __pyx_convert_vector_to_py_double(__pyx_v_quantization_origin); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 152, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_12 = NULL; + __pyx_t_6 = 0; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) { + __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_7); + if (likely(__pyx_t_12)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7); + __Pyx_INCREF(__pyx_t_12); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_7, function); + __pyx_t_6 = 1; + } + } + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_7)) { + PyObject *__pyx_temp[5] = {__pyx_t_12, __pyx_t_5, __pyx_t_2, __pyx_t_3, __pyx_t_4}; + __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_6, 4+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 150, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_7)) { + PyObject *__pyx_temp[5] = {__pyx_t_12, __pyx_t_5, __pyx_t_2, __pyx_t_3, __pyx_t_4}; + __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_7, __pyx_temp+1-__pyx_t_6, 4+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 150, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_12); __pyx_t_12 = 0; + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } else + #endif + { + __pyx_t_13 = PyTuple_New(4+__pyx_t_6); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 150, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_13); + if (__pyx_t_12) { + __Pyx_GIVEREF(__pyx_t_12); PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_12); __pyx_t_12 = NULL; + } + __Pyx_GIVEREF(__pyx_t_5); + PyTuple_SET_ITEM(__pyx_t_13, 0+__pyx_t_6, __pyx_t_5); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_13, 1+__pyx_t_6, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_13, 2+__pyx_t_6, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_13, 3+__pyx_t_6, __pyx_t_4); + __pyx_t_5 = 0; + __pyx_t_2 = 0; + __pyx_t_3 = 0; + __pyx_t_4 = 0; + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_13, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 150, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + } + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; -static std::vector __pyx_convert_vector_from_py_float(PyObject *__pyx_v_o) { - std::vector __pyx_v_v; - PyObject *__pyx_v_item = NULL; - std::vector __pyx_r; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - Py_ssize_t __pyx_t_2; - PyObject *(*__pyx_t_3)(PyObject *); - PyObject *__pyx_t_4 = NULL; - float __pyx_t_5; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__pyx_convert_vector_from_py_float", 0); + /* "DracoPy.pyx":153 + * GeometryAttributeType.POSITION, quantization_bits, + * quantization_range, quantization_origin) + * if to_create_quantization_metadata: # <<<<<<<<<<<<<< + * metadata.entries[b"quantization_range"] = struct.pack( + * "=d", quantization_range) + */ + __pyx_t_8 = (__pyx_v_to_create_quantization_metadata != 0); + if (__pyx_t_8) { + + /* "DracoPy.pyx":154 + * quantization_range, quantization_origin) + * if to_create_quantization_metadata: + * metadata.entries[b"quantization_range"] = struct.pack( # <<<<<<<<<<<<<< + * "=d", quantization_range) + * metadata.entries[b"quantization_origin"] = struct.pack( + */ + __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_struct); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 154, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_pack); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 154, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_13); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "vector.from_py":47 - * cdef vector[X] __pyx_convert_vector_from_py_float(object o) except *: - * cdef vector[X] v - * for item in o: # <<<<<<<<<<<<<< - * v.push_back(item) - * return v + /* "DracoPy.pyx":155 + * if to_create_quantization_metadata: + * metadata.entries[b"quantization_range"] = struct.pack( + * "=d", quantization_range) # <<<<<<<<<<<<<< + * metadata.entries[b"quantization_origin"] = struct.pack( + * "=ddd", */ - if (likely(PyList_CheckExact(__pyx_v_o)) || PyTuple_CheckExact(__pyx_v_o)) { - __pyx_t_1 = __pyx_v_o; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0; - __pyx_t_3 = NULL; - } else { - __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_o); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 47, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 47, __pyx_L1_error) - } - for (;;) { - if (likely(!__pyx_t_3)) { - if (likely(PyList_CheckExact(__pyx_t_1))) { - if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(1, 47, __pyx_L1_error) - #else - __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 47, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - #endif - } else { - if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(1, 47, __pyx_L1_error) - #else - __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 47, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - #endif + __pyx_t_7 = PyFloat_FromDouble(__pyx_v_quantization_range); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 155, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_4 = NULL; + __pyx_t_6 = 0; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_13))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_13); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_13); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_13, function); + __pyx_t_6 = 1; + } } - } else { - __pyx_t_4 = __pyx_t_3(__pyx_t_1); - if (unlikely(!__pyx_t_4)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(1, 47, __pyx_L1_error) + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_13)) { + PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_kp_u_d, __pyx_t_7}; + __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_13, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 154, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_13)) { + PyObject *__pyx_temp[3] = {__pyx_t_4, __pyx_kp_u_d, __pyx_t_7}; + __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_13, __pyx_temp+1-__pyx_t_6, 2+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 154, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + } else + #endif + { + __pyx_t_3 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 154, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (__pyx_t_4) { + __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4); __pyx_t_4 = NULL; } - break; + __Pyx_INCREF(__pyx_kp_u_d); + __Pyx_GIVEREF(__pyx_kp_u_d); + PyTuple_SET_ITEM(__pyx_t_3, 0+__pyx_t_6, __pyx_kp_u_d); + __Pyx_GIVEREF(__pyx_t_7); + PyTuple_SET_ITEM(__pyx_t_3, 1+__pyx_t_6, __pyx_t_7); + __pyx_t_7 = 0; + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_13, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 154, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } - __Pyx_GOTREF(__pyx_t_4); - } - __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_4); - __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + + /* "DracoPy.pyx":154 + * quantization_range, quantization_origin) + * if to_create_quantization_metadata: + * metadata.entries[b"quantization_range"] = struct.pack( # <<<<<<<<<<<<<< + * "=d", quantization_range) + * metadata.entries[b"quantization_origin"] = struct.pack( + */ + __pyx_t_9 = __pyx_convert_string_from_py_std__in_string(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 154, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_10 = __pyx_convert_string_from_py_std__in_string(__pyx_n_b_quantization_range); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 154, __pyx_L1_error) + (__pyx_v_metadata->entries[__pyx_t_10]) = __pyx_t_9; + + /* "DracoPy.pyx":156 + * metadata.entries[b"quantization_range"] = struct.pack( + * "=d", quantization_range) + * metadata.entries[b"quantization_origin"] = struct.pack( # <<<<<<<<<<<<<< + * "=ddd", + * quantization_origin[0], + */ + __Pyx_GetModuleGlobalName(__pyx_t_13, __pyx_n_s_struct); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 156, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_13); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_n_s_pack); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 156, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + + /* "DracoPy.pyx":158 + * metadata.entries[b"quantization_origin"] = struct.pack( + * "=ddd", + * quantization_origin[0], # <<<<<<<<<<<<<< + * quantization_origin[1], + * quantization_origin[2]) + */ + __pyx_t_13 = PyFloat_FromDouble((__pyx_v_quantization_origin[0])); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 158, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_13); + + /* "DracoPy.pyx":159 + * "=ddd", + * quantization_origin[0], + * quantization_origin[1], # <<<<<<<<<<<<<< + * quantization_origin[2]) + * return encoder + */ + __pyx_t_7 = PyFloat_FromDouble((__pyx_v_quantization_origin[1])); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 159, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); - /* "vector.from_py":48 - * cdef vector[X] v - * for item in o: - * v.push_back(item) # <<<<<<<<<<<<<< - * return v + /* "DracoPy.pyx":160 + * quantization_origin[0], + * quantization_origin[1], + * quantization_origin[2]) # <<<<<<<<<<<<<< + * return encoder * */ - __pyx_t_5 = __pyx_PyFloat_AsFloat(__pyx_v_item); if (unlikely((__pyx_t_5 == (float)-1) && PyErr_Occurred())) __PYX_ERR(1, 48, __pyx_L1_error) - __pyx_v_v.push_back(((float)__pyx_t_5)); - - /* "vector.from_py":47 - * cdef vector[X] __pyx_convert_vector_from_py_float(object o) except *: - * cdef vector[X] v - * for item in o: # <<<<<<<<<<<<<< - * v.push_back(item) - * return v + __pyx_t_4 = PyFloat_FromDouble((__pyx_v_quantization_origin[2])); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 160, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_2 = NULL; + __pyx_t_6 = 0; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_2)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_2); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + __pyx_t_6 = 1; + } + } + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_3)) { + PyObject *__pyx_temp[5] = {__pyx_t_2, __pyx_kp_u_ddd, __pyx_t_13, __pyx_t_7, __pyx_t_4}; + __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_6, 4+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 156, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_3)) { + PyObject *__pyx_temp[5] = {__pyx_t_2, __pyx_kp_u_ddd, __pyx_t_13, __pyx_t_7, __pyx_t_4}; + __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_3, __pyx_temp+1-__pyx_t_6, 4+__pyx_t_6); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 156, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + } else + #endif + { + __pyx_t_5 = PyTuple_New(4+__pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 156, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (__pyx_t_2) { + __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2); __pyx_t_2 = NULL; + } + __Pyx_INCREF(__pyx_kp_u_ddd); + __Pyx_GIVEREF(__pyx_kp_u_ddd); + PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_6, __pyx_kp_u_ddd); + __Pyx_GIVEREF(__pyx_t_13); + PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_6, __pyx_t_13); + __Pyx_GIVEREF(__pyx_t_7); + PyTuple_SET_ITEM(__pyx_t_5, 2+__pyx_t_6, __pyx_t_7); + __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_5, 3+__pyx_t_6, __pyx_t_4); + __pyx_t_13 = 0; + __pyx_t_7 = 0; + __pyx_t_4 = 0; + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 156, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "DracoPy.pyx":156 + * metadata.entries[b"quantization_range"] = struct.pack( + * "=d", quantization_range) + * metadata.entries[b"quantization_origin"] = struct.pack( # <<<<<<<<<<<<<< + * "=ddd", + * quantization_origin[0], */ + __pyx_t_9 = __pyx_convert_string_from_py_std__in_string(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 156, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_10 = __pyx_convert_string_from_py_std__in_string(__pyx_n_b_quantization_origin); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 156, __pyx_L1_error) + (__pyx_v_metadata->entries[__pyx_t_10]) = __pyx_t_9; + + /* "DracoPy.pyx":153 + * GeometryAttributeType.POSITION, quantization_bits, + * quantization_range, quantization_origin) + * if to_create_quantization_metadata: # <<<<<<<<<<<<<< + * metadata.entries[b"quantization_range"] = struct.pack( + * "=d", quantization_range) + */ + } } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_L4:; - /* "vector.from_py":49 - * for item in o: - * v.push_back(item) - * return v # <<<<<<<<<<<<<< - * + /* "DracoPy.pyx":161 + * quantization_origin[1], + * quantization_origin[2]) + * return encoder # <<<<<<<<<<<<<< * + * def encode_mesh_to_buffer(points, faces, */ - __pyx_r = __pyx_v_v; + __Pyx_XDECREF(((PyObject *)__pyx_r)); + __Pyx_INCREF(((PyObject *)__pyx_v_encoder)); + __pyx_r = __pyx_v_encoder; goto __pyx_L0; - /* "vector.from_py":45 + /* "DracoPy.pyx":130 * - * @cname("__pyx_convert_vector_from_py_float") - * cdef vector[X] __pyx_convert_vector_from_py_float(object o) except *: # <<<<<<<<<<<<<< - * cdef vector[X] v - * for item in o: + * + * cdef Encoder _generate_encoder_and_update_metadata( # <<<<<<<<<<<<<< + * int quantization_bits, + * int compression_level, */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("vector.from_py.__pyx_convert_vector_from_py_float", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_pretend_to_initialize(&__pyx_r); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_12); + __Pyx_XDECREF(__pyx_t_13); + __Pyx_AddTraceback("DracoPy._generate_encoder_and_update_metadata", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; __pyx_L0:; - __Pyx_XDECREF(__pyx_v_item); + __Pyx_XDECREF((PyObject *)__pyx_v_encoder); + __Pyx_XGIVEREF((PyObject *)__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -static std::vector __pyx_convert_vector_from_py_uint32_t(PyObject *__pyx_v_o) { - std::vector __pyx_v_v; - PyObject *__pyx_v_item = NULL; - std::vector __pyx_r; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - Py_ssize_t __pyx_t_2; - PyObject *(*__pyx_t_3)(PyObject *); - PyObject *__pyx_t_4 = NULL; - uint32_t __pyx_t_5; +/* "DracoPy.pyx":163 + * return encoder + * + * def encode_mesh_to_buffer(points, faces, # <<<<<<<<<<<<<< + * quantization_bits=14, + * compression_level=1, + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_7DracoPy_5encode_mesh_to_buffer(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_7DracoPy_4encode_mesh_to_buffer[] = "\n Legacy version of 'encode_to_buffer' function\n It allows:\n * set up encoder\n * save encoder settings into metadata\n * serialize to buffer as mesh\n\n :param List[float] points: vector of points coordination\n :param Optional[List[int]] faces: vector of points indexes\n (each triple means one face).\n :param int quantization_bits: integer between 0 and 31\n :param int compression_level: integer between 0 and 10\n :param float quantization_range: float representing the size\n of the bounding cube for the mesh. By default it is the range of\n the dimension of the input vertices with greatest range.\n :param quantization_origin: point in space where the bounding box begins.\n By default it is a point where each coordinate is the minimum\n of that coordinate among the input vertices.\n :param bool create_metadata: if True then it creates GeometryMetadata\n :return bytes: encoded mesh\n "; +static PyMethodDef __pyx_mdef_7DracoPy_5encode_mesh_to_buffer = {"encode_mesh_to_buffer", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7DracoPy_5encode_mesh_to_buffer, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7DracoPy_4encode_mesh_to_buffer}; +static PyObject *__pyx_pw_7DracoPy_5encode_mesh_to_buffer(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_points = 0; + PyObject *__pyx_v_faces = 0; + PyObject *__pyx_v_quantization_bits = 0; + PyObject *__pyx_v_compression_level = 0; + PyObject *__pyx_v_quantization_range = 0; + PyObject *__pyx_v_quantization_origin = 0; + PyObject *__pyx_v_create_metadata = 0; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__pyx_convert_vector_from_py_uint32_t", 0); + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("encode_mesh_to_buffer (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_points,&__pyx_n_s_faces,&__pyx_n_s_quantization_bits,&__pyx_n_s_compression_level,&__pyx_n_s_quantization_range,&__pyx_n_s_quantization_origin,&__pyx_n_s_create_metadata,0}; + PyObject* values[7] = {0,0,0,0,0,0,0}; + values[2] = ((PyObject *)__pyx_int_14); + values[3] = ((PyObject *)__pyx_int_1); + values[4] = ((PyObject *)__pyx_int_neg_1); - /* "vector.from_py":47 - * cdef vector[X] __pyx_convert_vector_from_py_uint32_t(object o) except *: - * cdef vector[X] v - * for item in o: # <<<<<<<<<<<<<< - * v.push_back(item) - * return v + /* "DracoPy.pyx":167 + * compression_level=1, + * quantization_range=-1, + * quantization_origin=None, # <<<<<<<<<<<<<< + * create_metadata=False, + * ): */ - if (likely(PyList_CheckExact(__pyx_v_o)) || PyTuple_CheckExact(__pyx_v_o)) { - __pyx_t_1 = __pyx_v_o; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0; - __pyx_t_3 = NULL; - } else { - __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_o); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 47, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 47, __pyx_L1_error) - } - for (;;) { - if (likely(!__pyx_t_3)) { - if (likely(PyList_CheckExact(__pyx_t_1))) { - if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(1, 47, __pyx_L1_error) - #else - __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 47, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - #endif - } else { - if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break; - #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(1, 47, __pyx_L1_error) - #else - __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 47, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - #endif - } - } else { - __pyx_t_4 = __pyx_t_3(__pyx_t_1); - if (unlikely(!__pyx_t_4)) { - PyObject* exc_type = PyErr_Occurred(); - if (exc_type) { - if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(1, 47, __pyx_L1_error) - } - break; - } - __Pyx_GOTREF(__pyx_t_4); - } - __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_4); - __pyx_t_4 = 0; + values[5] = ((PyObject *)Py_None); - /* "vector.from_py":48 - * cdef vector[X] v - * for item in o: - * v.push_back(item) # <<<<<<<<<<<<<< - * return v - * - */ - __pyx_t_5 = __Pyx_PyInt_As_uint32_t(__pyx_v_item); if (unlikely((__pyx_t_5 == ((uint32_t)-1)) && PyErr_Occurred())) __PYX_ERR(1, 48, __pyx_L1_error) - __pyx_v_v.push_back(((uint32_t)__pyx_t_5)); - - /* "vector.from_py":47 - * cdef vector[X] __pyx_convert_vector_from_py_uint32_t(object o) except *: - * cdef vector[X] v - * for item in o: # <<<<<<<<<<<<<< - * v.push_back(item) - * return v + /* "DracoPy.pyx":168 + * quantization_range=-1, + * quantization_origin=None, + * create_metadata=False, # <<<<<<<<<<<<<< + * ): + * """ */ + values[6] = ((PyObject *)Py_False); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); + CYTHON_FALLTHROUGH; + case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); + CYTHON_FALLTHROUGH; + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + CYTHON_FALLTHROUGH; + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + CYTHON_FALLTHROUGH; + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_points)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_faces)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("encode_mesh_to_buffer", 0, 2, 7, 1); __PYX_ERR(0, 163, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_quantization_bits); + if (value) { values[2] = value; kw_args--; } + } + CYTHON_FALLTHROUGH; + case 3: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_compression_level); + if (value) { values[3] = value; kw_args--; } + } + CYTHON_FALLTHROUGH; + case 4: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_quantization_range); + if (value) { values[4] = value; kw_args--; } + } + CYTHON_FALLTHROUGH; + case 5: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_quantization_origin); + if (value) { values[5] = value; kw_args--; } + } + CYTHON_FALLTHROUGH; + case 6: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_create_metadata); + if (value) { values[6] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "encode_mesh_to_buffer") < 0)) __PYX_ERR(0, 163, __pyx_L3_error) + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); + CYTHON_FALLTHROUGH; + case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); + CYTHON_FALLTHROUGH; + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + CYTHON_FALLTHROUGH; + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + CYTHON_FALLTHROUGH; + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_points = values[0]; + __pyx_v_faces = values[1]; + __pyx_v_quantization_bits = values[2]; + __pyx_v_compression_level = values[3]; + __pyx_v_quantization_range = values[4]; + __pyx_v_quantization_origin = values[5]; + __pyx_v_create_metadata = values[6]; } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "vector.from_py":49 - * for item in o: - * v.push_back(item) - * return v # <<<<<<<<<<<<<< - * - * - */ - __pyx_r = __pyx_v_v; - goto __pyx_L0; + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("encode_mesh_to_buffer", 0, 2, 7, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 163, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("DracoPy.encode_mesh_to_buffer", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_7DracoPy_4encode_mesh_to_buffer(__pyx_self, __pyx_v_points, __pyx_v_faces, __pyx_v_quantization_bits, __pyx_v_compression_level, __pyx_v_quantization_range, __pyx_v_quantization_origin, __pyx_v_create_metadata); - /* "vector.from_py":45 + /* "DracoPy.pyx":163 + * return encoder * - * @cname("__pyx_convert_vector_from_py_uint32_t") - * cdef vector[X] __pyx_convert_vector_from_py_uint32_t(object o) except *: # <<<<<<<<<<<<<< - * cdef vector[X] v - * for item in o: + * def encode_mesh_to_buffer(points, faces, # <<<<<<<<<<<<<< + * quantization_bits=14, + * compression_level=1, */ /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("vector.from_py.__pyx_convert_vector_from_py_uint32_t", __pyx_clineno, __pyx_lineno, __pyx_filename); - __Pyx_pretend_to_initialize(&__pyx_r); - __pyx_L0:; - __Pyx_XDECREF(__pyx_v_item); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "vector.to_py":60 - * - * @cname("__pyx_convert_vector_to_py_unsigned_char") - * cdef object __pyx_convert_vector_to_py_unsigned_char(vector[X]& v): # <<<<<<<<<<<<<< - * return [v[i] for i in range(v.size())] - * - */ - -static PyObject *__pyx_convert_vector_to_py_unsigned_char(const std::vector &__pyx_v_v) { - size_t __pyx_v_i; +static PyObject *__pyx_pf_7DracoPy_4encode_mesh_to_buffer(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_points, PyObject *__pyx_v_faces, PyObject *__pyx_v_quantization_bits, PyObject *__pyx_v_compression_level, PyObject *__pyx_v_quantization_range, PyObject *__pyx_v_quantization_origin, PyObject *__pyx_v_create_metadata) { + struct DracoFunctions::GeometryMetadataObject __pyx_v_geometry_metadata; + std::vector __pyx_v_metadatas; + struct __pyx_obj_7DracoPy_Encoder *__pyx_v_encoder = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - size_t __pyx_t_2; - size_t __pyx_t_3; - size_t __pyx_t_4; - PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + struct DracoFunctions::GeometryMetadataObject __pyx_t_4; + int __pyx_t_5; + struct DracoFunctions::MetadataObject __pyx_t_6; + int __pyx_t_7; + int __pyx_t_8; + double __pyx_t_9; + std::vector __pyx_t_10; + std::vector __pyx_t_11; + PyObject *__pyx_t_12 = NULL; + PyObject *__pyx_t_13 = NULL; + PyObject *__pyx_t_14 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__pyx_convert_vector_to_py_unsigned_char", 0); + __Pyx_RefNannySetupContext("encode_mesh_to_buffer", 0); - /* "vector.to_py":61 - * @cname("__pyx_convert_vector_to_py_unsigned_char") - * cdef object __pyx_convert_vector_to_py_unsigned_char(vector[X]& v): - * return [v[i] for i in range(v.size())] # <<<<<<<<<<<<<< + /* "DracoPy.pyx":191 + * :return bytes: encoded mesh + * """ + * cdef GeometryMetadataObject geometry_metadata = _create_empty_geometry_metadata() # <<<<<<<<<<<<<< + * cdef vector[MetadataObject] metadatas + * if create_metadata: + */ + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_create_empty_geometry_metadata); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 191, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + } + } + __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 191, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_4 = __pyx_convert__from_py_struct__DracoFunctions_3a__3a_GeometryMetadataObject(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 191, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_geometry_metadata = __pyx_t_4; + + /* "DracoPy.pyx":193 + * cdef GeometryMetadataObject geometry_metadata = _create_empty_geometry_metadata() + * cdef vector[MetadataObject] metadatas + * if create_metadata: # <<<<<<<<<<<<<< + * metadatas.push_back(_create_empty_metadata()) + * encoder = _generate_encoder_and_update_metadata( + */ + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_create_metadata); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 193, __pyx_L1_error) + if (__pyx_t_5) { + + /* "DracoPy.pyx":194 + * cdef vector[MetadataObject] metadatas + * if create_metadata: + * metadatas.push_back(_create_empty_metadata()) # <<<<<<<<<<<<<< + * encoder = _generate_encoder_and_update_metadata( + * quantization_bits, + */ + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_create_empty_metadata); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 194, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + } + } + __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 194, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_6 = __pyx_convert__from_py_struct__DracoFunctions_3a__3a_MetadataObject(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 194, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + try { + __pyx_v_metadatas.push_back(__pyx_t_6); + } catch(...) { + __Pyx_CppExn2PyErr(); + __PYX_ERR(0, 194, __pyx_L1_error) + } + + /* "DracoPy.pyx":193 + * cdef GeometryMetadataObject geometry_metadata = _create_empty_geometry_metadata() + * cdef vector[MetadataObject] metadatas + * if create_metadata: # <<<<<<<<<<<<<< + * metadatas.push_back(_create_empty_metadata()) + * encoder = _generate_encoder_and_update_metadata( + */ + } + + /* "DracoPy.pyx":196 + * metadatas.push_back(_create_empty_metadata()) + * encoder = _generate_encoder_and_update_metadata( + * quantization_bits, # <<<<<<<<<<<<<< + * compression_level, + * quantization_range, + */ + __pyx_t_7 = __Pyx_PyInt_As_int(__pyx_v_quantization_bits); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 196, __pyx_L1_error) + + /* "DracoPy.pyx":197 + * encoder = _generate_encoder_and_update_metadata( + * quantization_bits, + * compression_level, # <<<<<<<<<<<<<< + * quantization_range, + * [] if quantization_origin is None else quantization_origin, + */ + __pyx_t_8 = __Pyx_PyInt_As_int(__pyx_v_compression_level); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 197, __pyx_L1_error) + + /* "DracoPy.pyx":198 + * quantization_bits, + * compression_level, + * quantization_range, # <<<<<<<<<<<<<< + * [] if quantization_origin is None else quantization_origin, + * metadatas, + */ + __pyx_t_9 = __pyx_PyFloat_AsDouble(__pyx_v_quantization_range); if (unlikely((__pyx_t_9 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 198, __pyx_L1_error) + + /* "DracoPy.pyx":199 + * compression_level, + * quantization_range, + * [] if quantization_origin is None else quantization_origin, # <<<<<<<<<<<<<< + * metadatas, + * geometry_metadata, + */ + __pyx_t_5 = (__pyx_v_quantization_origin == Py_None); + if ((__pyx_t_5 != 0)) { + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 199, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_11 = __pyx_convert_vector_from_py_double(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 199, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_10 = __pyx_t_11; + } else { + __pyx_t_11 = __pyx_convert_vector_from_py_double(__pyx_v_quantization_origin); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 199, __pyx_L1_error) + __pyx_t_10 = __pyx_t_11; + } + + /* "DracoPy.pyx":195 + * if create_metadata: + * metadatas.push_back(_create_empty_metadata()) + * encoder = _generate_encoder_and_update_metadata( # <<<<<<<<<<<<<< + * quantization_bits, + * compression_level, + */ + __pyx_t_1 = ((PyObject *)__pyx_f_7DracoPy__generate_encoder_and_update_metadata(__pyx_t_7, __pyx_t_8, __pyx_t_9, __pyx_t_10, __pyx_v_metadatas, __pyx_v_geometry_metadata)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 195, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_encoder = ((struct __pyx_obj_7DracoPy_Encoder *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "DracoPy.pyx":203 + * geometry_metadata, + * ) + * return encode_to_buffer(points, faces, encoder, metadatas, geometry_metadata) # <<<<<<<<<<<<<< * * */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 61, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __pyx_v_v.size(); - __pyx_t_3 = __pyx_t_2; - for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { - __pyx_v_i = __pyx_t_4; - __pyx_t_5 = __Pyx_PyInt_From_unsigned_char((__pyx_v_v[__pyx_v_i])); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 61, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_5))) __PYX_ERR(1, 61, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_encode_to_buffer); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 203, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __pyx_convert_vector_to_py_struct__DracoFunctions_3a__3a_MetadataObject(__pyx_v_metadatas); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 203, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_12 = __pyx_convert__to_py_struct__DracoFunctions_3a__3a_GeometryMetadataObject(__pyx_v_geometry_metadata); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 203, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + __pyx_t_13 = NULL; + __pyx_t_8 = 0; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_13)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_13); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + __pyx_t_8 = 1; + } + } + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_2)) { + PyObject *__pyx_temp[6] = {__pyx_t_13, __pyx_v_points, __pyx_v_faces, ((PyObject *)__pyx_v_encoder), __pyx_t_3, __pyx_t_12}; + __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_8, 5+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 203, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { + PyObject *__pyx_temp[6] = {__pyx_t_13, __pyx_v_points, __pyx_v_faces, ((PyObject *)__pyx_v_encoder), __pyx_t_3, __pyx_t_12}; + __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_8, 5+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 203, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + } else + #endif + { + __pyx_t_14 = PyTuple_New(5+__pyx_t_8); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 203, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_14); + if (__pyx_t_13) { + __Pyx_GIVEREF(__pyx_t_13); PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_13); __pyx_t_13 = NULL; + } + __Pyx_INCREF(__pyx_v_points); + __Pyx_GIVEREF(__pyx_v_points); + PyTuple_SET_ITEM(__pyx_t_14, 0+__pyx_t_8, __pyx_v_points); + __Pyx_INCREF(__pyx_v_faces); + __Pyx_GIVEREF(__pyx_v_faces); + PyTuple_SET_ITEM(__pyx_t_14, 1+__pyx_t_8, __pyx_v_faces); + __Pyx_INCREF(((PyObject *)__pyx_v_encoder)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_encoder)); + PyTuple_SET_ITEM(__pyx_t_14, 2+__pyx_t_8, ((PyObject *)__pyx_v_encoder)); + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_14, 3+__pyx_t_8, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_12); + PyTuple_SET_ITEM(__pyx_t_14, 4+__pyx_t_8, __pyx_t_12); + __pyx_t_3 = 0; + __pyx_t_12 = 0; + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_14, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 203, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "vector.to_py":60 - * - * @cname("__pyx_convert_vector_to_py_unsigned_char") - * cdef object __pyx_convert_vector_to_py_unsigned_char(vector[X]& v): # <<<<<<<<<<<<<< - * return [v[i] for i in range(v.size())] + /* "DracoPy.pyx":163 + * return encoder * + * def encode_mesh_to_buffer(points, faces, # <<<<<<<<<<<<<< + * quantization_bits=14, + * compression_level=1, */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("vector.to_py.__pyx_convert_vector_to_py_unsigned_char", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_12); + __Pyx_XDECREF(__pyx_t_13); + __Pyx_XDECREF(__pyx_t_14); + __Pyx_AddTraceback("DracoPy.encode_mesh_to_buffer", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_encoder); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_convert_vector_to_py_float(const std::vector &__pyx_v_v) { - size_t __pyx_v_i; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - size_t __pyx_t_2; - size_t __pyx_t_3; - size_t __pyx_t_4; - PyObject *__pyx_t_5 = NULL; - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__pyx_convert_vector_to_py_float", 0); - - /* "vector.to_py":61 - * @cname("__pyx_convert_vector_to_py_float") - * cdef object __pyx_convert_vector_to_py_float(vector[X]& v): - * return [v[i] for i in range(v.size())] # <<<<<<<<<<<<<< +/* "DracoPy.pyx":206 * * + * def encode_point_cloud_to_buffer(points, # <<<<<<<<<<<<<< + * quantization_bits=14, + * compression_level=1, */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 61, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __pyx_v_v.size(); - __pyx_t_3 = __pyx_t_2; - for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { - __pyx_v_i = __pyx_t_4; - __pyx_t_5 = PyFloat_FromDouble((__pyx_v_v[__pyx_v_i])); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 61, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_5))) __PYX_ERR(1, 61, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; - /* "vector.to_py":60 +/* Python wrapper */ +static PyObject *__pyx_pw_7DracoPy_7encode_point_cloud_to_buffer(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_7DracoPy_6encode_point_cloud_to_buffer[] = "\n Legacy version of 'encode_to_buffer' function\n It allows:\n * set up encoder\n * save encoder settings into metadata\n * serialize to buffer as point cloud\n\n :param List[float] points: vector of points coordination\n :param int quantization_bits: integer between 0 and 31\n :param int compression_level: integer between 0 and 10\n :param float quantization_range: float representing the size\n of the bounding cube for the mesh. By default it is the range of\n the dimension of the input vertices with greatest range.\n :param quantization_origin: point in space where the bounding box begins.\n By default it is a point where each coordinate is the minimum\n of that coordinate among the input vertices.\n :param bool create_metadata: if True then it creates GeometryMetadata\n :return bytes: encoded point cloud\n "; +static PyMethodDef __pyx_mdef_7DracoPy_7encode_point_cloud_to_buffer = {"encode_point_cloud_to_buffer", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7DracoPy_7encode_point_cloud_to_buffer, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7DracoPy_6encode_point_cloud_to_buffer}; +static PyObject *__pyx_pw_7DracoPy_7encode_point_cloud_to_buffer(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_points = 0; + PyObject *__pyx_v_quantization_bits = 0; + PyObject *__pyx_v_compression_level = 0; + PyObject *__pyx_v_quantization_range = 0; + PyObject *__pyx_v_quantization_origin = 0; + PyObject *__pyx_v_create_metadata = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("encode_point_cloud_to_buffer (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_points,&__pyx_n_s_quantization_bits,&__pyx_n_s_compression_level,&__pyx_n_s_quantization_range,&__pyx_n_s_quantization_origin,&__pyx_n_s_create_metadata,0}; + PyObject* values[6] = {0,0,0,0,0,0}; + values[1] = ((PyObject *)__pyx_int_14); + values[2] = ((PyObject *)__pyx_int_1); + values[3] = ((PyObject *)__pyx_int_neg_1); + + /* "DracoPy.pyx":210 + * compression_level=1, + * quantization_range=-1, + * quantization_origin=None, # <<<<<<<<<<<<<< + * create_metadata=False + * ): + */ + values[4] = ((PyObject *)Py_None); + + /* "DracoPy.pyx":211 + * quantization_range=-1, + * quantization_origin=None, + * create_metadata=False # <<<<<<<<<<<<<< + * ): + * """ + */ + values[5] = ((PyObject *)Py_False); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); + CYTHON_FALLTHROUGH; + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + CYTHON_FALLTHROUGH; + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + CYTHON_FALLTHROUGH; + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_points)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_quantization_bits); + if (value) { values[1] = value; kw_args--; } + } + CYTHON_FALLTHROUGH; + case 2: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_compression_level); + if (value) { values[2] = value; kw_args--; } + } + CYTHON_FALLTHROUGH; + case 3: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_quantization_range); + if (value) { values[3] = value; kw_args--; } + } + CYTHON_FALLTHROUGH; + case 4: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_quantization_origin); + if (value) { values[4] = value; kw_args--; } + } + CYTHON_FALLTHROUGH; + case 5: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_create_metadata); + if (value) { values[5] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "encode_point_cloud_to_buffer") < 0)) __PYX_ERR(0, 206, __pyx_L3_error) + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); + CYTHON_FALLTHROUGH; + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + CYTHON_FALLTHROUGH; + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + CYTHON_FALLTHROUGH; + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_points = values[0]; + __pyx_v_quantization_bits = values[1]; + __pyx_v_compression_level = values[2]; + __pyx_v_quantization_range = values[3]; + __pyx_v_quantization_origin = values[4]; + __pyx_v_create_metadata = values[5]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("encode_point_cloud_to_buffer", 0, 1, 6, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 206, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("DracoPy.encode_point_cloud_to_buffer", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_7DracoPy_6encode_point_cloud_to_buffer(__pyx_self, __pyx_v_points, __pyx_v_quantization_bits, __pyx_v_compression_level, __pyx_v_quantization_range, __pyx_v_quantization_origin, __pyx_v_create_metadata); + + /* "DracoPy.pyx":206 * - * @cname("__pyx_convert_vector_to_py_float") - * cdef object __pyx_convert_vector_to_py_float(vector[X]& v): # <<<<<<<<<<<<<< - * return [v[i] for i in range(v.size())] * + * def encode_point_cloud_to_buffer(points, # <<<<<<<<<<<<<< + * quantization_bits=14, + * compression_level=1, */ /* function exit code */ - __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("vector.to_py.__pyx_convert_vector_to_py_float", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; - __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_convert_vector_to_py_unsigned_int(const std::vector &__pyx_v_v) { - size_t __pyx_v_i; +static PyObject *__pyx_pf_7DracoPy_6encode_point_cloud_to_buffer(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_points, PyObject *__pyx_v_quantization_bits, PyObject *__pyx_v_compression_level, PyObject *__pyx_v_quantization_range, PyObject *__pyx_v_quantization_origin, PyObject *__pyx_v_create_metadata) { + struct DracoFunctions::GeometryMetadataObject __pyx_v_geometry_metadata; + std::vector __pyx_v_metadatas; + struct __pyx_obj_7DracoPy_Encoder *__pyx_v_encoder = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - size_t __pyx_t_2; - size_t __pyx_t_3; - size_t __pyx_t_4; - PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + struct DracoFunctions::GeometryMetadataObject __pyx_t_4; + int __pyx_t_5; + struct DracoFunctions::MetadataObject __pyx_t_6; + int __pyx_t_7; + int __pyx_t_8; + double __pyx_t_9; + std::vector __pyx_t_10; + std::vector __pyx_t_11; + PyObject *__pyx_t_12 = NULL; + PyObject *__pyx_t_13 = NULL; + PyObject *__pyx_t_14 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__pyx_convert_vector_to_py_unsigned_int", 0); + __Pyx_RefNannySetupContext("encode_point_cloud_to_buffer", 0); - /* "vector.to_py":61 - * @cname("__pyx_convert_vector_to_py_unsigned_int") - * cdef object __pyx_convert_vector_to_py_unsigned_int(vector[X]& v): - * return [v[i] for i in range(v.size())] # <<<<<<<<<<<<<< + /* "DracoPy.pyx":232 + * :return bytes: encoded point cloud + * """ + * cdef GeometryMetadataObject geometry_metadata = _create_empty_geometry_metadata() # <<<<<<<<<<<<<< + * cdef vector[MetadataObject] metadatas + * if create_metadata: + */ + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_create_empty_geometry_metadata); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 232, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + } + } + __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 232, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_4 = __pyx_convert__from_py_struct__DracoFunctions_3a__3a_GeometryMetadataObject(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 232, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_geometry_metadata = __pyx_t_4; + + /* "DracoPy.pyx":234 + * cdef GeometryMetadataObject geometry_metadata = _create_empty_geometry_metadata() + * cdef vector[MetadataObject] metadatas + * if create_metadata: # <<<<<<<<<<<<<< + * metadatas.push_back(_create_empty_metadata()) + * encoder = _generate_encoder_and_update_metadata( + */ + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_create_metadata); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 234, __pyx_L1_error) + if (__pyx_t_5) { + + /* "DracoPy.pyx":235 + * cdef vector[MetadataObject] metadatas + * if create_metadata: + * metadatas.push_back(_create_empty_metadata()) # <<<<<<<<<<<<<< + * encoder = _generate_encoder_and_update_metadata( + * quantization_bits, + */ + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_create_empty_metadata); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 235, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + } + } + __pyx_t_1 = (__pyx_t_3) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_3) : __Pyx_PyObject_CallNoArg(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 235, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_6 = __pyx_convert__from_py_struct__DracoFunctions_3a__3a_MetadataObject(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 235, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + try { + __pyx_v_metadatas.push_back(__pyx_t_6); + } catch(...) { + __Pyx_CppExn2PyErr(); + __PYX_ERR(0, 235, __pyx_L1_error) + } + + /* "DracoPy.pyx":234 + * cdef GeometryMetadataObject geometry_metadata = _create_empty_geometry_metadata() + * cdef vector[MetadataObject] metadatas + * if create_metadata: # <<<<<<<<<<<<<< + * metadatas.push_back(_create_empty_metadata()) + * encoder = _generate_encoder_and_update_metadata( + */ + } + + /* "DracoPy.pyx":237 + * metadatas.push_back(_create_empty_metadata()) + * encoder = _generate_encoder_and_update_metadata( + * quantization_bits, # <<<<<<<<<<<<<< + * compression_level, + * quantization_range, + */ + __pyx_t_7 = __Pyx_PyInt_As_int(__pyx_v_quantization_bits); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 237, __pyx_L1_error) + + /* "DracoPy.pyx":238 + * encoder = _generate_encoder_and_update_metadata( + * quantization_bits, + * compression_level, # <<<<<<<<<<<<<< + * quantization_range, + * [] if quantization_origin is None else quantization_origin, + */ + __pyx_t_8 = __Pyx_PyInt_As_int(__pyx_v_compression_level); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 238, __pyx_L1_error) + + /* "DracoPy.pyx":239 + * quantization_bits, + * compression_level, + * quantization_range, # <<<<<<<<<<<<<< + * [] if quantization_origin is None else quantization_origin, + * metadatas, + */ + __pyx_t_9 = __pyx_PyFloat_AsDouble(__pyx_v_quantization_range); if (unlikely((__pyx_t_9 == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 239, __pyx_L1_error) + + /* "DracoPy.pyx":240 + * compression_level, + * quantization_range, + * [] if quantization_origin is None else quantization_origin, # <<<<<<<<<<<<<< + * metadatas, + * geometry_metadata, + */ + __pyx_t_5 = (__pyx_v_quantization_origin == Py_None); + if ((__pyx_t_5 != 0)) { + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 240, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_11 = __pyx_convert_vector_from_py_double(__pyx_t_1); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 240, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_10 = __pyx_t_11; + } else { + __pyx_t_11 = __pyx_convert_vector_from_py_double(__pyx_v_quantization_origin); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 240, __pyx_L1_error) + __pyx_t_10 = __pyx_t_11; + } + + /* "DracoPy.pyx":236 + * if create_metadata: + * metadatas.push_back(_create_empty_metadata()) + * encoder = _generate_encoder_and_update_metadata( # <<<<<<<<<<<<<< + * quantization_bits, + * compression_level, + */ + __pyx_t_1 = ((PyObject *)__pyx_f_7DracoPy__generate_encoder_and_update_metadata(__pyx_t_7, __pyx_t_8, __pyx_t_9, __pyx_t_10, __pyx_v_metadatas, __pyx_v_geometry_metadata)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 236, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_encoder = ((struct __pyx_obj_7DracoPy_Encoder *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "DracoPy.pyx":244 + * geometry_metadata, + * ) + * return encode_to_buffer(points, None, encoder, metadatas, geometry_metadata) # <<<<<<<<<<<<<< * * */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 61, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __pyx_v_v.size(); - __pyx_t_3 = __pyx_t_2; - for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { - __pyx_v_i = __pyx_t_4; - __pyx_t_5 = __Pyx_PyInt_From_unsigned_int((__pyx_v_v[__pyx_v_i])); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 61, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_5))) __PYX_ERR(1, 61, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_encode_to_buffer); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 244, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __pyx_convert_vector_to_py_struct__DracoFunctions_3a__3a_MetadataObject(__pyx_v_metadatas); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 244, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_12 = __pyx_convert__to_py_struct__DracoFunctions_3a__3a_GeometryMetadataObject(__pyx_v_geometry_metadata); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 244, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + __pyx_t_13 = NULL; + __pyx_t_8 = 0; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_13 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_13)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_13); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + __pyx_t_8 = 1; + } + } + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_2)) { + PyObject *__pyx_temp[6] = {__pyx_t_13, __pyx_v_points, Py_None, ((PyObject *)__pyx_v_encoder), __pyx_t_3, __pyx_t_12}; + __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_8, 5+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 244, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { + PyObject *__pyx_temp[6] = {__pyx_t_13, __pyx_v_points, Py_None, ((PyObject *)__pyx_v_encoder), __pyx_t_3, __pyx_t_12}; + __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_8, 5+__pyx_t_8); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 244, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_13); __pyx_t_13 = 0; + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + } else + #endif + { + __pyx_t_14 = PyTuple_New(5+__pyx_t_8); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 244, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_14); + if (__pyx_t_13) { + __Pyx_GIVEREF(__pyx_t_13); PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_13); __pyx_t_13 = NULL; + } + __Pyx_INCREF(__pyx_v_points); + __Pyx_GIVEREF(__pyx_v_points); + PyTuple_SET_ITEM(__pyx_t_14, 0+__pyx_t_8, __pyx_v_points); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + PyTuple_SET_ITEM(__pyx_t_14, 1+__pyx_t_8, Py_None); + __Pyx_INCREF(((PyObject *)__pyx_v_encoder)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_encoder)); + PyTuple_SET_ITEM(__pyx_t_14, 2+__pyx_t_8, ((PyObject *)__pyx_v_encoder)); + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_14, 3+__pyx_t_8, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_12); + PyTuple_SET_ITEM(__pyx_t_14, 4+__pyx_t_8, __pyx_t_12); + __pyx_t_3 = 0; + __pyx_t_12 = 0; + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_14, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 244, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = __pyx_t_1; __pyx_t_1 = 0; goto __pyx_L0; - /* "vector.to_py":60 + /* "DracoPy.pyx":206 * - * @cname("__pyx_convert_vector_to_py_unsigned_int") - * cdef object __pyx_convert_vector_to_py_unsigned_int(vector[X]& v): # <<<<<<<<<<<<<< - * return [v[i] for i in range(v.size())] * + * def encode_point_cloud_to_buffer(points, # <<<<<<<<<<<<<< + * quantization_bits=14, + * compression_level=1, */ /* function exit code */ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("vector.to_py.__pyx_convert_vector_to_py_unsigned_int", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_12); + __Pyx_XDECREF(__pyx_t_13); + __Pyx_XDECREF(__pyx_t_14); + __Pyx_AddTraceback("DracoPy.encode_point_cloud_to_buffer", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_encoder); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_convert_vector_to_py_double(const std::vector &__pyx_v_v) { - size_t __pyx_v_i; - PyObject *__pyx_r = NULL; - __Pyx_RefNannyDeclarations - PyObject *__pyx_t_1 = NULL; - size_t __pyx_t_2; - size_t __pyx_t_3; - size_t __pyx_t_4; - PyObject *__pyx_t_5 = NULL; +/* "DracoPy.pyx":247 + * + * + * def encode_to_buffer(points: List[float], # <<<<<<<<<<<<<< + * faces: List[int] = None, + * encoder: Encoder = Encoder(), + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_7DracoPy_9encode_to_buffer(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_7DracoPy_8encode_to_buffer[] = "\n Encode a list or numpy array of points/vertices (float) to a draco buffer.\n :param List[float] points: vector of points coordination\n :param Optional[List[int]] faces: vector of points indexes\n (each triple means one face). If faces is None then point cloud\n will be encoded, otherwise mesh will be encoded\n :param List[dict] metadatas: list of metadatas each of them containing\n \"entries\" - dictionary with strings (entry name) and binary data\n related to that entry\n \"sub_metadata_ids\" - dictionary with strings (submetadata name) and\n related submetadata index in the list 'metadatas'\n :param dict geometry_metadata: dict containing the following items:\n \"metadata_id\" - index in the list 'metadatas' related to that metadata\n \"generic_attributes\" - list of geometry attributes (dict) each of them contain:\n \"data\" - dictionary with point index (not pure points index)\n from points list\n \"datatype\" - type of the data item (see DataType enum)\n \"dimension\" - integer that defines number of data items with type 'datatype'\n are placed per point\n \"metadata_id\" - metadata index in 'metadatas'\n NOTE: all 'metadata_id' indexes have to exist in 'metadatas'\n :return bytes: encoded mesh\n "; +static PyMethodDef __pyx_mdef_7DracoPy_9encode_to_buffer = {"encode_to_buffer", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7DracoPy_9encode_to_buffer, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7DracoPy_8encode_to_buffer}; +static PyObject *__pyx_pw_7DracoPy_9encode_to_buffer(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_points = 0; + PyObject *__pyx_v_faces = 0; + struct __pyx_obj_7DracoPy_Encoder *__pyx_v_encoder = 0; + PyObject *__pyx_v_metadatas = 0; + PyObject *__pyx_v_geometry_metadata = 0; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannySetupContext("__pyx_convert_vector_to_py_double", 0); + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("encode_to_buffer (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_points,&__pyx_n_s_faces,&__pyx_n_s_encoder,&__pyx_n_s_metadatas,&__pyx_n_s_geometry_metadata,0}; + PyObject* values[5] = {0,0,0,0,0}; - /* "vector.to_py":61 - * @cname("__pyx_convert_vector_to_py_double") - * cdef object __pyx_convert_vector_to_py_double(vector[X]& v): - * return [v[i] for i in range(v.size())] # <<<<<<<<<<<<<< - * + /* "DracoPy.pyx":248 * + * def encode_to_buffer(points: List[float], + * faces: List[int] = None, # <<<<<<<<<<<<<< + * encoder: Encoder = Encoder(), + * metadatas = None, */ - __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 61, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __pyx_v_v.size(); - __pyx_t_3 = __pyx_t_2; - for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { - __pyx_v_i = __pyx_t_4; - __pyx_t_5 = PyFloat_FromDouble((__pyx_v_v[__pyx_v_i])); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 61, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_5))) __PYX_ERR(1, 61, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - } - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; - goto __pyx_L0; + values[1] = ((PyObject *)Py_None); + values[2] = (PyObject *)__pyx_k__4; + + /* "DracoPy.pyx":250 + * faces: List[int] = None, + * encoder: Encoder = Encoder(), + * metadatas = None, # <<<<<<<<<<<<<< + * geometry_metadata = None, + * ): + */ + values[3] = ((PyObject *)Py_None); - /* "vector.to_py":60 + /* "DracoPy.pyx":251 + * encoder: Encoder = Encoder(), + * metadatas = None, + * geometry_metadata = None, # <<<<<<<<<<<<<< + * ): + * """ + */ + values[4] = ((PyObject *)Py_None); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + CYTHON_FALLTHROUGH; + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + CYTHON_FALLTHROUGH; + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_points)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_faces); + if (value) { values[1] = value; kw_args--; } + } + CYTHON_FALLTHROUGH; + case 2: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_encoder); + if (value) { values[2] = value; kw_args--; } + } + CYTHON_FALLTHROUGH; + case 3: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_metadatas); + if (value) { values[3] = value; kw_args--; } + } + CYTHON_FALLTHROUGH; + case 4: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_geometry_metadata); + if (value) { values[4] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "encode_to_buffer") < 0)) __PYX_ERR(0, 247, __pyx_L3_error) + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + CYTHON_FALLTHROUGH; + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + CYTHON_FALLTHROUGH; + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_points = values[0]; + __pyx_v_faces = values[1]; + __pyx_v_encoder = ((struct __pyx_obj_7DracoPy_Encoder *)values[2]); + __pyx_v_metadatas = values[3]; + __pyx_v_geometry_metadata = values[4]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("encode_to_buffer", 0, 1, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 247, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("DracoPy.encode_to_buffer", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_encoder), __pyx_ptype_7DracoPy_Encoder, 1, "encoder", 0))) __PYX_ERR(0, 249, __pyx_L1_error) + __pyx_r = __pyx_pf_7DracoPy_8encode_to_buffer(__pyx_self, __pyx_v_points, __pyx_v_faces, __pyx_v_encoder, __pyx_v_metadatas, __pyx_v_geometry_metadata); + + /* "DracoPy.pyx":247 * - * @cname("__pyx_convert_vector_to_py_double") - * cdef object __pyx_convert_vector_to_py_double(vector[X]& v): # <<<<<<<<<<<<<< - * return [v[i] for i in range(v.size())] * + * def encode_to_buffer(points: List[float], # <<<<<<<<<<<<<< + * faces: List[int] = None, + * encoder: Encoder = Encoder(), */ /* function exit code */ + goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("vector.to_py.__pyx_convert_vector_to_py_double", __pyx_clineno, __pyx_lineno, __pyx_filename); - __pyx_r = 0; + __pyx_r = NULL; __pyx_L0:; - __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyMethodDef __pyx_methods[] = { - {0, 0, 0, 0} -}; - -#if PY_MAJOR_VERSION >= 3 -#if CYTHON_PEP489_MULTI_PHASE_INIT -static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/ -static int __pyx_pymod_exec_DracoPy(PyObject* module); /*proto*/ -static PyModuleDef_Slot __pyx_moduledef_slots[] = { - {Py_mod_create, (void*)__pyx_pymod_create}, - {Py_mod_exec, (void*)__pyx_pymod_exec_DracoPy}, - {0, NULL} -}; -#endif - -static struct PyModuleDef __pyx_moduledef = { - PyModuleDef_HEAD_INIT, - "DracoPy", - 0, /* m_doc */ - #if CYTHON_PEP489_MULTI_PHASE_INIT - 0, /* m_size */ - #else - -1, /* m_size */ - #endif - __pyx_methods /* m_methods */, - #if CYTHON_PEP489_MULTI_PHASE_INIT - __pyx_moduledef_slots, /* m_slots */ - #else - NULL, /* m_reload */ - #endif - NULL, /* m_traverse */ - NULL, /* m_clear */ - NULL /* m_free */ -}; -#endif -#ifndef CYTHON_SMALL_CODE -#if defined(__clang__) - #define CYTHON_SMALL_CODE -#elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)) - #define CYTHON_SMALL_CODE __attribute__((cold)) -#else - #define CYTHON_SMALL_CODE -#endif -#endif - -static __Pyx_StringTabEntry __pyx_string_tab[] = { - {&__pyx_n_s_DracoMesh, __pyx_k_DracoMesh, sizeof(__pyx_k_DracoMesh), 0, 0, 1, 1}, - {&__pyx_n_s_DracoMesh_faces, __pyx_k_DracoMesh_faces, sizeof(__pyx_k_DracoMesh_faces), 0, 0, 1, 1}, - {&__pyx_n_s_DracoMesh_normals, __pyx_k_DracoMesh_normals, sizeof(__pyx_k_DracoMesh_normals), 0, 0, 1, 1}, - {&__pyx_n_s_DracoPointCloud, __pyx_k_DracoPointCloud, sizeof(__pyx_k_DracoPointCloud), 0, 0, 1, 1}, - {&__pyx_n_s_DracoPointCloud___init, __pyx_k_DracoPointCloud___init, sizeof(__pyx_k_DracoPointCloud___init), 0, 0, 1, 1}, - {&__pyx_n_s_DracoPointCloud_get_encoded_coor, __pyx_k_DracoPointCloud_get_encoded_coor, sizeof(__pyx_k_DracoPointCloud_get_encoded_coor), 0, 0, 1, 1}, - {&__pyx_n_s_DracoPointCloud_get_encoded_poin, __pyx_k_DracoPointCloud_get_encoded_poin, sizeof(__pyx_k_DracoPointCloud_get_encoded_poin), 0, 0, 1, 1}, - {&__pyx_n_s_DracoPointCloud_num_axes, __pyx_k_DracoPointCloud_num_axes, sizeof(__pyx_k_DracoPointCloud_num_axes), 0, 0, 1, 1}, - {&__pyx_n_s_DracoPointCloud_points, __pyx_k_DracoPointCloud_points, sizeof(__pyx_k_DracoPointCloud_points), 0, 0, 1, 1}, - {&__pyx_n_s_DracoPy, __pyx_k_DracoPy, sizeof(__pyx_k_DracoPy), 0, 0, 1, 1}, - {&__pyx_kp_u_DracoPy_only_supports_meshes_wit, __pyx_k_DracoPy_only_supports_meshes_wit, sizeof(__pyx_k_DracoPy_only_supports_meshes_wit), 0, 1, 0, 0}, - {&__pyx_n_s_EncodingFailedException, __pyx_k_EncodingFailedException, sizeof(__pyx_k_EncodingFailedException), 0, 0, 1, 1}, - {&__pyx_n_s_EncodingOptions, __pyx_k_EncodingOptions, sizeof(__pyx_k_EncodingOptions), 0, 0, 1, 1}, - {&__pyx_n_s_EncodingOptions___init, __pyx_k_EncodingOptions___init, sizeof(__pyx_k_EncodingOptions___init), 0, 0, 1, 1}, - {&__pyx_n_s_EncodingOptions_get_encoded_coor, __pyx_k_EncodingOptions_get_encoded_coor, sizeof(__pyx_k_EncodingOptions_get_encoded_coor), 0, 0, 1, 1}, - {&__pyx_n_s_EncodingOptions_get_encoded_poin, __pyx_k_EncodingOptions_get_encoded_poin, sizeof(__pyx_k_EncodingOptions_get_encoded_poin), 0, 0, 1, 1}, - {&__pyx_n_s_EncodingOptions_num_axes, __pyx_k_EncodingOptions_num_axes, sizeof(__pyx_k_EncodingOptions_num_axes), 0, 0, 1, 1}, - {&__pyx_kp_u_Failed_to_decode_input_mesh_Data, __pyx_k_Failed_to_decode_input_mesh_Data, sizeof(__pyx_k_Failed_to_decode_input_mesh_Data), 0, 1, 0, 0}, - {&__pyx_n_s_FileTypeException, __pyx_k_FileTypeException, sizeof(__pyx_k_FileTypeException), 0, 0, 1, 1}, - {&__pyx_kp_u_Input_invalid, __pyx_k_Input_invalid, sizeof(__pyx_k_Input_invalid), 0, 1, 0, 0}, - {&__pyx_kp_u_Input_mesh_is_not_draco_encoded, __pyx_k_Input_mesh_is_not_draco_encoded, sizeof(__pyx_k_Input_mesh_is_not_draco_encoded), 0, 1, 0, 0}, - {&__pyx_kp_u_Invalid_mesh, __pyx_k_Invalid_mesh, sizeof(__pyx_k_Invalid_mesh), 0, 1, 0, 0}, - {&__pyx_kp_u_Invalid_point_cloud, __pyx_k_Invalid_point_cloud, sizeof(__pyx_k_Invalid_point_cloud), 0, 1, 0, 0}, - {&__pyx_kp_u_Specified_value_out_of_encoded_r, __pyx_k_Specified_value_out_of_encoded_r, sizeof(__pyx_k_Specified_value_out_of_encoded_r), 0, 1, 0, 0}, - {&__pyx_n_s_TypeError, __pyx_k_TypeError, sizeof(__pyx_k_TypeError), 0, 0, 1, 1}, - {&__pyx_n_s_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 0, 0, 1, 1}, - {&__pyx_n_s_axis, __pyx_k_axis, sizeof(__pyx_k_axis), 0, 0, 1, 1}, - {&__pyx_n_s_buffer, __pyx_k_buffer, sizeof(__pyx_k_buffer), 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_compression_level, __pyx_k_compression_level, sizeof(__pyx_k_compression_level), 0, 0, 1, 1}, - {&__pyx_n_s_create_metadata, __pyx_k_create_metadata, sizeof(__pyx_k_create_metadata), 0, 0, 1, 1}, - {&__pyx_n_s_data_struct, __pyx_k_data_struct, sizeof(__pyx_k_data_struct), 0, 0, 1, 1}, - {&__pyx_n_s_decode_buffer_to_mesh, __pyx_k_decode_buffer_to_mesh, sizeof(__pyx_k_decode_buffer_to_mesh), 0, 0, 1, 1}, - {&__pyx_n_s_decode_point_cloud_buffer, __pyx_k_decode_point_cloud_buffer, sizeof(__pyx_k_decode_point_cloud_buffer), 0, 0, 1, 1}, - {&__pyx_n_s_decode_status, __pyx_k_decode_status, sizeof(__pyx_k_decode_status), 0, 0, 1, 1}, - {&__pyx_n_s_decoding_status, __pyx_k_decoding_status, sizeof(__pyx_k_decoding_status), 0, 0, 1, 1}, - {&__pyx_n_s_difference, __pyx_k_difference, sizeof(__pyx_k_difference), 0, 0, 1, 1}, - {&__pyx_n_s_dim, __pyx_k_dim, sizeof(__pyx_k_dim), 0, 0, 1, 1}, - {&__pyx_n_s_doc, __pyx_k_doc, sizeof(__pyx_k_doc), 0, 0, 1, 1}, - {&__pyx_n_s_encode_mesh_to_buffer, __pyx_k_encode_mesh_to_buffer, sizeof(__pyx_k_encode_mesh_to_buffer), 0, 0, 1, 1}, - {&__pyx_n_s_encode_point_cloud_to_buffer, __pyx_k_encode_point_cloud_to_buffer, sizeof(__pyx_k_encode_point_cloud_to_buffer), 0, 0, 1, 1}, - {&__pyx_n_s_encoded_mesh, __pyx_k_encoded_mesh, sizeof(__pyx_k_encoded_mesh), 0, 0, 1, 1}, - {&__pyx_n_s_encoded_point, __pyx_k_encoded_point, sizeof(__pyx_k_encoded_point), 0, 0, 1, 1}, - {&__pyx_n_s_encoded_point_cloud, __pyx_k_encoded_point_cloud, sizeof(__pyx_k_encoded_point_cloud), 0, 0, 1, 1}, - {&__pyx_n_s_encoding_options, __pyx_k_encoding_options, sizeof(__pyx_k_encoding_options), 0, 0, 1, 1}, - {&__pyx_n_s_encoding_options_set, __pyx_k_encoding_options_set, sizeof(__pyx_k_encoding_options_set), 0, 0, 1, 1}, - {&__pyx_n_u_encoding_options_set, __pyx_k_encoding_options_set, sizeof(__pyx_k_encoding_options_set), 0, 1, 0, 1}, - {&__pyx_n_s_faces, __pyx_k_faces, sizeof(__pyx_k_faces), 0, 0, 1, 1}, - {&__pyx_n_u_faces, __pyx_k_faces, sizeof(__pyx_k_faces), 0, 1, 0, 1}, - {&__pyx_n_s_floor, __pyx_k_floor, sizeof(__pyx_k_floor), 0, 0, 1, 1}, - {&__pyx_n_s_get_encoded_coordinate, __pyx_k_get_encoded_coordinate, sizeof(__pyx_k_get_encoded_coordinate), 0, 0, 1, 1}, - {&__pyx_n_s_get_encoded_point, __pyx_k_get_encoded_point, sizeof(__pyx_k_get_encoded_point), 0, 0, 1, 1}, - {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1}, - {&__pyx_n_s_init, __pyx_k_init, sizeof(__pyx_k_init), 0, 0, 1, 1}, - {&__pyx_n_s_inverse_alpha, __pyx_k_inverse_alpha, sizeof(__pyx_k_inverse_alpha), 0, 0, 1, 1}, - {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1}, - {&__pyx_n_s_math, __pyx_k_math, sizeof(__pyx_k_math), 0, 0, 1, 1}, - {&__pyx_n_s_mesh_struct, __pyx_k_mesh_struct, sizeof(__pyx_k_mesh_struct), 0, 0, 1, 1}, - {&__pyx_n_s_metaclass, __pyx_k_metaclass, sizeof(__pyx_k_metaclass), 0, 0, 1, 1}, - {&__pyx_n_s_module, __pyx_k_module, sizeof(__pyx_k_module), 0, 0, 1, 1}, - {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1}, - {&__pyx_n_s_normals, __pyx_k_normals, sizeof(__pyx_k_normals), 0, 0, 1, 1}, - {&__pyx_n_u_normals, __pyx_k_normals, sizeof(__pyx_k_normals), 0, 1, 0, 1}, - {&__pyx_n_s_num_axes, __pyx_k_num_axes, sizeof(__pyx_k_num_axes), 0, 0, 1, 1}, - {&__pyx_n_s_num_dims, __pyx_k_num_dims, sizeof(__pyx_k_num_dims), 0, 0, 1, 1}, - {&__pyx_n_s_object, __pyx_k_object, sizeof(__pyx_k_object), 0, 0, 1, 1}, - {&__pyx_n_s_point, __pyx_k_point, sizeof(__pyx_k_point), 0, 0, 1, 1}, - {&__pyx_n_s_point_cloud_struct, __pyx_k_point_cloud_struct, sizeof(__pyx_k_point_cloud_struct), 0, 0, 1, 1}, - {&__pyx_n_s_points, __pyx_k_points, sizeof(__pyx_k_points), 0, 0, 1, 1}, - {&__pyx_n_u_points, __pyx_k_points, sizeof(__pyx_k_points), 0, 1, 0, 1}, - {&__pyx_n_s_prepare, __pyx_k_prepare, sizeof(__pyx_k_prepare), 0, 0, 1, 1}, - {&__pyx_n_s_property, __pyx_k_property, sizeof(__pyx_k_property), 0, 0, 1, 1}, - {&__pyx_n_s_qualname, __pyx_k_qualname, sizeof(__pyx_k_qualname), 0, 0, 1, 1}, - {&__pyx_n_s_quant_origin, __pyx_k_quant_origin, sizeof(__pyx_k_quant_origin), 0, 0, 1, 1}, - {&__pyx_n_s_quantization_bits, __pyx_k_quantization_bits, sizeof(__pyx_k_quantization_bits), 0, 0, 1, 1}, - {&__pyx_n_u_quantization_bits, __pyx_k_quantization_bits, sizeof(__pyx_k_quantization_bits), 0, 1, 0, 1}, - {&__pyx_n_s_quantization_origin, __pyx_k_quantization_origin, sizeof(__pyx_k_quantization_origin), 0, 0, 1, 1}, - {&__pyx_n_u_quantization_origin, __pyx_k_quantization_origin, sizeof(__pyx_k_quantization_origin), 0, 1, 0, 1}, - {&__pyx_n_s_quantization_range, __pyx_k_quantization_range, sizeof(__pyx_k_quantization_range), 0, 0, 1, 1}, - {&__pyx_n_u_quantization_range, __pyx_k_quantization_range, sizeof(__pyx_k_quantization_range), 0, 1, 0, 1}, - {&__pyx_n_s_quantized_index, __pyx_k_quantized_index, sizeof(__pyx_k_quantized_index), 0, 0, 1, 1}, - {&__pyx_n_s_raise_decoding_error, __pyx_k_raise_decoding_error, sizeof(__pyx_k_raise_decoding_error), 0, 0, 1, 1}, - {&__pyx_n_s_range, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1}, - {&__pyx_n_s_self, __pyx_k_self, sizeof(__pyx_k_self), 0, 0, 1, 1}, - {&__pyx_kp_s_src_DracoPy_pyx, __pyx_k_src_DracoPy_pyx, sizeof(__pyx_k_src_DracoPy_pyx), 0, 0, 1, 0}, - {&__pyx_n_s_struct, __pyx_k_struct, sizeof(__pyx_k_struct), 0, 0, 1, 1}, - {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1}, - {&__pyx_n_s_value, __pyx_k_value, sizeof(__pyx_k_value), 0, 0, 1, 1}, - {0, 0, 0, 0, 0, 0, 0} -}; -static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) { - __pyx_builtin_object = __Pyx_GetBuiltinName(__pyx_n_s_object); if (!__pyx_builtin_object) __PYX_ERR(0, 9, __pyx_L1_error) - __pyx_builtin_property = __Pyx_GetBuiltinName(__pyx_n_s_property); if (!__pyx_builtin_property) __PYX_ERR(0, 26, __pyx_L1_error) - __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(0, 52, __pyx_L1_error) - __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 59, __pyx_L1_error) - __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) __PYX_ERR(0, 139, __pyx_L1_error) - return 0; - __pyx_L1_error:; - return -1; -} - -static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { +static PyObject *__pyx_pf_7DracoPy_8encode_to_buffer(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_points, PyObject *__pyx_v_faces, struct __pyx_obj_7DracoPy_Encoder *__pyx_v_encoder, PyObject *__pyx_v_metadatas, PyObject *__pyx_v_geometry_metadata) { + PyObject *__pyx_v_is_mesh = NULL; + float *__pyx_v_quant_origin; + struct DracoFunctions::EncodedObject __pyx_v_draco_encoded; + PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + int __pyx_t_4; + Py_ssize_t __pyx_t_5; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + PyObject *__pyx_t_10 = NULL; + std::vector __pyx_t_11; + std::vector __pyx_t_12; + std::vector __pyx_t_13; + struct DracoFunctions::GeometryMetadataObject __pyx_t_14; + struct DracoFunctions::EncodedObject __pyx_t_15; + PyObject *__pyx_t_16 = NULL; + int __pyx_t_17; + PyObject *__pyx_t_18 = NULL; + PyObject *__pyx_t_19 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("encode_to_buffer", 0); + __Pyx_INCREF(__pyx_v_metadatas); + __Pyx_INCREF(__pyx_v_geometry_metadata); - /* "DracoPy.pyx":52 - * def get_encoded_coordinate(self, value, axis): - * if value < self.quantization_origin[axis] or value > (self.quantization_origin[axis] + self.quantization_range): - * raise ValueError('Specified value out of encoded range') # <<<<<<<<<<<<<< - * difference = value - self.quantization_origin[axis] - * quantized_index = floor((difference / self.inverse_alpha) + 0.5) + /* "DracoPy.pyx":276 + * :return bytes: encoded mesh + * """ + * is_mesh = faces is not None # <<<<<<<<<<<<<< + * if not is_mesh and isinstance(geometry_metadata, dict) and \ + * len(geometry_metadata["generic_attributes"]) > 0: */ - __pyx_tuple_ = PyTuple_Pack(1, __pyx_kp_u_Specified_value_out_of_encoded_r); if (unlikely(!__pyx_tuple_)) __PYX_ERR(0, 52, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple_); - __Pyx_GIVEREF(__pyx_tuple_); + __pyx_t_1 = (__pyx_v_faces != Py_None); + __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 276, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_v_is_mesh = __pyx_t_2; + __pyx_t_2 = 0; - /* "DracoPy.pyx":102 - * if quant_origin != NULL: - * PyMem_Free(quant_origin) - * raise ValueError("Input invalid") # <<<<<<<<<<<<<< - * - * def encode_point_cloud_to_buffer(points, quantization_bits=14, compression_level=1, quantization_range=-1, quantization_origin=None, create_metadata=False): + /* "DracoPy.pyx":277 + * """ + * is_mesh = faces is not None + * if not is_mesh and isinstance(geometry_metadata, dict) and \ # <<<<<<<<<<<<<< + * len(geometry_metadata["generic_attributes"]) > 0: + * raise RuntimeError("generic attributes encoding/decoding " */ - __pyx_tuple__2 = PyTuple_Pack(1, __pyx_kp_u_Input_invalid); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(0, 102, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__2); - __Pyx_GIVEREF(__pyx_tuple__2); - - /* "DracoPy.pyx":139 - * raise FileTypeException('Input mesh is not draco encoded') - * elif decoding_status == DracoPy.decoding_status.failed_during_decoding: - * raise TypeError('Failed to decode input mesh. Data might be corrupted') # <<<<<<<<<<<<<< - * elif decoding_status == DracoPy.decoding_status.no_position_attribute: - * raise ValueError('DracoPy only supports meshes with position attributes') - */ - __pyx_tuple__3 = PyTuple_Pack(1, __pyx_kp_u_Failed_to_decode_input_mesh_Data); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(0, 139, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__3); - __Pyx_GIVEREF(__pyx_tuple__3); + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_is_mesh); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 277, __pyx_L1_error) + __pyx_t_4 = ((!__pyx_t_3) != 0); + if (__pyx_t_4) { + } else { + __pyx_t_1 = __pyx_t_4; + goto __pyx_L4_bool_binop_done; + } + __pyx_t_4 = PyDict_Check(__pyx_v_geometry_metadata); + __pyx_t_3 = (__pyx_t_4 != 0); + if (__pyx_t_3) { + } else { + __pyx_t_1 = __pyx_t_3; + goto __pyx_L4_bool_binop_done; + } - /* "DracoPy.pyx":141 - * raise TypeError('Failed to decode input mesh. Data might be corrupted') - * elif decoding_status == DracoPy.decoding_status.no_position_attribute: - * raise ValueError('DracoPy only supports meshes with position attributes') # <<<<<<<<<<<<<< - * - * def decode_buffer_to_mesh(buffer): + /* "DracoPy.pyx":278 + * is_mesh = faces is not None + * if not is_mesh and isinstance(geometry_metadata, dict) and \ + * len(geometry_metadata["generic_attributes"]) > 0: # <<<<<<<<<<<<<< + * raise RuntimeError("generic attributes encoding/decoding " + * "is not supported for point cloud") */ - __pyx_tuple__4 = PyTuple_Pack(1, __pyx_kp_u_DracoPy_only_supports_meshes_wit); if (unlikely(!__pyx_tuple__4)) __PYX_ERR(0, 141, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__4); - __Pyx_GIVEREF(__pyx_tuple__4); + __pyx_t_2 = __Pyx_PyObject_Dict_GetItem(__pyx_v_geometry_metadata, __pyx_n_u_generic_attributes); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 278, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = PyObject_Length(__pyx_t_2); if (unlikely(__pyx_t_5 == ((Py_ssize_t)-1))) __PYX_ERR(0, 278, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_3 = ((__pyx_t_5 > 0) != 0); + __pyx_t_1 = __pyx_t_3; + __pyx_L4_bool_binop_done:; - /* "DracoPy.pyx":9 - * from libc.string cimport memcmp - * - * class DracoPointCloud(object): # <<<<<<<<<<<<<< - * def __init__(self, data_struct): - * self.data_struct = data_struct + /* "DracoPy.pyx":277 + * """ + * is_mesh = faces is not None + * if not is_mesh and isinstance(geometry_metadata, dict) and \ # <<<<<<<<<<<<<< + * len(geometry_metadata["generic_attributes"]) > 0: + * raise RuntimeError("generic attributes encoding/decoding " */ - __pyx_tuple__5 = PyTuple_Pack(1, __pyx_builtin_object); if (unlikely(!__pyx_tuple__5)) __PYX_ERR(0, 9, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__5); - __Pyx_GIVEREF(__pyx_tuple__5); + if (unlikely(__pyx_t_1)) { - /* "DracoPy.pyx":10 - * - * class DracoPointCloud(object): - * def __init__(self, data_struct): # <<<<<<<<<<<<<< - * self.data_struct = data_struct - * if data_struct['encoding_options_set']: + /* "DracoPy.pyx":279 + * if not is_mesh and isinstance(geometry_metadata, dict) and \ + * len(geometry_metadata["generic_attributes"]) > 0: + * raise RuntimeError("generic attributes encoding/decoding " # <<<<<<<<<<<<<< + * "is not supported for point cloud") + * if metadatas is None: */ - __pyx_tuple__6 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_data_struct); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(0, 10, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__6); - __Pyx_GIVEREF(__pyx_tuple__6); - __pyx_codeobj__7 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__6, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_init, 10, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__7)) __PYX_ERR(0, 10, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_RuntimeError, __pyx_tuple__5, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 279, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __PYX_ERR(0, 279, __pyx_L1_error) - /* "DracoPy.pyx":18 - * self.encoding_options = None - * - * def get_encoded_coordinate(self, value, axis): # <<<<<<<<<<<<<< - * if self.encoding_options is not None: - * return self.encoding_options.get_encoded_coordinate(value, axis) + /* "DracoPy.pyx":277 + * """ + * is_mesh = faces is not None + * if not is_mesh and isinstance(geometry_metadata, dict) and \ # <<<<<<<<<<<<<< + * len(geometry_metadata["generic_attributes"]) > 0: + * raise RuntimeError("generic attributes encoding/decoding " */ - __pyx_tuple__8 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_value, __pyx_n_s_axis); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(0, 18, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__8); - __Pyx_GIVEREF(__pyx_tuple__8); - __pyx_codeobj__9 = (PyObject*)__Pyx_PyCode_New(3, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__8, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_get_encoded_coordinate, 18, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__9)) __PYX_ERR(0, 18, __pyx_L1_error) + } - /* "DracoPy.pyx":22 - * return self.encoding_options.get_encoded_coordinate(value, axis) - * - * def get_encoded_point(self, point): # <<<<<<<<<<<<<< - * if self.encoding_options is not None: - * return self.encoding_options.get_encoded_point(point) + /* "DracoPy.pyx":281 + * raise RuntimeError("generic attributes encoding/decoding " + * "is not supported for point cloud") + * if metadatas is None: # <<<<<<<<<<<<<< + * metadatas = [] + * if geometry_metadata is None: */ - __pyx_tuple__10 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_point); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(0, 22, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__10); - __Pyx_GIVEREF(__pyx_tuple__10); - __pyx_codeobj__11 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__10, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_get_encoded_point, 22, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__11)) __PYX_ERR(0, 22, __pyx_L1_error) + __pyx_t_1 = (__pyx_v_metadatas == Py_None); + __pyx_t_3 = (__pyx_t_1 != 0); + if (__pyx_t_3) { - /* "DracoPy.pyx":27 - * - * @property - * def num_axes(self): # <<<<<<<<<<<<<< - * return 3 - * + /* "DracoPy.pyx":282 + * "is not supported for point cloud") + * if metadatas is None: + * metadatas = [] # <<<<<<<<<<<<<< + * if geometry_metadata is None: + * geometry_metadata = _create_empty_geometry_metadata() */ - __pyx_tuple__12 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__12)) __PYX_ERR(0, 27, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__12); - __Pyx_GIVEREF(__pyx_tuple__12); - __pyx_codeobj__13 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__12, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_num_axes, 27, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__13)) __PYX_ERR(0, 27, __pyx_L1_error) + __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 282, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF_SET(__pyx_v_metadatas, __pyx_t_2); + __pyx_t_2 = 0; - /* "DracoPy.pyx":31 - * - * @property - * def points(self): # <<<<<<<<<<<<<< - * return self.data_struct['points'] - * + /* "DracoPy.pyx":281 + * raise RuntimeError("generic attributes encoding/decoding " + * "is not supported for point cloud") + * if metadatas is None: # <<<<<<<<<<<<<< + * metadatas = [] + * if geometry_metadata is None: */ - __pyx_tuple__14 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__14)) __PYX_ERR(0, 31, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__14); - __Pyx_GIVEREF(__pyx_tuple__14); - __pyx_codeobj__15 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__14, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_points, 31, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__15)) __PYX_ERR(0, 31, __pyx_L1_error) + } - /* "DracoPy.pyx":36 - * class DracoMesh(DracoPointCloud): - * @property - * def faces(self): # <<<<<<<<<<<<<< - * return self.data_struct['faces'] - * + /* "DracoPy.pyx":283 + * if metadatas is None: + * metadatas = [] + * if geometry_metadata is None: # <<<<<<<<<<<<<< + * geometry_metadata = _create_empty_geometry_metadata() + * cdef float* quant_origin = NULL */ - __pyx_tuple__16 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__16)) __PYX_ERR(0, 36, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__16); - __Pyx_GIVEREF(__pyx_tuple__16); - __pyx_codeobj__17 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__16, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_faces, 36, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__17)) __PYX_ERR(0, 36, __pyx_L1_error) + __pyx_t_3 = (__pyx_v_geometry_metadata == Py_None); + __pyx_t_1 = (__pyx_t_3 != 0); + if (__pyx_t_1) { + + /* "DracoPy.pyx":284 + * metadatas = [] + * if geometry_metadata is None: + * geometry_metadata = _create_empty_geometry_metadata() # <<<<<<<<<<<<<< + * cdef float* quant_origin = NULL + * try: + */ + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_create_empty_geometry_metadata); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 284, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_6))) { + __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6); + if (likely(__pyx_t_7)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); + __Pyx_INCREF(__pyx_t_7); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_6, function); + } + } + __pyx_t_2 = (__pyx_t_7) ? __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_7) : __Pyx_PyObject_CallNoArg(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 284, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF_SET(__pyx_v_geometry_metadata, __pyx_t_2); + __pyx_t_2 = 0; - /* "DracoPy.pyx":40 - * - * @property - * def normals(self): # <<<<<<<<<<<<<< - * return self.data_struct['normals'] - * + /* "DracoPy.pyx":283 + * if metadatas is None: + * metadatas = [] + * if geometry_metadata is None: # <<<<<<<<<<<<<< + * geometry_metadata = _create_empty_geometry_metadata() + * cdef float* quant_origin = NULL */ - __pyx_tuple__18 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__18)) __PYX_ERR(0, 40, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__18); - __Pyx_GIVEREF(__pyx_tuple__18); - __pyx_codeobj__19 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__18, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_normals, 40, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__19)) __PYX_ERR(0, 40, __pyx_L1_error) + } - /* "DracoPy.pyx":43 - * return self.data_struct['normals'] - * - * class EncodingOptions(object): # <<<<<<<<<<<<<< - * def __init__(self, quantization_bits, quantization_range, quantization_origin): - * self.quantization_bits = quantization_bits + /* "DracoPy.pyx":285 + * if geometry_metadata is None: + * geometry_metadata = _create_empty_geometry_metadata() + * cdef float* quant_origin = NULL # <<<<<<<<<<<<<< + * try: + * if is_mesh: */ - __pyx_tuple__20 = PyTuple_Pack(1, __pyx_builtin_object); if (unlikely(!__pyx_tuple__20)) __PYX_ERR(0, 43, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__20); - __Pyx_GIVEREF(__pyx_tuple__20); + __pyx_v_quant_origin = NULL; - /* "DracoPy.pyx":44 - * - * class EncodingOptions(object): - * def __init__(self, quantization_bits, quantization_range, quantization_origin): # <<<<<<<<<<<<<< - * self.quantization_bits = quantization_bits - * self.quantization_range = quantization_range + /* "DracoPy.pyx":286 + * geometry_metadata = _create_empty_geometry_metadata() + * cdef float* quant_origin = NULL + * try: # <<<<<<<<<<<<<< + * if is_mesh: + * draco_encoded = DracoPy.encode_mesh(points, */ - __pyx_tuple__21 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_quantization_bits, __pyx_n_s_quantization_range, __pyx_n_s_quantization_origin); if (unlikely(!__pyx_tuple__21)) __PYX_ERR(0, 44, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__21); - __Pyx_GIVEREF(__pyx_tuple__21); - __pyx_codeobj__22 = (PyObject*)__Pyx_PyCode_New(4, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__21, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_init, 44, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__22)) __PYX_ERR(0, 44, __pyx_L1_error) + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_8, &__pyx_t_9, &__pyx_t_10); + __Pyx_XGOTREF(__pyx_t_8); + __Pyx_XGOTREF(__pyx_t_9); + __Pyx_XGOTREF(__pyx_t_10); + /*try:*/ { - /* "DracoPy.pyx":50 - * self.inverse_alpha = quantization_range / ((2 ** quantization_bits) - 1) - * - * def get_encoded_coordinate(self, value, axis): # <<<<<<<<<<<<<< - * if value < self.quantization_origin[axis] or value > (self.quantization_origin[axis] + self.quantization_range): - * raise ValueError('Specified value out of encoded range') + /* "DracoPy.pyx":287 + * cdef float* quant_origin = NULL + * try: + * if is_mesh: # <<<<<<<<<<<<<< + * draco_encoded = DracoPy.encode_mesh(points, + * faces, */ - __pyx_tuple__23 = PyTuple_Pack(5, __pyx_n_s_self, __pyx_n_s_value, __pyx_n_s_axis, __pyx_n_s_difference, __pyx_n_s_quantized_index); if (unlikely(!__pyx_tuple__23)) __PYX_ERR(0, 50, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__23); - __Pyx_GIVEREF(__pyx_tuple__23); - __pyx_codeobj__24 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__23, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_get_encoded_coordinate, 50, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__24)) __PYX_ERR(0, 50, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_is_mesh); if (unlikely(__pyx_t_1 < 0)) __PYX_ERR(0, 287, __pyx_L9_error) + if (__pyx_t_1) { - /* "DracoPy.pyx":57 - * return self.quantization_origin[axis] + (quantized_index * self.inverse_alpha) - * - * def get_encoded_point(self, point): # <<<<<<<<<<<<<< - * encoded_point = [] - * for axis in range(self.num_axes): + /* "DracoPy.pyx":288 + * try: + * if is_mesh: + * draco_encoded = DracoPy.encode_mesh(points, # <<<<<<<<<<<<<< + * faces, + * encoder.this_encoder, */ - __pyx_tuple__25 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_point, __pyx_n_s_encoded_point, __pyx_n_s_axis); if (unlikely(!__pyx_tuple__25)) __PYX_ERR(0, 57, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__25); - __Pyx_GIVEREF(__pyx_tuple__25); - __pyx_codeobj__26 = (PyObject*)__Pyx_PyCode_New(2, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__25, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_get_encoded_point, 57, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__26)) __PYX_ERR(0, 57, __pyx_L1_error) + __pyx_t_11 = __pyx_convert_vector_from_py_float(__pyx_v_points); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 288, __pyx_L9_error) + + /* "DracoPy.pyx":289 + * if is_mesh: + * draco_encoded = DracoPy.encode_mesh(points, + * faces, # <<<<<<<<<<<<<< + * encoder.this_encoder, + * metadatas, + */ + __pyx_t_12 = __pyx_convert_vector_from_py_uint32_t(__pyx_v_faces); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 289, __pyx_L9_error) - /* "DracoPy.pyx":64 - * - * @property - * def num_axes(self): # <<<<<<<<<<<<<< - * return 3 - * + /* "DracoPy.pyx":291 + * faces, + * encoder.this_encoder, + * metadatas, # <<<<<<<<<<<<<< + * geometry_metadata) + * else: */ - __pyx_tuple__27 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__27)) __PYX_ERR(0, 64, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__27); - __Pyx_GIVEREF(__pyx_tuple__27); - __pyx_codeobj__28 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__27, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_num_axes, 64, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__28)) __PYX_ERR(0, 64, __pyx_L1_error) + __pyx_t_13 = __pyx_convert_vector_from_py_struct__DracoFunctions_3a__3a_MetadataObject(__pyx_v_metadatas); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 291, __pyx_L9_error) - /* "DracoPy.pyx":73 - * pass - * - * def encode_mesh_to_buffer(points, faces, quantization_bits=14, compression_level=1, quantization_range=-1, quantization_origin=None, create_metadata=False): # <<<<<<<<<<<<<< - * """ - * Encode a list or numpy array of points/vertices (float) and faces (unsigned int) to a draco buffer. + /* "DracoPy.pyx":292 + * encoder.this_encoder, + * metadatas, + * geometry_metadata) # <<<<<<<<<<<<<< + * else: + * draco_encoded = DracoPy.encode_point_cloud(points, */ - __pyx_tuple__29 = PyTuple_Pack(11, __pyx_n_s_points, __pyx_n_s_faces, __pyx_n_s_quantization_bits, __pyx_n_s_compression_level, __pyx_n_s_quantization_range, __pyx_n_s_quantization_origin, __pyx_n_s_create_metadata, __pyx_n_s_quant_origin, __pyx_n_s_num_dims, __pyx_n_s_dim, __pyx_n_s_encoded_mesh); if (unlikely(!__pyx_tuple__29)) __PYX_ERR(0, 73, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__29); - __Pyx_GIVEREF(__pyx_tuple__29); - __pyx_codeobj__30 = (PyObject*)__Pyx_PyCode_New(7, 0, 11, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__29, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_encode_mesh_to_buffer, 73, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__30)) __PYX_ERR(0, 73, __pyx_L1_error) + __pyx_t_14 = __pyx_convert__from_py_struct__DracoFunctions_3a__3a_GeometryMetadataObject(__pyx_v_geometry_metadata); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 292, __pyx_L9_error) - /* "DracoPy.pyx":104 - * raise ValueError("Input invalid") - * - * def encode_point_cloud_to_buffer(points, quantization_bits=14, compression_level=1, quantization_range=-1, quantization_origin=None, create_metadata=False): # <<<<<<<<<<<<<< - * """ - * Encode a list or numpy array of points/vertices (float) to a draco buffer. + /* "DracoPy.pyx":288 + * try: + * if is_mesh: + * draco_encoded = DracoPy.encode_mesh(points, # <<<<<<<<<<<<<< + * faces, + * encoder.this_encoder, */ - __pyx_tuple__31 = PyTuple_Pack(10, __pyx_n_s_points, __pyx_n_s_quantization_bits, __pyx_n_s_compression_level, __pyx_n_s_quantization_range, __pyx_n_s_quantization_origin, __pyx_n_s_create_metadata, __pyx_n_s_quant_origin, __pyx_n_s_num_dims, __pyx_n_s_dim, __pyx_n_s_encoded_point_cloud); if (unlikely(!__pyx_tuple__31)) __PYX_ERR(0, 104, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__31); - __Pyx_GIVEREF(__pyx_tuple__31); - __pyx_codeobj__32 = (PyObject*)__Pyx_PyCode_New(6, 0, 10, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__31, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_encode_point_cloud_to_buffer, 104, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__32)) __PYX_ERR(0, 104, __pyx_L1_error) + try { + __pyx_t_15 = DracoFunctions::encode_mesh(__pyx_t_11, __pyx_t_12, __pyx_v_encoder->this_encoder, __pyx_t_13, __pyx_t_14); + } catch(...) { + __Pyx_CppExn2PyErr(); + __PYX_ERR(0, 288, __pyx_L9_error) + } + __pyx_v_draco_encoded = __pyx_t_15; - /* "DracoPy.pyx":135 - * raise ValueError("Input invalid") - * - * def raise_decoding_error(decoding_status): # <<<<<<<<<<<<<< - * if decoding_status == DracoPy.decoding_status.not_draco_encoded: - * raise FileTypeException('Input mesh is not draco encoded') + /* "DracoPy.pyx":287 + * cdef float* quant_origin = NULL + * try: + * if is_mesh: # <<<<<<<<<<<<<< + * draco_encoded = DracoPy.encode_mesh(points, + * faces, */ - __pyx_tuple__33 = PyTuple_Pack(1, __pyx_n_s_decoding_status); if (unlikely(!__pyx_tuple__33)) __PYX_ERR(0, 135, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__33); - __Pyx_GIVEREF(__pyx_tuple__33); - __pyx_codeobj__34 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__33, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_raise_decoding_error, 135, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__34)) __PYX_ERR(0, 135, __pyx_L1_error) + goto __pyx_L15; + } - /* "DracoPy.pyx":143 - * raise ValueError('DracoPy only supports meshes with position attributes') - * - * def decode_buffer_to_mesh(buffer): # <<<<<<<<<<<<<< - * mesh_struct = DracoPy.decode_buffer(buffer, len(buffer)) - * if mesh_struct.decode_status == DracoPy.decoding_status.successful: + /* "DracoPy.pyx":294 + * geometry_metadata) + * else: + * draco_encoded = DracoPy.encode_point_cloud(points, # <<<<<<<<<<<<<< + * encoder.this_encoder, + * metadatas, */ - __pyx_tuple__35 = PyTuple_Pack(2, __pyx_n_s_buffer, __pyx_n_s_mesh_struct); if (unlikely(!__pyx_tuple__35)) __PYX_ERR(0, 143, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__35); - __Pyx_GIVEREF(__pyx_tuple__35); - __pyx_codeobj__36 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__35, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_decode_buffer_to_mesh, 143, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__36)) __PYX_ERR(0, 143, __pyx_L1_error) + /*else*/ { + __pyx_t_11 = __pyx_convert_vector_from_py_float(__pyx_v_points); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 294, __pyx_L9_error) + + /* "DracoPy.pyx":296 + * draco_encoded = DracoPy.encode_point_cloud(points, + * encoder.this_encoder, + * metadatas, # <<<<<<<<<<<<<< + * geometry_metadata) + * if quant_origin != NULL: + */ + __pyx_t_13 = __pyx_convert_vector_from_py_struct__DracoFunctions_3a__3a_MetadataObject(__pyx_v_metadatas); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 296, __pyx_L9_error) - /* "DracoPy.pyx":150 - * raise_decoding_error(mesh_struct.decode_status) - * - * def decode_point_cloud_buffer(buffer): # <<<<<<<<<<<<<< - * point_cloud_struct = DracoPy.decode_buffer_to_point_cloud(buffer, len(buffer)) - * if point_cloud_struct.decode_status == DracoPy.decoding_status.successful: + /* "DracoPy.pyx":297 + * encoder.this_encoder, + * metadatas, + * geometry_metadata) # <<<<<<<<<<<<<< + * if quant_origin != NULL: + * PyMem_Free(quant_origin) */ - __pyx_tuple__37 = PyTuple_Pack(2, __pyx_n_s_buffer, __pyx_n_s_point_cloud_struct); if (unlikely(!__pyx_tuple__37)) __PYX_ERR(0, 150, __pyx_L1_error) - __Pyx_GOTREF(__pyx_tuple__37); - __Pyx_GIVEREF(__pyx_tuple__37); - __pyx_codeobj__38 = (PyObject*)__Pyx_PyCode_New(1, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__37, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_decode_point_cloud_buffer, 150, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__38)) __PYX_ERR(0, 150, __pyx_L1_error) - __Pyx_RefNannyFinishContext(); - return 0; - __pyx_L1_error:; - __Pyx_RefNannyFinishContext(); - return -1; -} + __pyx_t_14 = __pyx_convert__from_py_struct__DracoFunctions_3a__3a_GeometryMetadataObject(__pyx_v_geometry_metadata); if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 297, __pyx_L9_error) -static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) { - if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error); - __pyx_float_0_5 = PyFloat_FromDouble(0.5); if (unlikely(!__pyx_float_0_5)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_int_2 = PyInt_FromLong(2); if (unlikely(!__pyx_int_2)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_int_3 = PyInt_FromLong(3); if (unlikely(!__pyx_int_3)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_int_14 = PyInt_FromLong(14); if (unlikely(!__pyx_int_14)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_int_neg_1 = PyInt_FromLong(-1); if (unlikely(!__pyx_int_neg_1)) __PYX_ERR(0, 1, __pyx_L1_error) - return 0; - __pyx_L1_error:; - return -1; -} + /* "DracoPy.pyx":294 + * geometry_metadata) + * else: + * draco_encoded = DracoPy.encode_point_cloud(points, # <<<<<<<<<<<<<< + * encoder.this_encoder, + * metadatas, + */ + try { + __pyx_t_15 = DracoFunctions::encode_point_cloud(__pyx_t_11, __pyx_v_encoder->this_encoder, __pyx_t_13, __pyx_t_14); + } catch(...) { + __Pyx_CppExn2PyErr(); + __PYX_ERR(0, 294, __pyx_L9_error) + } + __pyx_v_draco_encoded = __pyx_t_15; + } + __pyx_L15:; -static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(void); /*proto*/ -static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(void); /*proto*/ -static CYTHON_SMALL_CODE int __Pyx_modinit_function_export_code(void); /*proto*/ -static CYTHON_SMALL_CODE int __Pyx_modinit_type_init_code(void); /*proto*/ -static CYTHON_SMALL_CODE int __Pyx_modinit_type_import_code(void); /*proto*/ -static CYTHON_SMALL_CODE int __Pyx_modinit_variable_import_code(void); /*proto*/ -static CYTHON_SMALL_CODE int __Pyx_modinit_function_import_code(void); /*proto*/ + /* "DracoPy.pyx":298 + * metadatas, + * geometry_metadata) + * if quant_origin != NULL: # <<<<<<<<<<<<<< + * PyMem_Free(quant_origin) + * if draco_encoded.encode_status == DracoPy.encoding_status.successful_encoding: + */ + __pyx_t_1 = ((__pyx_v_quant_origin != NULL) != 0); + if (__pyx_t_1) { -static int __Pyx_modinit_global_init_code(void) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0); - /*--- Global init code ---*/ - __Pyx_RefNannyFinishContext(); - return 0; -} + /* "DracoPy.pyx":299 + * geometry_metadata) + * if quant_origin != NULL: + * PyMem_Free(quant_origin) # <<<<<<<<<<<<<< + * if draco_encoded.encode_status == DracoPy.encoding_status.successful_encoding: + * return bytes(draco_encoded.buffer) + */ + PyMem_Free(__pyx_v_quant_origin); -static int __Pyx_modinit_variable_export_code(void) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0); - /*--- Variable export code ---*/ - __Pyx_RefNannyFinishContext(); - return 0; -} + /* "DracoPy.pyx":298 + * metadatas, + * geometry_metadata) + * if quant_origin != NULL: # <<<<<<<<<<<<<< + * PyMem_Free(quant_origin) + * if draco_encoded.encode_status == DracoPy.encoding_status.successful_encoding: + */ + } -static int __Pyx_modinit_function_export_code(void) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0); - /*--- Function export code ---*/ - __Pyx_RefNannyFinishContext(); - return 0; -} - -static int __Pyx_modinit_type_init_code(void) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0); - /*--- Type init code ---*/ - __Pyx_RefNannyFinishContext(); - return 0; -} + /* "DracoPy.pyx":300 + * if quant_origin != NULL: + * PyMem_Free(quant_origin) + * if draco_encoded.encode_status == DracoPy.encoding_status.successful_encoding: # <<<<<<<<<<<<<< + * return bytes(draco_encoded.buffer) + * elif draco_encoded.encode_status == DracoPy.encoding_status.failed_during_encoding: + */ + switch (__pyx_v_draco_encoded.encode_status) { + case DracoFunctions::successful_encoding: -static int __Pyx_modinit_type_import_code(void) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0); - /*--- Type import code ---*/ - __Pyx_RefNannyFinishContext(); - return 0; -} + /* "DracoPy.pyx":301 + * PyMem_Free(quant_origin) + * if draco_encoded.encode_status == DracoPy.encoding_status.successful_encoding: + * return bytes(draco_encoded.buffer) # <<<<<<<<<<<<<< + * elif draco_encoded.encode_status == DracoPy.encoding_status.failed_during_encoding: + * raise EncodingFailedException('Invalid draco structure') + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __pyx_convert_vector_to_py_unsigned_char(__pyx_v_draco_encoded.buffer); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 301, __pyx_L9_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_6 = __Pyx_PyObject_CallOneArg(((PyObject *)(&PyBytes_Type)), __pyx_t_2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 301, __pyx_L9_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_6; + __pyx_t_6 = 0; + goto __pyx_L13_try_return; -static int __Pyx_modinit_variable_import_code(void) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0); - /*--- Variable import code ---*/ - __Pyx_RefNannyFinishContext(); - return 0; -} + /* "DracoPy.pyx":300 + * if quant_origin != NULL: + * PyMem_Free(quant_origin) + * if draco_encoded.encode_status == DracoPy.encoding_status.successful_encoding: # <<<<<<<<<<<<<< + * return bytes(draco_encoded.buffer) + * elif draco_encoded.encode_status == DracoPy.encoding_status.failed_during_encoding: + */ + break; + case DracoFunctions::failed_during_encoding: -static int __Pyx_modinit_function_import_code(void) { - __Pyx_RefNannyDeclarations - __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0); - /*--- Function import code ---*/ - __Pyx_RefNannyFinishContext(); - return 0; -} + /* "DracoPy.pyx":303 + * return bytes(draco_encoded.buffer) + * elif draco_encoded.encode_status == DracoPy.encoding_status.failed_during_encoding: + * raise EncodingFailedException('Invalid draco structure') # <<<<<<<<<<<<<< + * except EncodingFailedException: + * raise EncodingFailedException('Invalid draco structure') + */ + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_EncodingFailedException); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 303, __pyx_L9_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_7 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_7)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_7); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + } + } + __pyx_t_6 = (__pyx_t_7) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_7, __pyx_kp_u_Invalid_draco_structure) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_kp_u_Invalid_draco_structure); + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 303, __pyx_L9_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_Raise(__pyx_t_6, 0, 0, 0); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __PYX_ERR(0, 303, __pyx_L9_error) + /* "DracoPy.pyx":302 + * if draco_encoded.encode_status == DracoPy.encoding_status.successful_encoding: + * return bytes(draco_encoded.buffer) + * elif draco_encoded.encode_status == DracoPy.encoding_status.failed_during_encoding: # <<<<<<<<<<<<<< + * raise EncodingFailedException('Invalid draco structure') + * except EncodingFailedException: + */ + break; + default: break; + } -#ifndef CYTHON_NO_PYINIT_EXPORT -#define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC -#elif PY_MAJOR_VERSION < 3 -#ifdef __cplusplus -#define __Pyx_PyMODINIT_FUNC extern "C" void -#else -#define __Pyx_PyMODINIT_FUNC void -#endif -#else -#ifdef __cplusplus -#define __Pyx_PyMODINIT_FUNC extern "C" PyObject * -#else -#define __Pyx_PyMODINIT_FUNC PyObject * -#endif -#endif + /* "DracoPy.pyx":286 + * geometry_metadata = _create_empty_geometry_metadata() + * cdef float* quant_origin = NULL + * try: # <<<<<<<<<<<<<< + * if is_mesh: + * draco_encoded = DracoPy.encode_mesh(points, + */ + } + __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; + goto __pyx_L14_try_end; + __pyx_L9_error:; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + /* "DracoPy.pyx":304 + * elif draco_encoded.encode_status == DracoPy.encoding_status.failed_during_encoding: + * raise EncodingFailedException('Invalid draco structure') + * except EncodingFailedException: # <<<<<<<<<<<<<< + * raise EncodingFailedException('Invalid draco structure') + * except: + */ + __Pyx_ErrFetch(&__pyx_t_6, &__pyx_t_2, &__pyx_t_7); + __Pyx_GetModuleGlobalName(__pyx_t_16, __pyx_n_s_EncodingFailedException); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 304, __pyx_L11_except_error) + __Pyx_GOTREF(__pyx_t_16); + __pyx_t_17 = __Pyx_PyErr_GivenExceptionMatches(__pyx_t_6, __pyx_t_16); + __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; + __Pyx_ErrRestore(__pyx_t_6, __pyx_t_2, __pyx_t_7); + __pyx_t_6 = 0; __pyx_t_2 = 0; __pyx_t_7 = 0; + if (__pyx_t_17) { + __Pyx_AddTraceback("DracoPy.encode_to_buffer", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_7, &__pyx_t_2, &__pyx_t_6) < 0) __PYX_ERR(0, 304, __pyx_L11_except_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GOTREF(__pyx_t_6); -#if PY_MAJOR_VERSION < 3 -__Pyx_PyMODINIT_FUNC initDracoPy(void) CYTHON_SMALL_CODE; /*proto*/ -__Pyx_PyMODINIT_FUNC initDracoPy(void) -#else -__Pyx_PyMODINIT_FUNC PyInit_DracoPy(void) CYTHON_SMALL_CODE; /*proto*/ -__Pyx_PyMODINIT_FUNC PyInit_DracoPy(void) -#if CYTHON_PEP489_MULTI_PHASE_INIT -{ - return PyModuleDef_Init(&__pyx_moduledef); -} -static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) { - #if PY_VERSION_HEX >= 0x030700A1 - static PY_INT64_T main_interpreter_id = -1; - PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp); - if (main_interpreter_id == -1) { - main_interpreter_id = current_id; - return (unlikely(current_id == -1)) ? -1 : 0; - } else if (unlikely(main_interpreter_id != current_id)) - #else - static PyInterpreterState *main_interpreter = NULL; - PyInterpreterState *current_interpreter = PyThreadState_Get()->interp; - if (!main_interpreter) { - main_interpreter = current_interpreter; - } else if (unlikely(main_interpreter != current_interpreter)) - #endif - { - PyErr_SetString( - PyExc_ImportError, - "Interpreter change detected - this module can only be loaded into one interpreter per process."); - return -1; - } - return 0; -} -static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *moddict, const char* from_name, const char* to_name, int allow_none) { - PyObject *value = PyObject_GetAttrString(spec, from_name); - int result = 0; - if (likely(value)) { - if (allow_none || value != Py_None) { - result = PyDict_SetItemString(moddict, to_name, value); + /* "DracoPy.pyx":305 + * raise EncodingFailedException('Invalid draco structure') + * except EncodingFailedException: + * raise EncodingFailedException('Invalid draco structure') # <<<<<<<<<<<<<< + * except: + * if quant_origin != NULL: + */ + __Pyx_GetModuleGlobalName(__pyx_t_18, __pyx_n_s_EncodingFailedException); if (unlikely(!__pyx_t_18)) __PYX_ERR(0, 305, __pyx_L11_except_error) + __Pyx_GOTREF(__pyx_t_18); + __pyx_t_19 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_18))) { + __pyx_t_19 = PyMethod_GET_SELF(__pyx_t_18); + if (likely(__pyx_t_19)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_18); + __Pyx_INCREF(__pyx_t_19); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_18, function); } - Py_DECREF(value); - } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) { - PyErr_Clear(); - } else { - result = -1; + } + __pyx_t_16 = (__pyx_t_19) ? __Pyx_PyObject_Call2Args(__pyx_t_18, __pyx_t_19, __pyx_kp_u_Invalid_draco_structure) : __Pyx_PyObject_CallOneArg(__pyx_t_18, __pyx_kp_u_Invalid_draco_structure); + __Pyx_XDECREF(__pyx_t_19); __pyx_t_19 = 0; + if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 305, __pyx_L11_except_error) + __Pyx_GOTREF(__pyx_t_16); + __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; + __Pyx_Raise(__pyx_t_16, 0, 0, 0); + __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; + __PYX_ERR(0, 305, __pyx_L11_except_error) } - return result; -} -static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, CYTHON_UNUSED PyModuleDef *def) { - PyObject *module = NULL, *moddict, *modname; - if (__Pyx_check_single_interpreter()) - return NULL; - if (__pyx_m) - return __Pyx_NewRef(__pyx_m); - modname = PyObject_GetAttrString(spec, "name"); - if (unlikely(!modname)) goto bad; - module = PyModule_NewObject(modname); - Py_DECREF(modname); - if (unlikely(!module)) goto bad; - moddict = PyModule_GetDict(module); - if (unlikely(!moddict)) goto bad; - if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__", 1) < 0)) goto bad; - if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__", 1) < 0)) goto bad; - if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__", 1) < 0)) goto bad; - if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations", "__path__", 0) < 0)) goto bad; - return module; -bad: - Py_XDECREF(module); - return NULL; + + /* "DracoPy.pyx":306 + * except EncodingFailedException: + * raise EncodingFailedException('Invalid draco structure') + * except: # <<<<<<<<<<<<<< + * if quant_origin != NULL: + * PyMem_Free(quant_origin) + */ + /*except:*/ { + __Pyx_AddTraceback("DracoPy.encode_to_buffer", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_6, &__pyx_t_2, &__pyx_t_7) < 0) __PYX_ERR(0, 306, __pyx_L11_except_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GOTREF(__pyx_t_7); + + /* "DracoPy.pyx":307 + * raise EncodingFailedException('Invalid draco structure') + * except: + * if quant_origin != NULL: # <<<<<<<<<<<<<< + * PyMem_Free(quant_origin) + * raise ValueError("Input invalid") + */ + __pyx_t_1 = ((__pyx_v_quant_origin != NULL) != 0); + if (__pyx_t_1) { + + /* "DracoPy.pyx":308 + * except: + * if quant_origin != NULL: + * PyMem_Free(quant_origin) # <<<<<<<<<<<<<< + * raise ValueError("Input invalid") + * + */ + PyMem_Free(__pyx_v_quant_origin); + + /* "DracoPy.pyx":307 + * raise EncodingFailedException('Invalid draco structure') + * except: + * if quant_origin != NULL: # <<<<<<<<<<<<<< + * PyMem_Free(quant_origin) + * raise ValueError("Input invalid") + */ + } + + /* "DracoPy.pyx":309 + * if quant_origin != NULL: + * PyMem_Free(quant_origin) + * raise ValueError("Input invalid") # <<<<<<<<<<<<<< + * + * def raise_decoding_error(decoding_status): + */ + __pyx_t_16 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__6, NULL); if (unlikely(!__pyx_t_16)) __PYX_ERR(0, 309, __pyx_L11_except_error) + __Pyx_GOTREF(__pyx_t_16); + __Pyx_Raise(__pyx_t_16, 0, 0, 0); + __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; + __PYX_ERR(0, 309, __pyx_L11_except_error) + } + __pyx_L11_except_error:; + + /* "DracoPy.pyx":286 + * geometry_metadata = _create_empty_geometry_metadata() + * cdef float* quant_origin = NULL + * try: # <<<<<<<<<<<<<< + * if is_mesh: + * draco_encoded = DracoPy.encode_mesh(points, + */ + __Pyx_XGIVEREF(__pyx_t_8); + __Pyx_XGIVEREF(__pyx_t_9); + __Pyx_XGIVEREF(__pyx_t_10); + __Pyx_ExceptionReset(__pyx_t_8, __pyx_t_9, __pyx_t_10); + goto __pyx_L1_error; + __pyx_L13_try_return:; + __Pyx_XGIVEREF(__pyx_t_8); + __Pyx_XGIVEREF(__pyx_t_9); + __Pyx_XGIVEREF(__pyx_t_10); + __Pyx_ExceptionReset(__pyx_t_8, __pyx_t_9, __pyx_t_10); + goto __pyx_L0; + __pyx_L14_try_end:; + } + + /* "DracoPy.pyx":247 + * + * + * def encode_to_buffer(points: List[float], # <<<<<<<<<<<<<< + * faces: List[int] = None, + * encoder: Encoder = Encoder(), + */ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_16); + __Pyx_XDECREF(__pyx_t_18); + __Pyx_XDECREF(__pyx_t_19); + __Pyx_AddTraceback("DracoPy.encode_to_buffer", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_is_mesh); + __Pyx_XDECREF(__pyx_v_metadatas); + __Pyx_XDECREF(__pyx_v_geometry_metadata); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; } +/* "DracoPy.pyx":311 + * raise ValueError("Input invalid") + * + * def raise_decoding_error(decoding_status): # <<<<<<<<<<<<<< + * if decoding_status == DracoPy.decoding_status.not_draco_encoded: + * raise FileTypeException('Input mesh is not draco encoded') + */ -static CYTHON_SMALL_CODE int __pyx_pymod_exec_DracoPy(PyObject *__pyx_pyinit_module) -#endif -#endif -{ +/* Python wrapper */ +static PyObject *__pyx_pw_7DracoPy_11raise_decoding_error(PyObject *__pyx_self, PyObject *__pyx_v_decoding_status); /*proto*/ +static PyMethodDef __pyx_mdef_7DracoPy_11raise_decoding_error = {"raise_decoding_error", (PyCFunction)__pyx_pw_7DracoPy_11raise_decoding_error, METH_O, 0}; +static PyObject *__pyx_pw_7DracoPy_11raise_decoding_error(PyObject *__pyx_self, PyObject *__pyx_v_decoding_status) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("raise_decoding_error (wrapper)", 0); + __pyx_r = __pyx_pf_7DracoPy_10raise_decoding_error(__pyx_self, ((PyObject *)__pyx_v_decoding_status)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_7DracoPy_10raise_decoding_error(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_decoding_status) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; + int __pyx_t_3; PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - __Pyx_RefNannyDeclarations - #if CYTHON_PEP489_MULTI_PHASE_INIT - if (__pyx_m) { - if (__pyx_m == __pyx_pyinit_module) return 0; - PyErr_SetString(PyExc_RuntimeError, "Module 'DracoPy' has already been imported. Re-initialisation is not supported."); - return -1; + __Pyx_RefNannySetupContext("raise_decoding_error", 0); + + /* "DracoPy.pyx":312 + * + * def raise_decoding_error(decoding_status): + * if decoding_status == DracoPy.decoding_status.not_draco_encoded: # <<<<<<<<<<<<<< + * raise FileTypeException('Input mesh is not draco encoded') + * elif decoding_status == DracoPy.decoding_status.failed_during_decoding: + */ + __pyx_t_1 = __Pyx_PyInt_From_enum__DracoFunctions_3a__3a_decoding_status(DracoFunctions::not_draco_encoded); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 312, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_RichCompare(__pyx_v_decoding_status, __pyx_t_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 312, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 312, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(__pyx_t_3)) { + + /* "DracoPy.pyx":313 + * def raise_decoding_error(decoding_status): + * if decoding_status == DracoPy.decoding_status.not_draco_encoded: + * raise FileTypeException('Input mesh is not draco encoded') # <<<<<<<<<<<<<< + * elif decoding_status == DracoPy.decoding_status.failed_during_decoding: + * raise TypeError('Failed to decode input mesh. Data might be corrupted') + */ + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_FileTypeException); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 313, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_1))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_1); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_1, function); + } + } + __pyx_t_2 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_1, __pyx_t_4, __pyx_kp_u_Input_mesh_is_not_draco_encoded) : __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_kp_u_Input_mesh_is_not_draco_encoded); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 313, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __PYX_ERR(0, 313, __pyx_L1_error) + + /* "DracoPy.pyx":312 + * + * def raise_decoding_error(decoding_status): + * if decoding_status == DracoPy.decoding_status.not_draco_encoded: # <<<<<<<<<<<<<< + * raise FileTypeException('Input mesh is not draco encoded') + * elif decoding_status == DracoPy.decoding_status.failed_during_decoding: + */ } - #elif PY_MAJOR_VERSION >= 3 - if (__pyx_m) return __Pyx_NewRef(__pyx_m); - #endif - #if CYTHON_REFNANNY -__Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); -if (!__Pyx_RefNanny) { - PyErr_Clear(); - __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny"); - if (!__Pyx_RefNanny) - Py_FatalError("failed to import 'refnanny' module"); -} -#endif - __Pyx_RefNannySetupContext("__Pyx_PyMODINIT_FUNC PyInit_DracoPy(void)", 0); - if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #ifdef __Pxy_PyFrame_Initialize_Offsets - __Pxy_PyFrame_Initialize_Offsets(); - #endif - __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error) - #ifdef __Pyx_CyFunction_USED - if (__pyx_CyFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - #ifdef __Pyx_FusedFunction_USED - if (__pyx_FusedFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - #ifdef __Pyx_Coroutine_USED - if (__pyx_Coroutine_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - #ifdef __Pyx_Generator_USED - if (__pyx_Generator_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - #ifdef __Pyx_AsyncGen_USED - if (__pyx_AsyncGen_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - #ifdef __Pyx_StopAsyncIteration_USED - if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - /*--- Library function declarations ---*/ - /*--- Threads initialization code ---*/ - #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS - #ifdef WITH_THREAD /* Python build with threading support? */ - PyEval_InitThreads(); - #endif - #endif - /*--- Module creation code ---*/ - #if CYTHON_PEP489_MULTI_PHASE_INIT - __pyx_m = __pyx_pyinit_module; - Py_INCREF(__pyx_m); - #else - #if PY_MAJOR_VERSION < 3 - __pyx_m = Py_InitModule4("DracoPy", __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m); - #else - __pyx_m = PyModule_Create(&__pyx_moduledef); - #endif - if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error) - Py_INCREF(__pyx_d); - __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error) - Py_INCREF(__pyx_b); - __pyx_cython_runtime = PyImport_AddModule((char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error) - Py_INCREF(__pyx_cython_runtime); - if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error); - /*--- Initialize various global constants etc. ---*/ - if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT) - if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - #endif - if (__pyx_module_is_main_DracoPy) { - if (PyObject_SetAttr(__pyx_m, __pyx_n_s_name, __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error) + + /* "DracoPy.pyx":314 + * if decoding_status == DracoPy.decoding_status.not_draco_encoded: + * raise FileTypeException('Input mesh is not draco encoded') + * elif decoding_status == DracoPy.decoding_status.failed_during_decoding: # <<<<<<<<<<<<<< + * raise TypeError('Failed to decode input mesh. Data might be corrupted') + * elif decoding_status == DracoPy.decoding_status.no_position_attribute: + */ + __pyx_t_2 = __Pyx_PyInt_From_enum__DracoFunctions_3a__3a_decoding_status(DracoFunctions::failed_during_decoding); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 314, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyObject_RichCompare(__pyx_v_decoding_status, __pyx_t_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 314, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 314, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(__pyx_t_3)) { + + /* "DracoPy.pyx":315 + * raise FileTypeException('Input mesh is not draco encoded') + * elif decoding_status == DracoPy.decoding_status.failed_during_decoding: + * raise TypeError('Failed to decode input mesh. Data might be corrupted') # <<<<<<<<<<<<<< + * elif decoding_status == DracoPy.decoding_status.no_position_attribute: + * raise ValueError('DracoPy only supports meshes with position attributes') + */ + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_TypeError, __pyx_tuple__7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 315, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_Raise(__pyx_t_1, 0, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __PYX_ERR(0, 315, __pyx_L1_error) + + /* "DracoPy.pyx":314 + * if decoding_status == DracoPy.decoding_status.not_draco_encoded: + * raise FileTypeException('Input mesh is not draco encoded') + * elif decoding_status == DracoPy.decoding_status.failed_during_decoding: # <<<<<<<<<<<<<< + * raise TypeError('Failed to decode input mesh. Data might be corrupted') + * elif decoding_status == DracoPy.decoding_status.no_position_attribute: + */ } - #if PY_MAJOR_VERSION >= 3 + + /* "DracoPy.pyx":316 + * elif decoding_status == DracoPy.decoding_status.failed_during_decoding: + * raise TypeError('Failed to decode input mesh. Data might be corrupted') + * elif decoding_status == DracoPy.decoding_status.no_position_attribute: # <<<<<<<<<<<<<< + * raise ValueError('DracoPy only supports meshes with position attributes') + * + */ + __pyx_t_1 = __Pyx_PyInt_From_enum__DracoFunctions_3a__3a_decoding_status(DracoFunctions::no_position_attribute); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 316, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_RichCompare(__pyx_v_decoding_status, __pyx_t_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 316, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) __PYX_ERR(0, 316, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(__pyx_t_3)) { + + /* "DracoPy.pyx":317 + * raise TypeError('Failed to decode input mesh. Data might be corrupted') + * elif decoding_status == DracoPy.decoding_status.no_position_attribute: + * raise ValueError('DracoPy only supports meshes with position attributes') # <<<<<<<<<<<<<< + * + * def decode_buffer_to_mesh(buffer, deduplicate=False): + */ + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__8, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 317, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_Raise(__pyx_t_2, 0, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __PYX_ERR(0, 317, __pyx_L1_error) + + /* "DracoPy.pyx":316 + * elif decoding_status == DracoPy.decoding_status.failed_during_decoding: + * raise TypeError('Failed to decode input mesh. Data might be corrupted') + * elif decoding_status == DracoPy.decoding_status.no_position_attribute: # <<<<<<<<<<<<<< + * raise ValueError('DracoPy only supports meshes with position attributes') + * + */ + } + + /* "DracoPy.pyx":311 + * raise ValueError("Input invalid") + * + * def raise_decoding_error(decoding_status): # <<<<<<<<<<<<<< + * if decoding_status == DracoPy.decoding_status.not_draco_encoded: + * raise FileTypeException('Input mesh is not draco encoded') + */ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("DracoPy.raise_decoding_error", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "DracoPy.pyx":319 + * raise ValueError('DracoPy only supports meshes with position attributes') + * + * def decode_buffer_to_mesh(buffer, deduplicate=False): # <<<<<<<<<<<<<< + * """ + * Decode buffer to mesh + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_7DracoPy_13decode_buffer_to_mesh(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_7DracoPy_12decode_buffer_to_mesh[] = "\n Decode buffer to mesh\n :param bytes buffer: encoded mesh\n :param bool deduplicate: run Draco deduplcation functions\n :return: mesh object\n "; +static PyMethodDef __pyx_mdef_7DracoPy_13decode_buffer_to_mesh = {"decode_buffer_to_mesh", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7DracoPy_13decode_buffer_to_mesh, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7DracoPy_12decode_buffer_to_mesh}; +static PyObject *__pyx_pw_7DracoPy_13decode_buffer_to_mesh(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_buffer = 0; + PyObject *__pyx_v_deduplicate = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("decode_buffer_to_mesh (wrapper)", 0); { - PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error) - if (!PyDict_GetItemString(modules, "DracoPy")) { - if (unlikely(PyDict_SetItemString(modules, "DracoPy", __pyx_m) < 0)) __PYX_ERR(0, 1, __pyx_L1_error) + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_buffer,&__pyx_n_s_deduplicate,0}; + PyObject* values[2] = {0,0}; + values[1] = ((PyObject *)Py_False); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_buffer)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_deduplicate); + if (value) { values[1] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "decode_buffer_to_mesh") < 0)) __PYX_ERR(0, 319, __pyx_L3_error) + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } } + __pyx_v_buffer = values[0]; + __pyx_v_deduplicate = values[1]; } - #endif - /*--- Builtin init code ---*/ - if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - /*--- Constants init code ---*/ - if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error) - /*--- Global type/function init code ---*/ - (void)__Pyx_modinit_global_init_code(); - (void)__Pyx_modinit_variable_export_code(); - (void)__Pyx_modinit_function_export_code(); - (void)__Pyx_modinit_type_init_code(); - (void)__Pyx_modinit_type_import_code(); - (void)__Pyx_modinit_variable_import_code(); - (void)__Pyx_modinit_function_import_code(); - /*--- Execution code ---*/ - #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED) + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("decode_buffer_to_mesh", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 319, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("DracoPy.decode_buffer_to_mesh", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_7DracoPy_12decode_buffer_to_mesh(__pyx_self, __pyx_v_buffer, __pyx_v_deduplicate); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_7DracoPy_12decode_buffer_to_mesh(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_buffer, PyObject *__pyx_v_deduplicate) { + struct DracoFunctions::MeshObject __pyx_v_mesh_struct; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + char const *__pyx_t_1; + Py_ssize_t __pyx_t_2; + bool __pyx_t_3; + struct DracoFunctions::MeshObject __pyx_t_4; + int __pyx_t_5; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("decode_buffer_to_mesh", 0); + + /* "DracoPy.pyx":326 + * :return: mesh object + * """ + * mesh_struct = DracoPy.decode_buffer(buffer, len(buffer), deduplicate) # <<<<<<<<<<<<<< + * if mesh_struct.decode_status == DracoPy.decoding_status.successful: + * return DracoMesh(mesh_struct) + */ + __pyx_t_1 = __Pyx_PyObject_AsString(__pyx_v_buffer); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) __PYX_ERR(0, 326, __pyx_L1_error) + __pyx_t_2 = PyObject_Length(__pyx_v_buffer); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 326, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_deduplicate); if (unlikely((__pyx_t_3 == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 326, __pyx_L1_error) + try { + __pyx_t_4 = DracoFunctions::decode_buffer(__pyx_t_1, __pyx_t_2, __pyx_t_3); + } catch(...) { + __Pyx_CppExn2PyErr(); + __PYX_ERR(0, 326, __pyx_L1_error) + } + __pyx_v_mesh_struct = __pyx_t_4; + + /* "DracoPy.pyx":327 + * """ + * mesh_struct = DracoPy.decode_buffer(buffer, len(buffer), deduplicate) + * if mesh_struct.decode_status == DracoPy.decoding_status.successful: # <<<<<<<<<<<<<< + * return DracoMesh(mesh_struct) + * else: + */ + __pyx_t_5 = ((__pyx_v_mesh_struct.decode_status == DracoFunctions::successful) != 0); + if (__pyx_t_5) { + + /* "DracoPy.pyx":328 + * mesh_struct = DracoPy.decode_buffer(buffer, len(buffer), deduplicate) + * if mesh_struct.decode_status == DracoPy.decoding_status.successful: + * return DracoMesh(mesh_struct) # <<<<<<<<<<<<<< + * else: + * raise_decoding_error(mesh_struct.decode_status) + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_DracoMesh); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 328, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = __pyx_convert__to_py_struct__DracoFunctions_3a__3a_MeshObject(__pyx_v_mesh_struct); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 328, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_9 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) { + __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_7); + if (likely(__pyx_t_9)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7); + __Pyx_INCREF(__pyx_t_9); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_7, function); + } + } + __pyx_t_6 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_9, __pyx_t_8) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_8); + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 328, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_r = __pyx_t_6; + __pyx_t_6 = 0; + goto __pyx_L0; + + /* "DracoPy.pyx":327 + * """ + * mesh_struct = DracoPy.decode_buffer(buffer, len(buffer), deduplicate) + * if mesh_struct.decode_status == DracoPy.decoding_status.successful: # <<<<<<<<<<<<<< + * return DracoMesh(mesh_struct) + * else: + */ + } + + /* "DracoPy.pyx":330 + * return DracoMesh(mesh_struct) + * else: + * raise_decoding_error(mesh_struct.decode_status) # <<<<<<<<<<<<<< + * + * def decode_point_cloud_buffer(buffer, deduplicate=False): + */ + /*else*/ { + __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_raise_decoding_error); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 330, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = __Pyx_PyInt_From_enum__DracoFunctions_3a__3a_decoding_status(__pyx_v_mesh_struct.decode_status); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 330, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_9 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) { + __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_7); + if (likely(__pyx_t_9)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7); + __Pyx_INCREF(__pyx_t_9); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_7, function); + } + } + __pyx_t_6 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_9, __pyx_t_8) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_8); + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 330, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } + + /* "DracoPy.pyx":319 + * raise ValueError('DracoPy only supports meshes with position attributes') + * + * def decode_buffer_to_mesh(buffer, deduplicate=False): # <<<<<<<<<<<<<< + * """ + * Decode buffer to mesh + */ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_AddTraceback("DracoPy.decode_buffer_to_mesh", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "DracoPy.pyx":332 + * raise_decoding_error(mesh_struct.decode_status) + * + * def decode_point_cloud_buffer(buffer, deduplicate=False): # <<<<<<<<<<<<<< + * """ + * Decode buffer to point cloud + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_7DracoPy_15decode_point_cloud_buffer(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_7DracoPy_14decode_point_cloud_buffer[] = "\n Decode buffer to point cloud\n :param bytes buffer: encoded point cloud\n :param bool deduplicate: run Draco deduplcation functions\n :return: point cloud object\n "; +static PyMethodDef __pyx_mdef_7DracoPy_15decode_point_cloud_buffer = {"decode_point_cloud_buffer", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7DracoPy_15decode_point_cloud_buffer, METH_VARARGS|METH_KEYWORDS, __pyx_doc_7DracoPy_14decode_point_cloud_buffer}; +static PyObject *__pyx_pw_7DracoPy_15decode_point_cloud_buffer(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_buffer = 0; + PyObject *__pyx_v_deduplicate = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("decode_point_cloud_buffer (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_buffer,&__pyx_n_s_deduplicate,0}; + PyObject* values[2] = {0,0}; + values[1] = ((PyObject *)Py_False); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_buffer)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_deduplicate); + if (value) { values[1] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "decode_point_cloud_buffer") < 0)) __PYX_ERR(0, 332, __pyx_L3_error) + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_buffer = values[0]; + __pyx_v_deduplicate = values[1]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("decode_point_cloud_buffer", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 332, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("DracoPy.decode_point_cloud_buffer", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_7DracoPy_14decode_point_cloud_buffer(__pyx_self, __pyx_v_buffer, __pyx_v_deduplicate); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_7DracoPy_14decode_point_cloud_buffer(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_buffer, PyObject *__pyx_v_deduplicate) { + struct DracoFunctions::PointCloudObject __pyx_v_point_cloud_struct; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + char const *__pyx_t_1; + Py_ssize_t __pyx_t_2; + bool __pyx_t_3; + struct DracoFunctions::PointCloudObject __pyx_t_4; + int __pyx_t_5; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("decode_point_cloud_buffer", 0); + + /* "DracoPy.pyx":339 + * :return: point cloud object + * """ + * point_cloud_struct = DracoPy.decode_buffer_to_point_cloud(buffer, len(buffer), deduplicate) # <<<<<<<<<<<<<< + * if point_cloud_struct.decode_status == DracoPy.decoding_status.successful: + * return DracoPointCloud(point_cloud_struct) + */ + __pyx_t_1 = __Pyx_PyObject_AsString(__pyx_v_buffer); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) __PYX_ERR(0, 339, __pyx_L1_error) + __pyx_t_2 = PyObject_Length(__pyx_v_buffer); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(0, 339, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_v_deduplicate); if (unlikely((__pyx_t_3 == ((bool)-1)) && PyErr_Occurred())) __PYX_ERR(0, 339, __pyx_L1_error) + try { + __pyx_t_4 = DracoFunctions::decode_buffer_to_point_cloud(__pyx_t_1, __pyx_t_2, __pyx_t_3); + } catch(...) { + __Pyx_CppExn2PyErr(); + __PYX_ERR(0, 339, __pyx_L1_error) + } + __pyx_v_point_cloud_struct = __pyx_t_4; + + /* "DracoPy.pyx":340 + * """ + * point_cloud_struct = DracoPy.decode_buffer_to_point_cloud(buffer, len(buffer), deduplicate) + * if point_cloud_struct.decode_status == DracoPy.decoding_status.successful: # <<<<<<<<<<<<<< + * return DracoPointCloud(point_cloud_struct) + * else: + */ + __pyx_t_5 = ((__pyx_v_point_cloud_struct.decode_status == DracoFunctions::successful) != 0); + if (__pyx_t_5) { + + /* "DracoPy.pyx":341 + * point_cloud_struct = DracoPy.decode_buffer_to_point_cloud(buffer, len(buffer), deduplicate) + * if point_cloud_struct.decode_status == DracoPy.decoding_status.successful: + * return DracoPointCloud(point_cloud_struct) # <<<<<<<<<<<<<< + * else: + * raise_decoding_error(point_cloud_struct.decode_status) + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_DracoPointCloud); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 341, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = __pyx_convert__to_py_struct__DracoFunctions_3a__3a_PointCloudObject(__pyx_v_point_cloud_struct); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 341, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_9 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) { + __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_7); + if (likely(__pyx_t_9)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7); + __Pyx_INCREF(__pyx_t_9); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_7, function); + } + } + __pyx_t_6 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_9, __pyx_t_8) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_8); + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 341, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_r = __pyx_t_6; + __pyx_t_6 = 0; + goto __pyx_L0; + + /* "DracoPy.pyx":340 + * """ + * point_cloud_struct = DracoPy.decode_buffer_to_point_cloud(buffer, len(buffer), deduplicate) + * if point_cloud_struct.decode_status == DracoPy.decoding_status.successful: # <<<<<<<<<<<<<< + * return DracoPointCloud(point_cloud_struct) + * else: + */ + } + + /* "DracoPy.pyx":343 + * return DracoPointCloud(point_cloud_struct) + * else: + * raise_decoding_error(point_cloud_struct.decode_status) # <<<<<<<<<<<<<< + */ + /*else*/ { + __Pyx_GetModuleGlobalName(__pyx_t_7, __pyx_n_s_raise_decoding_error); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 343, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = __Pyx_PyInt_From_enum__DracoFunctions_3a__3a_decoding_status(__pyx_v_point_cloud_struct.decode_status); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 343, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_9 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_7))) { + __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_7); + if (likely(__pyx_t_9)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7); + __Pyx_INCREF(__pyx_t_9); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_7, function); + } + } + __pyx_t_6 = (__pyx_t_9) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_9, __pyx_t_8) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_8); + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 343, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } + + /* "DracoPy.pyx":332 + * raise_decoding_error(mesh_struct.decode_status) + * + * def decode_point_cloud_buffer(buffer, deduplicate=False): # <<<<<<<<<<<<<< + * """ + * Decode buffer to point cloud + */ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_AddTraceback("DracoPy.decode_point_cloud_buffer", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "vector.from_py":45 + * + * @cname("__pyx_convert_vector_from_py_float") + * cdef vector[X] __pyx_convert_vector_from_py_float(object o) except *: # <<<<<<<<<<<<<< + * cdef vector[X] v + * for item in o: + */ + +static std::vector __pyx_convert_vector_from_py_float(PyObject *__pyx_v_o) { + std::vector __pyx_v_v; + PyObject *__pyx_v_item = NULL; + std::vector __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + Py_ssize_t __pyx_t_2; + PyObject *(*__pyx_t_3)(PyObject *); + PyObject *__pyx_t_4 = NULL; + float __pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__pyx_convert_vector_from_py_float", 0); + + /* "vector.from_py":47 + * cdef vector[X] __pyx_convert_vector_from_py_float(object o) except *: + * cdef vector[X] v + * for item in o: # <<<<<<<<<<<<<< + * v.push_back(item) + * return v + */ + if (likely(PyList_CheckExact(__pyx_v_o)) || PyTuple_CheckExact(__pyx_v_o)) { + __pyx_t_1 = __pyx_v_o; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0; + __pyx_t_3 = NULL; + } else { + __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_o); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 47, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 47, __pyx_L1_error) + } + for (;;) { + if (likely(!__pyx_t_3)) { + if (likely(PyList_CheckExact(__pyx_t_1))) { + if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(1, 47, __pyx_L1_error) + #else + __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 47, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + #endif + } else { + if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(1, 47, __pyx_L1_error) + #else + __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 47, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + #endif + } + } else { + __pyx_t_4 = __pyx_t_3(__pyx_t_1); + if (unlikely(!__pyx_t_4)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); + else __PYX_ERR(1, 47, __pyx_L1_error) + } + break; + } + __Pyx_GOTREF(__pyx_t_4); + } + __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_4); + __pyx_t_4 = 0; + + /* "vector.from_py":48 + * cdef vector[X] v + * for item in o: + * v.push_back(item) # <<<<<<<<<<<<<< + * return v + * + */ + __pyx_t_5 = __pyx_PyFloat_AsFloat(__pyx_v_item); if (unlikely((__pyx_t_5 == (float)-1) && PyErr_Occurred())) __PYX_ERR(1, 48, __pyx_L1_error) + __pyx_v_v.push_back(((float)__pyx_t_5)); + + /* "vector.from_py":47 + * cdef vector[X] __pyx_convert_vector_from_py_float(object o) except *: + * cdef vector[X] v + * for item in o: # <<<<<<<<<<<<<< + * v.push_back(item) + * return v + */ + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "vector.from_py":49 + * for item in o: + * v.push_back(item) + * return v # <<<<<<<<<<<<<< + * + * + */ + __pyx_r = __pyx_v_v; + goto __pyx_L0; + + /* "vector.from_py":45 + * + * @cname("__pyx_convert_vector_from_py_float") + * cdef vector[X] __pyx_convert_vector_from_py_float(object o) except *: # <<<<<<<<<<<<<< + * cdef vector[X] v + * for item in o: + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("vector.from_py.__pyx_convert_vector_from_py_float", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_pretend_to_initialize(&__pyx_r); + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_item); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "string.from_py":13 + * + * @cname("__pyx_convert_string_from_py_std__in_string") + * cdef string __pyx_convert_string_from_py_std__in_string(object o) except *: # <<<<<<<<<<<<<< + * cdef Py_ssize_t length = 0 + * cdef const char* data = __Pyx_PyObject_AsStringAndSize(o, &length) + */ + +static std::string __pyx_convert_string_from_py_std__in_string(PyObject *__pyx_v_o) { + Py_ssize_t __pyx_v_length; + char const *__pyx_v_data; + std::string __pyx_r; + __Pyx_RefNannyDeclarations + char const *__pyx_t_1; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__pyx_convert_string_from_py_std__in_string", 0); + + /* "string.from_py":14 + * @cname("__pyx_convert_string_from_py_std__in_string") + * cdef string __pyx_convert_string_from_py_std__in_string(object o) except *: + * cdef Py_ssize_t length = 0 # <<<<<<<<<<<<<< + * cdef const char* data = __Pyx_PyObject_AsStringAndSize(o, &length) + * return string(data, length) + */ + __pyx_v_length = 0; + + /* "string.from_py":15 + * cdef string __pyx_convert_string_from_py_std__in_string(object o) except *: + * cdef Py_ssize_t length = 0 + * cdef const char* data = __Pyx_PyObject_AsStringAndSize(o, &length) # <<<<<<<<<<<<<< + * return string(data, length) + * + */ + __pyx_t_1 = __Pyx_PyObject_AsStringAndSize(__pyx_v_o, (&__pyx_v_length)); if (unlikely(__pyx_t_1 == ((char const *)NULL))) __PYX_ERR(1, 15, __pyx_L1_error) + __pyx_v_data = __pyx_t_1; + + /* "string.from_py":16 + * cdef Py_ssize_t length = 0 + * cdef const char* data = __Pyx_PyObject_AsStringAndSize(o, &length) + * return string(data, length) # <<<<<<<<<<<<<< + * + * + */ + __pyx_r = std::string(__pyx_v_data, __pyx_v_length); + goto __pyx_L0; + + /* "string.from_py":13 + * + * @cname("__pyx_convert_string_from_py_std__in_string") + * cdef string __pyx_convert_string_from_py_std__in_string(object o) except *: # <<<<<<<<<<<<<< + * cdef Py_ssize_t length = 0 + * cdef const char* data = __Pyx_PyObject_AsStringAndSize(o, &length) + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_AddTraceback("string.from_py.__pyx_convert_string_from_py_std__in_string", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_pretend_to_initialize(&__pyx_r); + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "vector.to_py":60 + * + * @cname("__pyx_convert_vector_to_py_double") + * cdef object __pyx_convert_vector_to_py_double(vector[X]& v): # <<<<<<<<<<<<<< + * return [v[i] for i in range(v.size())] + * + */ + +static PyObject *__pyx_convert_vector_to_py_double(const std::vector &__pyx_v_v) { + size_t __pyx_v_i; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + size_t __pyx_t_2; + size_t __pyx_t_3; + size_t __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__pyx_convert_vector_to_py_double", 0); + + /* "vector.to_py":61 + * @cname("__pyx_convert_vector_to_py_double") + * cdef object __pyx_convert_vector_to_py_double(vector[X]& v): + * return [v[i] for i in range(v.size())] # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 61, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __pyx_v_v.size(); + __pyx_t_3 = __pyx_t_2; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { + __pyx_v_i = __pyx_t_4; + __pyx_t_5 = PyFloat_FromDouble((__pyx_v_v[__pyx_v_i])); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 61, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_5))) __PYX_ERR(1, 61, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "vector.to_py":60 + * + * @cname("__pyx_convert_vector_to_py_double") + * cdef object __pyx_convert_vector_to_py_double(vector[X]& v): # <<<<<<<<<<<<<< + * return [v[i] for i in range(v.size())] + * + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("vector.to_py.__pyx_convert_vector_to_py_double", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "map.from_py":174 + * + * @cname("__pyx_convert_unordered_map_from_py_uint32_t__and_std_3a__3a_string") + * cdef map[X,Y] __pyx_convert_unordered_map_from_py_uint32_t__and_std_3a__3a_string(object o) except *: # <<<<<<<<<<<<<< + * cdef dict d = o + * cdef map[X,Y] m + */ + +static std::unordered_map __pyx_convert_unordered_map_from_py_uint32_t__and_std_3a__3a_string(PyObject *__pyx_v_o) { + PyObject *__pyx_v_d = 0; + std::unordered_map __pyx_v_m; + PyObject *__pyx_v_key = NULL; + PyObject *__pyx_v_value = NULL; + std::unordered_map __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + Py_ssize_t __pyx_t_2; + Py_ssize_t __pyx_t_3; + int __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + int __pyx_t_7; + uint32_t __pyx_t_8; + std::string __pyx_t_9; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__pyx_convert_unordered_map_from_py_uint32_t__and_std_3a__3a_string", 0); + + /* "map.from_py":175 + * @cname("__pyx_convert_unordered_map_from_py_uint32_t__and_std_3a__3a_string") + * cdef map[X,Y] __pyx_convert_unordered_map_from_py_uint32_t__and_std_3a__3a_string(object o) except *: + * cdef dict d = o # <<<<<<<<<<<<<< + * cdef map[X,Y] m + * for key, value in d.iteritems(): + */ + if (!(likely(PyDict_CheckExact(__pyx_v_o))||((__pyx_v_o) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "dict", Py_TYPE(__pyx_v_o)->tp_name), 0))) __PYX_ERR(1, 175, __pyx_L1_error) + __pyx_t_1 = __pyx_v_o; + __Pyx_INCREF(__pyx_t_1); + __pyx_v_d = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "map.from_py":177 + * cdef dict d = o + * cdef map[X,Y] m + * for key, value in d.iteritems(): # <<<<<<<<<<<<<< + * m.insert(pair[X,Y](key, value)) + * return m + */ + __pyx_t_2 = 0; + if (unlikely(__pyx_v_d == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "iteritems"); + __PYX_ERR(1, 177, __pyx_L1_error) + } + __pyx_t_5 = __Pyx_dict_iterator(__pyx_v_d, 1, __pyx_n_s_iteritems, (&__pyx_t_3), (&__pyx_t_4)); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 177, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_1); + __pyx_t_1 = __pyx_t_5; + __pyx_t_5 = 0; + while (1) { + __pyx_t_7 = __Pyx_dict_iter_next(__pyx_t_1, __pyx_t_3, &__pyx_t_2, &__pyx_t_5, &__pyx_t_6, NULL, __pyx_t_4); + if (unlikely(__pyx_t_7 == 0)) break; + if (unlikely(__pyx_t_7 == -1)) __PYX_ERR(1, 177, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GOTREF(__pyx_t_6); + __Pyx_XDECREF_SET(__pyx_v_key, __pyx_t_5); + __pyx_t_5 = 0; + __Pyx_XDECREF_SET(__pyx_v_value, __pyx_t_6); + __pyx_t_6 = 0; + + /* "map.from_py":178 + * cdef map[X,Y] m + * for key, value in d.iteritems(): + * m.insert(pair[X,Y](key, value)) # <<<<<<<<<<<<<< + * return m + * + */ + __pyx_t_8 = __Pyx_PyInt_As_uint32_t(__pyx_v_key); if (unlikely((__pyx_t_8 == ((uint32_t)-1)) && PyErr_Occurred())) __PYX_ERR(1, 178, __pyx_L1_error) + __pyx_t_9 = __pyx_convert_string_from_py_std__in_string(__pyx_v_value); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 178, __pyx_L1_error) + __pyx_v_m.insert(std::pair (((uint32_t)__pyx_t_8), ((std::string)__pyx_t_9))); + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "map.from_py":179 + * for key, value in d.iteritems(): + * m.insert(pair[X,Y](key, value)) + * return m # <<<<<<<<<<<<<< + * + * + */ + __pyx_r = __pyx_v_m; + goto __pyx_L0; + + /* "map.from_py":174 + * + * @cname("__pyx_convert_unordered_map_from_py_uint32_t__and_std_3a__3a_string") + * cdef map[X,Y] __pyx_convert_unordered_map_from_py_uint32_t__and_std_3a__3a_string(object o) except *: # <<<<<<<<<<<<<< + * cdef dict d = o + * cdef map[X,Y] m + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_AddTraceback("map.from_py.__pyx_convert_unordered_map_from_py_uint32_t__and_std_3a__3a_string", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_pretend_to_initialize(&__pyx_r); + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_d); + __Pyx_XDECREF(__pyx_v_key); + __Pyx_XDECREF(__pyx_v_value); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "FromPyStructUtility":11 + * + * @cname("__pyx_convert__from_py_struct__DracoFunctions_3a__3a_PointAttributeObject") + * cdef struct_type __pyx_convert__from_py_struct__DracoFunctions_3a__3a_PointAttributeObject(obj) except *: # <<<<<<<<<<<<<< + * cdef struct_type result + * if not PyMapping_Check(obj): + */ + +static struct DracoFunctions::PointAttributeObject __pyx_convert__from_py_struct__DracoFunctions_3a__3a_PointAttributeObject(PyObject *__pyx_v_obj) { + struct DracoFunctions::PointAttributeObject __pyx_v_result; + PyObject *__pyx_v_value = NULL; + struct DracoFunctions::PointAttributeObject __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_t_6; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + std::unordered_map __pyx_t_10; + enum draco::DataType __pyx_t_11; + uint32_t __pyx_t_12; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__pyx_convert__from_py_struct__DracoFunctions_3a__3a_PointAttributeObject", 0); + + /* "FromPyStructUtility":13 + * cdef struct_type __pyx_convert__from_py_struct__DracoFunctions_3a__3a_PointAttributeObject(obj) except *: + * cdef struct_type result + * if not PyMapping_Check(obj): # <<<<<<<<<<<<<< + * PyErr_Format(TypeError, b"Expected %.16s, got %.200s", b"a mapping", Py_TYPE(obj).tp_name) + * + */ + __pyx_t_1 = ((!(PyMapping_Check(__pyx_v_obj) != 0)) != 0); + if (__pyx_t_1) { + + /* "FromPyStructUtility":14 + * cdef struct_type result + * if not PyMapping_Check(obj): + * PyErr_Format(TypeError, b"Expected %.16s, got %.200s", b"a mapping", Py_TYPE(obj).tp_name) # <<<<<<<<<<<<<< + * + * try: + */ + __pyx_t_2 = PyErr_Format(__pyx_builtin_TypeError, ((char const *)"Expected %.16s, got %.200s"), ((char *)"a mapping"), Py_TYPE(__pyx_v_obj)->tp_name); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 14, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "FromPyStructUtility":13 + * cdef struct_type __pyx_convert__from_py_struct__DracoFunctions_3a__3a_PointAttributeObject(obj) except *: + * cdef struct_type result + * if not PyMapping_Check(obj): # <<<<<<<<<<<<<< + * PyErr_Format(TypeError, b"Expected %.16s, got %.200s", b"a mapping", Py_TYPE(obj).tp_name) + * + */ + } + + /* "FromPyStructUtility":16 + * PyErr_Format(TypeError, b"Expected %.16s, got %.200s", b"a mapping", Py_TYPE(obj).tp_name) + * + * try: # <<<<<<<<<<<<<< + * value = obj['data'] + * except KeyError: + */ + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5); + __Pyx_XGOTREF(__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_4); + __Pyx_XGOTREF(__pyx_t_5); + /*try:*/ { + + /* "FromPyStructUtility":17 + * + * try: + * value = obj['data'] # <<<<<<<<<<<<<< + * except KeyError: + * raise ValueError("No value specified for struct attribute 'data'") + */ + __pyx_t_2 = __Pyx_PyObject_Dict_GetItem(__pyx_v_obj, __pyx_n_s_data); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 17, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_v_value = __pyx_t_2; + __pyx_t_2 = 0; + + /* "FromPyStructUtility":16 + * PyErr_Format(TypeError, b"Expected %.16s, got %.200s", b"a mapping", Py_TYPE(obj).tp_name) + * + * try: # <<<<<<<<<<<<<< + * value = obj['data'] + * except KeyError: + */ + } + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + goto __pyx_L9_try_end; + __pyx_L4_error:; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "FromPyStructUtility":18 + * try: + * value = obj['data'] + * except KeyError: # <<<<<<<<<<<<<< + * raise ValueError("No value specified for struct attribute 'data'") + * result.data = value + */ + __pyx_t_6 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_KeyError); + if (__pyx_t_6) { + __Pyx_AddTraceback("FromPyStructUtility.__pyx_convert__from_py_struct__DracoFunctions_3a__3a_PointAttributeObject", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_7, &__pyx_t_8) < 0) __PYX_ERR(1, 18, __pyx_L6_except_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GOTREF(__pyx_t_7); + __Pyx_GOTREF(__pyx_t_8); + + /* "FromPyStructUtility":19 + * value = obj['data'] + * except KeyError: + * raise ValueError("No value specified for struct attribute 'data'") # <<<<<<<<<<<<<< + * result.data = value + * try: + */ + __pyx_t_9 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__9, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 19, __pyx_L6_except_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_Raise(__pyx_t_9, 0, 0, 0); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __PYX_ERR(1, 19, __pyx_L6_except_error) + } + goto __pyx_L6_except_error; + __pyx_L6_except_error:; + + /* "FromPyStructUtility":16 + * PyErr_Format(TypeError, b"Expected %.16s, got %.200s", b"a mapping", Py_TYPE(obj).tp_name) + * + * try: # <<<<<<<<<<<<<< + * value = obj['data'] + * except KeyError: + */ + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_XGIVEREF(__pyx_t_4); + __Pyx_XGIVEREF(__pyx_t_5); + __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5); + goto __pyx_L1_error; + __pyx_L9_try_end:; + } + + /* "FromPyStructUtility":20 + * except KeyError: + * raise ValueError("No value specified for struct attribute 'data'") + * result.data = value # <<<<<<<<<<<<<< + * try: + * value = obj['datatype'] + */ + __pyx_t_10 = __pyx_convert_unordered_map_from_py_uint32_t__and_std_3a__3a_string(__pyx_v_value); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 20, __pyx_L1_error) + __pyx_v_result.data = __pyx_t_10; + + /* "FromPyStructUtility":21 + * raise ValueError("No value specified for struct attribute 'data'") + * result.data = value + * try: # <<<<<<<<<<<<<< + * value = obj['datatype'] + * except KeyError: + */ + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_5, &__pyx_t_4, &__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_5); + __Pyx_XGOTREF(__pyx_t_4); + __Pyx_XGOTREF(__pyx_t_3); + /*try:*/ { + + /* "FromPyStructUtility":22 + * result.data = value + * try: + * value = obj['datatype'] # <<<<<<<<<<<<<< + * except KeyError: + * raise ValueError("No value specified for struct attribute 'datatype'") + */ + __pyx_t_8 = __Pyx_PyObject_Dict_GetItem(__pyx_v_obj, __pyx_n_s_datatype); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 22, __pyx_L12_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF_SET(__pyx_v_value, __pyx_t_8); + __pyx_t_8 = 0; + + /* "FromPyStructUtility":21 + * raise ValueError("No value specified for struct attribute 'data'") + * result.data = value + * try: # <<<<<<<<<<<<<< + * value = obj['datatype'] + * except KeyError: + */ + } + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + goto __pyx_L17_try_end; + __pyx_L12_error:; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + + /* "FromPyStructUtility":23 + * try: + * value = obj['datatype'] + * except KeyError: # <<<<<<<<<<<<<< + * raise ValueError("No value specified for struct attribute 'datatype'") + * result.datatype = value + */ + __pyx_t_6 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_KeyError); + if (__pyx_t_6) { + __Pyx_AddTraceback("FromPyStructUtility.__pyx_convert__from_py_struct__DracoFunctions_3a__3a_PointAttributeObject", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_8, &__pyx_t_7, &__pyx_t_2) < 0) __PYX_ERR(1, 23, __pyx_L14_except_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_GOTREF(__pyx_t_7); + __Pyx_GOTREF(__pyx_t_2); + + /* "FromPyStructUtility":24 + * value = obj['datatype'] + * except KeyError: + * raise ValueError("No value specified for struct attribute 'datatype'") # <<<<<<<<<<<<<< + * result.datatype = value + * try: + */ + __pyx_t_9 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__10, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 24, __pyx_L14_except_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_Raise(__pyx_t_9, 0, 0, 0); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __PYX_ERR(1, 24, __pyx_L14_except_error) + } + goto __pyx_L14_except_error; + __pyx_L14_except_error:; + + /* "FromPyStructUtility":21 + * raise ValueError("No value specified for struct attribute 'data'") + * result.data = value + * try: # <<<<<<<<<<<<<< + * value = obj['datatype'] + * except KeyError: + */ + __Pyx_XGIVEREF(__pyx_t_5); + __Pyx_XGIVEREF(__pyx_t_4); + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_4, __pyx_t_3); + goto __pyx_L1_error; + __pyx_L17_try_end:; + } + + /* "FromPyStructUtility":25 + * except KeyError: + * raise ValueError("No value specified for struct attribute 'datatype'") + * result.datatype = value # <<<<<<<<<<<<<< + * try: + * value = obj['dimension'] + */ + __pyx_t_11 = ((enum draco::DataType)__Pyx_PyInt_As_enum__draco_3a__3a_DataType(__pyx_v_value)); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 25, __pyx_L1_error) + __pyx_v_result.datatype = __pyx_t_11; + + /* "FromPyStructUtility":26 + * raise ValueError("No value specified for struct attribute 'datatype'") + * result.datatype = value + * try: # <<<<<<<<<<<<<< + * value = obj['dimension'] + * except KeyError: + */ + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5); + __Pyx_XGOTREF(__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_4); + __Pyx_XGOTREF(__pyx_t_5); + /*try:*/ { + + /* "FromPyStructUtility":27 + * result.datatype = value + * try: + * value = obj['dimension'] # <<<<<<<<<<<<<< + * except KeyError: + * raise ValueError("No value specified for struct attribute 'dimension'") + */ + __pyx_t_2 = __Pyx_PyObject_Dict_GetItem(__pyx_v_obj, __pyx_n_s_dimension); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 27, __pyx_L20_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF_SET(__pyx_v_value, __pyx_t_2); + __pyx_t_2 = 0; + + /* "FromPyStructUtility":26 + * raise ValueError("No value specified for struct attribute 'datatype'") + * result.datatype = value + * try: # <<<<<<<<<<<<<< + * value = obj['dimension'] + * except KeyError: + */ + } + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + goto __pyx_L25_try_end; + __pyx_L20_error:; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + + /* "FromPyStructUtility":28 + * try: + * value = obj['dimension'] + * except KeyError: # <<<<<<<<<<<<<< + * raise ValueError("No value specified for struct attribute 'dimension'") + * result.dimension = value + */ + __pyx_t_6 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_KeyError); + if (__pyx_t_6) { + __Pyx_AddTraceback("FromPyStructUtility.__pyx_convert__from_py_struct__DracoFunctions_3a__3a_PointAttributeObject", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_7, &__pyx_t_8) < 0) __PYX_ERR(1, 28, __pyx_L22_except_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GOTREF(__pyx_t_7); + __Pyx_GOTREF(__pyx_t_8); + + /* "FromPyStructUtility":29 + * value = obj['dimension'] + * except KeyError: + * raise ValueError("No value specified for struct attribute 'dimension'") # <<<<<<<<<<<<<< + * result.dimension = value + * try: + */ + __pyx_t_9 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__11, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 29, __pyx_L22_except_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_Raise(__pyx_t_9, 0, 0, 0); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __PYX_ERR(1, 29, __pyx_L22_except_error) + } + goto __pyx_L22_except_error; + __pyx_L22_except_error:; + + /* "FromPyStructUtility":26 + * raise ValueError("No value specified for struct attribute 'datatype'") + * result.datatype = value + * try: # <<<<<<<<<<<<<< + * value = obj['dimension'] + * except KeyError: + */ + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_XGIVEREF(__pyx_t_4); + __Pyx_XGIVEREF(__pyx_t_5); + __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5); + goto __pyx_L1_error; + __pyx_L25_try_end:; + } + + /* "FromPyStructUtility":30 + * except KeyError: + * raise ValueError("No value specified for struct attribute 'dimension'") + * result.dimension = value # <<<<<<<<<<<<<< + * try: + * value = obj['metadata_id'] + */ + __pyx_t_12 = __Pyx_PyInt_As_uint32_t(__pyx_v_value); if (unlikely((__pyx_t_12 == ((uint32_t)-1)) && PyErr_Occurred())) __PYX_ERR(1, 30, __pyx_L1_error) + __pyx_v_result.dimension = __pyx_t_12; + + /* "FromPyStructUtility":31 + * raise ValueError("No value specified for struct attribute 'dimension'") + * result.dimension = value + * try: # <<<<<<<<<<<<<< + * value = obj['metadata_id'] + * except KeyError: + */ + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_5, &__pyx_t_4, &__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_5); + __Pyx_XGOTREF(__pyx_t_4); + __Pyx_XGOTREF(__pyx_t_3); + /*try:*/ { + + /* "FromPyStructUtility":32 + * result.dimension = value + * try: + * value = obj['metadata_id'] # <<<<<<<<<<<<<< + * except KeyError: + * raise ValueError("No value specified for struct attribute 'metadata_id'") + */ + __pyx_t_8 = __Pyx_PyObject_Dict_GetItem(__pyx_v_obj, __pyx_n_s_metadata_id); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 32, __pyx_L28_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF_SET(__pyx_v_value, __pyx_t_8); + __pyx_t_8 = 0; + + /* "FromPyStructUtility":31 + * raise ValueError("No value specified for struct attribute 'dimension'") + * result.dimension = value + * try: # <<<<<<<<<<<<<< + * value = obj['metadata_id'] + * except KeyError: + */ + } + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + goto __pyx_L33_try_end; + __pyx_L28_error:; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + + /* "FromPyStructUtility":33 + * try: + * value = obj['metadata_id'] + * except KeyError: # <<<<<<<<<<<<<< + * raise ValueError("No value specified for struct attribute 'metadata_id'") + * result.metadata_id = value + */ + __pyx_t_6 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_KeyError); + if (__pyx_t_6) { + __Pyx_AddTraceback("FromPyStructUtility.__pyx_convert__from_py_struct__DracoFunctions_3a__3a_PointAttributeObject", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_8, &__pyx_t_7, &__pyx_t_2) < 0) __PYX_ERR(1, 33, __pyx_L30_except_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_GOTREF(__pyx_t_7); + __Pyx_GOTREF(__pyx_t_2); + + /* "FromPyStructUtility":34 + * value = obj['metadata_id'] + * except KeyError: + * raise ValueError("No value specified for struct attribute 'metadata_id'") # <<<<<<<<<<<<<< + * result.metadata_id = value + * return result + */ + __pyx_t_9 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__12, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 34, __pyx_L30_except_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_Raise(__pyx_t_9, 0, 0, 0); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __PYX_ERR(1, 34, __pyx_L30_except_error) + } + goto __pyx_L30_except_error; + __pyx_L30_except_error:; + + /* "FromPyStructUtility":31 + * raise ValueError("No value specified for struct attribute 'dimension'") + * result.dimension = value + * try: # <<<<<<<<<<<<<< + * value = obj['metadata_id'] + * except KeyError: + */ + __Pyx_XGIVEREF(__pyx_t_5); + __Pyx_XGIVEREF(__pyx_t_4); + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_4, __pyx_t_3); + goto __pyx_L1_error; + __pyx_L33_try_end:; + } + + /* "FromPyStructUtility":35 + * except KeyError: + * raise ValueError("No value specified for struct attribute 'metadata_id'") + * result.metadata_id = value # <<<<<<<<<<<<<< + * return result + * + */ + __pyx_t_12 = __Pyx_PyInt_As_uint32_t(__pyx_v_value); if (unlikely((__pyx_t_12 == ((uint32_t)-1)) && PyErr_Occurred())) __PYX_ERR(1, 35, __pyx_L1_error) + __pyx_v_result.metadata_id = __pyx_t_12; + + /* "FromPyStructUtility":36 + * raise ValueError("No value specified for struct attribute 'metadata_id'") + * result.metadata_id = value + * return result # <<<<<<<<<<<<<< + * + * + */ + __pyx_r = __pyx_v_result; + goto __pyx_L0; + + /* "FromPyStructUtility":11 + * + * @cname("__pyx_convert__from_py_struct__DracoFunctions_3a__3a_PointAttributeObject") + * cdef struct_type __pyx_convert__from_py_struct__DracoFunctions_3a__3a_PointAttributeObject(obj) except *: # <<<<<<<<<<<<<< + * cdef struct_type result + * if not PyMapping_Check(obj): + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_AddTraceback("FromPyStructUtility.__pyx_convert__from_py_struct__DracoFunctions_3a__3a_PointAttributeObject", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_pretend_to_initialize(&__pyx_r); + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_value); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "vector.from_py":45 + * + * @cname("__pyx_convert_vector_from_py_struct__DracoFunctions_3a__3a_PointAttributeObject") + * cdef vector[X] __pyx_convert_vector_from_py_struct__DracoFunctions_3a__3a_PointAttributeObject(object o) except *: # <<<<<<<<<<<<<< + * cdef vector[X] v + * for item in o: + */ + +static std::vector __pyx_convert_vector_from_py_struct__DracoFunctions_3a__3a_PointAttributeObject(PyObject *__pyx_v_o) { + std::vector __pyx_v_v; + PyObject *__pyx_v_item = NULL; + std::vector __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + Py_ssize_t __pyx_t_2; + PyObject *(*__pyx_t_3)(PyObject *); + PyObject *__pyx_t_4 = NULL; + struct DracoFunctions::PointAttributeObject __pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__pyx_convert_vector_from_py_struct__DracoFunctions_3a__3a_PointAttributeObject", 0); + + /* "vector.from_py":47 + * cdef vector[X] __pyx_convert_vector_from_py_struct__DracoFunctions_3a__3a_PointAttributeObject(object o) except *: + * cdef vector[X] v + * for item in o: # <<<<<<<<<<<<<< + * v.push_back(item) + * return v + */ + if (likely(PyList_CheckExact(__pyx_v_o)) || PyTuple_CheckExact(__pyx_v_o)) { + __pyx_t_1 = __pyx_v_o; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0; + __pyx_t_3 = NULL; + } else { + __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_o); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 47, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 47, __pyx_L1_error) + } + for (;;) { + if (likely(!__pyx_t_3)) { + if (likely(PyList_CheckExact(__pyx_t_1))) { + if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(1, 47, __pyx_L1_error) + #else + __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 47, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + #endif + } else { + if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(1, 47, __pyx_L1_error) + #else + __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 47, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + #endif + } + } else { + __pyx_t_4 = __pyx_t_3(__pyx_t_1); + if (unlikely(!__pyx_t_4)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); + else __PYX_ERR(1, 47, __pyx_L1_error) + } + break; + } + __Pyx_GOTREF(__pyx_t_4); + } + __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_4); + __pyx_t_4 = 0; + + /* "vector.from_py":48 + * cdef vector[X] v + * for item in o: + * v.push_back(item) # <<<<<<<<<<<<<< + * return v + * + */ + __pyx_t_5 = __pyx_convert__from_py_struct__DracoFunctions_3a__3a_PointAttributeObject(__pyx_v_item); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 48, __pyx_L1_error) + __pyx_v_v.push_back(__pyx_t_5); + + /* "vector.from_py":47 + * cdef vector[X] __pyx_convert_vector_from_py_struct__DracoFunctions_3a__3a_PointAttributeObject(object o) except *: + * cdef vector[X] v + * for item in o: # <<<<<<<<<<<<<< + * v.push_back(item) + * return v + */ + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "vector.from_py":49 + * for item in o: + * v.push_back(item) + * return v # <<<<<<<<<<<<<< + * + * + */ + __pyx_r = __pyx_v_v; + goto __pyx_L0; + + /* "vector.from_py":45 + * + * @cname("__pyx_convert_vector_from_py_struct__DracoFunctions_3a__3a_PointAttributeObject") + * cdef vector[X] __pyx_convert_vector_from_py_struct__DracoFunctions_3a__3a_PointAttributeObject(object o) except *: # <<<<<<<<<<<<<< + * cdef vector[X] v + * for item in o: + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("vector.from_py.__pyx_convert_vector_from_py_struct__DracoFunctions_3a__3a_PointAttributeObject", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_pretend_to_initialize(&__pyx_r); + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_item); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "FromPyStructUtility":11 + * + * @cname("__pyx_convert__from_py_struct__DracoFunctions_3a__3a_GeometryMetadataObject") + * cdef struct_type __pyx_convert__from_py_struct__DracoFunctions_3a__3a_GeometryMetadataObject(obj) except *: # <<<<<<<<<<<<<< + * cdef struct_type result + * if not PyMapping_Check(obj): + */ + +static struct DracoFunctions::GeometryMetadataObject __pyx_convert__from_py_struct__DracoFunctions_3a__3a_GeometryMetadataObject(PyObject *__pyx_v_obj) { + struct DracoFunctions::GeometryMetadataObject __pyx_v_result; + PyObject *__pyx_v_value = NULL; + struct DracoFunctions::GeometryMetadataObject __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_t_6; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + uint32_t __pyx_t_10; + std::vector __pyx_t_11; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__pyx_convert__from_py_struct__DracoFunctions_3a__3a_GeometryMetadataObject", 0); + + /* "FromPyStructUtility":13 + * cdef struct_type __pyx_convert__from_py_struct__DracoFunctions_3a__3a_GeometryMetadataObject(obj) except *: + * cdef struct_type result + * if not PyMapping_Check(obj): # <<<<<<<<<<<<<< + * PyErr_Format(TypeError, b"Expected %.16s, got %.200s", b"a mapping", Py_TYPE(obj).tp_name) + * + */ + __pyx_t_1 = ((!(PyMapping_Check(__pyx_v_obj) != 0)) != 0); + if (__pyx_t_1) { + + /* "FromPyStructUtility":14 + * cdef struct_type result + * if not PyMapping_Check(obj): + * PyErr_Format(TypeError, b"Expected %.16s, got %.200s", b"a mapping", Py_TYPE(obj).tp_name) # <<<<<<<<<<<<<< + * + * try: + */ + __pyx_t_2 = PyErr_Format(__pyx_builtin_TypeError, ((char const *)"Expected %.16s, got %.200s"), ((char *)"a mapping"), Py_TYPE(__pyx_v_obj)->tp_name); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 14, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "FromPyStructUtility":13 + * cdef struct_type __pyx_convert__from_py_struct__DracoFunctions_3a__3a_GeometryMetadataObject(obj) except *: + * cdef struct_type result + * if not PyMapping_Check(obj): # <<<<<<<<<<<<<< + * PyErr_Format(TypeError, b"Expected %.16s, got %.200s", b"a mapping", Py_TYPE(obj).tp_name) + * + */ + } + + /* "FromPyStructUtility":16 + * PyErr_Format(TypeError, b"Expected %.16s, got %.200s", b"a mapping", Py_TYPE(obj).tp_name) + * + * try: # <<<<<<<<<<<<<< + * value = obj['metadata_id'] + * except KeyError: + */ + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5); + __Pyx_XGOTREF(__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_4); + __Pyx_XGOTREF(__pyx_t_5); + /*try:*/ { + + /* "FromPyStructUtility":17 + * + * try: + * value = obj['metadata_id'] # <<<<<<<<<<<<<< + * except KeyError: + * raise ValueError("No value specified for struct attribute 'metadata_id'") + */ + __pyx_t_2 = __Pyx_PyObject_Dict_GetItem(__pyx_v_obj, __pyx_n_s_metadata_id); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 17, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_v_value = __pyx_t_2; + __pyx_t_2 = 0; + + /* "FromPyStructUtility":16 + * PyErr_Format(TypeError, b"Expected %.16s, got %.200s", b"a mapping", Py_TYPE(obj).tp_name) + * + * try: # <<<<<<<<<<<<<< + * value = obj['metadata_id'] + * except KeyError: + */ + } + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + goto __pyx_L9_try_end; + __pyx_L4_error:; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "FromPyStructUtility":18 + * try: + * value = obj['metadata_id'] + * except KeyError: # <<<<<<<<<<<<<< + * raise ValueError("No value specified for struct attribute 'metadata_id'") + * result.metadata_id = value + */ + __pyx_t_6 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_KeyError); + if (__pyx_t_6) { + __Pyx_AddTraceback("FromPyStructUtility.__pyx_convert__from_py_struct__DracoFunctions_3a__3a_GeometryMetadataObject", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_7, &__pyx_t_8) < 0) __PYX_ERR(1, 18, __pyx_L6_except_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GOTREF(__pyx_t_7); + __Pyx_GOTREF(__pyx_t_8); + + /* "FromPyStructUtility":19 + * value = obj['metadata_id'] + * except KeyError: + * raise ValueError("No value specified for struct attribute 'metadata_id'") # <<<<<<<<<<<<<< + * result.metadata_id = value + * try: + */ + __pyx_t_9 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__12, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 19, __pyx_L6_except_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_Raise(__pyx_t_9, 0, 0, 0); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __PYX_ERR(1, 19, __pyx_L6_except_error) + } + goto __pyx_L6_except_error; + __pyx_L6_except_error:; + + /* "FromPyStructUtility":16 + * PyErr_Format(TypeError, b"Expected %.16s, got %.200s", b"a mapping", Py_TYPE(obj).tp_name) + * + * try: # <<<<<<<<<<<<<< + * value = obj['metadata_id'] + * except KeyError: + */ + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_XGIVEREF(__pyx_t_4); + __Pyx_XGIVEREF(__pyx_t_5); + __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5); + goto __pyx_L1_error; + __pyx_L9_try_end:; + } + + /* "FromPyStructUtility":20 + * except KeyError: + * raise ValueError("No value specified for struct attribute 'metadata_id'") + * result.metadata_id = value # <<<<<<<<<<<<<< + * try: + * value = obj['generic_attributes'] + */ + __pyx_t_10 = __Pyx_PyInt_As_uint32_t(__pyx_v_value); if (unlikely((__pyx_t_10 == ((uint32_t)-1)) && PyErr_Occurred())) __PYX_ERR(1, 20, __pyx_L1_error) + __pyx_v_result.metadata_id = __pyx_t_10; + + /* "FromPyStructUtility":21 + * raise ValueError("No value specified for struct attribute 'metadata_id'") + * result.metadata_id = value + * try: # <<<<<<<<<<<<<< + * value = obj['generic_attributes'] + * except KeyError: + */ + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_5, &__pyx_t_4, &__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_5); + __Pyx_XGOTREF(__pyx_t_4); + __Pyx_XGOTREF(__pyx_t_3); + /*try:*/ { + + /* "FromPyStructUtility":22 + * result.metadata_id = value + * try: + * value = obj['generic_attributes'] # <<<<<<<<<<<<<< + * except KeyError: + * raise ValueError("No value specified for struct attribute 'generic_attributes'") + */ + __pyx_t_8 = __Pyx_PyObject_Dict_GetItem(__pyx_v_obj, __pyx_n_s_generic_attributes); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 22, __pyx_L12_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF_SET(__pyx_v_value, __pyx_t_8); + __pyx_t_8 = 0; + + /* "FromPyStructUtility":21 + * raise ValueError("No value specified for struct attribute 'metadata_id'") + * result.metadata_id = value + * try: # <<<<<<<<<<<<<< + * value = obj['generic_attributes'] + * except KeyError: + */ + } + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + goto __pyx_L17_try_end; + __pyx_L12_error:; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + + /* "FromPyStructUtility":23 + * try: + * value = obj['generic_attributes'] + * except KeyError: # <<<<<<<<<<<<<< + * raise ValueError("No value specified for struct attribute 'generic_attributes'") + * result.generic_attributes = value + */ + __pyx_t_6 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_KeyError); + if (__pyx_t_6) { + __Pyx_AddTraceback("FromPyStructUtility.__pyx_convert__from_py_struct__DracoFunctions_3a__3a_GeometryMetadataObject", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_8, &__pyx_t_7, &__pyx_t_2) < 0) __PYX_ERR(1, 23, __pyx_L14_except_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_GOTREF(__pyx_t_7); + __Pyx_GOTREF(__pyx_t_2); + + /* "FromPyStructUtility":24 + * value = obj['generic_attributes'] + * except KeyError: + * raise ValueError("No value specified for struct attribute 'generic_attributes'") # <<<<<<<<<<<<<< + * result.generic_attributes = value + * return result + */ + __pyx_t_9 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__13, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 24, __pyx_L14_except_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_Raise(__pyx_t_9, 0, 0, 0); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __PYX_ERR(1, 24, __pyx_L14_except_error) + } + goto __pyx_L14_except_error; + __pyx_L14_except_error:; + + /* "FromPyStructUtility":21 + * raise ValueError("No value specified for struct attribute 'metadata_id'") + * result.metadata_id = value + * try: # <<<<<<<<<<<<<< + * value = obj['generic_attributes'] + * except KeyError: + */ + __Pyx_XGIVEREF(__pyx_t_5); + __Pyx_XGIVEREF(__pyx_t_4); + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_4, __pyx_t_3); + goto __pyx_L1_error; + __pyx_L17_try_end:; + } + + /* "FromPyStructUtility":25 + * except KeyError: + * raise ValueError("No value specified for struct attribute 'generic_attributes'") + * result.generic_attributes = value # <<<<<<<<<<<<<< + * return result + * + */ + __pyx_t_11 = __pyx_convert_vector_from_py_struct__DracoFunctions_3a__3a_PointAttributeObject(__pyx_v_value); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 25, __pyx_L1_error) + __pyx_v_result.generic_attributes = __pyx_t_11; + + /* "FromPyStructUtility":26 + * raise ValueError("No value specified for struct attribute 'generic_attributes'") + * result.generic_attributes = value + * return result # <<<<<<<<<<<<<< + * + * + */ + __pyx_r = __pyx_v_result; + goto __pyx_L0; + + /* "FromPyStructUtility":11 + * + * @cname("__pyx_convert__from_py_struct__DracoFunctions_3a__3a_GeometryMetadataObject") + * cdef struct_type __pyx_convert__from_py_struct__DracoFunctions_3a__3a_GeometryMetadataObject(obj) except *: # <<<<<<<<<<<<<< + * cdef struct_type result + * if not PyMapping_Check(obj): + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_AddTraceback("FromPyStructUtility.__pyx_convert__from_py_struct__DracoFunctions_3a__3a_GeometryMetadataObject", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_pretend_to_initialize(&__pyx_r); + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_value); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "map.from_py":174 + * + * @cname("__pyx_convert_unordered_map_from_py_std_3a__3a_string__and_std_3a__3a_string") + * cdef map[X,Y] __pyx_convert_unordered_map_from_py_std_3a__3a_string__and_std_3a__3a_string(object o) except *: # <<<<<<<<<<<<<< + * cdef dict d = o + * cdef map[X,Y] m + */ + +static std::unordered_map __pyx_convert_unordered_map_from_py_std_3a__3a_string__and_std_3a__3a_string(PyObject *__pyx_v_o) { + PyObject *__pyx_v_d = 0; + std::unordered_map __pyx_v_m; + PyObject *__pyx_v_key = NULL; + PyObject *__pyx_v_value = NULL; + std::unordered_map __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + Py_ssize_t __pyx_t_2; + Py_ssize_t __pyx_t_3; + int __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + int __pyx_t_7; + std::string __pyx_t_8; + std::string __pyx_t_9; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__pyx_convert_unordered_map_from_py_std_3a__3a_string__and_std_3a__3a_string", 0); + + /* "map.from_py":175 + * @cname("__pyx_convert_unordered_map_from_py_std_3a__3a_string__and_std_3a__3a_string") + * cdef map[X,Y] __pyx_convert_unordered_map_from_py_std_3a__3a_string__and_std_3a__3a_string(object o) except *: + * cdef dict d = o # <<<<<<<<<<<<<< + * cdef map[X,Y] m + * for key, value in d.iteritems(): + */ + if (!(likely(PyDict_CheckExact(__pyx_v_o))||((__pyx_v_o) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "dict", Py_TYPE(__pyx_v_o)->tp_name), 0))) __PYX_ERR(1, 175, __pyx_L1_error) + __pyx_t_1 = __pyx_v_o; + __Pyx_INCREF(__pyx_t_1); + __pyx_v_d = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "map.from_py":177 + * cdef dict d = o + * cdef map[X,Y] m + * for key, value in d.iteritems(): # <<<<<<<<<<<<<< + * m.insert(pair[X,Y](key, value)) + * return m + */ + __pyx_t_2 = 0; + if (unlikely(__pyx_v_d == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "iteritems"); + __PYX_ERR(1, 177, __pyx_L1_error) + } + __pyx_t_5 = __Pyx_dict_iterator(__pyx_v_d, 1, __pyx_n_s_iteritems, (&__pyx_t_3), (&__pyx_t_4)); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 177, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_1); + __pyx_t_1 = __pyx_t_5; + __pyx_t_5 = 0; + while (1) { + __pyx_t_7 = __Pyx_dict_iter_next(__pyx_t_1, __pyx_t_3, &__pyx_t_2, &__pyx_t_5, &__pyx_t_6, NULL, __pyx_t_4); + if (unlikely(__pyx_t_7 == 0)) break; + if (unlikely(__pyx_t_7 == -1)) __PYX_ERR(1, 177, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GOTREF(__pyx_t_6); + __Pyx_XDECREF_SET(__pyx_v_key, __pyx_t_5); + __pyx_t_5 = 0; + __Pyx_XDECREF_SET(__pyx_v_value, __pyx_t_6); + __pyx_t_6 = 0; + + /* "map.from_py":178 + * cdef map[X,Y] m + * for key, value in d.iteritems(): + * m.insert(pair[X,Y](key, value)) # <<<<<<<<<<<<<< + * return m + * + */ + __pyx_t_8 = __pyx_convert_string_from_py_std__in_string(__pyx_v_key); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 178, __pyx_L1_error) + __pyx_t_9 = __pyx_convert_string_from_py_std__in_string(__pyx_v_value); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 178, __pyx_L1_error) + __pyx_v_m.insert(std::pair (((std::string)__pyx_t_8), ((std::string)__pyx_t_9))); + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "map.from_py":179 + * for key, value in d.iteritems(): + * m.insert(pair[X,Y](key, value)) + * return m # <<<<<<<<<<<<<< + * + * + */ + __pyx_r = __pyx_v_m; + goto __pyx_L0; + + /* "map.from_py":174 + * + * @cname("__pyx_convert_unordered_map_from_py_std_3a__3a_string__and_std_3a__3a_string") + * cdef map[X,Y] __pyx_convert_unordered_map_from_py_std_3a__3a_string__and_std_3a__3a_string(object o) except *: # <<<<<<<<<<<<<< + * cdef dict d = o + * cdef map[X,Y] m + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_AddTraceback("map.from_py.__pyx_convert_unordered_map_from_py_std_3a__3a_string__and_std_3a__3a_string", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_pretend_to_initialize(&__pyx_r); + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_d); + __Pyx_XDECREF(__pyx_v_key); + __Pyx_XDECREF(__pyx_v_value); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static std::unordered_map __pyx_convert_unordered_map_from_py_std_3a__3a_string__and_uint32_t(PyObject *__pyx_v_o) { + PyObject *__pyx_v_d = 0; + std::unordered_map __pyx_v_m; + PyObject *__pyx_v_key = NULL; + PyObject *__pyx_v_value = NULL; + std::unordered_map __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + Py_ssize_t __pyx_t_2; + Py_ssize_t __pyx_t_3; + int __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + int __pyx_t_7; + std::string __pyx_t_8; + uint32_t __pyx_t_9; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__pyx_convert_unordered_map_from_py_std_3a__3a_string__and_uint32_t", 0); + + /* "map.from_py":175 + * @cname("__pyx_convert_unordered_map_from_py_std_3a__3a_string__and_uint32_t") + * cdef map[X,Y] __pyx_convert_unordered_map_from_py_std_3a__3a_string__and_uint32_t(object o) except *: + * cdef dict d = o # <<<<<<<<<<<<<< + * cdef map[X,Y] m + * for key, value in d.iteritems(): + */ + if (!(likely(PyDict_CheckExact(__pyx_v_o))||((__pyx_v_o) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "dict", Py_TYPE(__pyx_v_o)->tp_name), 0))) __PYX_ERR(1, 175, __pyx_L1_error) + __pyx_t_1 = __pyx_v_o; + __Pyx_INCREF(__pyx_t_1); + __pyx_v_d = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "map.from_py":177 + * cdef dict d = o + * cdef map[X,Y] m + * for key, value in d.iteritems(): # <<<<<<<<<<<<<< + * m.insert(pair[X,Y](key, value)) + * return m + */ + __pyx_t_2 = 0; + if (unlikely(__pyx_v_d == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%.30s'", "iteritems"); + __PYX_ERR(1, 177, __pyx_L1_error) + } + __pyx_t_5 = __Pyx_dict_iterator(__pyx_v_d, 1, __pyx_n_s_iteritems, (&__pyx_t_3), (&__pyx_t_4)); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 177, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_1); + __pyx_t_1 = __pyx_t_5; + __pyx_t_5 = 0; + while (1) { + __pyx_t_7 = __Pyx_dict_iter_next(__pyx_t_1, __pyx_t_3, &__pyx_t_2, &__pyx_t_5, &__pyx_t_6, NULL, __pyx_t_4); + if (unlikely(__pyx_t_7 == 0)) break; + if (unlikely(__pyx_t_7 == -1)) __PYX_ERR(1, 177, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GOTREF(__pyx_t_6); + __Pyx_XDECREF_SET(__pyx_v_key, __pyx_t_5); + __pyx_t_5 = 0; + __Pyx_XDECREF_SET(__pyx_v_value, __pyx_t_6); + __pyx_t_6 = 0; + + /* "map.from_py":178 + * cdef map[X,Y] m + * for key, value in d.iteritems(): + * m.insert(pair[X,Y](key, value)) # <<<<<<<<<<<<<< + * return m + * + */ + __pyx_t_8 = __pyx_convert_string_from_py_std__in_string(__pyx_v_key); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 178, __pyx_L1_error) + __pyx_t_9 = __Pyx_PyInt_As_uint32_t(__pyx_v_value); if (unlikely((__pyx_t_9 == ((uint32_t)-1)) && PyErr_Occurred())) __PYX_ERR(1, 178, __pyx_L1_error) + __pyx_v_m.insert(std::pair (((std::string)__pyx_t_8), ((uint32_t)__pyx_t_9))); + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "map.from_py":179 + * for key, value in d.iteritems(): + * m.insert(pair[X,Y](key, value)) + * return m # <<<<<<<<<<<<<< + * + * + */ + __pyx_r = __pyx_v_m; + goto __pyx_L0; + + /* "map.from_py":174 + * + * @cname("__pyx_convert_unordered_map_from_py_std_3a__3a_string__and_uint32_t") + * cdef map[X,Y] __pyx_convert_unordered_map_from_py_std_3a__3a_string__and_uint32_t(object o) except *: # <<<<<<<<<<<<<< + * cdef dict d = o + * cdef map[X,Y] m + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_AddTraceback("map.from_py.__pyx_convert_unordered_map_from_py_std_3a__3a_string__and_uint32_t", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_pretend_to_initialize(&__pyx_r); + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_d); + __Pyx_XDECREF(__pyx_v_key); + __Pyx_XDECREF(__pyx_v_value); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "FromPyStructUtility":11 + * + * @cname("__pyx_convert__from_py_struct__DracoFunctions_3a__3a_MetadataObject") + * cdef struct_type __pyx_convert__from_py_struct__DracoFunctions_3a__3a_MetadataObject(obj) except *: # <<<<<<<<<<<<<< + * cdef struct_type result + * if not PyMapping_Check(obj): + */ + +static struct DracoFunctions::MetadataObject __pyx_convert__from_py_struct__DracoFunctions_3a__3a_MetadataObject(PyObject *__pyx_v_obj) { + struct DracoFunctions::MetadataObject __pyx_v_result; + PyObject *__pyx_v_value = NULL; + struct DracoFunctions::MetadataObject __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_t_6; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + std::unordered_map __pyx_t_10; + std::unordered_map __pyx_t_11; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__pyx_convert__from_py_struct__DracoFunctions_3a__3a_MetadataObject", 0); + + /* "FromPyStructUtility":13 + * cdef struct_type __pyx_convert__from_py_struct__DracoFunctions_3a__3a_MetadataObject(obj) except *: + * cdef struct_type result + * if not PyMapping_Check(obj): # <<<<<<<<<<<<<< + * PyErr_Format(TypeError, b"Expected %.16s, got %.200s", b"a mapping", Py_TYPE(obj).tp_name) + * + */ + __pyx_t_1 = ((!(PyMapping_Check(__pyx_v_obj) != 0)) != 0); + if (__pyx_t_1) { + + /* "FromPyStructUtility":14 + * cdef struct_type result + * if not PyMapping_Check(obj): + * PyErr_Format(TypeError, b"Expected %.16s, got %.200s", b"a mapping", Py_TYPE(obj).tp_name) # <<<<<<<<<<<<<< + * + * try: + */ + __pyx_t_2 = PyErr_Format(__pyx_builtin_TypeError, ((char const *)"Expected %.16s, got %.200s"), ((char *)"a mapping"), Py_TYPE(__pyx_v_obj)->tp_name); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 14, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "FromPyStructUtility":13 + * cdef struct_type __pyx_convert__from_py_struct__DracoFunctions_3a__3a_MetadataObject(obj) except *: + * cdef struct_type result + * if not PyMapping_Check(obj): # <<<<<<<<<<<<<< + * PyErr_Format(TypeError, b"Expected %.16s, got %.200s", b"a mapping", Py_TYPE(obj).tp_name) + * + */ + } + + /* "FromPyStructUtility":16 + * PyErr_Format(TypeError, b"Expected %.16s, got %.200s", b"a mapping", Py_TYPE(obj).tp_name) + * + * try: # <<<<<<<<<<<<<< + * value = obj['entries'] + * except KeyError: + */ + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5); + __Pyx_XGOTREF(__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_4); + __Pyx_XGOTREF(__pyx_t_5); + /*try:*/ { + + /* "FromPyStructUtility":17 + * + * try: + * value = obj['entries'] # <<<<<<<<<<<<<< + * except KeyError: + * raise ValueError("No value specified for struct attribute 'entries'") + */ + __pyx_t_2 = __Pyx_PyObject_Dict_GetItem(__pyx_v_obj, __pyx_n_s_entries); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 17, __pyx_L4_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_v_value = __pyx_t_2; + __pyx_t_2 = 0; + + /* "FromPyStructUtility":16 + * PyErr_Format(TypeError, b"Expected %.16s, got %.200s", b"a mapping", Py_TYPE(obj).tp_name) + * + * try: # <<<<<<<<<<<<<< + * value = obj['entries'] + * except KeyError: + */ + } + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + goto __pyx_L9_try_end; + __pyx_L4_error:; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "FromPyStructUtility":18 + * try: + * value = obj['entries'] + * except KeyError: # <<<<<<<<<<<<<< + * raise ValueError("No value specified for struct attribute 'entries'") + * result.entries = value + */ + __pyx_t_6 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_KeyError); + if (__pyx_t_6) { + __Pyx_AddTraceback("FromPyStructUtility.__pyx_convert__from_py_struct__DracoFunctions_3a__3a_MetadataObject", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_2, &__pyx_t_7, &__pyx_t_8) < 0) __PYX_ERR(1, 18, __pyx_L6_except_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GOTREF(__pyx_t_7); + __Pyx_GOTREF(__pyx_t_8); + + /* "FromPyStructUtility":19 + * value = obj['entries'] + * except KeyError: + * raise ValueError("No value specified for struct attribute 'entries'") # <<<<<<<<<<<<<< + * result.entries = value + * try: + */ + __pyx_t_9 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__14, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 19, __pyx_L6_except_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_Raise(__pyx_t_9, 0, 0, 0); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __PYX_ERR(1, 19, __pyx_L6_except_error) + } + goto __pyx_L6_except_error; + __pyx_L6_except_error:; + + /* "FromPyStructUtility":16 + * PyErr_Format(TypeError, b"Expected %.16s, got %.200s", b"a mapping", Py_TYPE(obj).tp_name) + * + * try: # <<<<<<<<<<<<<< + * value = obj['entries'] + * except KeyError: + */ + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_XGIVEREF(__pyx_t_4); + __Pyx_XGIVEREF(__pyx_t_5); + __Pyx_ExceptionReset(__pyx_t_3, __pyx_t_4, __pyx_t_5); + goto __pyx_L1_error; + __pyx_L9_try_end:; + } + + /* "FromPyStructUtility":20 + * except KeyError: + * raise ValueError("No value specified for struct attribute 'entries'") + * result.entries = value # <<<<<<<<<<<<<< + * try: + * value = obj['sub_metadata_ids'] + */ + __pyx_t_10 = __pyx_convert_unordered_map_from_py_std_3a__3a_string__and_std_3a__3a_string(__pyx_v_value); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 20, __pyx_L1_error) + __pyx_v_result.entries = __pyx_t_10; + + /* "FromPyStructUtility":21 + * raise ValueError("No value specified for struct attribute 'entries'") + * result.entries = value + * try: # <<<<<<<<<<<<<< + * value = obj['sub_metadata_ids'] + * except KeyError: + */ + { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + __Pyx_ExceptionSave(&__pyx_t_5, &__pyx_t_4, &__pyx_t_3); + __Pyx_XGOTREF(__pyx_t_5); + __Pyx_XGOTREF(__pyx_t_4); + __Pyx_XGOTREF(__pyx_t_3); + /*try:*/ { + + /* "FromPyStructUtility":22 + * result.entries = value + * try: + * value = obj['sub_metadata_ids'] # <<<<<<<<<<<<<< + * except KeyError: + * raise ValueError("No value specified for struct attribute 'sub_metadata_ids'") + */ + __pyx_t_8 = __Pyx_PyObject_Dict_GetItem(__pyx_v_obj, __pyx_n_s_sub_metadata_ids); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 22, __pyx_L12_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF_SET(__pyx_v_value, __pyx_t_8); + __pyx_t_8 = 0; + + /* "FromPyStructUtility":21 + * raise ValueError("No value specified for struct attribute 'entries'") + * result.entries = value + * try: # <<<<<<<<<<<<<< + * value = obj['sub_metadata_ids'] + * except KeyError: + */ + } + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + goto __pyx_L17_try_end; + __pyx_L12_error:; + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + + /* "FromPyStructUtility":23 + * try: + * value = obj['sub_metadata_ids'] + * except KeyError: # <<<<<<<<<<<<<< + * raise ValueError("No value specified for struct attribute 'sub_metadata_ids'") + * result.sub_metadata_ids = value + */ + __pyx_t_6 = __Pyx_PyErr_ExceptionMatches(__pyx_builtin_KeyError); + if (__pyx_t_6) { + __Pyx_AddTraceback("FromPyStructUtility.__pyx_convert__from_py_struct__DracoFunctions_3a__3a_MetadataObject", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_8, &__pyx_t_7, &__pyx_t_2) < 0) __PYX_ERR(1, 23, __pyx_L14_except_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_GOTREF(__pyx_t_7); + __Pyx_GOTREF(__pyx_t_2); + + /* "FromPyStructUtility":24 + * value = obj['sub_metadata_ids'] + * except KeyError: + * raise ValueError("No value specified for struct attribute 'sub_metadata_ids'") # <<<<<<<<<<<<<< + * result.sub_metadata_ids = value + * return result + */ + __pyx_t_9 = __Pyx_PyObject_Call(__pyx_builtin_ValueError, __pyx_tuple__15, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 24, __pyx_L14_except_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_Raise(__pyx_t_9, 0, 0, 0); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __PYX_ERR(1, 24, __pyx_L14_except_error) + } + goto __pyx_L14_except_error; + __pyx_L14_except_error:; + + /* "FromPyStructUtility":21 + * raise ValueError("No value specified for struct attribute 'entries'") + * result.entries = value + * try: # <<<<<<<<<<<<<< + * value = obj['sub_metadata_ids'] + * except KeyError: + */ + __Pyx_XGIVEREF(__pyx_t_5); + __Pyx_XGIVEREF(__pyx_t_4); + __Pyx_XGIVEREF(__pyx_t_3); + __Pyx_ExceptionReset(__pyx_t_5, __pyx_t_4, __pyx_t_3); + goto __pyx_L1_error; + __pyx_L17_try_end:; + } + + /* "FromPyStructUtility":25 + * except KeyError: + * raise ValueError("No value specified for struct attribute 'sub_metadata_ids'") + * result.sub_metadata_ids = value # <<<<<<<<<<<<<< + * return result + * + */ + __pyx_t_11 = __pyx_convert_unordered_map_from_py_std_3a__3a_string__and_uint32_t(__pyx_v_value); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 25, __pyx_L1_error) + __pyx_v_result.sub_metadata_ids = __pyx_t_11; + + /* "FromPyStructUtility":26 + * raise ValueError("No value specified for struct attribute 'sub_metadata_ids'") + * result.sub_metadata_ids = value + * return result # <<<<<<<<<<<<<< + * + * + */ + __pyx_r = __pyx_v_result; + goto __pyx_L0; + + /* "FromPyStructUtility":11 + * + * @cname("__pyx_convert__from_py_struct__DracoFunctions_3a__3a_MetadataObject") + * cdef struct_type __pyx_convert__from_py_struct__DracoFunctions_3a__3a_MetadataObject(obj) except *: # <<<<<<<<<<<<<< + * cdef struct_type result + * if not PyMapping_Check(obj): + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_AddTraceback("FromPyStructUtility.__pyx_convert__from_py_struct__DracoFunctions_3a__3a_MetadataObject", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_pretend_to_initialize(&__pyx_r); + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_value); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "vector.from_py":45 + * + * @cname("__pyx_convert_vector_from_py_double") + * cdef vector[X] __pyx_convert_vector_from_py_double(object o) except *: # <<<<<<<<<<<<<< + * cdef vector[X] v + * for item in o: + */ + +static std::vector __pyx_convert_vector_from_py_double(PyObject *__pyx_v_o) { + std::vector __pyx_v_v; + PyObject *__pyx_v_item = NULL; + std::vector __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + Py_ssize_t __pyx_t_2; + PyObject *(*__pyx_t_3)(PyObject *); + PyObject *__pyx_t_4 = NULL; + double __pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__pyx_convert_vector_from_py_double", 0); + + /* "vector.from_py":47 + * cdef vector[X] __pyx_convert_vector_from_py_double(object o) except *: + * cdef vector[X] v + * for item in o: # <<<<<<<<<<<<<< + * v.push_back(item) + * return v + */ + if (likely(PyList_CheckExact(__pyx_v_o)) || PyTuple_CheckExact(__pyx_v_o)) { + __pyx_t_1 = __pyx_v_o; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0; + __pyx_t_3 = NULL; + } else { + __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_o); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 47, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 47, __pyx_L1_error) + } + for (;;) { + if (likely(!__pyx_t_3)) { + if (likely(PyList_CheckExact(__pyx_t_1))) { + if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(1, 47, __pyx_L1_error) + #else + __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 47, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + #endif + } else { + if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(1, 47, __pyx_L1_error) + #else + __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 47, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + #endif + } + } else { + __pyx_t_4 = __pyx_t_3(__pyx_t_1); + if (unlikely(!__pyx_t_4)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); + else __PYX_ERR(1, 47, __pyx_L1_error) + } + break; + } + __Pyx_GOTREF(__pyx_t_4); + } + __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_4); + __pyx_t_4 = 0; + + /* "vector.from_py":48 + * cdef vector[X] v + * for item in o: + * v.push_back(item) # <<<<<<<<<<<<<< + * return v + * + */ + __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_v_item); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) __PYX_ERR(1, 48, __pyx_L1_error) + __pyx_v_v.push_back(((double)__pyx_t_5)); + + /* "vector.from_py":47 + * cdef vector[X] __pyx_convert_vector_from_py_double(object o) except *: + * cdef vector[X] v + * for item in o: # <<<<<<<<<<<<<< + * v.push_back(item) + * return v + */ + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "vector.from_py":49 + * for item in o: + * v.push_back(item) + * return v # <<<<<<<<<<<<<< + * + * + */ + __pyx_r = __pyx_v_v; + goto __pyx_L0; + + /* "vector.from_py":45 + * + * @cname("__pyx_convert_vector_from_py_double") + * cdef vector[X] __pyx_convert_vector_from_py_double(object o) except *: # <<<<<<<<<<<<<< + * cdef vector[X] v + * for item in o: + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("vector.from_py.__pyx_convert_vector_from_py_double", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_pretend_to_initialize(&__pyx_r); + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_item); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "string.to_py":31 + * + * @cname("__pyx_convert_PyObject_string_to_py_std__in_string") + * cdef inline object __pyx_convert_PyObject_string_to_py_std__in_string(const string& s): # <<<<<<<<<<<<<< + * return __Pyx_PyObject_FromStringAndSize(s.data(), s.size()) + * cdef extern from *: + */ + +static CYTHON_INLINE PyObject *__pyx_convert_PyObject_string_to_py_std__in_string(std::string const &__pyx_v_s) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__pyx_convert_PyObject_string_to_py_std__in_string", 0); + + /* "string.to_py":32 + * @cname("__pyx_convert_PyObject_string_to_py_std__in_string") + * cdef inline object __pyx_convert_PyObject_string_to_py_std__in_string(const string& s): + * return __Pyx_PyObject_FromStringAndSize(s.data(), s.size()) # <<<<<<<<<<<<<< + * cdef extern from *: + * cdef object __Pyx_PyUnicode_FromStringAndSize(const char*, size_t) + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyObject_FromStringAndSize(__pyx_v_s.data(), __pyx_v_s.size()); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 32, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "string.to_py":31 + * + * @cname("__pyx_convert_PyObject_string_to_py_std__in_string") + * cdef inline object __pyx_convert_PyObject_string_to_py_std__in_string(const string& s): # <<<<<<<<<<<<<< + * return __Pyx_PyObject_FromStringAndSize(s.data(), s.size()) + * cdef extern from *: + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("string.to_py.__pyx_convert_PyObject_string_to_py_std__in_string", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "string.to_py":37 + * + * @cname("__pyx_convert_PyUnicode_string_to_py_std__in_string") + * cdef inline object __pyx_convert_PyUnicode_string_to_py_std__in_string(const string& s): # <<<<<<<<<<<<<< + * return __Pyx_PyUnicode_FromStringAndSize(s.data(), s.size()) + * cdef extern from *: + */ + +static CYTHON_INLINE PyObject *__pyx_convert_PyUnicode_string_to_py_std__in_string(std::string const &__pyx_v_s) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__pyx_convert_PyUnicode_string_to_py_std__in_string", 0); + + /* "string.to_py":38 + * @cname("__pyx_convert_PyUnicode_string_to_py_std__in_string") + * cdef inline object __pyx_convert_PyUnicode_string_to_py_std__in_string(const string& s): + * return __Pyx_PyUnicode_FromStringAndSize(s.data(), s.size()) # <<<<<<<<<<<<<< + * cdef extern from *: + * cdef object __Pyx_PyStr_FromStringAndSize(const char*, size_t) + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyUnicode_FromStringAndSize(__pyx_v_s.data(), __pyx_v_s.size()); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 38, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "string.to_py":37 + * + * @cname("__pyx_convert_PyUnicode_string_to_py_std__in_string") + * cdef inline object __pyx_convert_PyUnicode_string_to_py_std__in_string(const string& s): # <<<<<<<<<<<<<< + * return __Pyx_PyUnicode_FromStringAndSize(s.data(), s.size()) + * cdef extern from *: + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("string.to_py.__pyx_convert_PyUnicode_string_to_py_std__in_string", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "string.to_py":43 + * + * @cname("__pyx_convert_PyStr_string_to_py_std__in_string") + * cdef inline object __pyx_convert_PyStr_string_to_py_std__in_string(const string& s): # <<<<<<<<<<<<<< + * return __Pyx_PyStr_FromStringAndSize(s.data(), s.size()) + * cdef extern from *: + */ + +static CYTHON_INLINE PyObject *__pyx_convert_PyStr_string_to_py_std__in_string(std::string const &__pyx_v_s) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__pyx_convert_PyStr_string_to_py_std__in_string", 0); + + /* "string.to_py":44 + * @cname("__pyx_convert_PyStr_string_to_py_std__in_string") + * cdef inline object __pyx_convert_PyStr_string_to_py_std__in_string(const string& s): + * return __Pyx_PyStr_FromStringAndSize(s.data(), s.size()) # <<<<<<<<<<<<<< + * cdef extern from *: + * cdef object __Pyx_PyBytes_FromStringAndSize(const char*, size_t) + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyStr_FromStringAndSize(__pyx_v_s.data(), __pyx_v_s.size()); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 44, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "string.to_py":43 + * + * @cname("__pyx_convert_PyStr_string_to_py_std__in_string") + * cdef inline object __pyx_convert_PyStr_string_to_py_std__in_string(const string& s): # <<<<<<<<<<<<<< + * return __Pyx_PyStr_FromStringAndSize(s.data(), s.size()) + * cdef extern from *: + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("string.to_py.__pyx_convert_PyStr_string_to_py_std__in_string", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "string.to_py":49 + * + * @cname("__pyx_convert_PyBytes_string_to_py_std__in_string") + * cdef inline object __pyx_convert_PyBytes_string_to_py_std__in_string(const string& s): # <<<<<<<<<<<<<< + * return __Pyx_PyBytes_FromStringAndSize(s.data(), s.size()) + * cdef extern from *: + */ + +static CYTHON_INLINE PyObject *__pyx_convert_PyBytes_string_to_py_std__in_string(std::string const &__pyx_v_s) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__pyx_convert_PyBytes_string_to_py_std__in_string", 0); + + /* "string.to_py":50 + * @cname("__pyx_convert_PyBytes_string_to_py_std__in_string") + * cdef inline object __pyx_convert_PyBytes_string_to_py_std__in_string(const string& s): + * return __Pyx_PyBytes_FromStringAndSize(s.data(), s.size()) # <<<<<<<<<<<<<< + * cdef extern from *: + * cdef object __Pyx_PyByteArray_FromStringAndSize(const char*, size_t) + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyBytes_FromStringAndSize(__pyx_v_s.data(), __pyx_v_s.size()); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 50, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "string.to_py":49 + * + * @cname("__pyx_convert_PyBytes_string_to_py_std__in_string") + * cdef inline object __pyx_convert_PyBytes_string_to_py_std__in_string(const string& s): # <<<<<<<<<<<<<< + * return __Pyx_PyBytes_FromStringAndSize(s.data(), s.size()) + * cdef extern from *: + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("string.to_py.__pyx_convert_PyBytes_string_to_py_std__in_string", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "string.to_py":55 + * + * @cname("__pyx_convert_PyByteArray_string_to_py_std__in_string") + * cdef inline object __pyx_convert_PyByteArray_string_to_py_std__in_string(const string& s): # <<<<<<<<<<<<<< + * return __Pyx_PyByteArray_FromStringAndSize(s.data(), s.size()) + * + */ + +static CYTHON_INLINE PyObject *__pyx_convert_PyByteArray_string_to_py_std__in_string(std::string const &__pyx_v_s) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__pyx_convert_PyByteArray_string_to_py_std__in_string", 0); + + /* "string.to_py":56 + * @cname("__pyx_convert_PyByteArray_string_to_py_std__in_string") + * cdef inline object __pyx_convert_PyByteArray_string_to_py_std__in_string(const string& s): + * return __Pyx_PyByteArray_FromStringAndSize(s.data(), s.size()) # <<<<<<<<<<<<<< + * + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyByteArray_FromStringAndSize(__pyx_v_s.data(), __pyx_v_s.size()); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 56, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "string.to_py":55 + * + * @cname("__pyx_convert_PyByteArray_string_to_py_std__in_string") + * cdef inline object __pyx_convert_PyByteArray_string_to_py_std__in_string(const string& s): # <<<<<<<<<<<<<< + * return __Pyx_PyByteArray_FromStringAndSize(s.data(), s.size()) + * + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("string.to_py.__pyx_convert_PyByteArray_string_to_py_std__in_string", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "map.to_py":201 + * + * @cname("__pyx_convert_unordered_map_to_py_std_3a__3a_string____std_3a__3a_string") + * cdef object __pyx_convert_unordered_map_to_py_std_3a__3a_string____std_3a__3a_string(const map[X,Y]& s): # <<<<<<<<<<<<<< + * o = {} + * cdef const map[X,Y].value_type *key_value + */ + +static PyObject *__pyx_convert_unordered_map_to_py_std_3a__3a_string____std_3a__3a_string(std::unordered_map const &__pyx_v_s) { + PyObject *__pyx_v_o = NULL; + std::unordered_map ::value_type const *__pyx_v_key_value; + std::unordered_map ::const_iterator __pyx_v_iter; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__pyx_convert_unordered_map_to_py_std_3a__3a_string____std_3a__3a_string", 0); + + /* "map.to_py":202 + * @cname("__pyx_convert_unordered_map_to_py_std_3a__3a_string____std_3a__3a_string") + * cdef object __pyx_convert_unordered_map_to_py_std_3a__3a_string____std_3a__3a_string(const map[X,Y]& s): + * o = {} # <<<<<<<<<<<<<< + * cdef const map[X,Y].value_type *key_value + * cdef map[X,Y].const_iterator iter = s.begin() + */ + __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 202, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_o = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "map.to_py":204 + * o = {} + * cdef const map[X,Y].value_type *key_value + * cdef map[X,Y].const_iterator iter = s.begin() # <<<<<<<<<<<<<< + * while iter != s.end(): + * key_value = &cython.operator.dereference(iter) + */ + __pyx_v_iter = __pyx_v_s.begin(); + + /* "map.to_py":205 + * cdef const map[X,Y].value_type *key_value + * cdef map[X,Y].const_iterator iter = s.begin() + * while iter != s.end(): # <<<<<<<<<<<<<< + * key_value = &cython.operator.dereference(iter) + * o[key_value.first] = key_value.second + */ + while (1) { + __pyx_t_2 = ((__pyx_v_iter != __pyx_v_s.end()) != 0); + if (!__pyx_t_2) break; + + /* "map.to_py":206 + * cdef map[X,Y].const_iterator iter = s.begin() + * while iter != s.end(): + * key_value = &cython.operator.dereference(iter) # <<<<<<<<<<<<<< + * o[key_value.first] = key_value.second + * cython.operator.preincrement(iter) + */ + __pyx_v_key_value = (&(*__pyx_v_iter)); + + /* "map.to_py":207 + * while iter != s.end(): + * key_value = &cython.operator.dereference(iter) + * o[key_value.first] = key_value.second # <<<<<<<<<<<<<< + * cython.operator.preincrement(iter) + * return o + */ + __pyx_t_1 = __pyx_convert_PyBytes_string_to_py_std__in_string(__pyx_v_key_value->second); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 207, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __pyx_convert_PyBytes_string_to_py_std__in_string(__pyx_v_key_value->first); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 207, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (unlikely(PyDict_SetItem(__pyx_v_o, __pyx_t_3, __pyx_t_1) < 0)) __PYX_ERR(1, 207, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "map.to_py":208 + * key_value = &cython.operator.dereference(iter) + * o[key_value.first] = key_value.second + * cython.operator.preincrement(iter) # <<<<<<<<<<<<<< + * return o + * + */ + (void)((++__pyx_v_iter)); + } + + /* "map.to_py":209 + * o[key_value.first] = key_value.second + * cython.operator.preincrement(iter) + * return o # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_o); + __pyx_r = __pyx_v_o; + goto __pyx_L0; + + /* "map.to_py":201 + * + * @cname("__pyx_convert_unordered_map_to_py_std_3a__3a_string____std_3a__3a_string") + * cdef object __pyx_convert_unordered_map_to_py_std_3a__3a_string____std_3a__3a_string(const map[X,Y]& s): # <<<<<<<<<<<<<< + * o = {} + * cdef const map[X,Y].value_type *key_value + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("map.to_py.__pyx_convert_unordered_map_to_py_std_3a__3a_string____std_3a__3a_string", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_o); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_convert_unordered_map_to_py_std_3a__3a_string____uint32_t(std::unordered_map const &__pyx_v_s) { + PyObject *__pyx_v_o = NULL; + std::unordered_map ::value_type const *__pyx_v_key_value; + std::unordered_map ::const_iterator __pyx_v_iter; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__pyx_convert_unordered_map_to_py_std_3a__3a_string____uint32_t", 0); + + /* "map.to_py":202 + * @cname("__pyx_convert_unordered_map_to_py_std_3a__3a_string____uint32_t") + * cdef object __pyx_convert_unordered_map_to_py_std_3a__3a_string____uint32_t(const map[X,Y]& s): + * o = {} # <<<<<<<<<<<<<< + * cdef const map[X,Y].value_type *key_value + * cdef map[X,Y].const_iterator iter = s.begin() + */ + __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 202, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_o = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "map.to_py":204 + * o = {} + * cdef const map[X,Y].value_type *key_value + * cdef map[X,Y].const_iterator iter = s.begin() # <<<<<<<<<<<<<< + * while iter != s.end(): + * key_value = &cython.operator.dereference(iter) + */ + __pyx_v_iter = __pyx_v_s.begin(); + + /* "map.to_py":205 + * cdef const map[X,Y].value_type *key_value + * cdef map[X,Y].const_iterator iter = s.begin() + * while iter != s.end(): # <<<<<<<<<<<<<< + * key_value = &cython.operator.dereference(iter) + * o[key_value.first] = key_value.second + */ + while (1) { + __pyx_t_2 = ((__pyx_v_iter != __pyx_v_s.end()) != 0); + if (!__pyx_t_2) break; + + /* "map.to_py":206 + * cdef map[X,Y].const_iterator iter = s.begin() + * while iter != s.end(): + * key_value = &cython.operator.dereference(iter) # <<<<<<<<<<<<<< + * o[key_value.first] = key_value.second + * cython.operator.preincrement(iter) + */ + __pyx_v_key_value = (&(*__pyx_v_iter)); + + /* "map.to_py":207 + * while iter != s.end(): + * key_value = &cython.operator.dereference(iter) + * o[key_value.first] = key_value.second # <<<<<<<<<<<<<< + * cython.operator.preincrement(iter) + * return o + */ + __pyx_t_1 = __Pyx_PyInt_From_uint32_t(__pyx_v_key_value->second); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 207, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __pyx_convert_PyBytes_string_to_py_std__in_string(__pyx_v_key_value->first); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 207, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (unlikely(PyDict_SetItem(__pyx_v_o, __pyx_t_3, __pyx_t_1) < 0)) __PYX_ERR(1, 207, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "map.to_py":208 + * key_value = &cython.operator.dereference(iter) + * o[key_value.first] = key_value.second + * cython.operator.preincrement(iter) # <<<<<<<<<<<<<< + * return o + * + */ + (void)((++__pyx_v_iter)); + } + + /* "map.to_py":209 + * o[key_value.first] = key_value.second + * cython.operator.preincrement(iter) + * return o # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_o); + __pyx_r = __pyx_v_o; + goto __pyx_L0; + + /* "map.to_py":201 + * + * @cname("__pyx_convert_unordered_map_to_py_std_3a__3a_string____uint32_t") + * cdef object __pyx_convert_unordered_map_to_py_std_3a__3a_string____uint32_t(const map[X,Y]& s): # <<<<<<<<<<<<<< + * o = {} + * cdef const map[X,Y].value_type *key_value + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("map.to_py.__pyx_convert_unordered_map_to_py_std_3a__3a_string____uint32_t", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_o); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "vector.to_py":60 + * + * @cname("__pyx_convert_vector_to_py_struct__DracoFunctions_3a__3a_MetadataObject") + * cdef object __pyx_convert_vector_to_py_struct__DracoFunctions_3a__3a_MetadataObject(vector[X]& v): # <<<<<<<<<<<<<< + * return [v[i] for i in range(v.size())] + * + */ + +static PyObject *__pyx_convert_vector_to_py_struct__DracoFunctions_3a__3a_MetadataObject(const std::vector &__pyx_v_v) { + size_t __pyx_v_i; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + size_t __pyx_t_2; + size_t __pyx_t_3; + size_t __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__pyx_convert_vector_to_py_struct__DracoFunctions_3a__3a_MetadataObject", 0); + + /* "vector.to_py":61 + * @cname("__pyx_convert_vector_to_py_struct__DracoFunctions_3a__3a_MetadataObject") + * cdef object __pyx_convert_vector_to_py_struct__DracoFunctions_3a__3a_MetadataObject(vector[X]& v): + * return [v[i] for i in range(v.size())] # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 61, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __pyx_v_v.size(); + __pyx_t_3 = __pyx_t_2; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { + __pyx_v_i = __pyx_t_4; + __pyx_t_5 = __pyx_convert__to_py_struct__DracoFunctions_3a__3a_MetadataObject((__pyx_v_v[__pyx_v_i])); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 61, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_5))) __PYX_ERR(1, 61, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "vector.to_py":60 + * + * @cname("__pyx_convert_vector_to_py_struct__DracoFunctions_3a__3a_MetadataObject") + * cdef object __pyx_convert_vector_to_py_struct__DracoFunctions_3a__3a_MetadataObject(vector[X]& v): # <<<<<<<<<<<<<< + * return [v[i] for i in range(v.size())] + * + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("vector.to_py.__pyx_convert_vector_to_py_struct__DracoFunctions_3a__3a_MetadataObject", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "map.to_py":201 + * + * @cname("__pyx_convert_unordered_map_to_py_uint32_t____std_3a__3a_string") + * cdef object __pyx_convert_unordered_map_to_py_uint32_t____std_3a__3a_string(const map[X,Y]& s): # <<<<<<<<<<<<<< + * o = {} + * cdef const map[X,Y].value_type *key_value + */ + +static PyObject *__pyx_convert_unordered_map_to_py_uint32_t____std_3a__3a_string(std::unordered_map const &__pyx_v_s) { + PyObject *__pyx_v_o = NULL; + std::unordered_map ::value_type const *__pyx_v_key_value; + std::unordered_map ::const_iterator __pyx_v_iter; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__pyx_convert_unordered_map_to_py_uint32_t____std_3a__3a_string", 0); + + /* "map.to_py":202 + * @cname("__pyx_convert_unordered_map_to_py_uint32_t____std_3a__3a_string") + * cdef object __pyx_convert_unordered_map_to_py_uint32_t____std_3a__3a_string(const map[X,Y]& s): + * o = {} # <<<<<<<<<<<<<< + * cdef const map[X,Y].value_type *key_value + * cdef map[X,Y].const_iterator iter = s.begin() + */ + __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 202, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_o = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "map.to_py":204 + * o = {} + * cdef const map[X,Y].value_type *key_value + * cdef map[X,Y].const_iterator iter = s.begin() # <<<<<<<<<<<<<< + * while iter != s.end(): + * key_value = &cython.operator.dereference(iter) + */ + __pyx_v_iter = __pyx_v_s.begin(); + + /* "map.to_py":205 + * cdef const map[X,Y].value_type *key_value + * cdef map[X,Y].const_iterator iter = s.begin() + * while iter != s.end(): # <<<<<<<<<<<<<< + * key_value = &cython.operator.dereference(iter) + * o[key_value.first] = key_value.second + */ + while (1) { + __pyx_t_2 = ((__pyx_v_iter != __pyx_v_s.end()) != 0); + if (!__pyx_t_2) break; + + /* "map.to_py":206 + * cdef map[X,Y].const_iterator iter = s.begin() + * while iter != s.end(): + * key_value = &cython.operator.dereference(iter) # <<<<<<<<<<<<<< + * o[key_value.first] = key_value.second + * cython.operator.preincrement(iter) + */ + __pyx_v_key_value = (&(*__pyx_v_iter)); + + /* "map.to_py":207 + * while iter != s.end(): + * key_value = &cython.operator.dereference(iter) + * o[key_value.first] = key_value.second # <<<<<<<<<<<<<< + * cython.operator.preincrement(iter) + * return o + */ + __pyx_t_1 = __pyx_convert_PyBytes_string_to_py_std__in_string(__pyx_v_key_value->second); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 207, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_PyInt_From_uint32_t(__pyx_v_key_value->first); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 207, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (unlikely(PyDict_SetItem(__pyx_v_o, __pyx_t_3, __pyx_t_1) < 0)) __PYX_ERR(1, 207, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "map.to_py":208 + * key_value = &cython.operator.dereference(iter) + * o[key_value.first] = key_value.second + * cython.operator.preincrement(iter) # <<<<<<<<<<<<<< + * return o + * + */ + (void)((++__pyx_v_iter)); + } + + /* "map.to_py":209 + * o[key_value.first] = key_value.second + * cython.operator.preincrement(iter) + * return o # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_o); + __pyx_r = __pyx_v_o; + goto __pyx_L0; + + /* "map.to_py":201 + * + * @cname("__pyx_convert_unordered_map_to_py_uint32_t____std_3a__3a_string") + * cdef object __pyx_convert_unordered_map_to_py_uint32_t____std_3a__3a_string(const map[X,Y]& s): # <<<<<<<<<<<<<< + * o = {} + * cdef const map[X,Y].value_type *key_value + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("map.to_py.__pyx_convert_unordered_map_to_py_uint32_t____std_3a__3a_string", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_o); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "vector.to_py":60 + * + * @cname("__pyx_convert_vector_to_py_struct__DracoFunctions_3a__3a_PointAttributeObject") + * cdef object __pyx_convert_vector_to_py_struct__DracoFunctions_3a__3a_PointAttributeObject(vector[X]& v): # <<<<<<<<<<<<<< + * return [v[i] for i in range(v.size())] + * + */ + +static PyObject *__pyx_convert_vector_to_py_struct__DracoFunctions_3a__3a_PointAttributeObject(const std::vector &__pyx_v_v) { + size_t __pyx_v_i; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + size_t __pyx_t_2; + size_t __pyx_t_3; + size_t __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__pyx_convert_vector_to_py_struct__DracoFunctions_3a__3a_PointAttributeObject", 0); + + /* "vector.to_py":61 + * @cname("__pyx_convert_vector_to_py_struct__DracoFunctions_3a__3a_PointAttributeObject") + * cdef object __pyx_convert_vector_to_py_struct__DracoFunctions_3a__3a_PointAttributeObject(vector[X]& v): + * return [v[i] for i in range(v.size())] # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 61, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __pyx_v_v.size(); + __pyx_t_3 = __pyx_t_2; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { + __pyx_v_i = __pyx_t_4; + __pyx_t_5 = __pyx_convert__to_py_struct__DracoFunctions_3a__3a_PointAttributeObject((__pyx_v_v[__pyx_v_i])); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 61, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_5))) __PYX_ERR(1, 61, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "vector.to_py":60 + * + * @cname("__pyx_convert_vector_to_py_struct__DracoFunctions_3a__3a_PointAttributeObject") + * cdef object __pyx_convert_vector_to_py_struct__DracoFunctions_3a__3a_PointAttributeObject(vector[X]& v): # <<<<<<<<<<<<<< + * return [v[i] for i in range(v.size())] + * + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("vector.to_py.__pyx_convert_vector_to_py_struct__DracoFunctions_3a__3a_PointAttributeObject", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "vector.from_py":45 + * + * @cname("__pyx_convert_vector_from_py_uint32_t") + * cdef vector[X] __pyx_convert_vector_from_py_uint32_t(object o) except *: # <<<<<<<<<<<<<< + * cdef vector[X] v + * for item in o: + */ + +static std::vector __pyx_convert_vector_from_py_uint32_t(PyObject *__pyx_v_o) { + std::vector __pyx_v_v; + PyObject *__pyx_v_item = NULL; + std::vector __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + Py_ssize_t __pyx_t_2; + PyObject *(*__pyx_t_3)(PyObject *); + PyObject *__pyx_t_4 = NULL; + uint32_t __pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__pyx_convert_vector_from_py_uint32_t", 0); + + /* "vector.from_py":47 + * cdef vector[X] __pyx_convert_vector_from_py_uint32_t(object o) except *: + * cdef vector[X] v + * for item in o: # <<<<<<<<<<<<<< + * v.push_back(item) + * return v + */ + if (likely(PyList_CheckExact(__pyx_v_o)) || PyTuple_CheckExact(__pyx_v_o)) { + __pyx_t_1 = __pyx_v_o; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0; + __pyx_t_3 = NULL; + } else { + __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_o); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 47, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 47, __pyx_L1_error) + } + for (;;) { + if (likely(!__pyx_t_3)) { + if (likely(PyList_CheckExact(__pyx_t_1))) { + if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(1, 47, __pyx_L1_error) + #else + __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 47, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + #endif + } else { + if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(1, 47, __pyx_L1_error) + #else + __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 47, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + #endif + } + } else { + __pyx_t_4 = __pyx_t_3(__pyx_t_1); + if (unlikely(!__pyx_t_4)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); + else __PYX_ERR(1, 47, __pyx_L1_error) + } + break; + } + __Pyx_GOTREF(__pyx_t_4); + } + __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_4); + __pyx_t_4 = 0; + + /* "vector.from_py":48 + * cdef vector[X] v + * for item in o: + * v.push_back(item) # <<<<<<<<<<<<<< + * return v + * + */ + __pyx_t_5 = __Pyx_PyInt_As_uint32_t(__pyx_v_item); if (unlikely((__pyx_t_5 == ((uint32_t)-1)) && PyErr_Occurred())) __PYX_ERR(1, 48, __pyx_L1_error) + __pyx_v_v.push_back(((uint32_t)__pyx_t_5)); + + /* "vector.from_py":47 + * cdef vector[X] __pyx_convert_vector_from_py_uint32_t(object o) except *: + * cdef vector[X] v + * for item in o: # <<<<<<<<<<<<<< + * v.push_back(item) + * return v + */ + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "vector.from_py":49 + * for item in o: + * v.push_back(item) + * return v # <<<<<<<<<<<<<< + * + * + */ + __pyx_r = __pyx_v_v; + goto __pyx_L0; + + /* "vector.from_py":45 + * + * @cname("__pyx_convert_vector_from_py_uint32_t") + * cdef vector[X] __pyx_convert_vector_from_py_uint32_t(object o) except *: # <<<<<<<<<<<<<< + * cdef vector[X] v + * for item in o: + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("vector.from_py.__pyx_convert_vector_from_py_uint32_t", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_pretend_to_initialize(&__pyx_r); + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_item); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static std::vector __pyx_convert_vector_from_py_struct__DracoFunctions_3a__3a_MetadataObject(PyObject *__pyx_v_o) { + std::vector __pyx_v_v; + PyObject *__pyx_v_item = NULL; + std::vector __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + Py_ssize_t __pyx_t_2; + PyObject *(*__pyx_t_3)(PyObject *); + PyObject *__pyx_t_4 = NULL; + struct DracoFunctions::MetadataObject __pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__pyx_convert_vector_from_py_struct__DracoFunctions_3a__3a_MetadataObject", 0); + + /* "vector.from_py":47 + * cdef vector[X] __pyx_convert_vector_from_py_struct__DracoFunctions_3a__3a_MetadataObject(object o) except *: + * cdef vector[X] v + * for item in o: # <<<<<<<<<<<<<< + * v.push_back(item) + * return v + */ + if (likely(PyList_CheckExact(__pyx_v_o)) || PyTuple_CheckExact(__pyx_v_o)) { + __pyx_t_1 = __pyx_v_o; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0; + __pyx_t_3 = NULL; + } else { + __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_o); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 47, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 47, __pyx_L1_error) + } + for (;;) { + if (likely(!__pyx_t_3)) { + if (likely(PyList_CheckExact(__pyx_t_1))) { + if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(1, 47, __pyx_L1_error) + #else + __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 47, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + #endif + } else { + if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(1, 47, __pyx_L1_error) + #else + __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 47, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + #endif + } + } else { + __pyx_t_4 = __pyx_t_3(__pyx_t_1); + if (unlikely(!__pyx_t_4)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); + else __PYX_ERR(1, 47, __pyx_L1_error) + } + break; + } + __Pyx_GOTREF(__pyx_t_4); + } + __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_4); + __pyx_t_4 = 0; + + /* "vector.from_py":48 + * cdef vector[X] v + * for item in o: + * v.push_back(item) # <<<<<<<<<<<<<< + * return v + * + */ + __pyx_t_5 = __pyx_convert__from_py_struct__DracoFunctions_3a__3a_MetadataObject(__pyx_v_item); if (unlikely(PyErr_Occurred())) __PYX_ERR(1, 48, __pyx_L1_error) + __pyx_v_v.push_back(__pyx_t_5); + + /* "vector.from_py":47 + * cdef vector[X] __pyx_convert_vector_from_py_struct__DracoFunctions_3a__3a_MetadataObject(object o) except *: + * cdef vector[X] v + * for item in o: # <<<<<<<<<<<<<< + * v.push_back(item) + * return v + */ + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "vector.from_py":49 + * for item in o: + * v.push_back(item) + * return v # <<<<<<<<<<<<<< + * + * + */ + __pyx_r = __pyx_v_v; + goto __pyx_L0; + + /* "vector.from_py":45 + * + * @cname("__pyx_convert_vector_from_py_struct__DracoFunctions_3a__3a_MetadataObject") + * cdef vector[X] __pyx_convert_vector_from_py_struct__DracoFunctions_3a__3a_MetadataObject(object o) except *: # <<<<<<<<<<<<<< + * cdef vector[X] v + * for item in o: + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("vector.from_py.__pyx_convert_vector_from_py_struct__DracoFunctions_3a__3a_MetadataObject", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_pretend_to_initialize(&__pyx_r); + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_item); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "vector.to_py":60 + * + * @cname("__pyx_convert_vector_to_py_unsigned_char") + * cdef object __pyx_convert_vector_to_py_unsigned_char(vector[X]& v): # <<<<<<<<<<<<<< + * return [v[i] for i in range(v.size())] + * + */ + +static PyObject *__pyx_convert_vector_to_py_unsigned_char(const std::vector &__pyx_v_v) { + size_t __pyx_v_i; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + size_t __pyx_t_2; + size_t __pyx_t_3; + size_t __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__pyx_convert_vector_to_py_unsigned_char", 0); + + /* "vector.to_py":61 + * @cname("__pyx_convert_vector_to_py_unsigned_char") + * cdef object __pyx_convert_vector_to_py_unsigned_char(vector[X]& v): + * return [v[i] for i in range(v.size())] # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 61, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __pyx_v_v.size(); + __pyx_t_3 = __pyx_t_2; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { + __pyx_v_i = __pyx_t_4; + __pyx_t_5 = __Pyx_PyInt_From_unsigned_char((__pyx_v_v[__pyx_v_i])); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 61, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_5))) __PYX_ERR(1, 61, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "vector.to_py":60 + * + * @cname("__pyx_convert_vector_to_py_unsigned_char") + * cdef object __pyx_convert_vector_to_py_unsigned_char(vector[X]& v): # <<<<<<<<<<<<<< + * return [v[i] for i in range(v.size())] + * + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("vector.to_py.__pyx_convert_vector_to_py_unsigned_char", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_convert_vector_to_py_float(const std::vector &__pyx_v_v) { + size_t __pyx_v_i; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + size_t __pyx_t_2; + size_t __pyx_t_3; + size_t __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__pyx_convert_vector_to_py_float", 0); + + /* "vector.to_py":61 + * @cname("__pyx_convert_vector_to_py_float") + * cdef object __pyx_convert_vector_to_py_float(vector[X]& v): + * return [v[i] for i in range(v.size())] # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 61, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __pyx_v_v.size(); + __pyx_t_3 = __pyx_t_2; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { + __pyx_v_i = __pyx_t_4; + __pyx_t_5 = PyFloat_FromDouble((__pyx_v_v[__pyx_v_i])); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 61, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_5))) __PYX_ERR(1, 61, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "vector.to_py":60 + * + * @cname("__pyx_convert_vector_to_py_float") + * cdef object __pyx_convert_vector_to_py_float(vector[X]& v): # <<<<<<<<<<<<<< + * return [v[i] for i in range(v.size())] + * + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("vector.to_py.__pyx_convert_vector_to_py_float", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_convert_vector_to_py_unsigned_int(const std::vector &__pyx_v_v) { + size_t __pyx_v_i; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + size_t __pyx_t_2; + size_t __pyx_t_3; + size_t __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__pyx_convert_vector_to_py_unsigned_int", 0); + + /* "vector.to_py":61 + * @cname("__pyx_convert_vector_to_py_unsigned_int") + * cdef object __pyx_convert_vector_to_py_unsigned_int(vector[X]& v): + * return [v[i] for i in range(v.size())] # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 61, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __pyx_v_v.size(); + __pyx_t_3 = __pyx_t_2; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { + __pyx_v_i = __pyx_t_4; + __pyx_t_5 = __Pyx_PyInt_From_unsigned_int((__pyx_v_v[__pyx_v_i])); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 61, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_5))) __PYX_ERR(1, 61, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "vector.to_py":60 + * + * @cname("__pyx_convert_vector_to_py_unsigned_int") + * cdef object __pyx_convert_vector_to_py_unsigned_int(vector[X]& v): # <<<<<<<<<<<<<< + * return [v[i] for i in range(v.size())] + * + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("vector.to_py.__pyx_convert_vector_to_py_unsigned_int", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "EnumBase":16 + * @cython.internal + * cdef class __Pyx_EnumMeta(type): + * def __init__(cls, name, parents, dct): # <<<<<<<<<<<<<< + * type.__init__(cls, name, parents, dct) + * cls.__members__ = __Pyx_OrderedDict() + */ + +/* Python wrapper */ +static int __pyx_pw_8EnumBase_14__Pyx_EnumMeta_1__init__(PyObject *__pyx_v_cls, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_8EnumBase_14__Pyx_EnumMeta_1__init__(PyObject *__pyx_v_cls, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_name = 0; + PyObject *__pyx_v_parents = 0; + PyObject *__pyx_v_dct = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_name,&__pyx_n_s_parents,&__pyx_n_s_dct,0}; + PyObject* values[3] = {0,0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_name)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_parents)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, 1); __PYX_ERR(1, 16, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_dct)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, 2); __PYX_ERR(1, 16, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(1, 16, __pyx_L3_error) + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + } + __pyx_v_name = values[0]; + __pyx_v_parents = values[1]; + __pyx_v_dct = values[2]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 16, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("EnumBase.__Pyx_EnumMeta.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_8EnumBase_14__Pyx_EnumMeta___init__(((struct __pyx_obj___Pyx_EnumMeta *)__pyx_v_cls), __pyx_v_name, __pyx_v_parents, __pyx_v_dct); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_8EnumBase_14__Pyx_EnumMeta___init__(struct __pyx_obj___Pyx_EnumMeta *__pyx_v_cls, PyObject *__pyx_v_name, PyObject *__pyx_v_parents, PyObject *__pyx_v_dct) { + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__init__", 0); + + /* "EnumBase":17 + * cdef class __Pyx_EnumMeta(type): + * def __init__(cls, name, parents, dct): + * type.__init__(cls, name, parents, dct) # <<<<<<<<<<<<<< + * cls.__members__ = __Pyx_OrderedDict() + * def __iter__(cls): + */ + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)(&PyType_Type)), __pyx_n_s_init); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 17, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = NULL; + __pyx_t_4 = 0; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_3)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + __pyx_t_4 = 1; + } + } + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_2)) { + PyObject *__pyx_temp[5] = {__pyx_t_3, ((PyObject *)__pyx_v_cls), __pyx_v_name, __pyx_v_parents, __pyx_v_dct}; + __pyx_t_1 = __Pyx_PyFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 4+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 17, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_GOTREF(__pyx_t_1); + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_2)) { + PyObject *__pyx_temp[5] = {__pyx_t_3, ((PyObject *)__pyx_v_cls), __pyx_v_name, __pyx_v_parents, __pyx_v_dct}; + __pyx_t_1 = __Pyx_PyCFunction_FastCall(__pyx_t_2, __pyx_temp+1-__pyx_t_4, 4+__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 17, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_GOTREF(__pyx_t_1); + } else + #endif + { + __pyx_t_5 = PyTuple_New(4+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 17, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + if (__pyx_t_3) { + __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL; + } + __Pyx_INCREF(((PyObject *)__pyx_v_cls)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_cls)); + PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, ((PyObject *)__pyx_v_cls)); + __Pyx_INCREF(__pyx_v_name); + __Pyx_GIVEREF(__pyx_v_name); + PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, __pyx_v_name); + __Pyx_INCREF(__pyx_v_parents); + __Pyx_GIVEREF(__pyx_v_parents); + PyTuple_SET_ITEM(__pyx_t_5, 2+__pyx_t_4, __pyx_v_parents); + __Pyx_INCREF(__pyx_v_dct); + __Pyx_GIVEREF(__pyx_v_dct); + PyTuple_SET_ITEM(__pyx_t_5, 3+__pyx_t_4, __pyx_v_dct); + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 17, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "EnumBase":18 + * def __init__(cls, name, parents, dct): + * type.__init__(cls, name, parents, dct) + * cls.__members__ = __Pyx_OrderedDict() # <<<<<<<<<<<<<< + * def __iter__(cls): + * return iter(cls.__members__.values()) + */ + __Pyx_INCREF(__Pyx_OrderedDict); + __pyx_t_2 = __Pyx_OrderedDict; __pyx_t_5 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + } + } + __pyx_t_1 = (__pyx_t_5) ? __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_5) : __Pyx_PyObject_CallNoArg(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 18, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (__Pyx_PyObject_SetAttrStr(((PyObject *)__pyx_v_cls), __pyx_n_s_members, __pyx_t_1) < 0) __PYX_ERR(1, 18, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "EnumBase":16 + * @cython.internal + * cdef class __Pyx_EnumMeta(type): + * def __init__(cls, name, parents, dct): # <<<<<<<<<<<<<< + * type.__init__(cls, name, parents, dct) + * cls.__members__ = __Pyx_OrderedDict() + */ + + /* function exit code */ + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("EnumBase.__Pyx_EnumMeta.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "EnumBase":19 + * type.__init__(cls, name, parents, dct) + * cls.__members__ = __Pyx_OrderedDict() + * def __iter__(cls): # <<<<<<<<<<<<<< + * return iter(cls.__members__.values()) + * def __getitem__(cls, name): + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_8EnumBase_14__Pyx_EnumMeta_3__iter__(PyObject *__pyx_v_cls); /*proto*/ +static PyObject *__pyx_pw_8EnumBase_14__Pyx_EnumMeta_3__iter__(PyObject *__pyx_v_cls) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0); + __pyx_r = __pyx_pf_8EnumBase_14__Pyx_EnumMeta_2__iter__(((struct __pyx_obj___Pyx_EnumMeta *)__pyx_v_cls)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_8EnumBase_14__Pyx_EnumMeta_2__iter__(struct __pyx_obj___Pyx_EnumMeta *__pyx_v_cls) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__iter__", 0); + + /* "EnumBase":20 + * cls.__members__ = __Pyx_OrderedDict() + * def __iter__(cls): + * return iter(cls.__members__.values()) # <<<<<<<<<<<<<< + * def __getitem__(cls, name): + * return cls.__members__[name] + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_cls), __pyx_n_s_members); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 20, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_values); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 20, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_2)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_2); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_3, function); + } + } + __pyx_t_1 = (__pyx_t_2) ? __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2) : __Pyx_PyObject_CallNoArg(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 20, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 20, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L0; + + /* "EnumBase":19 + * type.__init__(cls, name, parents, dct) + * cls.__members__ = __Pyx_OrderedDict() + * def __iter__(cls): # <<<<<<<<<<<<<< + * return iter(cls.__members__.values()) + * def __getitem__(cls, name): + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("EnumBase.__Pyx_EnumMeta.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "EnumBase":21 + * def __iter__(cls): + * return iter(cls.__members__.values()) + * def __getitem__(cls, name): # <<<<<<<<<<<<<< + * return cls.__members__[name] + * + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_8EnumBase_14__Pyx_EnumMeta_5__getitem__(PyObject *__pyx_v_cls, PyObject *__pyx_v_name); /*proto*/ +static PyObject *__pyx_pw_8EnumBase_14__Pyx_EnumMeta_5__getitem__(PyObject *__pyx_v_cls, PyObject *__pyx_v_name) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0); + __pyx_r = __pyx_pf_8EnumBase_14__Pyx_EnumMeta_4__getitem__(((struct __pyx_obj___Pyx_EnumMeta *)__pyx_v_cls), ((PyObject *)__pyx_v_name)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_8EnumBase_14__Pyx_EnumMeta_4__getitem__(struct __pyx_obj___Pyx_EnumMeta *__pyx_v_cls, PyObject *__pyx_v_name) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__getitem__", 0); + + /* "EnumBase":22 + * return iter(cls.__members__.values()) + * def __getitem__(cls, name): + * return cls.__members__[name] # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_cls), __pyx_n_s_members); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 22, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_t_1, __pyx_v_name); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 22, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + /* "EnumBase":21 + * def __iter__(cls): + * return iter(cls.__members__.values()) + * def __getitem__(cls, name): # <<<<<<<<<<<<<< + * return cls.__members__[name] + * + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("EnumBase.__Pyx_EnumMeta.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * cdef tuple state + * cdef object _dict + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_8EnumBase_14__Pyx_EnumMeta_7__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_8EnumBase_14__Pyx_EnumMeta_7__reduce_cython__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__reduce_cython__ (wrapper)", 0); + __pyx_r = __pyx_pf_8EnumBase_14__Pyx_EnumMeta_6__reduce_cython__(((struct __pyx_obj___Pyx_EnumMeta *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_8EnumBase_14__Pyx_EnumMeta_6__reduce_cython__(struct __pyx_obj___Pyx_EnumMeta *__pyx_v_self) { + PyObject *__pyx_v_state = 0; + PyObject *__pyx_v__dict = 0; + int __pyx_v_use_setstate; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__reduce_cython__", 0); + + /* "(tree fragment)":5 + * cdef object _dict + * cdef bint use_setstate + * state = () # <<<<<<<<<<<<<< + * _dict = getattr(self, '__dict__', None) + * if _dict is not None: + */ + __Pyx_INCREF(__pyx_empty_tuple); + __pyx_v_state = __pyx_empty_tuple; + + /* "(tree fragment)":6 + * cdef bint use_setstate + * state = () + * _dict = getattr(self, '__dict__', None) # <<<<<<<<<<<<<< + * if _dict is not None: + * state += (_dict,) + */ + __pyx_t_1 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_n_s_dict, Py_None); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 6, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_v__dict = __pyx_t_1; + __pyx_t_1 = 0; + + /* "(tree fragment)":7 + * state = () + * _dict = getattr(self, '__dict__', None) + * if _dict is not None: # <<<<<<<<<<<<<< + * state += (_dict,) + * use_setstate = True + */ + __pyx_t_2 = (__pyx_v__dict != Py_None); + __pyx_t_3 = (__pyx_t_2 != 0); + if (__pyx_t_3) { + + /* "(tree fragment)":8 + * _dict = getattr(self, '__dict__', None) + * if _dict is not None: + * state += (_dict,) # <<<<<<<<<<<<<< + * use_setstate = True + * else: + */ + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 8, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_v__dict); + __Pyx_GIVEREF(__pyx_v__dict); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v__dict); + __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 8, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_4)); + __pyx_t_4 = 0; + + /* "(tree fragment)":9 + * if _dict is not None: + * state += (_dict,) + * use_setstate = True # <<<<<<<<<<<<<< + * else: + * use_setstate = False + */ + __pyx_v_use_setstate = 1; + + /* "(tree fragment)":7 + * state = () + * _dict = getattr(self, '__dict__', None) + * if _dict is not None: # <<<<<<<<<<<<<< + * state += (_dict,) + * use_setstate = True + */ + goto __pyx_L3; + } + + /* "(tree fragment)":11 + * use_setstate = True + * else: + * use_setstate = False # <<<<<<<<<<<<<< + * if use_setstate: + * return __pyx_unpickle___Pyx_EnumMeta, (type(self), 0xd41d8cd, None), state + */ + /*else*/ { + __pyx_v_use_setstate = 0; + } + __pyx_L3:; + + /* "(tree fragment)":12 + * else: + * use_setstate = False + * if use_setstate: # <<<<<<<<<<<<<< + * return __pyx_unpickle___Pyx_EnumMeta, (type(self), 0xd41d8cd, None), state + * else: + */ + __pyx_t_3 = (__pyx_v_use_setstate != 0); + if (__pyx_t_3) { + + /* "(tree fragment)":13 + * use_setstate = False + * if use_setstate: + * return __pyx_unpickle___Pyx_EnumMeta, (type(self), 0xd41d8cd, None), state # <<<<<<<<<<<<<< + * else: + * return __pyx_unpickle___Pyx_EnumMeta, (type(self), 0xd41d8cd, state) + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_pyx_unpickle___Pyx_EnumMeta); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 13, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 13, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); + __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); + PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); + __Pyx_INCREF(__pyx_int_222419149); + __Pyx_GIVEREF(__pyx_int_222419149); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_222419149); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + PyTuple_SET_ITEM(__pyx_t_1, 2, Py_None); + __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 13, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1); + __Pyx_INCREF(__pyx_v_state); + __Pyx_GIVEREF(__pyx_v_state); + PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_v_state); + __pyx_t_4 = 0; + __pyx_t_1 = 0; + __pyx_r = __pyx_t_5; + __pyx_t_5 = 0; + goto __pyx_L0; + + /* "(tree fragment)":12 + * else: + * use_setstate = False + * if use_setstate: # <<<<<<<<<<<<<< + * return __pyx_unpickle___Pyx_EnumMeta, (type(self), 0xd41d8cd, None), state + * else: + */ + } + + /* "(tree fragment)":15 + * return __pyx_unpickle___Pyx_EnumMeta, (type(self), 0xd41d8cd, None), state + * else: + * return __pyx_unpickle___Pyx_EnumMeta, (type(self), 0xd41d8cd, state) # <<<<<<<<<<<<<< + * def __setstate_cython__(self, __pyx_state): + * __pyx_unpickle___Pyx_EnumMeta__set_state(self, __pyx_state) + */ + /*else*/ { + __Pyx_XDECREF(__pyx_r); + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_pyx_unpickle___Pyx_EnumMeta); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 15, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 15, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); + __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); + PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); + __Pyx_INCREF(__pyx_int_222419149); + __Pyx_GIVEREF(__pyx_int_222419149); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_222419149); + __Pyx_INCREF(__pyx_v_state); + __Pyx_GIVEREF(__pyx_v_state); + PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_state); + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 15, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GIVEREF(__pyx_t_5); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5); + __Pyx_GIVEREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1); + __pyx_t_5 = 0; + __pyx_t_1 = 0; + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; + goto __pyx_L0; + } + + /* "(tree fragment)":1 + * def __reduce_cython__(self): # <<<<<<<<<<<<<< + * cdef tuple state + * cdef object _dict + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("EnumBase.__Pyx_EnumMeta.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_state); + __Pyx_XDECREF(__pyx_v__dict); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":16 + * else: + * return __pyx_unpickle___Pyx_EnumMeta, (type(self), 0xd41d8cd, state) + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * __pyx_unpickle___Pyx_EnumMeta__set_state(self, __pyx_state) + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_8EnumBase_14__Pyx_EnumMeta_9__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state); /*proto*/ +static PyObject *__pyx_pw_8EnumBase_14__Pyx_EnumMeta_9__setstate_cython__(PyObject *__pyx_v_self, PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__setstate_cython__ (wrapper)", 0); + __pyx_r = __pyx_pf_8EnumBase_14__Pyx_EnumMeta_8__setstate_cython__(((struct __pyx_obj___Pyx_EnumMeta *)__pyx_v_self), ((PyObject *)__pyx_v___pyx_state)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_8EnumBase_14__Pyx_EnumMeta_8__setstate_cython__(struct __pyx_obj___Pyx_EnumMeta *__pyx_v_self, PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__setstate_cython__", 0); + + /* "(tree fragment)":17 + * return __pyx_unpickle___Pyx_EnumMeta, (type(self), 0xd41d8cd, state) + * def __setstate_cython__(self, __pyx_state): + * __pyx_unpickle___Pyx_EnumMeta__set_state(self, __pyx_state) # <<<<<<<<<<<<<< + */ + if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(1, 17, __pyx_L1_error) + __pyx_t_1 = __pyx_unpickle___Pyx_EnumMeta__set_state(__pyx_v_self, ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 17, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "(tree fragment)":16 + * else: + * return __pyx_unpickle___Pyx_EnumMeta, (type(self), 0xd41d8cd, state) + * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< + * __pyx_unpickle___Pyx_EnumMeta__set_state(self, __pyx_state) + */ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("EnumBase.__Pyx_EnumMeta.__setstate_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "EnumBase":28 + * class __Pyx_EnumBase(int): + * __metaclass__ = __Pyx_EnumMeta + * def __new__(cls, value, name=None): # <<<<<<<<<<<<<< + * for v in cls: + * if v == value: + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_8EnumBase_14__Pyx_EnumBase_1__new__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyMethodDef __pyx_mdef_8EnumBase_14__Pyx_EnumBase_1__new__ = {"__new__", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_8EnumBase_14__Pyx_EnumBase_1__new__, METH_VARARGS|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_8EnumBase_14__Pyx_EnumBase_1__new__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_cls = 0; + PyObject *__pyx_v_value = 0; + PyObject *__pyx_v_name = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__new__ (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_cls,&__pyx_n_s_value,&__pyx_n_s_name,0}; + PyObject* values[3] = {0,0,0}; + values[2] = ((PyObject *)((PyObject *)Py_None)); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_cls)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_value)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__new__", 0, 2, 3, 1); __PYX_ERR(1, 28, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (kw_args > 0) { + PyObject* value = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_name); + if (value) { values[2] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__new__") < 0)) __PYX_ERR(1, 28, __pyx_L3_error) + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_cls = values[0]; + __pyx_v_value = values[1]; + __pyx_v_name = values[2]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__new__", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 28, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("EnumBase.__Pyx_EnumBase.__new__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_8EnumBase_14__Pyx_EnumBase___new__(__pyx_self, __pyx_v_cls, __pyx_v_value, __pyx_v_name); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_8EnumBase_14__Pyx_EnumBase___new__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_cls, PyObject *__pyx_v_value, PyObject *__pyx_v_name) { + PyObject *__pyx_v_v = NULL; + PyObject *__pyx_v_res = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + Py_ssize_t __pyx_t_2; + PyObject *(*__pyx_t_3)(PyObject *); + PyObject *__pyx_t_4 = NULL; + int __pyx_t_5; + int __pyx_t_6; + PyObject *__pyx_t_7 = NULL; + int __pyx_t_8; + PyObject *__pyx_t_9 = NULL; + int __pyx_t_10; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__new__", 0); + + /* "EnumBase":29 + * __metaclass__ = __Pyx_EnumMeta + * def __new__(cls, value, name=None): + * for v in cls: # <<<<<<<<<<<<<< + * if v == value: + * return v + */ + if (likely(PyList_CheckExact(__pyx_v_cls)) || PyTuple_CheckExact(__pyx_v_cls)) { + __pyx_t_1 = __pyx_v_cls; __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0; + __pyx_t_3 = NULL; + } else { + __pyx_t_2 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_cls); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 29, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 29, __pyx_L1_error) + } + for (;;) { + if (likely(!__pyx_t_3)) { + if (likely(PyList_CheckExact(__pyx_t_1))) { + if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(1, 29, __pyx_L1_error) + #else + __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 29, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + #endif + } else { + if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break; + #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS + __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_4); __pyx_t_2++; if (unlikely(0 < 0)) __PYX_ERR(1, 29, __pyx_L1_error) + #else + __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 29, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + #endif + } + } else { + __pyx_t_4 = __pyx_t_3(__pyx_t_1); + if (unlikely(!__pyx_t_4)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); + else __PYX_ERR(1, 29, __pyx_L1_error) + } + break; + } + __Pyx_GOTREF(__pyx_t_4); + } + __Pyx_XDECREF_SET(__pyx_v_v, __pyx_t_4); + __pyx_t_4 = 0; + + /* "EnumBase":30 + * def __new__(cls, value, name=None): + * for v in cls: + * if v == value: # <<<<<<<<<<<<<< + * return v + * if name is None: + */ + __pyx_t_4 = PyObject_RichCompare(__pyx_v_v, __pyx_v_value, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 30, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(1, 30, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__pyx_t_5) { + + /* "EnumBase":31 + * for v in cls: + * if v == value: + * return v # <<<<<<<<<<<<<< + * if name is None: + * raise ValueError("Unknown enum value: '%s'" % value) + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_v); + __pyx_r = __pyx_v_v; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + + /* "EnumBase":30 + * def __new__(cls, value, name=None): + * for v in cls: + * if v == value: # <<<<<<<<<<<<<< + * return v + * if name is None: + */ + } + + /* "EnumBase":29 + * __metaclass__ = __Pyx_EnumMeta + * def __new__(cls, value, name=None): + * for v in cls: # <<<<<<<<<<<<<< + * if v == value: + * return v + */ + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "EnumBase":32 + * if v == value: + * return v + * if name is None: # <<<<<<<<<<<<<< + * raise ValueError("Unknown enum value: '%s'" % value) + * res = int.__new__(cls, value) + */ + __pyx_t_5 = (__pyx_v_name == Py_None); + __pyx_t_6 = (__pyx_t_5 != 0); + if (unlikely(__pyx_t_6)) { + + /* "EnumBase":33 + * return v + * if name is None: + * raise ValueError("Unknown enum value: '%s'" % value) # <<<<<<<<<<<<<< + * res = int.__new__(cls, value) + * res.name = name + */ + __pyx_t_1 = __Pyx_PyString_FormatSafe(__pyx_kp_s_Unknown_enum_value_s, __pyx_v_value); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 33, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_ValueError, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 33, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_Raise(__pyx_t_4, 0, 0, 0); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __PYX_ERR(1, 33, __pyx_L1_error) + + /* "EnumBase":32 + * if v == value: + * return v + * if name is None: # <<<<<<<<<<<<<< + * raise ValueError("Unknown enum value: '%s'" % value) + * res = int.__new__(cls, value) + */ + } + + /* "EnumBase":34 + * if name is None: + * raise ValueError("Unknown enum value: '%s'" % value) + * res = int.__new__(cls, value) # <<<<<<<<<<<<<< + * res.name = name + * setattr(cls, name, res) + */ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)(&PyInt_Type)), __pyx_n_s_new); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 34, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_7 = NULL; + __pyx_t_8 = 0; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_1))) { + __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_1); + if (likely(__pyx_t_7)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); + __Pyx_INCREF(__pyx_t_7); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_1, function); + __pyx_t_8 = 1; + } + } + #if CYTHON_FAST_PYCALL + if (PyFunction_Check(__pyx_t_1)) { + PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_v_cls, __pyx_v_value}; + __pyx_t_4 = __Pyx_PyFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 34, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_GOTREF(__pyx_t_4); + } else + #endif + #if CYTHON_FAST_PYCCALL + if (__Pyx_PyFastCFunction_Check(__pyx_t_1)) { + PyObject *__pyx_temp[3] = {__pyx_t_7, __pyx_v_cls, __pyx_v_value}; + __pyx_t_4 = __Pyx_PyCFunction_FastCall(__pyx_t_1, __pyx_temp+1-__pyx_t_8, 2+__pyx_t_8); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 34, __pyx_L1_error) + __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_GOTREF(__pyx_t_4); + } else + #endif + { + __pyx_t_9 = PyTuple_New(2+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 34, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + if (__pyx_t_7) { + __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7); __pyx_t_7 = NULL; + } + __Pyx_INCREF(__pyx_v_cls); + __Pyx_GIVEREF(__pyx_v_cls); + PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_v_cls); + __Pyx_INCREF(__pyx_v_value); + __Pyx_GIVEREF(__pyx_v_value); + PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_v_value); + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_9, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 34, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_res = __pyx_t_4; + __pyx_t_4 = 0; + + /* "EnumBase":35 + * raise ValueError("Unknown enum value: '%s'" % value) + * res = int.__new__(cls, value) + * res.name = name # <<<<<<<<<<<<<< + * setattr(cls, name, res) + * cls.__members__[name] = res + */ + if (__Pyx_PyObject_SetAttrStr(__pyx_v_res, __pyx_n_s_name, __pyx_v_name) < 0) __PYX_ERR(1, 35, __pyx_L1_error) + + /* "EnumBase":36 + * res = int.__new__(cls, value) + * res.name = name + * setattr(cls, name, res) # <<<<<<<<<<<<<< + * cls.__members__[name] = res + * return res + */ + __pyx_t_10 = PyObject_SetAttr(__pyx_v_cls, __pyx_v_name, __pyx_v_res); if (unlikely(__pyx_t_10 == ((int)-1))) __PYX_ERR(1, 36, __pyx_L1_error) + + /* "EnumBase":37 + * res.name = name + * setattr(cls, name, res) + * cls.__members__[name] = res # <<<<<<<<<<<<<< + * return res + * def __repr__(self): + */ + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_cls, __pyx_n_s_members); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 37, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (unlikely(PyObject_SetItem(__pyx_t_4, __pyx_v_name, __pyx_v_res) < 0)) __PYX_ERR(1, 37, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "EnumBase":38 + * setattr(cls, name, res) + * cls.__members__[name] = res + * return res # <<<<<<<<<<<<<< + * def __repr__(self): + * return "<%s.%s: %d>" % (self.__class__.__name__, self.name, self) + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_res); + __pyx_r = __pyx_v_res; + goto __pyx_L0; + + /* "EnumBase":28 + * class __Pyx_EnumBase(int): + * __metaclass__ = __Pyx_EnumMeta + * def __new__(cls, value, name=None): # <<<<<<<<<<<<<< + * for v in cls: + * if v == value: + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_AddTraceback("EnumBase.__Pyx_EnumBase.__new__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_v); + __Pyx_XDECREF(__pyx_v_res); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "EnumBase":39 + * cls.__members__[name] = res + * return res + * def __repr__(self): # <<<<<<<<<<<<<< + * return "<%s.%s: %d>" % (self.__class__.__name__, self.name, self) + * def __str__(self): + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_8EnumBase_14__Pyx_EnumBase_3__repr__(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ +static PyMethodDef __pyx_mdef_8EnumBase_14__Pyx_EnumBase_3__repr__ = {"__repr__", (PyCFunction)__pyx_pw_8EnumBase_14__Pyx_EnumBase_3__repr__, METH_O, 0}; +static PyObject *__pyx_pw_8EnumBase_14__Pyx_EnumBase_3__repr__(PyObject *__pyx_self, PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__repr__ (wrapper)", 0); + __pyx_r = __pyx_pf_8EnumBase_14__Pyx_EnumBase_2__repr__(__pyx_self, ((PyObject *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_8EnumBase_14__Pyx_EnumBase_2__repr__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__repr__", 0); + + /* "EnumBase":40 + * return res + * def __repr__(self): + * return "<%s.%s: %d>" % (self.__class__.__name__, self.name, self) # <<<<<<<<<<<<<< + * def __str__(self): + * return "%s.%s" % (self.__class__.__name__, self.name) + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_class); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 40, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_name_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 40, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 40, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 40, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1); + __Pyx_INCREF(__pyx_v_self); + __Pyx_GIVEREF(__pyx_v_self); + PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_self); + __pyx_t_2 = 0; + __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_s_s_d, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 40, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "EnumBase":39 + * cls.__members__[name] = res + * return res + * def __repr__(self): # <<<<<<<<<<<<<< + * return "<%s.%s: %d>" % (self.__class__.__name__, self.name, self) + * def __str__(self): + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("EnumBase.__Pyx_EnumBase.__repr__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "EnumBase":41 + * def __repr__(self): + * return "<%s.%s: %d>" % (self.__class__.__name__, self.name, self) + * def __str__(self): # <<<<<<<<<<<<<< + * return "%s.%s" % (self.__class__.__name__, self.name) + * + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_8EnumBase_14__Pyx_EnumBase_5__str__(PyObject *__pyx_self, PyObject *__pyx_v_self); /*proto*/ +static PyMethodDef __pyx_mdef_8EnumBase_14__Pyx_EnumBase_5__str__ = {"__str__", (PyCFunction)__pyx_pw_8EnumBase_14__Pyx_EnumBase_5__str__, METH_O, 0}; +static PyObject *__pyx_pw_8EnumBase_14__Pyx_EnumBase_5__str__(PyObject *__pyx_self, PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__str__ (wrapper)", 0); + __pyx_r = __pyx_pf_8EnumBase_14__Pyx_EnumBase_4__str__(__pyx_self, ((PyObject *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_8EnumBase_14__Pyx_EnumBase_4__str__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__str__", 0); + + /* "EnumBase":42 + * return "<%s.%s: %d>" % (self.__class__.__name__, self.name, self) + * def __str__(self): + * return "%s.%s" % (self.__class__.__name__, self.name) # <<<<<<<<<<<<<< + * + * if PY_VERSION_HEX >= 0x03040000: + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_class); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 42, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_name_2); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 42, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s_name); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 42, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 42, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1); + __pyx_t_2 = 0; + __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyString_Format(__pyx_kp_s_s_s, __pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 42, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* "EnumBase":41 + * def __repr__(self): + * return "<%s.%s: %d>" % (self.__class__.__name__, self.name, self) + * def __str__(self): # <<<<<<<<<<<<<< + * return "%s.%s" % (self.__class__.__name__, self.name) + * + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("EnumBase.__Pyx_EnumBase.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":1 + * def __pyx_unpickle___Pyx_EnumMeta(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<< + * cdef object __pyx_PickleError + * cdef object __pyx_result + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_8EnumBase_1__pyx_unpickle___Pyx_EnumMeta(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyMethodDef __pyx_mdef_8EnumBase_1__pyx_unpickle___Pyx_EnumMeta = {"__pyx_unpickle___Pyx_EnumMeta", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_8EnumBase_1__pyx_unpickle___Pyx_EnumMeta, METH_VARARGS|METH_KEYWORDS, 0}; +static PyObject *__pyx_pw_8EnumBase_1__pyx_unpickle___Pyx_EnumMeta(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v___pyx_type = 0; + long __pyx_v___pyx_checksum; + PyObject *__pyx_v___pyx_state = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__pyx_unpickle___Pyx_EnumMeta (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_pyx_type,&__pyx_n_s_pyx_checksum,&__pyx_n_s_pyx_state,0}; + PyObject* values[3] = {0,0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + CYTHON_FALLTHROUGH; + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + CYTHON_FALLTHROUGH; + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + CYTHON_FALLTHROUGH; + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_type)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + CYTHON_FALLTHROUGH; + case 1: + if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_checksum)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__pyx_unpickle___Pyx_EnumMeta", 1, 3, 3, 1); __PYX_ERR(1, 1, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 2: + if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_pyx_state)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__pyx_unpickle___Pyx_EnumMeta", 1, 3, 3, 2); __PYX_ERR(1, 1, __pyx_L3_error) + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__pyx_unpickle___Pyx_EnumMeta") < 0)) __PYX_ERR(1, 1, __pyx_L3_error) + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + } + __pyx_v___pyx_type = values[0]; + __pyx_v___pyx_checksum = __Pyx_PyInt_As_long(values[1]); if (unlikely((__pyx_v___pyx_checksum == (long)-1) && PyErr_Occurred())) __PYX_ERR(1, 1, __pyx_L3_error) + __pyx_v___pyx_state = values[2]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__pyx_unpickle___Pyx_EnumMeta", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(1, 1, __pyx_L3_error) + __pyx_L3_error:; + __Pyx_AddTraceback("EnumBase.__pyx_unpickle___Pyx_EnumMeta", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_8EnumBase___pyx_unpickle___Pyx_EnumMeta(__pyx_self, __pyx_v___pyx_type, __pyx_v___pyx_checksum, __pyx_v___pyx_state); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_8EnumBase___pyx_unpickle___Pyx_EnumMeta(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_v___pyx_PickleError = 0; + PyObject *__pyx_v___pyx_result = 0; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_t_6; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__pyx_unpickle___Pyx_EnumMeta", 0); + + /* "(tree fragment)":4 + * cdef object __pyx_PickleError + * cdef object __pyx_result + * if __pyx_checksum != 0xd41d8cd: # <<<<<<<<<<<<<< + * from pickle import PickleError as __pyx_PickleError + * raise __pyx_PickleError("Incompatible checksums (%s vs 0xd41d8cd = ())" % __pyx_checksum) + */ + __pyx_t_1 = ((__pyx_v___pyx_checksum != 0xd41d8cd) != 0); + if (__pyx_t_1) { + + /* "(tree fragment)":5 + * cdef object __pyx_result + * if __pyx_checksum != 0xd41d8cd: + * from pickle import PickleError as __pyx_PickleError # <<<<<<<<<<<<<< + * raise __pyx_PickleError("Incompatible checksums (%s vs 0xd41d8cd = ())" % __pyx_checksum) + * __pyx_result = __Pyx_EnumMeta.__new__(__pyx_type) + */ + __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF(__pyx_n_s_PickleError); + __Pyx_GIVEREF(__pyx_n_s_PickleError); + PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_PickleError); + __pyx_t_3 = __Pyx_Import(__pyx_n_s_pickle, __pyx_t_2, -1); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_PickleError); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF(__pyx_t_2); + __pyx_v___pyx_PickleError = __pyx_t_2; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "(tree fragment)":6 + * if __pyx_checksum != 0xd41d8cd: + * from pickle import PickleError as __pyx_PickleError + * raise __pyx_PickleError("Incompatible checksums (%s vs 0xd41d8cd = ())" % __pyx_checksum) # <<<<<<<<<<<<<< + * __pyx_result = __Pyx_EnumMeta.__new__(__pyx_type) + * if __pyx_state is not None: + */ + __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 6, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Incompatible_checksums_s_vs_0xd4, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 6, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_INCREF(__pyx_v___pyx_PickleError); + __pyx_t_2 = __pyx_v___pyx_PickleError; __pyx_t_5 = NULL; + if (CYTHON_UNPACK_METHODS && unlikely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_5)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_5); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + } + } + __pyx_t_3 = (__pyx_t_5) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_5, __pyx_t_4) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 6, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_Raise(__pyx_t_3, 0, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __PYX_ERR(1, 6, __pyx_L1_error) + + /* "(tree fragment)":4 + * cdef object __pyx_PickleError + * cdef object __pyx_result + * if __pyx_checksum != 0xd41d8cd: # <<<<<<<<<<<<<< + * from pickle import PickleError as __pyx_PickleError + * raise __pyx_PickleError("Incompatible checksums (%s vs 0xd41d8cd = ())" % __pyx_checksum) + */ + } + + /* "(tree fragment)":7 + * from pickle import PickleError as __pyx_PickleError + * raise __pyx_PickleError("Incompatible checksums (%s vs 0xd41d8cd = ())" % __pyx_checksum) + * __pyx_result = __Pyx_EnumMeta.__new__(__pyx_type) # <<<<<<<<<<<<<< + * if __pyx_state is not None: + * __pyx_unpickle___Pyx_EnumMeta__set_state(<__Pyx_EnumMeta> __pyx_result, __pyx_state) + */ + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_ptype___Pyx_EnumMeta), __pyx_n_s_new); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 7, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_4)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_4); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + } + } + __pyx_t_3 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_2, __pyx_t_4, __pyx_v___pyx_type) : __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v___pyx_type); + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 7, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v___pyx_result = __pyx_t_3; + __pyx_t_3 = 0; + + /* "(tree fragment)":8 + * raise __pyx_PickleError("Incompatible checksums (%s vs 0xd41d8cd = ())" % __pyx_checksum) + * __pyx_result = __Pyx_EnumMeta.__new__(__pyx_type) + * if __pyx_state is not None: # <<<<<<<<<<<<<< + * __pyx_unpickle___Pyx_EnumMeta__set_state(<__Pyx_EnumMeta> __pyx_result, __pyx_state) + * return __pyx_result + */ + __pyx_t_1 = (__pyx_v___pyx_state != Py_None); + __pyx_t_6 = (__pyx_t_1 != 0); + if (__pyx_t_6) { + + /* "(tree fragment)":9 + * __pyx_result = __Pyx_EnumMeta.__new__(__pyx_type) + * if __pyx_state is not None: + * __pyx_unpickle___Pyx_EnumMeta__set_state(<__Pyx_EnumMeta> __pyx_result, __pyx_state) # <<<<<<<<<<<<<< + * return __pyx_result + * cdef __pyx_unpickle___Pyx_EnumMeta__set_state(__Pyx_EnumMeta __pyx_result, tuple __pyx_state): + */ + if (!(likely(PyTuple_CheckExact(__pyx_v___pyx_state))||((__pyx_v___pyx_state) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "tuple", Py_TYPE(__pyx_v___pyx_state)->tp_name), 0))) __PYX_ERR(1, 9, __pyx_L1_error) + __pyx_t_3 = __pyx_unpickle___Pyx_EnumMeta__set_state(((struct __pyx_obj___Pyx_EnumMeta *)__pyx_v___pyx_result), ((PyObject*)__pyx_v___pyx_state)); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 9, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "(tree fragment)":8 + * raise __pyx_PickleError("Incompatible checksums (%s vs 0xd41d8cd = ())" % __pyx_checksum) + * __pyx_result = __Pyx_EnumMeta.__new__(__pyx_type) + * if __pyx_state is not None: # <<<<<<<<<<<<<< + * __pyx_unpickle___Pyx_EnumMeta__set_state(<__Pyx_EnumMeta> __pyx_result, __pyx_state) + * return __pyx_result + */ + } + + /* "(tree fragment)":10 + * if __pyx_state is not None: + * __pyx_unpickle___Pyx_EnumMeta__set_state(<__Pyx_EnumMeta> __pyx_result, __pyx_state) + * return __pyx_result # <<<<<<<<<<<<<< + * cdef __pyx_unpickle___Pyx_EnumMeta__set_state(__Pyx_EnumMeta __pyx_result, tuple __pyx_state): + * if len(__pyx_state) > 0 and hasattr(__pyx_result, '__dict__'): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v___pyx_result); + __pyx_r = __pyx_v___pyx_result; + goto __pyx_L0; + + /* "(tree fragment)":1 + * def __pyx_unpickle___Pyx_EnumMeta(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<< + * cdef object __pyx_PickleError + * cdef object __pyx_result + */ + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("EnumBase.__pyx_unpickle___Pyx_EnumMeta", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v___pyx_PickleError); + __Pyx_XDECREF(__pyx_v___pyx_result); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "(tree fragment)":11 + * __pyx_unpickle___Pyx_EnumMeta__set_state(<__Pyx_EnumMeta> __pyx_result, __pyx_state) + * return __pyx_result + * cdef __pyx_unpickle___Pyx_EnumMeta__set_state(__Pyx_EnumMeta __pyx_result, tuple __pyx_state): # <<<<<<<<<<<<<< + * if len(__pyx_state) > 0 and hasattr(__pyx_result, '__dict__'): + * __pyx_result.__dict__.update(__pyx_state[0]) + */ + +static PyObject *__pyx_unpickle___Pyx_EnumMeta__set_state(struct __pyx_obj___Pyx_EnumMeta *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + Py_ssize_t __pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__pyx_unpickle___Pyx_EnumMeta__set_state", 0); + + /* "(tree fragment)":12 + * return __pyx_result + * cdef __pyx_unpickle___Pyx_EnumMeta__set_state(__Pyx_EnumMeta __pyx_result, tuple __pyx_state): + * if len(__pyx_state) > 0 and hasattr(__pyx_result, '__dict__'): # <<<<<<<<<<<<<< + * __pyx_result.__dict__.update(__pyx_state[0]) + */ + if (unlikely(__pyx_v___pyx_state == Py_None)) { + PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); + __PYX_ERR(1, 12, __pyx_L1_error) + } + __pyx_t_2 = PyTuple_GET_SIZE(__pyx_v___pyx_state); if (unlikely(__pyx_t_2 == ((Py_ssize_t)-1))) __PYX_ERR(1, 12, __pyx_L1_error) + __pyx_t_3 = ((__pyx_t_2 > 0) != 0); + if (__pyx_t_3) { + } else { + __pyx_t_1 = __pyx_t_3; + goto __pyx_L4_bool_binop_done; + } + __pyx_t_3 = __Pyx_HasAttr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(__pyx_t_3 == ((int)-1))) __PYX_ERR(1, 12, __pyx_L1_error) + __pyx_t_4 = (__pyx_t_3 != 0); + __pyx_t_1 = __pyx_t_4; + __pyx_L4_bool_binop_done:; + if (__pyx_t_1) { + + /* "(tree fragment)":13 + * cdef __pyx_unpickle___Pyx_EnumMeta__set_state(__Pyx_EnumMeta __pyx_result, tuple __pyx_state): + * if len(__pyx_state) > 0 and hasattr(__pyx_result, '__dict__'): + * __pyx_result.__dict__.update(__pyx_state[0]) # <<<<<<<<<<<<<< + */ + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 13, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_update); if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 13, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(__pyx_v___pyx_state == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(1, 13, __pyx_L1_error) + } + __pyx_t_6 = __Pyx_GetItemInt_Tuple(__pyx_v___pyx_state, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 13, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_8 = NULL; + if (CYTHON_UNPACK_METHODS && likely(PyMethod_Check(__pyx_t_7))) { + __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_7); + if (likely(__pyx_t_8)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7); + __Pyx_INCREF(__pyx_t_8); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_7, function); + } + } + __pyx_t_5 = (__pyx_t_8) ? __Pyx_PyObject_Call2Args(__pyx_t_7, __pyx_t_8, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_6); + __Pyx_XDECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 13, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "(tree fragment)":12 + * return __pyx_result + * cdef __pyx_unpickle___Pyx_EnumMeta__set_state(__Pyx_EnumMeta __pyx_result, tuple __pyx_state): + * if len(__pyx_state) > 0 and hasattr(__pyx_result, '__dict__'): # <<<<<<<<<<<<<< + * __pyx_result.__dict__.update(__pyx_state[0]) + */ + } + + /* "(tree fragment)":11 + * __pyx_unpickle___Pyx_EnumMeta__set_state(<__Pyx_EnumMeta> __pyx_result, __pyx_state) + * return __pyx_result + * cdef __pyx_unpickle___Pyx_EnumMeta__set_state(__Pyx_EnumMeta __pyx_result, tuple __pyx_state): # <<<<<<<<<<<<<< + * if len(__pyx_state) > 0 and hasattr(__pyx_result, '__dict__'): + * __pyx_result.__dict__.update(__pyx_state[0]) + */ + + /* function exit code */ + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_AddTraceback("EnumBase.__pyx_unpickle___Pyx_EnumMeta__set_state", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_tp_new_7DracoPy_Encoder(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_obj_7DracoPy_Encoder *p; + PyObject *o; + if (likely((t->tp_flags & Py_TPFLAGS_IS_ABSTRACT) == 0)) { + o = (*t->tp_alloc)(t, 0); + } else { + o = (PyObject *) PyBaseObject_Type.tp_new(t, __pyx_empty_tuple, 0); + } + if (unlikely(!o)) return 0; + p = ((struct __pyx_obj_7DracoPy_Encoder *)o); + new((void*)&(p->this_encoder)) draco::Encoder(); + if (unlikely(__pyx_pw_7DracoPy_7Encoder_1__cinit__(o, __pyx_empty_tuple, NULL) < 0)) goto bad; + return o; + bad: + Py_DECREF(o); o = 0; + return NULL; +} + +static void __pyx_tp_dealloc_7DracoPy_Encoder(PyObject *o) { + struct __pyx_obj_7DracoPy_Encoder *p = (struct __pyx_obj_7DracoPy_Encoder *)o; + #if CYTHON_USE_TP_FINALIZE + if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && (!PyType_IS_GC(Py_TYPE(o)) || !_PyGC_FINALIZED(o))) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + #endif + __Pyx_call_destructor(p->this_encoder); + (*Py_TYPE(o)->tp_free)(o); +} + +static PyMethodDef __pyx_methods_7DracoPy_Encoder[] = { + {"SetSpeedOptions", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7DracoPy_7Encoder_3SetSpeedOptions, METH_VARARGS|METH_KEYWORDS, 0}, + {"SetAttributeQuantization", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7DracoPy_7Encoder_5SetAttributeQuantization, METH_VARARGS|METH_KEYWORDS, 0}, + {"SetAttributeExplicitQuantization", (PyCFunction)(void*)(PyCFunctionWithKeywords)__pyx_pw_7DracoPy_7Encoder_7SetAttributeExplicitQuantization, METH_VARARGS|METH_KEYWORDS, 0}, + {"__reduce_cython__", (PyCFunction)__pyx_pw_7DracoPy_7Encoder_9__reduce_cython__, METH_NOARGS, 0}, + {"__setstate_cython__", (PyCFunction)__pyx_pw_7DracoPy_7Encoder_11__setstate_cython__, METH_O, 0}, + {0, 0, 0, 0} +}; + +static PyTypeObject __pyx_type_7DracoPy_Encoder = { + PyVarObject_HEAD_INIT(0, 0) + "DracoPy.Encoder", /*tp_name*/ + sizeof(struct __pyx_obj_7DracoPy_Encoder), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_7DracoPy_Encoder, /*tp_dealloc*/ + #if PY_VERSION_HEX < 0x030800b4 + 0, /*tp_print*/ + #endif + #if PY_VERSION_HEX >= 0x030800b4 + 0, /*tp_vectorcall_offset*/ + #endif + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #endif + #if PY_MAJOR_VERSION >= 3 + 0, /*tp_as_async*/ + #endif + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/ + "\n Python wrapper for draco::Encoder\n Allow set up encoding options\n ", /*tp_doc*/ + 0, /*tp_traverse*/ + 0, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_7DracoPy_Encoder, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_7DracoPy_Encoder, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + 0, /*tp_version_tag*/ + #if PY_VERSION_HEX >= 0x030400a1 + 0, /*tp_finalize*/ + #endif + #if PY_VERSION_HEX >= 0x030800b1 + 0, /*tp_vectorcall*/ + #endif + #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000 + 0, /*tp_print*/ + #endif + #if PY_VERSION_HEX >= 0x030B00A2 + 0, /*tp_inline_values_offset*/ + #endif +}; + +static PyObject *__pyx_tp_new___Pyx_EnumMeta(PyTypeObject *t, PyObject *a, PyObject *k) { + PyObject *o = (&PyType_Type)->tp_new(t, a, k); + if (unlikely(!o)) return 0; + return o; +} + +static void __pyx_tp_dealloc___Pyx_EnumMeta(PyObject *o) { + #if CYTHON_USE_TP_FINALIZE + if (unlikely(PyType_HasFeature(Py_TYPE(o), Py_TPFLAGS_HAVE_FINALIZE) && Py_TYPE(o)->tp_finalize) && !_PyGC_FINALIZED(o)) { + if (PyObject_CallFinalizerFromDealloc(o)) return; + } + #endif + PyObject_GC_UnTrack(o); + PyObject_GC_Track(o); + (&PyType_Type)->tp_dealloc(o); +} + +static int __pyx_tp_traverse___Pyx_EnumMeta(PyObject *o, visitproc v, void *a) { + int e; + if (!(&PyType_Type)->tp_traverse); else { e = (&PyType_Type)->tp_traverse(o,v,a); if (e) return e; } + return 0; +} + +static int __pyx_tp_clear___Pyx_EnumMeta(PyObject *o) { + if (!(&PyType_Type)->tp_clear); else (&PyType_Type)->tp_clear(o); + return 0; +} +static PyObject *__pyx_sq_item___Pyx_EnumMeta(PyObject *o, Py_ssize_t i) { + PyObject *r; + PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0; + r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x); + Py_DECREF(x); + return r; +} + +static PyMethodDef __pyx_methods___Pyx_EnumMeta[] = { + {"__reduce_cython__", (PyCFunction)__pyx_pw_8EnumBase_14__Pyx_EnumMeta_7__reduce_cython__, METH_NOARGS, 0}, + {"__setstate_cython__", (PyCFunction)__pyx_pw_8EnumBase_14__Pyx_EnumMeta_9__setstate_cython__, METH_O, 0}, + {0, 0, 0, 0} +}; + +static PySequenceMethods __pyx_tp_as_sequence___Pyx_EnumMeta = { + 0, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + __pyx_sq_item___Pyx_EnumMeta, /*sq_item*/ + 0, /*sq_slice*/ + 0, /*sq_ass_item*/ + 0, /*sq_ass_slice*/ + 0, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; + +static PyMappingMethods __pyx_tp_as_mapping___Pyx_EnumMeta = { + 0, /*mp_length*/ + __pyx_pw_8EnumBase_14__Pyx_EnumMeta_5__getitem__, /*mp_subscript*/ + 0, /*mp_ass_subscript*/ +}; + +static PyTypeObject __Pyx_EnumMeta = { + PyVarObject_HEAD_INIT(0, 0) + "DracoPy.__Pyx_EnumMeta", /*tp_name*/ + sizeof(struct __pyx_obj___Pyx_EnumMeta), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc___Pyx_EnumMeta, /*tp_dealloc*/ + #if PY_VERSION_HEX < 0x030800b4 + 0, /*tp_print*/ + #endif + #if PY_VERSION_HEX >= 0x030800b4 + 0, /*tp_vectorcall_offset*/ + #endif + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #endif + #if PY_MAJOR_VERSION >= 3 + 0, /*tp_as_async*/ + #endif + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + &__pyx_tp_as_sequence___Pyx_EnumMeta, /*tp_as_sequence*/ + &__pyx_tp_as_mapping___Pyx_EnumMeta, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + 0, /*tp_doc*/ + __pyx_tp_traverse___Pyx_EnumMeta, /*tp_traverse*/ + __pyx_tp_clear___Pyx_EnumMeta, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + __pyx_pw_8EnumBase_14__Pyx_EnumMeta_3__iter__, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods___Pyx_EnumMeta, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + __pyx_pw_8EnumBase_14__Pyx_EnumMeta_1__init__, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new___Pyx_EnumMeta, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + 0, /*tp_version_tag*/ + #if PY_VERSION_HEX >= 0x030400a1 + 0, /*tp_finalize*/ + #endif + #if PY_VERSION_HEX >= 0x030800b1 + 0, /*tp_vectorcall*/ + #endif + #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000 + 0, /*tp_print*/ + #endif + #if PY_VERSION_HEX >= 0x030B00A2 + 0, /*tp_inline_values_offset*/ + #endif +}; + +static PyMethodDef __pyx_methods[] = { + {0, 0, 0, 0} +}; + +#if PY_MAJOR_VERSION >= 3 +#if CYTHON_PEP489_MULTI_PHASE_INIT +static PyObject* __pyx_pymod_create(PyObject *spec, PyModuleDef *def); /*proto*/ +static int __pyx_pymod_exec_DracoPy(PyObject* module); /*proto*/ +static PyModuleDef_Slot __pyx_moduledef_slots[] = { + {Py_mod_create, (void*)__pyx_pymod_create}, + {Py_mod_exec, (void*)__pyx_pymod_exec_DracoPy}, + {0, NULL} +}; +#endif + +static struct PyModuleDef __pyx_moduledef = { + PyModuleDef_HEAD_INIT, + "DracoPy", + 0, /* m_doc */ + #if CYTHON_PEP489_MULTI_PHASE_INIT + 0, /* m_size */ + #else + -1, /* m_size */ + #endif + __pyx_methods /* m_methods */, + #if CYTHON_PEP489_MULTI_PHASE_INIT + __pyx_moduledef_slots, /* m_slots */ + #else + NULL, /* m_reload */ + #endif + NULL, /* m_traverse */ + NULL, /* m_clear */ + NULL /* m_free */ +}; +#endif +#ifndef CYTHON_SMALL_CODE +#if defined(__clang__) + #define CYTHON_SMALL_CODE +#elif defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)) + #define CYTHON_SMALL_CODE __attribute__((cold)) +#else + #define CYTHON_SMALL_CODE +#endif +#endif + +static __Pyx_StringTabEntry __pyx_string_tab[] = { + {&__pyx_n_s_COLOR, __pyx_k_COLOR, sizeof(__pyx_k_COLOR), 0, 0, 1, 1}, + {&__pyx_n_s_DT_BOOL, __pyx_k_DT_BOOL, sizeof(__pyx_k_DT_BOOL), 0, 0, 1, 1}, + {&__pyx_n_s_DT_FLOAT32, __pyx_k_DT_FLOAT32, sizeof(__pyx_k_DT_FLOAT32), 0, 0, 1, 1}, + {&__pyx_n_s_DT_FLOAT64, __pyx_k_DT_FLOAT64, sizeof(__pyx_k_DT_FLOAT64), 0, 0, 1, 1}, + {&__pyx_n_s_DT_INT16, __pyx_k_DT_INT16, sizeof(__pyx_k_DT_INT16), 0, 0, 1, 1}, + {&__pyx_n_s_DT_INT32, __pyx_k_DT_INT32, sizeof(__pyx_k_DT_INT32), 0, 0, 1, 1}, + {&__pyx_n_s_DT_INT64, __pyx_k_DT_INT64, sizeof(__pyx_k_DT_INT64), 0, 0, 1, 1}, + {&__pyx_n_s_DT_INT8, __pyx_k_DT_INT8, sizeof(__pyx_k_DT_INT8), 0, 0, 1, 1}, + {&__pyx_n_s_DT_INVALID, __pyx_k_DT_INVALID, sizeof(__pyx_k_DT_INVALID), 0, 0, 1, 1}, + {&__pyx_n_s_DT_TYPES_COUNT, __pyx_k_DT_TYPES_COUNT, sizeof(__pyx_k_DT_TYPES_COUNT), 0, 0, 1, 1}, + {&__pyx_n_s_DT_UINT16, __pyx_k_DT_UINT16, sizeof(__pyx_k_DT_UINT16), 0, 0, 1, 1}, + {&__pyx_n_s_DT_UINT32, __pyx_k_DT_UINT32, sizeof(__pyx_k_DT_UINT32), 0, 0, 1, 1}, + {&__pyx_n_s_DT_UINT64, __pyx_k_DT_UINT64, sizeof(__pyx_k_DT_UINT64), 0, 0, 1, 1}, + {&__pyx_n_s_DT_UINT8, __pyx_k_DT_UINT8, sizeof(__pyx_k_DT_UINT8), 0, 0, 1, 1}, + {&__pyx_n_s_DataType, __pyx_k_DataType, sizeof(__pyx_k_DataType), 0, 0, 1, 1}, + {&__pyx_n_s_Dict, __pyx_k_Dict, sizeof(__pyx_k_Dict), 0, 0, 1, 1}, + {&__pyx_n_s_DracoMesh, __pyx_k_DracoMesh, sizeof(__pyx_k_DracoMesh), 0, 0, 1, 1}, + {&__pyx_n_s_DracoMesh_faces, __pyx_k_DracoMesh_faces, sizeof(__pyx_k_DracoMesh_faces), 0, 0, 1, 1}, + {&__pyx_n_s_DracoMesh_normals, __pyx_k_DracoMesh_normals, sizeof(__pyx_k_DracoMesh_normals), 0, 0, 1, 1}, + {&__pyx_n_s_DracoPointCloud, __pyx_k_DracoPointCloud, sizeof(__pyx_k_DracoPointCloud), 0, 0, 1, 1}, + {&__pyx_n_s_DracoPointCloud___init, __pyx_k_DracoPointCloud___init, sizeof(__pyx_k_DracoPointCloud___init), 0, 0, 1, 1}, + {&__pyx_n_s_DracoPointCloud_geometry_metadat, __pyx_k_DracoPointCloud_geometry_metadat, sizeof(__pyx_k_DracoPointCloud_geometry_metadat), 0, 0, 1, 1}, + {&__pyx_n_s_DracoPointCloud_get_encoded_coor, __pyx_k_DracoPointCloud_get_encoded_coor, sizeof(__pyx_k_DracoPointCloud_get_encoded_coor), 0, 0, 1, 1}, + {&__pyx_n_s_DracoPointCloud_get_encoded_poin, __pyx_k_DracoPointCloud_get_encoded_poin, sizeof(__pyx_k_DracoPointCloud_get_encoded_poin), 0, 0, 1, 1}, + {&__pyx_n_s_DracoPointCloud_metadatas, __pyx_k_DracoPointCloud_metadatas, sizeof(__pyx_k_DracoPointCloud_metadatas), 0, 0, 1, 1}, + {&__pyx_n_s_DracoPointCloud_num_axes, __pyx_k_DracoPointCloud_num_axes, sizeof(__pyx_k_DracoPointCloud_num_axes), 0, 0, 1, 1}, + {&__pyx_n_s_DracoPointCloud_points, __pyx_k_DracoPointCloud_points, sizeof(__pyx_k_DracoPointCloud_points), 0, 0, 1, 1}, + {&__pyx_n_s_DracoPy, __pyx_k_DracoPy, sizeof(__pyx_k_DracoPy), 0, 0, 1, 1}, + {&__pyx_kp_u_DracoPy_only_supports_meshes_wit, __pyx_k_DracoPy_only_supports_meshes_wit, sizeof(__pyx_k_DracoPy_only_supports_meshes_wit), 0, 1, 0, 0}, + {&__pyx_n_s_Encoder, __pyx_k_Encoder, sizeof(__pyx_k_Encoder), 0, 0, 1, 1}, + {&__pyx_n_s_EncodingFailedException, __pyx_k_EncodingFailedException, sizeof(__pyx_k_EncodingFailedException), 0, 0, 1, 1}, + {&__pyx_n_s_EncodingOptions, __pyx_k_EncodingOptions, sizeof(__pyx_k_EncodingOptions), 0, 0, 1, 1}, + {&__pyx_n_s_EncodingOptions___init, __pyx_k_EncodingOptions___init, sizeof(__pyx_k_EncodingOptions___init), 0, 0, 1, 1}, + {&__pyx_n_s_EncodingOptions_get_encoded_coor, __pyx_k_EncodingOptions_get_encoded_coor, sizeof(__pyx_k_EncodingOptions_get_encoded_coor), 0, 0, 1, 1}, + {&__pyx_n_s_EncodingOptions_get_encoded_poin, __pyx_k_EncodingOptions_get_encoded_poin, sizeof(__pyx_k_EncodingOptions_get_encoded_poin), 0, 0, 1, 1}, + {&__pyx_n_s_EncodingOptions_num_axes, __pyx_k_EncodingOptions_num_axes, sizeof(__pyx_k_EncodingOptions_num_axes), 0, 0, 1, 1}, + {&__pyx_n_s_EnumBase, __pyx_k_EnumBase, sizeof(__pyx_k_EnumBase), 0, 0, 1, 1}, + {&__pyx_n_s_EnumType, __pyx_k_EnumType, sizeof(__pyx_k_EnumType), 0, 0, 1, 1}, + {&__pyx_kp_u_Failed_to_decode_input_mesh_Data, __pyx_k_Failed_to_decode_input_mesh_Data, sizeof(__pyx_k_Failed_to_decode_input_mesh_Data), 0, 1, 0, 0}, + {&__pyx_n_s_FileTypeException, __pyx_k_FileTypeException, sizeof(__pyx_k_FileTypeException), 0, 0, 1, 1}, + {&__pyx_n_s_GENERIC, __pyx_k_GENERIC, sizeof(__pyx_k_GENERIC), 0, 0, 1, 1}, + {&__pyx_n_s_GeometryAttributeType, __pyx_k_GeometryAttributeType, sizeof(__pyx_k_GeometryAttributeType), 0, 0, 1, 1}, + {&__pyx_n_s_INVALID, __pyx_k_INVALID, sizeof(__pyx_k_INVALID), 0, 0, 1, 1}, + {&__pyx_kp_s_Incompatible_checksums_s_vs_0xd4, __pyx_k_Incompatible_checksums_s_vs_0xd4, sizeof(__pyx_k_Incompatible_checksums_s_vs_0xd4), 0, 0, 1, 0}, + {&__pyx_kp_u_Input_invalid, __pyx_k_Input_invalid, sizeof(__pyx_k_Input_invalid), 0, 1, 0, 0}, + {&__pyx_kp_u_Input_mesh_is_not_draco_encoded, __pyx_k_Input_mesh_is_not_draco_encoded, sizeof(__pyx_k_Input_mesh_is_not_draco_encoded), 0, 1, 0, 0}, + {&__pyx_n_s_IntEnum, __pyx_k_IntEnum, sizeof(__pyx_k_IntEnum), 0, 0, 1, 1}, + {&__pyx_kp_u_Invalid_draco_structure, __pyx_k_Invalid_draco_structure, sizeof(__pyx_k_Invalid_draco_structure), 0, 1, 0, 0}, + {&__pyx_n_s_KeyError, __pyx_k_KeyError, sizeof(__pyx_k_KeyError), 0, 0, 1, 1}, + {&__pyx_n_s_List, __pyx_k_List, sizeof(__pyx_k_List), 0, 0, 1, 1}, + {&__pyx_n_s_NAMED_ATTRIBUTES_COUNT, __pyx_k_NAMED_ATTRIBUTES_COUNT, sizeof(__pyx_k_NAMED_ATTRIBUTES_COUNT), 0, 0, 1, 1}, + {&__pyx_n_s_NORMAL, __pyx_k_NORMAL, sizeof(__pyx_k_NORMAL), 0, 0, 1, 1}, + {&__pyx_kp_s_No_value_specified_for_struct_at, __pyx_k_No_value_specified_for_struct_at, sizeof(__pyx_k_No_value_specified_for_struct_at), 0, 0, 1, 0}, + {&__pyx_kp_s_No_value_specified_for_struct_at_2, __pyx_k_No_value_specified_for_struct_at_2, sizeof(__pyx_k_No_value_specified_for_struct_at_2), 0, 0, 1, 0}, + {&__pyx_kp_s_No_value_specified_for_struct_at_3, __pyx_k_No_value_specified_for_struct_at_3, sizeof(__pyx_k_No_value_specified_for_struct_at_3), 0, 0, 1, 0}, + {&__pyx_kp_s_No_value_specified_for_struct_at_4, __pyx_k_No_value_specified_for_struct_at_4, sizeof(__pyx_k_No_value_specified_for_struct_at_4), 0, 0, 1, 0}, + {&__pyx_kp_s_No_value_specified_for_struct_at_5, __pyx_k_No_value_specified_for_struct_at_5, sizeof(__pyx_k_No_value_specified_for_struct_at_5), 0, 0, 1, 0}, + {&__pyx_kp_s_No_value_specified_for_struct_at_6, __pyx_k_No_value_specified_for_struct_at_6, sizeof(__pyx_k_No_value_specified_for_struct_at_6), 0, 0, 1, 0}, + {&__pyx_kp_s_No_value_specified_for_struct_at_7, __pyx_k_No_value_specified_for_struct_at_7, sizeof(__pyx_k_No_value_specified_for_struct_at_7), 0, 0, 1, 0}, + {&__pyx_n_s_Optional, __pyx_k_Optional, sizeof(__pyx_k_Optional), 0, 0, 1, 1}, + {&__pyx_n_s_OrderedDict, __pyx_k_OrderedDict, sizeof(__pyx_k_OrderedDict), 0, 0, 1, 1}, + {&__pyx_n_s_POSITION, __pyx_k_POSITION, sizeof(__pyx_k_POSITION), 0, 0, 1, 1}, + {&__pyx_n_s_PickleError, __pyx_k_PickleError, sizeof(__pyx_k_PickleError), 0, 0, 1, 1}, + {&__pyx_n_s_Pyx_EnumBase, __pyx_k_Pyx_EnumBase, sizeof(__pyx_k_Pyx_EnumBase), 0, 0, 1, 1}, + {&__pyx_n_s_Pyx_EnumBase___new, __pyx_k_Pyx_EnumBase___new, sizeof(__pyx_k_Pyx_EnumBase___new), 0, 0, 1, 1}, + {&__pyx_n_s_Pyx_EnumBase___repr, __pyx_k_Pyx_EnumBase___repr, sizeof(__pyx_k_Pyx_EnumBase___repr), 0, 0, 1, 1}, + {&__pyx_n_s_Pyx_EnumBase___str, __pyx_k_Pyx_EnumBase___str, sizeof(__pyx_k_Pyx_EnumBase___str), 0, 0, 1, 1}, + {&__pyx_n_s_RuntimeError, __pyx_k_RuntimeError, sizeof(__pyx_k_RuntimeError), 0, 0, 1, 1}, + {&__pyx_n_s_SetAttributeExplicitQuantization, __pyx_k_SetAttributeExplicitQuantization, sizeof(__pyx_k_SetAttributeExplicitQuantization), 0, 0, 1, 1}, + {&__pyx_n_s_SetAttributeQuantization, __pyx_k_SetAttributeQuantization, sizeof(__pyx_k_SetAttributeQuantization), 0, 0, 1, 1}, + {&__pyx_n_s_SetSpeedOptions, __pyx_k_SetSpeedOptions, sizeof(__pyx_k_SetSpeedOptions), 0, 0, 1, 1}, + {&__pyx_kp_u_Specified_value_out_of_encoded_r, __pyx_k_Specified_value_out_of_encoded_r, sizeof(__pyx_k_Specified_value_out_of_encoded_r), 0, 1, 0, 0}, + {&__pyx_n_s_TEX_COORD, __pyx_k_TEX_COORD, sizeof(__pyx_k_TEX_COORD), 0, 0, 1, 1}, + {&__pyx_n_s_TypeError, __pyx_k_TypeError, sizeof(__pyx_k_TypeError), 0, 0, 1, 1}, + {&__pyx_kp_s_Unknown_enum_value_s, __pyx_k_Unknown_enum_value_s, sizeof(__pyx_k_Unknown_enum_value_s), 0, 0, 1, 0}, + {&__pyx_n_s_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 0, 0, 1, 1}, + {&__pyx_n_s_attr_type, __pyx_k_attr_type, sizeof(__pyx_k_attr_type), 0, 0, 1, 1}, + {&__pyx_n_s_axis, __pyx_k_axis, sizeof(__pyx_k_axis), 0, 0, 1, 1}, + {&__pyx_n_s_buffer, __pyx_k_buffer, sizeof(__pyx_k_buffer), 0, 0, 1, 1}, + {&__pyx_n_s_class, __pyx_k_class, sizeof(__pyx_k_class), 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_cls, __pyx_k_cls, sizeof(__pyx_k_cls), 0, 0, 1, 1}, + {&__pyx_n_s_collections, __pyx_k_collections, sizeof(__pyx_k_collections), 0, 0, 1, 1}, + {&__pyx_n_s_compression_level, __pyx_k_compression_level, sizeof(__pyx_k_compression_level), 0, 0, 1, 1}, + {&__pyx_n_s_create_empty_geometry_metadata, __pyx_k_create_empty_geometry_metadata, sizeof(__pyx_k_create_empty_geometry_metadata), 0, 0, 1, 1}, + {&__pyx_n_s_create_empty_metadata, __pyx_k_create_empty_metadata, sizeof(__pyx_k_create_empty_metadata), 0, 0, 1, 1}, + {&__pyx_n_s_create_metadata, __pyx_k_create_metadata, sizeof(__pyx_k_create_metadata), 0, 0, 1, 1}, + {&__pyx_kp_u_d, __pyx_k_d, sizeof(__pyx_k_d), 0, 1, 0, 0}, + {&__pyx_n_s_data, __pyx_k_data, sizeof(__pyx_k_data), 0, 0, 1, 1}, + {&__pyx_n_s_data_struct, __pyx_k_data_struct, sizeof(__pyx_k_data_struct), 0, 0, 1, 1}, + {&__pyx_n_s_datatype, __pyx_k_datatype, sizeof(__pyx_k_datatype), 0, 0, 1, 1}, + {&__pyx_n_s_dct, __pyx_k_dct, sizeof(__pyx_k_dct), 0, 0, 1, 1}, + {&__pyx_kp_u_ddd, __pyx_k_ddd, sizeof(__pyx_k_ddd), 0, 1, 0, 0}, + {&__pyx_n_s_decode_buffer_to_mesh, __pyx_k_decode_buffer_to_mesh, sizeof(__pyx_k_decode_buffer_to_mesh), 0, 0, 1, 1}, + {&__pyx_n_s_decode_point_cloud_buffer, __pyx_k_decode_point_cloud_buffer, sizeof(__pyx_k_decode_point_cloud_buffer), 0, 0, 1, 1}, + {&__pyx_n_s_decode_status, __pyx_k_decode_status, sizeof(__pyx_k_decode_status), 0, 0, 1, 1}, + {&__pyx_n_s_decoding_speed, __pyx_k_decoding_speed, sizeof(__pyx_k_decoding_speed), 0, 0, 1, 1}, + {&__pyx_n_s_decoding_status, __pyx_k_decoding_status, sizeof(__pyx_k_decoding_status), 0, 0, 1, 1}, + {&__pyx_n_s_deduplicate, __pyx_k_deduplicate, sizeof(__pyx_k_deduplicate), 0, 0, 1, 1}, + {&__pyx_n_s_dict, __pyx_k_dict, sizeof(__pyx_k_dict), 0, 0, 1, 1}, + {&__pyx_n_s_difference, __pyx_k_difference, sizeof(__pyx_k_difference), 0, 0, 1, 1}, + {&__pyx_n_s_dimension, __pyx_k_dimension, sizeof(__pyx_k_dimension), 0, 0, 1, 1}, + {&__pyx_n_s_doc, __pyx_k_doc, sizeof(__pyx_k_doc), 0, 0, 1, 1}, + {&__pyx_n_s_draco_encoded, __pyx_k_draco_encoded, sizeof(__pyx_k_draco_encoded), 0, 0, 1, 1}, + {&__pyx_n_s_encode_mesh_to_buffer, __pyx_k_encode_mesh_to_buffer, sizeof(__pyx_k_encode_mesh_to_buffer), 0, 0, 1, 1}, + {&__pyx_n_s_encode_point_cloud_to_buffer, __pyx_k_encode_point_cloud_to_buffer, sizeof(__pyx_k_encode_point_cloud_to_buffer), 0, 0, 1, 1}, + {&__pyx_n_s_encode_to_buffer, __pyx_k_encode_to_buffer, sizeof(__pyx_k_encode_to_buffer), 0, 0, 1, 1}, + {&__pyx_n_s_encoded_point, __pyx_k_encoded_point, sizeof(__pyx_k_encoded_point), 0, 0, 1, 1}, + {&__pyx_n_s_encoder, __pyx_k_encoder, sizeof(__pyx_k_encoder), 0, 0, 1, 1}, + {&__pyx_n_s_encoding_options, __pyx_k_encoding_options, sizeof(__pyx_k_encoding_options), 0, 0, 1, 1}, + {&__pyx_n_s_encoding_options_set, __pyx_k_encoding_options_set, sizeof(__pyx_k_encoding_options_set), 0, 0, 1, 1}, + {&__pyx_n_u_encoding_options_set, __pyx_k_encoding_options_set, sizeof(__pyx_k_encoding_options_set), 0, 1, 0, 1}, + {&__pyx_n_s_encoding_speed, __pyx_k_encoding_speed, sizeof(__pyx_k_encoding_speed), 0, 0, 1, 1}, + {&__pyx_n_s_entries, __pyx_k_entries, sizeof(__pyx_k_entries), 0, 0, 1, 1}, + {&__pyx_n_u_entries, __pyx_k_entries, sizeof(__pyx_k_entries), 0, 1, 0, 1}, + {&__pyx_n_s_enum, __pyx_k_enum, sizeof(__pyx_k_enum), 0, 0, 1, 1}, + {&__pyx_n_s_faces, __pyx_k_faces, sizeof(__pyx_k_faces), 0, 0, 1, 1}, + {&__pyx_n_u_faces, __pyx_k_faces, sizeof(__pyx_k_faces), 0, 1, 0, 1}, + {&__pyx_n_s_floor, __pyx_k_floor, sizeof(__pyx_k_floor), 0, 0, 1, 1}, + {&__pyx_n_s_generic_attributes, __pyx_k_generic_attributes, sizeof(__pyx_k_generic_attributes), 0, 0, 1, 1}, + {&__pyx_n_u_generic_attributes, __pyx_k_generic_attributes, sizeof(__pyx_k_generic_attributes), 0, 1, 0, 1}, + {&__pyx_kp_u_generic_attributes_encoding_deco, __pyx_k_generic_attributes_encoding_deco, sizeof(__pyx_k_generic_attributes_encoding_deco), 0, 1, 0, 0}, + {&__pyx_n_s_geometry_metadata, __pyx_k_geometry_metadata, sizeof(__pyx_k_geometry_metadata), 0, 0, 1, 1}, + {&__pyx_n_u_geometry_metadata, __pyx_k_geometry_metadata, sizeof(__pyx_k_geometry_metadata), 0, 1, 0, 1}, + {&__pyx_n_s_get_encoded_coordinate, __pyx_k_get_encoded_coordinate, sizeof(__pyx_k_get_encoded_coordinate), 0, 0, 1, 1}, + {&__pyx_n_s_get_encoded_point, __pyx_k_get_encoded_point, sizeof(__pyx_k_get_encoded_point), 0, 0, 1, 1}, + {&__pyx_n_s_getstate, __pyx_k_getstate, sizeof(__pyx_k_getstate), 0, 0, 1, 1}, + {&__pyx_kp_u_i, __pyx_k_i, sizeof(__pyx_k_i), 0, 1, 0, 0}, + {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1}, + {&__pyx_n_s_init, __pyx_k_init, sizeof(__pyx_k_init), 0, 0, 1, 1}, + {&__pyx_n_s_inverse_alpha, __pyx_k_inverse_alpha, sizeof(__pyx_k_inverse_alpha), 0, 0, 1, 1}, + {&__pyx_n_s_is_mesh, __pyx_k_is_mesh, sizeof(__pyx_k_is_mesh), 0, 0, 1, 1}, + {&__pyx_n_s_iteritems, __pyx_k_iteritems, sizeof(__pyx_k_iteritems), 0, 0, 1, 1}, + {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1}, + {&__pyx_n_s_math, __pyx_k_math, sizeof(__pyx_k_math), 0, 0, 1, 1}, + {&__pyx_n_s_members, __pyx_k_members, sizeof(__pyx_k_members), 0, 0, 1, 1}, + {&__pyx_n_s_mesh_struct, __pyx_k_mesh_struct, sizeof(__pyx_k_mesh_struct), 0, 0, 1, 1}, + {&__pyx_n_s_metaclass, __pyx_k_metaclass, sizeof(__pyx_k_metaclass), 0, 0, 1, 1}, + {&__pyx_n_s_metadata_id, __pyx_k_metadata_id, sizeof(__pyx_k_metadata_id), 0, 0, 1, 1}, + {&__pyx_n_u_metadata_id, __pyx_k_metadata_id, sizeof(__pyx_k_metadata_id), 0, 1, 0, 1}, + {&__pyx_n_s_metadatas, __pyx_k_metadatas, sizeof(__pyx_k_metadatas), 0, 0, 1, 1}, + {&__pyx_n_u_metadatas, __pyx_k_metadatas, sizeof(__pyx_k_metadatas), 0, 1, 0, 1}, + {&__pyx_n_s_module, __pyx_k_module, sizeof(__pyx_k_module), 0, 0, 1, 1}, + {&__pyx_n_s_name, __pyx_k_name, sizeof(__pyx_k_name), 0, 0, 1, 1}, + {&__pyx_n_s_name_2, __pyx_k_name_2, sizeof(__pyx_k_name_2), 0, 0, 1, 1}, + {&__pyx_n_s_new, __pyx_k_new, sizeof(__pyx_k_new), 0, 0, 1, 1}, + {&__pyx_kp_s_no_default___reduce___due_to_non, __pyx_k_no_default___reduce___due_to_non, sizeof(__pyx_k_no_default___reduce___due_to_non), 0, 0, 1, 0}, + {&__pyx_n_s_normals, __pyx_k_normals, sizeof(__pyx_k_normals), 0, 0, 1, 1}, + {&__pyx_n_u_normals, __pyx_k_normals, sizeof(__pyx_k_normals), 0, 1, 0, 1}, + {&__pyx_n_s_num_axes, __pyx_k_num_axes, sizeof(__pyx_k_num_axes), 0, 0, 1, 1}, + {&__pyx_n_s_object, __pyx_k_object, sizeof(__pyx_k_object), 0, 0, 1, 1}, + {&__pyx_n_s_pack, __pyx_k_pack, sizeof(__pyx_k_pack), 0, 0, 1, 1}, + {&__pyx_n_s_parents, __pyx_k_parents, sizeof(__pyx_k_parents), 0, 0, 1, 1}, + {&__pyx_n_s_pickle, __pyx_k_pickle, sizeof(__pyx_k_pickle), 0, 0, 1, 1}, + {&__pyx_n_s_point, __pyx_k_point, sizeof(__pyx_k_point), 0, 0, 1, 1}, + {&__pyx_n_s_point_cloud_struct, __pyx_k_point_cloud_struct, sizeof(__pyx_k_point_cloud_struct), 0, 0, 1, 1}, + {&__pyx_n_s_points, __pyx_k_points, sizeof(__pyx_k_points), 0, 0, 1, 1}, + {&__pyx_n_u_points, __pyx_k_points, sizeof(__pyx_k_points), 0, 1, 0, 1}, + {&__pyx_n_s_prepare, __pyx_k_prepare, sizeof(__pyx_k_prepare), 0, 0, 1, 1}, + {&__pyx_n_s_property, __pyx_k_property, sizeof(__pyx_k_property), 0, 0, 1, 1}, + {&__pyx_n_s_pyx_PickleError, __pyx_k_pyx_PickleError, sizeof(__pyx_k_pyx_PickleError), 0, 0, 1, 1}, + {&__pyx_n_s_pyx_checksum, __pyx_k_pyx_checksum, sizeof(__pyx_k_pyx_checksum), 0, 0, 1, 1}, + {&__pyx_n_s_pyx_result, __pyx_k_pyx_result, sizeof(__pyx_k_pyx_result), 0, 0, 1, 1}, + {&__pyx_n_s_pyx_state, __pyx_k_pyx_state, sizeof(__pyx_k_pyx_state), 0, 0, 1, 1}, + {&__pyx_n_s_pyx_type, __pyx_k_pyx_type, sizeof(__pyx_k_pyx_type), 0, 0, 1, 1}, + {&__pyx_n_s_pyx_unpickle___Pyx_EnumMeta, __pyx_k_pyx_unpickle___Pyx_EnumMeta, sizeof(__pyx_k_pyx_unpickle___Pyx_EnumMeta), 0, 0, 1, 1}, + {&__pyx_n_s_qualname, __pyx_k_qualname, sizeof(__pyx_k_qualname), 0, 0, 1, 1}, + {&__pyx_n_s_quant_origin, __pyx_k_quant_origin, sizeof(__pyx_k_quant_origin), 0, 0, 1, 1}, + {&__pyx_n_b_quantization_bits, __pyx_k_quantization_bits, sizeof(__pyx_k_quantization_bits), 0, 0, 0, 1}, + {&__pyx_n_s_quantization_bits, __pyx_k_quantization_bits, sizeof(__pyx_k_quantization_bits), 0, 0, 1, 1}, + {&__pyx_n_u_quantization_bits, __pyx_k_quantization_bits, sizeof(__pyx_k_quantization_bits), 0, 1, 0, 1}, + {&__pyx_n_b_quantization_origin, __pyx_k_quantization_origin, sizeof(__pyx_k_quantization_origin), 0, 0, 0, 1}, + {&__pyx_n_s_quantization_origin, __pyx_k_quantization_origin, sizeof(__pyx_k_quantization_origin), 0, 0, 1, 1}, + {&__pyx_n_u_quantization_origin, __pyx_k_quantization_origin, sizeof(__pyx_k_quantization_origin), 0, 1, 0, 1}, + {&__pyx_n_b_quantization_range, __pyx_k_quantization_range, sizeof(__pyx_k_quantization_range), 0, 0, 0, 1}, + {&__pyx_n_s_quantization_range, __pyx_k_quantization_range, sizeof(__pyx_k_quantization_range), 0, 0, 1, 1}, + {&__pyx_n_u_quantization_range, __pyx_k_quantization_range, sizeof(__pyx_k_quantization_range), 0, 1, 0, 1}, + {&__pyx_n_s_quantized_index, __pyx_k_quantized_index, sizeof(__pyx_k_quantized_index), 0, 0, 1, 1}, + {&__pyx_n_s_raise_decoding_error, __pyx_k_raise_decoding_error, sizeof(__pyx_k_raise_decoding_error), 0, 0, 1, 1}, + {&__pyx_n_s_range, __pyx_k_range, sizeof(__pyx_k_range), 0, 0, 1, 1}, + {&__pyx_n_s_reduce, __pyx_k_reduce, sizeof(__pyx_k_reduce), 0, 0, 1, 1}, + {&__pyx_n_s_reduce_cython, __pyx_k_reduce_cython, sizeof(__pyx_k_reduce_cython), 0, 0, 1, 1}, + {&__pyx_n_s_reduce_ex, __pyx_k_reduce_ex, sizeof(__pyx_k_reduce_ex), 0, 0, 1, 1}, + {&__pyx_n_s_repr, __pyx_k_repr, sizeof(__pyx_k_repr), 0, 0, 1, 1}, + {&__pyx_n_s_res, __pyx_k_res, sizeof(__pyx_k_res), 0, 0, 1, 1}, + {&__pyx_n_s_return, __pyx_k_return, sizeof(__pyx_k_return), 0, 0, 1, 1}, + {&__pyx_kp_s_s_s, __pyx_k_s_s, sizeof(__pyx_k_s_s), 0, 0, 1, 0}, + {&__pyx_kp_s_s_s_d, __pyx_k_s_s_d, sizeof(__pyx_k_s_s_d), 0, 0, 1, 0}, + {&__pyx_n_s_self, __pyx_k_self, sizeof(__pyx_k_self), 0, 0, 1, 1}, + {&__pyx_n_s_setstate, __pyx_k_setstate, sizeof(__pyx_k_setstate), 0, 0, 1, 1}, + {&__pyx_n_s_setstate_cython, __pyx_k_setstate_cython, sizeof(__pyx_k_setstate_cython), 0, 0, 1, 1}, + {&__pyx_kp_s_src_DracoPy_pyx, __pyx_k_src_DracoPy_pyx, sizeof(__pyx_k_src_DracoPy_pyx), 0, 0, 1, 0}, + {&__pyx_n_s_str, __pyx_k_str, sizeof(__pyx_k_str), 0, 0, 1, 1}, + {&__pyx_kp_s_stringsource, __pyx_k_stringsource, sizeof(__pyx_k_stringsource), 0, 0, 1, 0}, + {&__pyx_n_s_struct, __pyx_k_struct, sizeof(__pyx_k_struct), 0, 0, 1, 1}, + {&__pyx_n_s_sub_metadata_ids, __pyx_k_sub_metadata_ids, sizeof(__pyx_k_sub_metadata_ids), 0, 0, 1, 1}, + {&__pyx_n_u_sub_metadata_ids, __pyx_k_sub_metadata_ids, sizeof(__pyx_k_sub_metadata_ids), 0, 1, 0, 1}, + {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1}, + {&__pyx_n_s_typing, __pyx_k_typing, sizeof(__pyx_k_typing), 0, 0, 1, 1}, + {&__pyx_n_s_update, __pyx_k_update, sizeof(__pyx_k_update), 0, 0, 1, 1}, + {&__pyx_n_s_v, __pyx_k_v, sizeof(__pyx_k_v), 0, 0, 1, 1}, + {&__pyx_n_s_value, __pyx_k_value, sizeof(__pyx_k_value), 0, 0, 1, 1}, + {&__pyx_n_s_values, __pyx_k_values, sizeof(__pyx_k_values), 0, 0, 1, 1}, + {0, 0, 0, 0, 0, 0, 0} +}; +static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) { + __pyx_builtin_object = __Pyx_GetBuiltinName(__pyx_n_s_object); if (!__pyx_builtin_object) __PYX_ERR(0, 39, __pyx_L1_error) + __pyx_builtin_property = __Pyx_GetBuiltinName(__pyx_n_s_property); if (!__pyx_builtin_property) __PYX_ERR(0, 56, __pyx_L1_error) + __pyx_builtin_TypeError = __Pyx_GetBuiltinName(__pyx_n_s_TypeError); if (!__pyx_builtin_TypeError) __PYX_ERR(1, 2, __pyx_L1_error) + __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(0, 92, __pyx_L1_error) + __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 99, __pyx_L1_error) + __pyx_builtin_RuntimeError = __Pyx_GetBuiltinName(__pyx_n_s_RuntimeError); if (!__pyx_builtin_RuntimeError) __PYX_ERR(0, 279, __pyx_L1_error) + __pyx_builtin_KeyError = __Pyx_GetBuiltinName(__pyx_n_s_KeyError); if (!__pyx_builtin_KeyError) __PYX_ERR(1, 18, __pyx_L1_error) + return 0; + __pyx_L1_error:; + return -1; +} + +static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); + + /* "(tree fragment)":2 + * def __reduce_cython__(self): + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< + * def __setstate_cython__(self, __pyx_state): + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + */ + __pyx_tuple_ = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple_)) __PYX_ERR(1, 2, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple_); + __Pyx_GIVEREF(__pyx_tuple_); + + /* "(tree fragment)":4 + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") + * def __setstate_cython__(self, __pyx_state): + * raise TypeError("no default __reduce__ due to non-trivial __cinit__") # <<<<<<<<<<<<<< + */ + __pyx_tuple__2 = PyTuple_Pack(1, __pyx_kp_s_no_default___reduce___due_to_non); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(1, 4, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__2); + __Pyx_GIVEREF(__pyx_tuple__2); + + /* "DracoPy.pyx":92 + * def get_encoded_coordinate(self, value, axis): + * if value < self.quantization_origin[axis] or value > (self.quantization_origin[axis] + self.quantization_range): + * raise ValueError('Specified value out of encoded range') # <<<<<<<<<<<<<< + * difference = value - self.quantization_origin[axis] + * quantized_index = floor((difference / self.inverse_alpha) + 0.5) + */ + __pyx_tuple__3 = PyTuple_Pack(1, __pyx_kp_u_Specified_value_out_of_encoded_r); if (unlikely(!__pyx_tuple__3)) __PYX_ERR(0, 92, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__3); + __Pyx_GIVEREF(__pyx_tuple__3); + + /* "DracoPy.pyx":279 + * if not is_mesh and isinstance(geometry_metadata, dict) and \ + * len(geometry_metadata["generic_attributes"]) > 0: + * raise RuntimeError("generic attributes encoding/decoding " # <<<<<<<<<<<<<< + * "is not supported for point cloud") + * if metadatas is None: + */ + __pyx_tuple__5 = PyTuple_Pack(1, __pyx_kp_u_generic_attributes_encoding_deco); if (unlikely(!__pyx_tuple__5)) __PYX_ERR(0, 279, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__5); + __Pyx_GIVEREF(__pyx_tuple__5); + + /* "DracoPy.pyx":309 + * if quant_origin != NULL: + * PyMem_Free(quant_origin) + * raise ValueError("Input invalid") # <<<<<<<<<<<<<< + * + * def raise_decoding_error(decoding_status): + */ + __pyx_tuple__6 = PyTuple_Pack(1, __pyx_kp_u_Input_invalid); if (unlikely(!__pyx_tuple__6)) __PYX_ERR(0, 309, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__6); + __Pyx_GIVEREF(__pyx_tuple__6); + + /* "DracoPy.pyx":315 + * raise FileTypeException('Input mesh is not draco encoded') + * elif decoding_status == DracoPy.decoding_status.failed_during_decoding: + * raise TypeError('Failed to decode input mesh. Data might be corrupted') # <<<<<<<<<<<<<< + * elif decoding_status == DracoPy.decoding_status.no_position_attribute: + * raise ValueError('DracoPy only supports meshes with position attributes') + */ + __pyx_tuple__7 = PyTuple_Pack(1, __pyx_kp_u_Failed_to_decode_input_mesh_Data); if (unlikely(!__pyx_tuple__7)) __PYX_ERR(0, 315, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__7); + __Pyx_GIVEREF(__pyx_tuple__7); + + /* "DracoPy.pyx":317 + * raise TypeError('Failed to decode input mesh. Data might be corrupted') + * elif decoding_status == DracoPy.decoding_status.no_position_attribute: + * raise ValueError('DracoPy only supports meshes with position attributes') # <<<<<<<<<<<<<< + * + * def decode_buffer_to_mesh(buffer, deduplicate=False): + */ + __pyx_tuple__8 = PyTuple_Pack(1, __pyx_kp_u_DracoPy_only_supports_meshes_wit); if (unlikely(!__pyx_tuple__8)) __PYX_ERR(0, 317, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__8); + __Pyx_GIVEREF(__pyx_tuple__8); + + /* "FromPyStructUtility":19 + * value = obj['data'] + * except KeyError: + * raise ValueError("No value specified for struct attribute 'data'") # <<<<<<<<<<<<<< + * result.data = value + * try: + */ + __pyx_tuple__9 = PyTuple_Pack(1, __pyx_kp_s_No_value_specified_for_struct_at); if (unlikely(!__pyx_tuple__9)) __PYX_ERR(1, 19, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__9); + __Pyx_GIVEREF(__pyx_tuple__9); + + /* "FromPyStructUtility":24 + * value = obj['datatype'] + * except KeyError: + * raise ValueError("No value specified for struct attribute 'datatype'") # <<<<<<<<<<<<<< + * result.datatype = value + * try: + */ + __pyx_tuple__10 = PyTuple_Pack(1, __pyx_kp_s_No_value_specified_for_struct_at_2); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(1, 24, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__10); + __Pyx_GIVEREF(__pyx_tuple__10); + + /* "FromPyStructUtility":29 + * value = obj['dimension'] + * except KeyError: + * raise ValueError("No value specified for struct attribute 'dimension'") # <<<<<<<<<<<<<< + * result.dimension = value + * try: + */ + __pyx_tuple__11 = PyTuple_Pack(1, __pyx_kp_s_No_value_specified_for_struct_at_3); if (unlikely(!__pyx_tuple__11)) __PYX_ERR(1, 29, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__11); + __Pyx_GIVEREF(__pyx_tuple__11); + + /* "FromPyStructUtility":34 + * value = obj['metadata_id'] + * except KeyError: + * raise ValueError("No value specified for struct attribute 'metadata_id'") # <<<<<<<<<<<<<< + * result.metadata_id = value + * return result + */ + __pyx_tuple__12 = PyTuple_Pack(1, __pyx_kp_s_No_value_specified_for_struct_at_4); if (unlikely(!__pyx_tuple__12)) __PYX_ERR(1, 34, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__12); + __Pyx_GIVEREF(__pyx_tuple__12); + + /* "FromPyStructUtility":24 + * value = obj['generic_attributes'] + * except KeyError: + * raise ValueError("No value specified for struct attribute 'generic_attributes'") # <<<<<<<<<<<<<< + * result.generic_attributes = value + * return result + */ + __pyx_tuple__13 = PyTuple_Pack(1, __pyx_kp_s_No_value_specified_for_struct_at_5); if (unlikely(!__pyx_tuple__13)) __PYX_ERR(1, 24, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__13); + __Pyx_GIVEREF(__pyx_tuple__13); + + /* "FromPyStructUtility":19 + * value = obj['entries'] + * except KeyError: + * raise ValueError("No value specified for struct attribute 'entries'") # <<<<<<<<<<<<<< + * result.entries = value + * try: + */ + __pyx_tuple__14 = PyTuple_Pack(1, __pyx_kp_s_No_value_specified_for_struct_at_6); if (unlikely(!__pyx_tuple__14)) __PYX_ERR(1, 19, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__14); + __Pyx_GIVEREF(__pyx_tuple__14); + + /* "FromPyStructUtility":24 + * value = obj['sub_metadata_ids'] + * except KeyError: + * raise ValueError("No value specified for struct attribute 'sub_metadata_ids'") # <<<<<<<<<<<<<< + * result.sub_metadata_ids = value + * return result + */ + __pyx_tuple__15 = PyTuple_Pack(1, __pyx_kp_s_No_value_specified_for_struct_at_7); if (unlikely(!__pyx_tuple__15)) __PYX_ERR(1, 24, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__15); + __Pyx_GIVEREF(__pyx_tuple__15); + + /* "DracoPy.pyx":39 + * + * + * class DracoPointCloud(object): # <<<<<<<<<<<<<< + * def __init__(self, data_struct): + * self.data_struct = data_struct + */ + __pyx_tuple__16 = PyTuple_Pack(1, __pyx_builtin_object); if (unlikely(!__pyx_tuple__16)) __PYX_ERR(0, 39, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__16); + __Pyx_GIVEREF(__pyx_tuple__16); + + /* "DracoPy.pyx":40 + * + * class DracoPointCloud(object): + * def __init__(self, data_struct): # <<<<<<<<<<<<<< + * self.data_struct = data_struct + * if data_struct['encoding_options_set']: + */ + __pyx_tuple__17 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_data_struct); if (unlikely(!__pyx_tuple__17)) __PYX_ERR(0, 40, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__17); + __Pyx_GIVEREF(__pyx_tuple__17); + __pyx_codeobj__18 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__17, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_init, 40, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__18)) __PYX_ERR(0, 40, __pyx_L1_error) + + /* "DracoPy.pyx":48 + * self.encoding_options = None + * + * def get_encoded_coordinate(self, value, axis): # <<<<<<<<<<<<<< + * if self.encoding_options is not None: + * return self.encoding_options.get_encoded_coordinate(value, axis) + */ + __pyx_tuple__19 = PyTuple_Pack(3, __pyx_n_s_self, __pyx_n_s_value, __pyx_n_s_axis); if (unlikely(!__pyx_tuple__19)) __PYX_ERR(0, 48, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__19); + __Pyx_GIVEREF(__pyx_tuple__19); + __pyx_codeobj__20 = (PyObject*)__Pyx_PyCode_New(3, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__19, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_get_encoded_coordinate, 48, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__20)) __PYX_ERR(0, 48, __pyx_L1_error) + + /* "DracoPy.pyx":52 + * return self.encoding_options.get_encoded_coordinate(value, axis) + * + * def get_encoded_point(self, point): # <<<<<<<<<<<<<< + * if self.encoding_options is not None: + * return self.encoding_options.get_encoded_point(point) + */ + __pyx_tuple__21 = PyTuple_Pack(2, __pyx_n_s_self, __pyx_n_s_point); if (unlikely(!__pyx_tuple__21)) __PYX_ERR(0, 52, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__21); + __Pyx_GIVEREF(__pyx_tuple__21); + __pyx_codeobj__22 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__21, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_get_encoded_point, 52, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__22)) __PYX_ERR(0, 52, __pyx_L1_error) + + /* "DracoPy.pyx":57 + * + * @property + * def num_axes(self): # <<<<<<<<<<<<<< + * return 3 + * + */ + __pyx_tuple__23 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__23)) __PYX_ERR(0, 57, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__23); + __Pyx_GIVEREF(__pyx_tuple__23); + __pyx_codeobj__24 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__23, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_num_axes, 57, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__24)) __PYX_ERR(0, 57, __pyx_L1_error) + + /* "DracoPy.pyx":61 + * + * @property + * def points(self) -> List[float]: # <<<<<<<<<<<<<< + * return self.data_struct['points'] + * + */ + __pyx_tuple__25 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__25)) __PYX_ERR(0, 61, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__25); + __Pyx_GIVEREF(__pyx_tuple__25); + __pyx_codeobj__26 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__25, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_points, 61, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__26)) __PYX_ERR(0, 61, __pyx_L1_error) + + /* "DracoPy.pyx":65 + * + * @property + * def geometry_metadata(self) -> Optional[Dict]: # <<<<<<<<<<<<<< + * return self.data_struct['geometry_metadata'] if self.metadatas else None + * + */ + __pyx_tuple__27 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__27)) __PYX_ERR(0, 65, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__27); + __Pyx_GIVEREF(__pyx_tuple__27); + __pyx_codeobj__28 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__27, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_geometry_metadata, 65, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__28)) __PYX_ERR(0, 65, __pyx_L1_error) + + /* "DracoPy.pyx":69 + * + * @property + * def metadatas(self) -> List[Dict]: # <<<<<<<<<<<<<< + * return self.data_struct['metadatas'] + * + */ + __pyx_tuple__29 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__29)) __PYX_ERR(0, 69, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__29); + __Pyx_GIVEREF(__pyx_tuple__29); + __pyx_codeobj__30 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__29, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_metadatas, 69, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__30)) __PYX_ERR(0, 69, __pyx_L1_error) + + /* "DracoPy.pyx":75 + * class DracoMesh(DracoPointCloud): + * @property + * def faces(self) -> List[int]: # <<<<<<<<<<<<<< + * return self.data_struct['faces'] + * + */ + __pyx_tuple__31 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__31)) __PYX_ERR(0, 75, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__31); + __Pyx_GIVEREF(__pyx_tuple__31); + __pyx_codeobj__32 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__31, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_faces, 75, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__32)) __PYX_ERR(0, 75, __pyx_L1_error) + + /* "DracoPy.pyx":79 + * + * @property + * def normals(self): # <<<<<<<<<<<<<< + * return self.data_struct['normals'] + * + */ + __pyx_tuple__33 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__33)) __PYX_ERR(0, 79, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__33); + __Pyx_GIVEREF(__pyx_tuple__33); + __pyx_codeobj__34 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__33, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_normals, 79, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__34)) __PYX_ERR(0, 79, __pyx_L1_error) + + /* "DracoPy.pyx":83 + * + * + * class EncodingOptions(object): # <<<<<<<<<<<<<< + * def __init__(self, quantization_bits, quantization_range, quantization_origin): + * self.quantization_bits = quantization_bits + */ + __pyx_tuple__35 = PyTuple_Pack(1, __pyx_builtin_object); if (unlikely(!__pyx_tuple__35)) __PYX_ERR(0, 83, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__35); + __Pyx_GIVEREF(__pyx_tuple__35); + + /* "DracoPy.pyx":84 + * + * class EncodingOptions(object): + * def __init__(self, quantization_bits, quantization_range, quantization_origin): # <<<<<<<<<<<<<< + * self.quantization_bits = quantization_bits + * self.quantization_range = quantization_range + */ + __pyx_tuple__36 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_quantization_bits, __pyx_n_s_quantization_range, __pyx_n_s_quantization_origin); if (unlikely(!__pyx_tuple__36)) __PYX_ERR(0, 84, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__36); + __Pyx_GIVEREF(__pyx_tuple__36); + __pyx_codeobj__37 = (PyObject*)__Pyx_PyCode_New(4, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__36, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_init, 84, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__37)) __PYX_ERR(0, 84, __pyx_L1_error) + + /* "DracoPy.pyx":90 + * self.inverse_alpha = quantization_range / ((2 ** quantization_bits) - 1) + * + * def get_encoded_coordinate(self, value, axis): # <<<<<<<<<<<<<< + * if value < self.quantization_origin[axis] or value > (self.quantization_origin[axis] + self.quantization_range): + * raise ValueError('Specified value out of encoded range') + */ + __pyx_tuple__38 = PyTuple_Pack(5, __pyx_n_s_self, __pyx_n_s_value, __pyx_n_s_axis, __pyx_n_s_difference, __pyx_n_s_quantized_index); if (unlikely(!__pyx_tuple__38)) __PYX_ERR(0, 90, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__38); + __Pyx_GIVEREF(__pyx_tuple__38); + __pyx_codeobj__39 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__38, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_get_encoded_coordinate, 90, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__39)) __PYX_ERR(0, 90, __pyx_L1_error) + + /* "DracoPy.pyx":97 + * return self.quantization_origin[axis] + (quantized_index * self.inverse_alpha) + * + * def get_encoded_point(self, point): # <<<<<<<<<<<<<< + * encoded_point = [] + * for axis in range(self.num_axes): + */ + __pyx_tuple__40 = PyTuple_Pack(4, __pyx_n_s_self, __pyx_n_s_point, __pyx_n_s_encoded_point, __pyx_n_s_axis); if (unlikely(!__pyx_tuple__40)) __PYX_ERR(0, 97, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__40); + __Pyx_GIVEREF(__pyx_tuple__40); + __pyx_codeobj__41 = (PyObject*)__Pyx_PyCode_New(2, 0, 4, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__40, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_get_encoded_point, 97, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__41)) __PYX_ERR(0, 97, __pyx_L1_error) + + /* "DracoPy.pyx":104 + * + * @property + * def num_axes(self): # <<<<<<<<<<<<<< + * return 3 + * + */ + __pyx_tuple__42 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__42)) __PYX_ERR(0, 104, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__42); + __Pyx_GIVEREF(__pyx_tuple__42); + __pyx_codeobj__43 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__42, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_num_axes, 104, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__43)) __PYX_ERR(0, 104, __pyx_L1_error) + + /* "DracoPy.pyx":116 + * + * + * def _create_empty_geometry_metadata() -> GeometryMetadataObject: # <<<<<<<<<<<<<< + * return { + * "metadata_id": 0, + */ + __pyx_codeobj__44 = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_create_empty_geometry_metadata, 116, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__44)) __PYX_ERR(0, 116, __pyx_L1_error) + + /* "DracoPy.pyx":123 + * + * + * def _create_empty_metadata() -> MetadataObject: # <<<<<<<<<<<<<< + * return { + * "entries": {}, + */ + __pyx_codeobj__45 = (PyObject*)__Pyx_PyCode_New(0, 0, 0, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_create_empty_metadata, 123, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__45)) __PYX_ERR(0, 123, __pyx_L1_error) + + /* "DracoPy.pyx":163 + * return encoder + * + * def encode_mesh_to_buffer(points, faces, # <<<<<<<<<<<<<< + * quantization_bits=14, + * compression_level=1, + */ + __pyx_tuple__46 = PyTuple_Pack(10, __pyx_n_s_points, __pyx_n_s_faces, __pyx_n_s_quantization_bits, __pyx_n_s_compression_level, __pyx_n_s_quantization_range, __pyx_n_s_quantization_origin, __pyx_n_s_create_metadata, __pyx_n_s_geometry_metadata, __pyx_n_s_metadatas, __pyx_n_s_encoder); if (unlikely(!__pyx_tuple__46)) __PYX_ERR(0, 163, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__46); + __Pyx_GIVEREF(__pyx_tuple__46); + __pyx_codeobj__47 = (PyObject*)__Pyx_PyCode_New(7, 0, 10, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__46, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_encode_mesh_to_buffer, 163, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__47)) __PYX_ERR(0, 163, __pyx_L1_error) + + /* "DracoPy.pyx":206 + * + * + * def encode_point_cloud_to_buffer(points, # <<<<<<<<<<<<<< + * quantization_bits=14, + * compression_level=1, + */ + __pyx_tuple__48 = PyTuple_Pack(9, __pyx_n_s_points, __pyx_n_s_quantization_bits, __pyx_n_s_compression_level, __pyx_n_s_quantization_range, __pyx_n_s_quantization_origin, __pyx_n_s_create_metadata, __pyx_n_s_geometry_metadata, __pyx_n_s_metadatas, __pyx_n_s_encoder); if (unlikely(!__pyx_tuple__48)) __PYX_ERR(0, 206, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__48); + __Pyx_GIVEREF(__pyx_tuple__48); + __pyx_codeobj__49 = (PyObject*)__Pyx_PyCode_New(6, 0, 9, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__48, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_encode_point_cloud_to_buffer, 206, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__49)) __PYX_ERR(0, 206, __pyx_L1_error) + + /* "DracoPy.pyx":247 + * + * + * def encode_to_buffer(points: List[float], # <<<<<<<<<<<<<< + * faces: List[int] = None, + * encoder: Encoder = Encoder(), + */ + __pyx_tuple__50 = PyTuple_Pack(8, __pyx_n_s_points, __pyx_n_s_faces, __pyx_n_s_encoder, __pyx_n_s_metadatas, __pyx_n_s_geometry_metadata, __pyx_n_s_is_mesh, __pyx_n_s_quant_origin, __pyx_n_s_draco_encoded); if (unlikely(!__pyx_tuple__50)) __PYX_ERR(0, 247, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__50); + __Pyx_GIVEREF(__pyx_tuple__50); + __pyx_codeobj__51 = (PyObject*)__Pyx_PyCode_New(5, 0, 8, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__50, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_encode_to_buffer, 247, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__51)) __PYX_ERR(0, 247, __pyx_L1_error) + + /* "DracoPy.pyx":311 + * raise ValueError("Input invalid") + * + * def raise_decoding_error(decoding_status): # <<<<<<<<<<<<<< + * if decoding_status == DracoPy.decoding_status.not_draco_encoded: + * raise FileTypeException('Input mesh is not draco encoded') + */ + __pyx_tuple__52 = PyTuple_Pack(1, __pyx_n_s_decoding_status); if (unlikely(!__pyx_tuple__52)) __PYX_ERR(0, 311, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__52); + __Pyx_GIVEREF(__pyx_tuple__52); + __pyx_codeobj__53 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__52, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_raise_decoding_error, 311, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__53)) __PYX_ERR(0, 311, __pyx_L1_error) + + /* "DracoPy.pyx":319 + * raise ValueError('DracoPy only supports meshes with position attributes') + * + * def decode_buffer_to_mesh(buffer, deduplicate=False): # <<<<<<<<<<<<<< + * """ + * Decode buffer to mesh + */ + __pyx_tuple__54 = PyTuple_Pack(3, __pyx_n_s_buffer, __pyx_n_s_deduplicate, __pyx_n_s_mesh_struct); if (unlikely(!__pyx_tuple__54)) __PYX_ERR(0, 319, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__54); + __Pyx_GIVEREF(__pyx_tuple__54); + __pyx_codeobj__55 = (PyObject*)__Pyx_PyCode_New(2, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__54, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_decode_buffer_to_mesh, 319, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__55)) __PYX_ERR(0, 319, __pyx_L1_error) + + /* "DracoPy.pyx":332 + * raise_decoding_error(mesh_struct.decode_status) + * + * def decode_point_cloud_buffer(buffer, deduplicate=False): # <<<<<<<<<<<<<< + * """ + * Decode buffer to point cloud + */ + __pyx_tuple__56 = PyTuple_Pack(3, __pyx_n_s_buffer, __pyx_n_s_deduplicate, __pyx_n_s_point_cloud_struct); if (unlikely(!__pyx_tuple__56)) __PYX_ERR(0, 332, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__56); + __Pyx_GIVEREF(__pyx_tuple__56); + __pyx_codeobj__57 = (PyObject*)__Pyx_PyCode_New(2, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__56, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_src_DracoPy_pyx, __pyx_n_s_decode_point_cloud_buffer, 332, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__57)) __PYX_ERR(0, 332, __pyx_L1_error) + + /* "EnumBase":28 + * class __Pyx_EnumBase(int): + * __metaclass__ = __Pyx_EnumMeta + * def __new__(cls, value, name=None): # <<<<<<<<<<<<<< + * for v in cls: + * if v == value: + */ + __pyx_tuple__58 = PyTuple_Pack(5, __pyx_n_s_cls, __pyx_n_s_value, __pyx_n_s_name, __pyx_n_s_v, __pyx_n_s_res); if (unlikely(!__pyx_tuple__58)) __PYX_ERR(1, 28, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__58); + __Pyx_GIVEREF(__pyx_tuple__58); + __pyx_codeobj__59 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__58, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_new, 28, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__59)) __PYX_ERR(1, 28, __pyx_L1_error) + __pyx_tuple__60 = PyTuple_Pack(1, ((PyObject *)Py_None)); if (unlikely(!__pyx_tuple__60)) __PYX_ERR(1, 28, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__60); + __Pyx_GIVEREF(__pyx_tuple__60); + + /* "EnumBase":39 + * cls.__members__[name] = res + * return res + * def __repr__(self): # <<<<<<<<<<<<<< + * return "<%s.%s: %d>" % (self.__class__.__name__, self.name, self) + * def __str__(self): + */ + __pyx_tuple__61 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__61)) __PYX_ERR(1, 39, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__61); + __Pyx_GIVEREF(__pyx_tuple__61); + __pyx_codeobj__62 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__61, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_repr, 39, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__62)) __PYX_ERR(1, 39, __pyx_L1_error) + + /* "EnumBase":41 + * def __repr__(self): + * return "<%s.%s: %d>" % (self.__class__.__name__, self.name, self) + * def __str__(self): # <<<<<<<<<<<<<< + * return "%s.%s" % (self.__class__.__name__, self.name) + * + */ + __pyx_tuple__63 = PyTuple_Pack(1, __pyx_n_s_self); if (unlikely(!__pyx_tuple__63)) __PYX_ERR(1, 41, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__63); + __Pyx_GIVEREF(__pyx_tuple__63); + __pyx_codeobj__64 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__63, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_str, 41, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__64)) __PYX_ERR(1, 41, __pyx_L1_error) + + /* "(tree fragment)":1 + * def __pyx_unpickle___Pyx_EnumMeta(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<< + * cdef object __pyx_PickleError + * cdef object __pyx_result + */ + __pyx_tuple__65 = PyTuple_Pack(5, __pyx_n_s_pyx_type, __pyx_n_s_pyx_checksum, __pyx_n_s_pyx_state, __pyx_n_s_pyx_PickleError, __pyx_n_s_pyx_result); if (unlikely(!__pyx_tuple__65)) __PYX_ERR(1, 1, __pyx_L1_error) + __Pyx_GOTREF(__pyx_tuple__65); + __Pyx_GIVEREF(__pyx_tuple__65); + __pyx_codeobj__66 = (PyObject*)__Pyx_PyCode_New(3, 0, 5, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__65, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_stringsource, __pyx_n_s_pyx_unpickle___Pyx_EnumMeta, 1, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__66)) __PYX_ERR(1, 1, __pyx_L1_error) + __Pyx_RefNannyFinishContext(); + return 0; + __pyx_L1_error:; + __Pyx_RefNannyFinishContext(); + return -1; +} + +static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) { + if (__Pyx_InitStrings(__pyx_string_tab) < 0) __PYX_ERR(0, 1, __pyx_L1_error); + __pyx_float_0_5 = PyFloat_FromDouble(0.5); if (unlikely(!__pyx_float_0_5)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_int_2 = PyInt_FromLong(2); if (unlikely(!__pyx_int_2)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_int_3 = PyInt_FromLong(3); if (unlikely(!__pyx_int_3)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_int_14 = PyInt_FromLong(14); if (unlikely(!__pyx_int_14)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_int_222419149 = PyInt_FromLong(222419149L); if (unlikely(!__pyx_int_222419149)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_int_neg_1 = PyInt_FromLong(-1); if (unlikely(!__pyx_int_neg_1)) __PYX_ERR(0, 1, __pyx_L1_error) + return 0; + __pyx_L1_error:; + return -1; +} + +static CYTHON_SMALL_CODE int __Pyx_modinit_global_init_code(void); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_modinit_variable_export_code(void); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_modinit_function_export_code(void); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_modinit_type_init_code(void); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_modinit_type_import_code(void); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_modinit_variable_import_code(void); /*proto*/ +static CYTHON_SMALL_CODE int __Pyx_modinit_function_import_code(void); /*proto*/ + +static int __Pyx_modinit_global_init_code(void) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__Pyx_modinit_global_init_code", 0); + /*--- Global init code ---*/ + __Pyx_OrderedDict = Py_None; Py_INCREF(Py_None); + __Pyx_EnumBase = Py_None; Py_INCREF(Py_None); + __Pyx_globals = ((PyObject*)Py_None); Py_INCREF(Py_None); + __Pyx_RefNannyFinishContext(); + return 0; +} + +static int __Pyx_modinit_variable_export_code(void) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__Pyx_modinit_variable_export_code", 0); + /*--- Variable export code ---*/ + __Pyx_RefNannyFinishContext(); + return 0; +} + +static int __Pyx_modinit_function_export_code(void) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__Pyx_modinit_function_export_code", 0); + /*--- Function export code ---*/ + __Pyx_RefNannyFinishContext(); + return 0; +} + +static int __Pyx_modinit_type_init_code(void) { + __Pyx_RefNannyDeclarations + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0); + /*--- Type init code ---*/ + if (PyType_Ready(&__pyx_type_7DracoPy_Encoder) < 0) __PYX_ERR(0, 10, __pyx_L1_error) + #if PY_VERSION_HEX < 0x030800B1 + __pyx_type_7DracoPy_Encoder.tp_print = 0; + #endif + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__pyx_type_7DracoPy_Encoder.tp_dictoffset && __pyx_type_7DracoPy_Encoder.tp_getattro == PyObject_GenericGetAttr)) { + __pyx_type_7DracoPy_Encoder.tp_getattro = __Pyx_PyObject_GenericGetAttr; + } + if (PyObject_SetAttr(__pyx_m, __pyx_n_s_Encoder, (PyObject *)&__pyx_type_7DracoPy_Encoder) < 0) __PYX_ERR(0, 10, __pyx_L1_error) + if (__Pyx_setup_reduce((PyObject*)&__pyx_type_7DracoPy_Encoder) < 0) __PYX_ERR(0, 10, __pyx_L1_error) + __pyx_ptype_7DracoPy_Encoder = &__pyx_type_7DracoPy_Encoder; + __Pyx_EnumMeta.tp_base = (&PyType_Type); + if (PyType_Ready(&__Pyx_EnumMeta) < 0) __PYX_ERR(1, 15, __pyx_L1_error) + #if PY_VERSION_HEX < 0x030800B1 + __Pyx_EnumMeta.tp_print = 0; + #endif + if ((CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP) && likely(!__Pyx_EnumMeta.tp_dictoffset && __Pyx_EnumMeta.tp_getattro == PyObject_GenericGetAttr)) { + __Pyx_EnumMeta.tp_getattro = __Pyx_PyObject_GenericGetAttr; + } + if (__Pyx_setup_reduce((PyObject*)&__Pyx_EnumMeta) < 0) __PYX_ERR(1, 15, __pyx_L1_error) + __pyx_ptype___Pyx_EnumMeta = &__Pyx_EnumMeta; + __Pyx_RefNannyFinishContext(); + return 0; + __pyx_L1_error:; + __Pyx_RefNannyFinishContext(); + return -1; +} + +static int __Pyx_modinit_type_import_code(void) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__Pyx_modinit_type_import_code", 0); + /*--- Type import code ---*/ + __Pyx_RefNannyFinishContext(); + return 0; +} + +static int __Pyx_modinit_variable_import_code(void) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__Pyx_modinit_variable_import_code", 0); + /*--- Variable import code ---*/ + __Pyx_RefNannyFinishContext(); + return 0; +} + +static int __Pyx_modinit_function_import_code(void) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__Pyx_modinit_function_import_code", 0); + /*--- Function import code ---*/ + __Pyx_RefNannyFinishContext(); + return 0; +} + + +#ifndef CYTHON_NO_PYINIT_EXPORT +#define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC +#elif PY_MAJOR_VERSION < 3 +#ifdef __cplusplus +#define __Pyx_PyMODINIT_FUNC extern "C" void +#else +#define __Pyx_PyMODINIT_FUNC void +#endif +#else +#ifdef __cplusplus +#define __Pyx_PyMODINIT_FUNC extern "C" PyObject * +#else +#define __Pyx_PyMODINIT_FUNC PyObject * +#endif +#endif + + +#if PY_MAJOR_VERSION < 3 +__Pyx_PyMODINIT_FUNC initDracoPy(void) CYTHON_SMALL_CODE; /*proto*/ +__Pyx_PyMODINIT_FUNC initDracoPy(void) +#else +__Pyx_PyMODINIT_FUNC PyInit_DracoPy(void) CYTHON_SMALL_CODE; /*proto*/ +__Pyx_PyMODINIT_FUNC PyInit_DracoPy(void) +#if CYTHON_PEP489_MULTI_PHASE_INIT +{ + return PyModuleDef_Init(&__pyx_moduledef); +} +static CYTHON_SMALL_CODE int __Pyx_check_single_interpreter(void) { + #if PY_VERSION_HEX >= 0x030700A1 + static PY_INT64_T main_interpreter_id = -1; + PY_INT64_T current_id = PyInterpreterState_GetID(PyThreadState_Get()->interp); + if (main_interpreter_id == -1) { + main_interpreter_id = current_id; + return (unlikely(current_id == -1)) ? -1 : 0; + } else if (unlikely(main_interpreter_id != current_id)) + #else + static PyInterpreterState *main_interpreter = NULL; + PyInterpreterState *current_interpreter = PyThreadState_Get()->interp; + if (!main_interpreter) { + main_interpreter = current_interpreter; + } else if (unlikely(main_interpreter != current_interpreter)) + #endif + { + PyErr_SetString( + PyExc_ImportError, + "Interpreter change detected - this module can only be loaded into one interpreter per process."); + return -1; + } + return 0; +} +static CYTHON_SMALL_CODE int __Pyx_copy_spec_to_module(PyObject *spec, PyObject *moddict, const char* from_name, const char* to_name, int allow_none) { + PyObject *value = PyObject_GetAttrString(spec, from_name); + int result = 0; + if (likely(value)) { + if (allow_none || value != Py_None) { + result = PyDict_SetItemString(moddict, to_name, value); + } + Py_DECREF(value); + } else if (PyErr_ExceptionMatches(PyExc_AttributeError)) { + PyErr_Clear(); + } else { + result = -1; + } + return result; +} +static CYTHON_SMALL_CODE PyObject* __pyx_pymod_create(PyObject *spec, CYTHON_UNUSED PyModuleDef *def) { + PyObject *module = NULL, *moddict, *modname; + if (__Pyx_check_single_interpreter()) + return NULL; + if (__pyx_m) + return __Pyx_NewRef(__pyx_m); + modname = PyObject_GetAttrString(spec, "name"); + if (unlikely(!modname)) goto bad; + module = PyModule_NewObject(modname); + Py_DECREF(modname); + if (unlikely(!module)) goto bad; + moddict = PyModule_GetDict(module); + if (unlikely(!moddict)) goto bad; + if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "loader", "__loader__", 1) < 0)) goto bad; + if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "origin", "__file__", 1) < 0)) goto bad; + if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "parent", "__package__", 1) < 0)) goto bad; + if (unlikely(__Pyx_copy_spec_to_module(spec, moddict, "submodule_search_locations", "__path__", 0) < 0)) goto bad; + return module; +bad: + Py_XDECREF(module); + return NULL; +} + + +static CYTHON_SMALL_CODE int __pyx_pymod_exec_DracoPy(PyObject *__pyx_pyinit_module) +#endif +#endif +{ + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + int __pyx_t_7; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + PyObject *__pyx_t_10 = NULL; + PyObject *__pyx_t_11 = NULL; + PyObject *__pyx_t_12 = NULL; + PyObject *__pyx_t_13 = NULL; + PyObject *__pyx_t_14 = NULL; + PyObject *__pyx_t_15 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannyDeclarations + #if CYTHON_PEP489_MULTI_PHASE_INIT + if (__pyx_m) { + if (__pyx_m == __pyx_pyinit_module) return 0; + PyErr_SetString(PyExc_RuntimeError, "Module 'DracoPy' has already been imported. Re-initialisation is not supported."); + return -1; + } + #elif PY_MAJOR_VERSION >= 3 + if (__pyx_m) return __Pyx_NewRef(__pyx_m); + #endif + #if CYTHON_REFNANNY +__Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); +if (!__Pyx_RefNanny) { + PyErr_Clear(); + __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny"); + if (!__Pyx_RefNanny) + Py_FatalError("failed to import 'refnanny' module"); +} +#endif + __Pyx_RefNannySetupContext("__Pyx_PyMODINIT_FUNC PyInit_DracoPy(void)", 0); + if (__Pyx_check_binary_version() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + #ifdef __Pxy_PyFrame_Initialize_Offsets + __Pxy_PyFrame_Initialize_Offsets(); + #endif + __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_empty_unicode = PyUnicode_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_unicode)) __PYX_ERR(0, 1, __pyx_L1_error) + #ifdef __Pyx_CyFunction_USED + if (__pyx_CyFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + #endif + #ifdef __Pyx_FusedFunction_USED + if (__pyx_FusedFunction_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + #endif + #ifdef __Pyx_Coroutine_USED + if (__pyx_Coroutine_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + #endif + #ifdef __Pyx_Generator_USED + if (__pyx_Generator_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + #endif + #ifdef __Pyx_AsyncGen_USED + if (__pyx_AsyncGen_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + #endif + #ifdef __Pyx_StopAsyncIteration_USED + if (__pyx_StopAsyncIteration_init() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + #endif + /*--- Library function declarations ---*/ + /*--- Threads initialization code ---*/ + #if defined(WITH_THREAD) && PY_VERSION_HEX < 0x030700F0 && defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS + PyEval_InitThreads(); + #endif + /*--- Module creation code ---*/ + #if CYTHON_PEP489_MULTI_PHASE_INIT + __pyx_m = __pyx_pyinit_module; + Py_INCREF(__pyx_m); + #else + #if PY_MAJOR_VERSION < 3 + __pyx_m = Py_InitModule4("DracoPy", __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m); + #else + __pyx_m = PyModule_Create(&__pyx_moduledef); + #endif + if (unlikely(!__pyx_m)) __PYX_ERR(0, 1, __pyx_L1_error) + #endif + __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) __PYX_ERR(0, 1, __pyx_L1_error) + Py_INCREF(__pyx_d); + __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); if (unlikely(!__pyx_b)) __PYX_ERR(0, 1, __pyx_L1_error) + Py_INCREF(__pyx_b); + __pyx_cython_runtime = PyImport_AddModule((char *) "cython_runtime"); if (unlikely(!__pyx_cython_runtime)) __PYX_ERR(0, 1, __pyx_L1_error) + Py_INCREF(__pyx_cython_runtime); + if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) __PYX_ERR(0, 1, __pyx_L1_error); + /*--- Initialize various global constants etc. ---*/ + if (__Pyx_InitGlobals() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT) + if (__Pyx_init_sys_getdefaultencoding_params() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + #endif + if (__pyx_module_is_main_DracoPy) { + if (PyObject_SetAttr(__pyx_m, __pyx_n_s_name_2, __pyx_n_s_main) < 0) __PYX_ERR(0, 1, __pyx_L1_error) + } + #if PY_MAJOR_VERSION >= 3 + { + PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) __PYX_ERR(0, 1, __pyx_L1_error) + if (!PyDict_GetItemString(modules, "DracoPy")) { + if (unlikely(PyDict_SetItemString(modules, "DracoPy", __pyx_m) < 0)) __PYX_ERR(0, 1, __pyx_L1_error) + } + } + #endif + /*--- Builtin init code ---*/ + if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + /*--- Constants init code ---*/ + if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error) + /*--- Global type/function init code ---*/ + (void)__Pyx_modinit_global_init_code(); + (void)__Pyx_modinit_variable_export_code(); + (void)__Pyx_modinit_function_export_code(); + if (unlikely(__Pyx_modinit_type_init_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error) + (void)__Pyx_modinit_type_import_code(); + (void)__Pyx_modinit_variable_import_code(); + (void)__Pyx_modinit_function_import_code(); + /*--- Execution code ---*/ + #if defined(__Pyx_Generator_USED) || defined(__Pyx_Coroutine_USED) if (__Pyx_patch_abc() < 0) __PYX_ERR(0, 1, __pyx_L1_error) #endif - /* "DracoPy.pyx":5 - * from cpython.mem cimport PyMem_Malloc, PyMem_Free - * cimport DracoPy - * import struct # <<<<<<<<<<<<<< - * from math import floor - * from libc.string cimport memcmp + /* "DracoPy.pyx":2 + * # distutils: language = c++ + * import struct # <<<<<<<<<<<<<< + * from typing import Dict, List, Optional + * from libcpp.vector cimport vector + */ + __pyx_t_1 = __Pyx_Import(__pyx_n_s_struct, 0, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 2, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_struct, __pyx_t_1) < 0) __PYX_ERR(0, 2, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "DracoPy.pyx":3 + * # distutils: language = c++ + * import struct + * from typing import Dict, List, Optional # <<<<<<<<<<<<<< + * from libcpp.vector cimport vector + * from cpython.mem cimport PyMem_Malloc, PyMem_Free + */ + __pyx_t_1 = PyList_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_n_s_Dict); + __Pyx_GIVEREF(__pyx_n_s_Dict); + PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_Dict); + __Pyx_INCREF(__pyx_n_s_List); + __Pyx_GIVEREF(__pyx_n_s_List); + PyList_SET_ITEM(__pyx_t_1, 1, __pyx_n_s_List); + __Pyx_INCREF(__pyx_n_s_Optional); + __Pyx_GIVEREF(__pyx_n_s_Optional); + PyList_SET_ITEM(__pyx_t_1, 2, __pyx_n_s_Optional); + __pyx_t_2 = __Pyx_Import(__pyx_n_s_typing, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3, __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_Dict); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_Dict, __pyx_t_1) < 0) __PYX_ERR(0, 3, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_List); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_List, __pyx_t_1) < 0) __PYX_ERR(0, 3, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_Optional); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 3, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_Optional, __pyx_t_1) < 0) __PYX_ERR(0, 3, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "DracoPy.pyx":7 + * from cpython.mem cimport PyMem_Malloc, PyMem_Free + * cimport DracoPy + * from math import floor # <<<<<<<<<<<<<< + * + * + */ + __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 7, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF(__pyx_n_s_floor); + __Pyx_GIVEREF(__pyx_n_s_floor); + PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_floor); + __pyx_t_1 = __Pyx_Import(__pyx_n_s_math, __pyx_t_2, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 7, __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_floor); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 7, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_floor, __pyx_t_2) < 0) __PYX_ERR(0, 7, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "DracoPy.pyx":39 + * + * + * class DracoPointCloud(object): # <<<<<<<<<<<<<< + * def __init__(self, data_struct): + * self.data_struct = data_struct + */ + __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_tuple__16); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 39, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_tuple__16, __pyx_n_s_DracoPointCloud, __pyx_n_s_DracoPointCloud, (PyObject *) NULL, __pyx_n_s_DracoPy, (PyObject *) NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 39, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + + /* "DracoPy.pyx":40 + * + * class DracoPointCloud(object): + * def __init__(self, data_struct): # <<<<<<<<<<<<<< + * self.data_struct = data_struct + * if data_struct['encoding_options_set']: + */ + __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_7DracoPy_15DracoPointCloud_1__init__, 0, __pyx_n_s_DracoPointCloud___init, NULL, __pyx_n_s_DracoPy, __pyx_d, ((PyObject *)__pyx_codeobj__18)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 40, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_init, __pyx_t_3) < 0) __PYX_ERR(0, 40, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "DracoPy.pyx":48 + * self.encoding_options = None + * + * def get_encoded_coordinate(self, value, axis): # <<<<<<<<<<<<<< + * if self.encoding_options is not None: + * return self.encoding_options.get_encoded_coordinate(value, axis) + */ + __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_7DracoPy_15DracoPointCloud_3get_encoded_coordinate, 0, __pyx_n_s_DracoPointCloud_get_encoded_coor, NULL, __pyx_n_s_DracoPy, __pyx_d, ((PyObject *)__pyx_codeobj__20)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 48, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_get_encoded_coordinate, __pyx_t_3) < 0) __PYX_ERR(0, 48, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "DracoPy.pyx":52 + * return self.encoding_options.get_encoded_coordinate(value, axis) + * + * def get_encoded_point(self, point): # <<<<<<<<<<<<<< + * if self.encoding_options is not None: + * return self.encoding_options.get_encoded_point(point) + */ + __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_7DracoPy_15DracoPointCloud_5get_encoded_point, 0, __pyx_n_s_DracoPointCloud_get_encoded_poin, NULL, __pyx_n_s_DracoPy, __pyx_d, ((PyObject *)__pyx_codeobj__22)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 52, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_get_encoded_point, __pyx_t_3) < 0) __PYX_ERR(0, 52, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "DracoPy.pyx":57 + * + * @property + * def num_axes(self): # <<<<<<<<<<<<<< + * return 3 + * + */ + __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_7DracoPy_15DracoPointCloud_7num_axes, 0, __pyx_n_s_DracoPointCloud_num_axes, NULL, __pyx_n_s_DracoPy, __pyx_d, ((PyObject *)__pyx_codeobj__24)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 57, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + + /* "DracoPy.pyx":56 + * return self.encoding_options.get_encoded_point(point) + * + * @property # <<<<<<<<<<<<<< + * def num_axes(self): + * return 3 + */ + __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_property, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 56, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_num_axes, __pyx_t_4) < 0) __PYX_ERR(0, 57, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "DracoPy.pyx":61 + * + * @property + * def points(self) -> List[float]: # <<<<<<<<<<<<<< + * return self.data_struct['points'] + * + */ + __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 61, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_List); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 61, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_t_3, ((PyObject *)(&PyFloat_Type))); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 61, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_return, __pyx_t_5) < 0) __PYX_ERR(0, 61, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_7DracoPy_15DracoPointCloud_9points, 0, __pyx_n_s_DracoPointCloud_points, NULL, __pyx_n_s_DracoPy, __pyx_d, ((PyObject *)__pyx_codeobj__26)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 61, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_5, __pyx_t_4); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "DracoPy.pyx":60 + * return 3 + * + * @property # <<<<<<<<<<<<<< + * def points(self) -> List[float]: + * return self.data_struct['points'] + */ + __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_property, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 60, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_points, __pyx_t_4) < 0) __PYX_ERR(0, 61, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "DracoPy.pyx":65 + * + * @property + * def geometry_metadata(self) -> Optional[Dict]: # <<<<<<<<<<<<<< + * return self.data_struct['geometry_metadata'] if self.metadatas else None + * + */ + __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 65, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GetModuleGlobalName(__pyx_t_5, __pyx_n_s_Optional); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 65, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_Dict); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 65, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_6 = __Pyx_PyObject_GetItem(__pyx_t_5, __pyx_t_3); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 65, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_return, __pyx_t_6) < 0) __PYX_ERR(0, 65, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = __Pyx_CyFunction_New(&__pyx_mdef_7DracoPy_15DracoPointCloud_11geometry_metadata, 0, __pyx_n_s_DracoPointCloud_geometry_metadat, NULL, __pyx_n_s_DracoPy, __pyx_d, ((PyObject *)__pyx_codeobj__28)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 65, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_6, __pyx_t_4); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "DracoPy.pyx":64 + * return self.data_struct['points'] + * + * @property # <<<<<<<<<<<<<< + * def geometry_metadata(self) -> Optional[Dict]: + * return self.data_struct['geometry_metadata'] if self.metadatas else None + */ + __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_property, __pyx_t_6); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 64, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_geometry_metadata, __pyx_t_4) < 0) __PYX_ERR(0, 65, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "DracoPy.pyx":69 + * + * @property + * def metadatas(self) -> List[Dict]: # <<<<<<<<<<<<<< + * return self.data_struct['metadatas'] + * + */ + __pyx_t_4 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 69, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_List); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 69, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_Dict); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 69, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = __Pyx_PyObject_GetItem(__pyx_t_6, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 69, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_return, __pyx_t_5) < 0) __PYX_ERR(0, 69, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_7DracoPy_15DracoPointCloud_13metadatas, 0, __pyx_n_s_DracoPointCloud_metadatas, NULL, __pyx_n_s_DracoPy, __pyx_d, ((PyObject *)__pyx_codeobj__30)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 69, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_5, __pyx_t_4); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "DracoPy.pyx":68 + * return self.data_struct['geometry_metadata'] if self.metadatas else None + * + * @property # <<<<<<<<<<<<<< + * def metadatas(self) -> List[Dict]: + * return self.data_struct['metadatas'] + */ + __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_property, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 68, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_metadatas, __pyx_t_4) < 0) __PYX_ERR(0, 69, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "DracoPy.pyx":39 + * + * + * class DracoPointCloud(object): # <<<<<<<<<<<<<< + * def __init__(self, data_struct): + * self.data_struct = data_struct + */ + __pyx_t_4 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_DracoPointCloud, __pyx_tuple__16, __pyx_t_2, NULL, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 39, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_DracoPointCloud, __pyx_t_4) < 0) __PYX_ERR(0, 39, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "DracoPy.pyx":73 + * + * + * class DracoMesh(DracoPointCloud): # <<<<<<<<<<<<<< + * @property + * def faces(self) -> List[int]: + */ + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_DracoPointCloud); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 73, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 73, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GIVEREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); + __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 73, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_t_2, __pyx_n_s_DracoMesh, __pyx_n_s_DracoMesh, (PyObject *) NULL, __pyx_n_s_DracoPy, (PyObject *) NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 73, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + + /* "DracoPy.pyx":75 + * class DracoMesh(DracoPointCloud): + * @property + * def faces(self) -> List[int]: # <<<<<<<<<<<<<< + * return self.data_struct['faces'] + * + */ + __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 75, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_List); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 75, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_6 = __Pyx_PyObject_GetItem(__pyx_t_3, ((PyObject *)(&PyInt_Type))); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 75, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_return, __pyx_t_6) < 0) __PYX_ERR(0, 75, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = __Pyx_CyFunction_New(&__pyx_mdef_7DracoPy_9DracoMesh_1faces, 0, __pyx_n_s_DracoMesh_faces, NULL, __pyx_n_s_DracoPy, __pyx_d, ((PyObject *)__pyx_codeobj__32)); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 75, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_6, __pyx_t_5); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "DracoPy.pyx":74 + * + * class DracoMesh(DracoPointCloud): + * @property # <<<<<<<<<<<<<< + * def faces(self) -> List[int]: + * return self.data_struct['faces'] + */ + __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_builtin_property, __pyx_t_6); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 74, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (__Pyx_SetNameInClass(__pyx_t_4, __pyx_n_s_faces, __pyx_t_5) < 0) __PYX_ERR(0, 75, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "DracoPy.pyx":79 + * + * @property + * def normals(self): # <<<<<<<<<<<<<< + * return self.data_struct['normals'] + * + */ + __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_7DracoPy_9DracoMesh_3normals, 0, __pyx_n_s_DracoMesh_normals, NULL, __pyx_n_s_DracoPy, __pyx_d, ((PyObject *)__pyx_codeobj__34)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 79, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + + /* "DracoPy.pyx":78 + * return self.data_struct['faces'] + * + * @property # <<<<<<<<<<<<<< + * def normals(self): + * return self.data_struct['normals'] + */ + __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_builtin_property, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 78, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__Pyx_SetNameInClass(__pyx_t_4, __pyx_n_s_normals, __pyx_t_6) < 0) __PYX_ERR(0, 79, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + + /* "DracoPy.pyx":73 + * + * + * class DracoMesh(DracoPointCloud): # <<<<<<<<<<<<<< + * @property + * def faces(self) -> List[int]: + */ + __pyx_t_6 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_DracoMesh, __pyx_t_2, __pyx_t_4, NULL, 0, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 73, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_DracoMesh, __pyx_t_6) < 0) __PYX_ERR(0, 73, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "DracoPy.pyx":83 + * + * + * class EncodingOptions(object): # <<<<<<<<<<<<<< + * def __init__(self, quantization_bits, quantization_range, quantization_origin): + * self.quantization_bits = quantization_bits + */ + __pyx_t_2 = __Pyx_CalculateMetaclass(NULL, __pyx_tuple__35); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 83, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = __Pyx_Py3MetaclassPrepare(__pyx_t_2, __pyx_tuple__35, __pyx_n_s_EncodingOptions, __pyx_n_s_EncodingOptions, (PyObject *) NULL, __pyx_n_s_DracoPy, (PyObject *) NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 83, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + + /* "DracoPy.pyx":84 + * + * class EncodingOptions(object): + * def __init__(self, quantization_bits, quantization_range, quantization_origin): # <<<<<<<<<<<<<< + * self.quantization_bits = quantization_bits + * self.quantization_range = quantization_range + */ + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_7DracoPy_15EncodingOptions_1__init__, 0, __pyx_n_s_EncodingOptions___init, NULL, __pyx_n_s_DracoPy, __pyx_d, ((PyObject *)__pyx_codeobj__37)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 84, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_init, __pyx_t_4) < 0) __PYX_ERR(0, 84, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "DracoPy.pyx":90 + * self.inverse_alpha = quantization_range / ((2 ** quantization_bits) - 1) + * + * def get_encoded_coordinate(self, value, axis): # <<<<<<<<<<<<<< + * if value < self.quantization_origin[axis] or value > (self.quantization_origin[axis] + self.quantization_range): + * raise ValueError('Specified value out of encoded range') + */ + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_7DracoPy_15EncodingOptions_3get_encoded_coordinate, 0, __pyx_n_s_EncodingOptions_get_encoded_coor, NULL, __pyx_n_s_DracoPy, __pyx_d, ((PyObject *)__pyx_codeobj__39)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 90, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_get_encoded_coordinate, __pyx_t_4) < 0) __PYX_ERR(0, 90, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "DracoPy.pyx":97 + * return self.quantization_origin[axis] + (quantized_index * self.inverse_alpha) + * + * def get_encoded_point(self, point): # <<<<<<<<<<<<<< + * encoded_point = [] + * for axis in range(self.num_axes): + */ + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_7DracoPy_15EncodingOptions_5get_encoded_point, 0, __pyx_n_s_EncodingOptions_get_encoded_poin, NULL, __pyx_n_s_DracoPy, __pyx_d, ((PyObject *)__pyx_codeobj__41)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 97, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_get_encoded_point, __pyx_t_4) < 0) __PYX_ERR(0, 97, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + /* "DracoPy.pyx":104 + * + * @property + * def num_axes(self): # <<<<<<<<<<<<<< + * return 3 + * + */ + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_7DracoPy_15EncodingOptions_7num_axes, 0, __pyx_n_s_EncodingOptions_num_axes, NULL, __pyx_n_s_DracoPy, __pyx_d, ((PyObject *)__pyx_codeobj__43)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 104, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + + /* "DracoPy.pyx":103 + * return encoded_point + * + * @property # <<<<<<<<<<<<<< + * def num_axes(self): + * return 3 + */ + __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_builtin_property, __pyx_t_4); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 103, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_num_axes, __pyx_t_6) < 0) __PYX_ERR(0, 104, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + + /* "DracoPy.pyx":83 + * + * + * class EncodingOptions(object): # <<<<<<<<<<<<<< + * def __init__(self, quantization_bits, quantization_range, quantization_origin): + * self.quantization_bits = quantization_bits + */ + __pyx_t_6 = __Pyx_Py3ClassCreate(__pyx_t_2, __pyx_n_s_EncodingOptions, __pyx_tuple__35, __pyx_t_1, NULL, 0, 0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 83, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_EncodingOptions, __pyx_t_6) < 0) __PYX_ERR(0, 83, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "DracoPy.pyx":108 + * + * + * class FileTypeException(Exception): # <<<<<<<<<<<<<< + * pass + * + */ + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 108, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); + __Pyx_GIVEREF(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); + PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); + __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 108, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_6 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_t_2, __pyx_n_s_FileTypeException, __pyx_n_s_FileTypeException, (PyObject *) NULL, __pyx_n_s_DracoPy, (PyObject *) NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 108, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_4 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_FileTypeException, __pyx_t_2, __pyx_t_6, NULL, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 108, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_FileTypeException, __pyx_t_4) < 0) __PYX_ERR(0, 108, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "DracoPy.pyx":112 + * + * + * class EncodingFailedException(Exception): # <<<<<<<<<<<<<< + * pass + * + */ + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 112, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); + __Pyx_GIVEREF(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); + PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); + __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 112, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_6 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_t_2, __pyx_n_s_EncodingFailedException, __pyx_n_s_EncodingFailedException, (PyObject *) NULL, __pyx_n_s_DracoPy, (PyObject *) NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 112, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_4 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_EncodingFailedException, __pyx_t_2, __pyx_t_6, NULL, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 112, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_EncodingFailedException, __pyx_t_4) < 0) __PYX_ERR(0, 112, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "DracoPy.pyx":116 + * + * + * def _create_empty_geometry_metadata() -> GeometryMetadataObject: # <<<<<<<<<<<<<< + * return { + * "metadata_id": 0, + */ + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7DracoPy_1_create_empty_geometry_metadata, NULL, __pyx_n_s_DracoPy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 116, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_create_empty_geometry_metadata, __pyx_t_2) < 0) __PYX_ERR(0, 116, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "DracoPy.pyx":123 + * + * + * def _create_empty_metadata() -> MetadataObject: # <<<<<<<<<<<<<< + * return { + * "entries": {}, + */ + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7DracoPy_3_create_empty_metadata, NULL, __pyx_n_s_DracoPy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 123, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_create_empty_metadata, __pyx_t_2) < 0) __PYX_ERR(0, 123, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "DracoPy.pyx":163 + * return encoder + * + * def encode_mesh_to_buffer(points, faces, # <<<<<<<<<<<<<< + * quantization_bits=14, + * compression_level=1, + */ + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7DracoPy_5encode_mesh_to_buffer, NULL, __pyx_n_s_DracoPy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 163, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_encode_mesh_to_buffer, __pyx_t_2) < 0) __PYX_ERR(0, 163, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "DracoPy.pyx":206 + * + * + * def encode_point_cloud_to_buffer(points, # <<<<<<<<<<<<<< + * quantization_bits=14, + * compression_level=1, */ - __pyx_t_1 = __Pyx_Import(__pyx_n_s_struct, 0, 0); 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_struct, __pyx_t_1) < 0) __PYX_ERR(0, 5, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7DracoPy_7encode_point_cloud_to_buffer, NULL, __pyx_n_s_DracoPy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 206, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_encode_point_cloud_to_buffer, __pyx_t_2) < 0) __PYX_ERR(0, 206, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "DracoPy.pyx":6 - * cimport DracoPy - * import struct - * from math import floor # <<<<<<<<<<<<<< - * from libc.string cimport memcmp + /* "DracoPy.pyx":249 + * def encode_to_buffer(points: List[float], + * faces: List[int] = None, + * encoder: Encoder = Encoder(), # <<<<<<<<<<<<<< + * metadatas = None, + * geometry_metadata = None, + */ + __pyx_t_2 = __Pyx_PyObject_CallNoArg(((PyObject *)__pyx_ptype_7DracoPy_Encoder)); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 249, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_k__4 = ((struct __pyx_obj_7DracoPy_Encoder *)__pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + + /* "DracoPy.pyx":247 + * * + * def encode_to_buffer(points: List[float], # <<<<<<<<<<<<<< + * faces: List[int] = None, + * encoder: Encoder = Encoder(), */ - __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 6, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(__pyx_n_s_floor); - __Pyx_GIVEREF(__pyx_n_s_floor); - PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_floor); - __pyx_t_2 = __Pyx_Import(__pyx_n_s_math, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 6, __pyx_L1_error) + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7DracoPy_9encode_to_buffer, NULL, __pyx_n_s_DracoPy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 247, __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_floor); 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_floor, __pyx_t_1) < 0) __PYX_ERR(0, 6, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (PyDict_SetItem(__pyx_d, __pyx_n_s_encode_to_buffer, __pyx_t_2) < 0) __PYX_ERR(0, 247, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "DracoPy.pyx":9 - * from libc.string cimport memcmp + /* "DracoPy.pyx":311 + * raise ValueError("Input invalid") * - * class DracoPointCloud(object): # <<<<<<<<<<<<<< - * def __init__(self, data_struct): - * self.data_struct = data_struct + * def raise_decoding_error(decoding_status): # <<<<<<<<<<<<<< + * if decoding_status == DracoPy.decoding_status.not_draco_encoded: + * raise FileTypeException('Input mesh is not draco encoded') */ - __pyx_t_2 = __Pyx_CalculateMetaclass(NULL, __pyx_tuple__5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 9, __pyx_L1_error) + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7DracoPy_11raise_decoding_error, NULL, __pyx_n_s_DracoPy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 311, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = __Pyx_Py3MetaclassPrepare(__pyx_t_2, __pyx_tuple__5, __pyx_n_s_DracoPointCloud, __pyx_n_s_DracoPointCloud, (PyObject *) NULL, __pyx_n_s_DracoPy, (PyObject *) NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 9, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_raise_decoding_error, __pyx_t_2) < 0) __PYX_ERR(0, 311, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "DracoPy.pyx":10 + /* "DracoPy.pyx":319 + * raise ValueError('DracoPy only supports meshes with position attributes') * - * class DracoPointCloud(object): - * def __init__(self, data_struct): # <<<<<<<<<<<<<< - * self.data_struct = data_struct - * if data_struct['encoding_options_set']: + * def decode_buffer_to_mesh(buffer, deduplicate=False): # <<<<<<<<<<<<<< + * """ + * Decode buffer to mesh */ - __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_7DracoPy_15DracoPointCloud_1__init__, 0, __pyx_n_s_DracoPointCloud___init, NULL, __pyx_n_s_DracoPy, __pyx_d, ((PyObject *)__pyx_codeobj__7)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 10, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_init, __pyx_t_3) < 0) __PYX_ERR(0, 10, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7DracoPy_13decode_buffer_to_mesh, NULL, __pyx_n_s_DracoPy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 319, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_decode_buffer_to_mesh, __pyx_t_2) < 0) __PYX_ERR(0, 319, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "DracoPy.pyx":18 - * self.encoding_options = None + /* "DracoPy.pyx":332 + * raise_decoding_error(mesh_struct.decode_status) * - * def get_encoded_coordinate(self, value, axis): # <<<<<<<<<<<<<< - * if self.encoding_options is not None: - * return self.encoding_options.get_encoded_coordinate(value, axis) + * def decode_point_cloud_buffer(buffer, deduplicate=False): # <<<<<<<<<<<<<< + * """ + * Decode buffer to point cloud */ - __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_7DracoPy_15DracoPointCloud_3get_encoded_coordinate, 0, __pyx_n_s_DracoPointCloud_get_encoded_coor, NULL, __pyx_n_s_DracoPy, __pyx_d, ((PyObject *)__pyx_codeobj__9)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 18, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_get_encoded_coordinate, __pyx_t_3) < 0) __PYX_ERR(0, 18, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7DracoPy_15decode_point_cloud_buffer, NULL, __pyx_n_s_DracoPy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 332, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_decode_point_cloud_buffer, __pyx_t_2) < 0) __PYX_ERR(0, 332, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "DracoPy.pyx":22 - * return self.encoding_options.get_encoded_coordinate(value, axis) + /* "DracoPy.pyx":1 + * # distutils: language = c++ # <<<<<<<<<<<<<< + * import struct + * from typing import Dict, List, Optional + */ + __pyx_t_2 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_2) < 0) __PYX_ERR(0, 1, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "EnumBase":9 * - * def get_encoded_point(self, point): # <<<<<<<<<<<<<< - * if self.encoding_options is not None: - * return self.encoding_options.get_encoded_point(point) + * cdef object __Pyx_OrderedDict + * if PY_VERSION_HEX >= 0x02070000: # <<<<<<<<<<<<<< + * from collections import OrderedDict as __Pyx_OrderedDict + * else: */ - __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_7DracoPy_15DracoPointCloud_5get_encoded_point, 0, __pyx_n_s_DracoPointCloud_get_encoded_poin, NULL, __pyx_n_s_DracoPy, __pyx_d, ((PyObject *)__pyx_codeobj__11)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 22, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_get_encoded_point, __pyx_t_3) < 0) __PYX_ERR(0, 22, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_7 = ((PY_VERSION_HEX >= 0x02070000) != 0); + if (__pyx_t_7) { + + /* "EnumBase":10 + * cdef object __Pyx_OrderedDict + * if PY_VERSION_HEX >= 0x02070000: + * from collections import OrderedDict as __Pyx_OrderedDict # <<<<<<<<<<<<<< + * else: + * __Pyx_OrderedDict = dict + */ + __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 10, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF(__pyx_n_s_OrderedDict); + __Pyx_GIVEREF(__pyx_n_s_OrderedDict); + PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_OrderedDict); + __pyx_t_1 = __Pyx_Import(__pyx_n_s_collections, __pyx_t_2, -1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 10, __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_OrderedDict); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 10, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF(__pyx_t_2); + __Pyx_XGOTREF(__Pyx_OrderedDict); + __Pyx_DECREF_SET(__Pyx_OrderedDict, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "DracoPy.pyx":27 + /* "EnumBase":9 * - * @property - * def num_axes(self): # <<<<<<<<<<<<<< - * return 3 + * cdef object __Pyx_OrderedDict + * if PY_VERSION_HEX >= 0x02070000: # <<<<<<<<<<<<<< + * from collections import OrderedDict as __Pyx_OrderedDict + * else: + */ + goto __pyx_L2; + } + + /* "EnumBase":12 + * from collections import OrderedDict as __Pyx_OrderedDict + * else: + * __Pyx_OrderedDict = dict # <<<<<<<<<<<<<< * + * @cython.internal */ - __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_7DracoPy_15DracoPointCloud_7num_axes, 0, __pyx_n_s_DracoPointCloud_num_axes, NULL, __pyx_n_s_DracoPy, __pyx_d, ((PyObject *)__pyx_codeobj__13)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 27, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); + /*else*/ { + __Pyx_INCREF(((PyObject *)(&PyDict_Type))); + __Pyx_XGOTREF(__Pyx_OrderedDict); + __Pyx_DECREF_SET(__Pyx_OrderedDict, ((PyObject *)(&PyDict_Type))); + __Pyx_GIVEREF(((PyObject *)(&PyDict_Type))); + } + __pyx_L2:; - /* "DracoPy.pyx":26 - * return self.encoding_options.get_encoded_point(point) + /* "EnumBase":26 * - * @property # <<<<<<<<<<<<<< - * def num_axes(self): - * return 3 + * cdef object __Pyx_EnumBase + * class __Pyx_EnumBase(int): # <<<<<<<<<<<<<< + * __metaclass__ = __Pyx_EnumMeta + * def __new__(cls, value, name=None): + */ + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 26, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(((PyObject *)(&PyInt_Type))); + __Pyx_GIVEREF(((PyObject *)(&PyInt_Type))); + PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)(&PyInt_Type))); + __pyx_t_2 = __Pyx_CalculateMetaclass(NULL, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 26, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_6 = __Pyx_Py3MetaclassPrepare(__pyx_t_2, __pyx_t_1, __pyx_n_s_Pyx_EnumBase, __pyx_n_s_Pyx_EnumBase, (PyObject *) NULL, __pyx_n_s_EnumBase, (PyObject *) NULL); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 26, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + + /* "EnumBase":27 + * cdef object __Pyx_EnumBase + * class __Pyx_EnumBase(int): + * __metaclass__ = __Pyx_EnumMeta # <<<<<<<<<<<<<< + * def __new__(cls, value, name=None): + * for v in cls: */ - __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_property, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 26, __pyx_L1_error) + if (__Pyx_SetNameInClass(__pyx_t_6, __pyx_n_s_metaclass, ((PyObject *)__pyx_ptype___Pyx_EnumMeta)) < 0) __PYX_ERR(1, 27, __pyx_L1_error) + + /* "EnumBase":28 + * class __Pyx_EnumBase(int): + * __metaclass__ = __Pyx_EnumMeta + * def __new__(cls, value, name=None): # <<<<<<<<<<<<<< + * for v in cls: + * if v == value: + */ + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_8EnumBase_14__Pyx_EnumBase_1__new__, __Pyx_CYFUNCTION_STATICMETHOD, __pyx_n_s_Pyx_EnumBase___new, NULL, __pyx_n_s_EnumBase, __pyx_d, ((PyObject *)__pyx_codeobj__59)); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 28, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_num_axes, __pyx_t_4) < 0) __PYX_ERR(0, 27, __pyx_L1_error) + __Pyx_CyFunction_SetDefaultsTuple(__pyx_t_4, __pyx_tuple__60); + if (__Pyx_SetNameInClass(__pyx_t_6, __pyx_n_s_new, __pyx_t_4) < 0) __PYX_ERR(1, 28, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "DracoPy.pyx":31 - * - * @property - * def points(self): # <<<<<<<<<<<<<< - * return self.data_struct['points'] - * + /* "EnumBase":39 + * cls.__members__[name] = res + * return res + * def __repr__(self): # <<<<<<<<<<<<<< + * return "<%s.%s: %d>" % (self.__class__.__name__, self.name, self) + * def __str__(self): */ - __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_7DracoPy_15DracoPointCloud_9points, 0, __pyx_n_s_DracoPointCloud_points, NULL, __pyx_n_s_DracoPy, __pyx_d, ((PyObject *)__pyx_codeobj__15)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 31, __pyx_L1_error) + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_8EnumBase_14__Pyx_EnumBase_3__repr__, 0, __pyx_n_s_Pyx_EnumBase___repr, NULL, __pyx_n_s_EnumBase, __pyx_d, ((PyObject *)__pyx_codeobj__62)); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 39, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); + if (__Pyx_SetNameInClass(__pyx_t_6, __pyx_n_s_repr, __pyx_t_4) < 0) __PYX_ERR(1, 39, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "DracoPy.pyx":30 - * return 3 + /* "EnumBase":41 + * def __repr__(self): + * return "<%s.%s: %d>" % (self.__class__.__name__, self.name, self) + * def __str__(self): # <<<<<<<<<<<<<< + * return "%s.%s" % (self.__class__.__name__, self.name) * - * @property # <<<<<<<<<<<<<< - * def points(self): - * return self.data_struct['points'] */ - __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_builtin_property, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 30, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_8EnumBase_14__Pyx_EnumBase_5__str__, 0, __pyx_n_s_Pyx_EnumBase___str, NULL, __pyx_n_s_EnumBase, __pyx_d, ((PyObject *)__pyx_codeobj__64)); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 41, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + if (__Pyx_SetNameInClass(__pyx_t_6, __pyx_n_s_str, __pyx_t_4) < 0) __PYX_ERR(1, 41, __pyx_L1_error) __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (__Pyx_SetNameInClass(__pyx_t_1, __pyx_n_s_points, __pyx_t_3) < 0) __PYX_ERR(0, 31, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "DracoPy.pyx":9 - * from libc.string cimport memcmp + /* "EnumBase":26 * - * class DracoPointCloud(object): # <<<<<<<<<<<<<< - * def __init__(self, data_struct): - * self.data_struct = data_struct + * cdef object __Pyx_EnumBase + * class __Pyx_EnumBase(int): # <<<<<<<<<<<<<< + * __metaclass__ = __Pyx_EnumMeta + * def __new__(cls, value, name=None): */ - __pyx_t_3 = __Pyx_Py3ClassCreate(__pyx_t_2, __pyx_n_s_DracoPointCloud, __pyx_tuple__5, __pyx_t_1, NULL, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 9, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_DracoPointCloud, __pyx_t_3) < 0) __PYX_ERR(0, 9, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_4 = __Pyx_Py3ClassCreate(__pyx_t_2, __pyx_n_s_Pyx_EnumBase, __pyx_t_1, __pyx_t_6, NULL, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 26, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_XGOTREF(__Pyx_EnumBase); + __Pyx_DECREF_SET(__Pyx_EnumBase, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "EnumBase":44 + * return "%s.%s" % (self.__class__.__name__, self.name) + * + * if PY_VERSION_HEX >= 0x03040000: # <<<<<<<<<<<<<< + * from enum import IntEnum as __Pyx_EnumBase + * + */ + __pyx_t_7 = ((PY_VERSION_HEX >= 0x03040000) != 0); + if (__pyx_t_7) { + + /* "EnumBase":45 + * + * if PY_VERSION_HEX >= 0x03040000: + * from enum import IntEnum as __Pyx_EnumBase # <<<<<<<<<<<<<< + * + */ + __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 45, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_n_s_IntEnum); + __Pyx_GIVEREF(__pyx_n_s_IntEnum); + PyList_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_IntEnum); + __pyx_t_2 = __Pyx_Import(__pyx_n_s_enum, __pyx_t_1, -1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 45, __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_IntEnum); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 45, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_t_1); + __Pyx_XGOTREF(__Pyx_EnumBase); + __Pyx_DECREF_SET(__Pyx_EnumBase, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "EnumBase":44 + * return "%s.%s" % (self.__class__.__name__, self.name) + * + * if PY_VERSION_HEX >= 0x03040000: # <<<<<<<<<<<<<< + * from enum import IntEnum as __Pyx_EnumBase + * + */ + } + + /* "(tree fragment)":1 + * def __pyx_unpickle___Pyx_EnumMeta(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<< + * cdef object __pyx_PickleError + * cdef object __pyx_result + */ + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_8EnumBase_1__pyx_unpickle___Pyx_EnumMeta, NULL, __pyx_n_s_EnumBase); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 1, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_pyx_unpickle___Pyx_EnumMeta, __pyx_t_2) < 0) __PYX_ERR(1, 1, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "DracoPy.pyx":34 - * return self.data_struct['points'] + /* "EnumType":50 * - * class DracoMesh(DracoPointCloud): # <<<<<<<<<<<<<< - * @property - * def faces(self): + * + * cdef dict __Pyx_globals = globals() # <<<<<<<<<<<<<< + * if PY_VERSION_HEX >= 0x03040000: + * + */ + __pyx_t_2 = __Pyx_Globals(); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 50, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + if (!(likely(PyDict_CheckExact(__pyx_t_2))||((__pyx_t_2) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "dict", Py_TYPE(__pyx_t_2)->tp_name), 0))) __PYX_ERR(1, 50, __pyx_L1_error) + __Pyx_XGOTREF(__Pyx_globals); + __Pyx_DECREF_SET(__Pyx_globals, ((PyObject*)__pyx_t_2)); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + + /* "EnumType":51 + * + * cdef dict __Pyx_globals = globals() + * if PY_VERSION_HEX >= 0x03040000: # <<<<<<<<<<<<<< + * + * DataType = __Pyx_EnumBase('DataType', __Pyx_OrderedDict([ + */ + __pyx_t_7 = ((PY_VERSION_HEX >= 0x03040000) != 0); + if (__pyx_t_7) { + + /* "EnumType":54 + * + * DataType = __Pyx_EnumBase('DataType', __Pyx_OrderedDict([ + * ('DT_INVALID', DT_INVALID), # <<<<<<<<<<<<<< + * ('DT_INT8', DT_INT8), + * ('DT_UINT8', DT_UINT8), + */ + __pyx_t_2 = __Pyx_PyInt_From_enum__draco_3a__3a_DataType(draco::DataType::DT_INVALID); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 54, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 54, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_n_s_DT_INVALID); + __Pyx_GIVEREF(__pyx_n_s_DT_INVALID); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_n_s_DT_INVALID); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_2); + __pyx_t_2 = 0; + + /* "EnumType":55 + * DataType = __Pyx_EnumBase('DataType', __Pyx_OrderedDict([ + * ('DT_INVALID', DT_INVALID), + * ('DT_INT8', DT_INT8), # <<<<<<<<<<<<<< + * ('DT_UINT8', DT_UINT8), + * ('DT_INT16', DT_INT16), + */ + __pyx_t_2 = __Pyx_PyInt_From_enum__draco_3a__3a_DataType(draco::DataType::DT_INT8); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 55, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 55, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_INCREF(__pyx_n_s_DT_INT8); + __Pyx_GIVEREF(__pyx_n_s_DT_INT8); + PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_n_s_DT_INT8); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_2); + __pyx_t_2 = 0; + + /* "EnumType":56 + * ('DT_INVALID', DT_INVALID), + * ('DT_INT8', DT_INT8), + * ('DT_UINT8', DT_UINT8), # <<<<<<<<<<<<<< + * ('DT_INT16', DT_INT16), + * ('DT_UINT16', DT_UINT16), + */ + __pyx_t_2 = __Pyx_PyInt_From_enum__draco_3a__3a_DataType(draco::DataType::DT_UINT8); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 56, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 56, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(__pyx_n_s_DT_UINT8); + __Pyx_GIVEREF(__pyx_n_s_DT_UINT8); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_n_s_DT_UINT8); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_2); + __pyx_t_2 = 0; + + /* "EnumType":57 + * ('DT_INT8', DT_INT8), + * ('DT_UINT8', DT_UINT8), + * ('DT_INT16', DT_INT16), # <<<<<<<<<<<<<< + * ('DT_UINT16', DT_UINT16), + * ('DT_INT32', DT_INT32), + */ + __pyx_t_2 = __Pyx_PyInt_From_enum__draco_3a__3a_DataType(draco::DataType::DT_INT16); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 57, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 57, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_5); + __Pyx_INCREF(__pyx_n_s_DT_INT16); + __Pyx_GIVEREF(__pyx_n_s_DT_INT16); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_n_s_DT_INT16); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2); + __pyx_t_2 = 0; + + /* "EnumType":58 + * ('DT_UINT8', DT_UINT8), + * ('DT_INT16', DT_INT16), + * ('DT_UINT16', DT_UINT16), # <<<<<<<<<<<<<< + * ('DT_INT32', DT_INT32), + * ('DT_UINT32', DT_UINT32), + */ + __pyx_t_2 = __Pyx_PyInt_From_enum__draco_3a__3a_DataType(draco::DataType::DT_UINT16); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 58, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 58, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(__pyx_n_s_DT_UINT16); + __Pyx_GIVEREF(__pyx_n_s_DT_UINT16); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_n_s_DT_UINT16); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2); + __pyx_t_2 = 0; + + /* "EnumType":59 + * ('DT_INT16', DT_INT16), + * ('DT_UINT16', DT_UINT16), + * ('DT_INT32', DT_INT32), # <<<<<<<<<<<<<< + * ('DT_UINT32', DT_UINT32), + * ('DT_INT64', DT_INT64), + */ + __pyx_t_2 = __Pyx_PyInt_From_enum__draco_3a__3a_DataType(draco::DataType::DT_INT32); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 59, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 59, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_8); + __Pyx_INCREF(__pyx_n_s_DT_INT32); + __Pyx_GIVEREF(__pyx_n_s_DT_INT32); + PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_n_s_DT_INT32); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_2); + __pyx_t_2 = 0; + + /* "EnumType":60 + * ('DT_UINT16', DT_UINT16), + * ('DT_INT32', DT_INT32), + * ('DT_UINT32', DT_UINT32), # <<<<<<<<<<<<<< + * ('DT_INT64', DT_INT64), + * ('DT_UINT64', DT_UINT64), + */ + __pyx_t_2 = __Pyx_PyInt_From_enum__draco_3a__3a_DataType(draco::DataType::DT_UINT32); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 60, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 60, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_INCREF(__pyx_n_s_DT_UINT32); + __Pyx_GIVEREF(__pyx_n_s_DT_UINT32); + PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_n_s_DT_UINT32); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_2); + __pyx_t_2 = 0; + + /* "EnumType":61 + * ('DT_INT32', DT_INT32), + * ('DT_UINT32', DT_UINT32), + * ('DT_INT64', DT_INT64), # <<<<<<<<<<<<<< + * ('DT_UINT64', DT_UINT64), + * ('DT_FLOAT32', DT_FLOAT32), + */ + __pyx_t_2 = __Pyx_PyInt_From_enum__draco_3a__3a_DataType(draco::DataType::DT_INT64); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 61, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 61, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __Pyx_INCREF(__pyx_n_s_DT_INT64); + __Pyx_GIVEREF(__pyx_n_s_DT_INT64); + PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_n_s_DT_INT64); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_2); + __pyx_t_2 = 0; + + /* "EnumType":62 + * ('DT_UINT32', DT_UINT32), + * ('DT_INT64', DT_INT64), + * ('DT_UINT64', DT_UINT64), # <<<<<<<<<<<<<< + * ('DT_FLOAT32', DT_FLOAT32), + * ('DT_FLOAT64', DT_FLOAT64), + */ + __pyx_t_2 = __Pyx_PyInt_From_enum__draco_3a__3a_DataType(draco::DataType::DT_UINT64); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 62, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 62, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __Pyx_INCREF(__pyx_n_s_DT_UINT64); + __Pyx_GIVEREF(__pyx_n_s_DT_UINT64); + PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_n_s_DT_UINT64); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_2); + __pyx_t_2 = 0; + + /* "EnumType":63 + * ('DT_INT64', DT_INT64), + * ('DT_UINT64', DT_UINT64), + * ('DT_FLOAT32', DT_FLOAT32), # <<<<<<<<<<<<<< + * ('DT_FLOAT64', DT_FLOAT64), + * ('DT_BOOL', DT_BOOL), + */ + __pyx_t_2 = __Pyx_PyInt_From_enum__draco_3a__3a_DataType(draco::DataType::DT_FLOAT32); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 63, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_12 = PyTuple_New(2); if (unlikely(!__pyx_t_12)) __PYX_ERR(1, 63, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + __Pyx_INCREF(__pyx_n_s_DT_FLOAT32); + __Pyx_GIVEREF(__pyx_n_s_DT_FLOAT32); + PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_n_s_DT_FLOAT32); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_12, 1, __pyx_t_2); + __pyx_t_2 = 0; + + /* "EnumType":64 + * ('DT_UINT64', DT_UINT64), + * ('DT_FLOAT32', DT_FLOAT32), + * ('DT_FLOAT64', DT_FLOAT64), # <<<<<<<<<<<<<< + * ('DT_BOOL', DT_BOOL), + * ('DT_TYPES_COUNT', DT_TYPES_COUNT), + */ + __pyx_t_2 = __Pyx_PyInt_From_enum__draco_3a__3a_DataType(draco::DataType::DT_FLOAT64); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 64, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_13 = PyTuple_New(2); if (unlikely(!__pyx_t_13)) __PYX_ERR(1, 64, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_13); + __Pyx_INCREF(__pyx_n_s_DT_FLOAT64); + __Pyx_GIVEREF(__pyx_n_s_DT_FLOAT64); + PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_n_s_DT_FLOAT64); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_13, 1, __pyx_t_2); + __pyx_t_2 = 0; + + /* "EnumType":65 + * ('DT_FLOAT32', DT_FLOAT32), + * ('DT_FLOAT64', DT_FLOAT64), + * ('DT_BOOL', DT_BOOL), # <<<<<<<<<<<<<< + * ('DT_TYPES_COUNT', DT_TYPES_COUNT), + * ])) + */ + __pyx_t_2 = __Pyx_PyInt_From_enum__draco_3a__3a_DataType(draco::DataType::DT_BOOL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 65, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_14 = PyTuple_New(2); if (unlikely(!__pyx_t_14)) __PYX_ERR(1, 65, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_14); + __Pyx_INCREF(__pyx_n_s_DT_BOOL); + __Pyx_GIVEREF(__pyx_n_s_DT_BOOL); + PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_n_s_DT_BOOL); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_14, 1, __pyx_t_2); + __pyx_t_2 = 0; + + /* "EnumType":66 + * ('DT_FLOAT64', DT_FLOAT64), + * ('DT_BOOL', DT_BOOL), + * ('DT_TYPES_COUNT', DT_TYPES_COUNT), # <<<<<<<<<<<<<< + * ])) + * __Pyx_globals['DT_INVALID'] = DataType.DT_INVALID + */ + __pyx_t_2 = __Pyx_PyInt_From_enum__draco_3a__3a_DataType(draco::DataType::DT_TYPES_COUNT); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 66, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_15 = PyTuple_New(2); if (unlikely(!__pyx_t_15)) __PYX_ERR(1, 66, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_15); + __Pyx_INCREF(__pyx_n_s_DT_TYPES_COUNT); + __Pyx_GIVEREF(__pyx_n_s_DT_TYPES_COUNT); + PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_n_s_DT_TYPES_COUNT); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_15, 1, __pyx_t_2); + __pyx_t_2 = 0; + + /* "EnumType":53 + * if PY_VERSION_HEX >= 0x03040000: + * + * DataType = __Pyx_EnumBase('DataType', __Pyx_OrderedDict([ # <<<<<<<<<<<<<< + * ('DT_INVALID', DT_INVALID), + * ('DT_INT8', DT_INT8), + */ + __pyx_t_2 = PyList_New(13); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 53, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GIVEREF(__pyx_t_1); + PyList_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_6); + PyList_SET_ITEM(__pyx_t_2, 1, __pyx_t_6); + __Pyx_GIVEREF(__pyx_t_4); + PyList_SET_ITEM(__pyx_t_2, 2, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_5); + PyList_SET_ITEM(__pyx_t_2, 3, __pyx_t_5); + __Pyx_GIVEREF(__pyx_t_3); + PyList_SET_ITEM(__pyx_t_2, 4, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_8); + PyList_SET_ITEM(__pyx_t_2, 5, __pyx_t_8); + __Pyx_GIVEREF(__pyx_t_9); + PyList_SET_ITEM(__pyx_t_2, 6, __pyx_t_9); + __Pyx_GIVEREF(__pyx_t_10); + PyList_SET_ITEM(__pyx_t_2, 7, __pyx_t_10); + __Pyx_GIVEREF(__pyx_t_11); + PyList_SET_ITEM(__pyx_t_2, 8, __pyx_t_11); + __Pyx_GIVEREF(__pyx_t_12); + PyList_SET_ITEM(__pyx_t_2, 9, __pyx_t_12); + __Pyx_GIVEREF(__pyx_t_13); + PyList_SET_ITEM(__pyx_t_2, 10, __pyx_t_13); + __Pyx_GIVEREF(__pyx_t_14); + PyList_SET_ITEM(__pyx_t_2, 11, __pyx_t_14); + __Pyx_GIVEREF(__pyx_t_15); + PyList_SET_ITEM(__pyx_t_2, 12, __pyx_t_15); + __pyx_t_1 = 0; + __pyx_t_6 = 0; + __pyx_t_4 = 0; + __pyx_t_5 = 0; + __pyx_t_3 = 0; + __pyx_t_8 = 0; + __pyx_t_9 = 0; + __pyx_t_10 = 0; + __pyx_t_11 = 0; + __pyx_t_12 = 0; + __pyx_t_13 = 0; + __pyx_t_14 = 0; + __pyx_t_15 = 0; + __pyx_t_15 = __Pyx_PyObject_CallOneArg(__Pyx_OrderedDict, __pyx_t_2); if (unlikely(!__pyx_t_15)) __PYX_ERR(1, 53, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_15); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 53, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF(__pyx_n_s_DataType); + __Pyx_GIVEREF(__pyx_n_s_DataType); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_DataType); + __Pyx_GIVEREF(__pyx_t_15); + PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_15); + __pyx_t_15 = 0; + __pyx_t_15 = __Pyx_PyObject_Call(__Pyx_EnumBase, __pyx_t_2, NULL); if (unlikely(!__pyx_t_15)) __PYX_ERR(1, 53, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_15); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (PyDict_SetItem(__pyx_d, __pyx_n_s_DataType, __pyx_t_15) < 0) __PYX_ERR(1, 53, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + + /* "EnumType":68 + * ('DT_TYPES_COUNT', DT_TYPES_COUNT), + * ])) + * __Pyx_globals['DT_INVALID'] = DataType.DT_INVALID # <<<<<<<<<<<<<< + * __Pyx_globals['DT_INT8'] = DataType.DT_INT8 + * __Pyx_globals['DT_UINT8'] = DataType.DT_UINT8 + */ + __Pyx_GetModuleGlobalName(__pyx_t_15, __pyx_n_s_DataType); if (unlikely(!__pyx_t_15)) __PYX_ERR(1, 68, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_15); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_15, __pyx_n_s_DT_INVALID); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 68, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + if (unlikely(__Pyx_globals == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(1, 68, __pyx_L1_error) + } + if (unlikely(PyDict_SetItem(__Pyx_globals, __pyx_n_s_DT_INVALID, __pyx_t_2) < 0)) __PYX_ERR(1, 68, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "EnumType":69 + * ])) + * __Pyx_globals['DT_INVALID'] = DataType.DT_INVALID + * __Pyx_globals['DT_INT8'] = DataType.DT_INT8 # <<<<<<<<<<<<<< + * __Pyx_globals['DT_UINT8'] = DataType.DT_UINT8 + * __Pyx_globals['DT_INT16'] = DataType.DT_INT16 + */ + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_DataType); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 69, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_DT_INT8); if (unlikely(!__pyx_t_15)) __PYX_ERR(1, 69, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_15); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(__Pyx_globals == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(1, 69, __pyx_L1_error) + } + if (unlikely(PyDict_SetItem(__Pyx_globals, __pyx_n_s_DT_INT8, __pyx_t_15) < 0)) __PYX_ERR(1, 69, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + + /* "EnumType":70 + * __Pyx_globals['DT_INVALID'] = DataType.DT_INVALID + * __Pyx_globals['DT_INT8'] = DataType.DT_INT8 + * __Pyx_globals['DT_UINT8'] = DataType.DT_UINT8 # <<<<<<<<<<<<<< + * __Pyx_globals['DT_INT16'] = DataType.DT_INT16 + * __Pyx_globals['DT_UINT16'] = DataType.DT_UINT16 + */ + __Pyx_GetModuleGlobalName(__pyx_t_15, __pyx_n_s_DataType); if (unlikely(!__pyx_t_15)) __PYX_ERR(1, 70, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_15); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_15, __pyx_n_s_DT_UINT8); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 70, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + if (unlikely(__Pyx_globals == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(1, 70, __pyx_L1_error) + } + if (unlikely(PyDict_SetItem(__Pyx_globals, __pyx_n_s_DT_UINT8, __pyx_t_2) < 0)) __PYX_ERR(1, 70, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "EnumType":71 + * __Pyx_globals['DT_INT8'] = DataType.DT_INT8 + * __Pyx_globals['DT_UINT8'] = DataType.DT_UINT8 + * __Pyx_globals['DT_INT16'] = DataType.DT_INT16 # <<<<<<<<<<<<<< + * __Pyx_globals['DT_UINT16'] = DataType.DT_UINT16 + * __Pyx_globals['DT_INT32'] = DataType.DT_INT32 + */ + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_DataType); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 71, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_DT_INT16); if (unlikely(!__pyx_t_15)) __PYX_ERR(1, 71, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_15); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(__Pyx_globals == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(1, 71, __pyx_L1_error) + } + if (unlikely(PyDict_SetItem(__Pyx_globals, __pyx_n_s_DT_INT16, __pyx_t_15) < 0)) __PYX_ERR(1, 71, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + + /* "EnumType":72 + * __Pyx_globals['DT_UINT8'] = DataType.DT_UINT8 + * __Pyx_globals['DT_INT16'] = DataType.DT_INT16 + * __Pyx_globals['DT_UINT16'] = DataType.DT_UINT16 # <<<<<<<<<<<<<< + * __Pyx_globals['DT_INT32'] = DataType.DT_INT32 + * __Pyx_globals['DT_UINT32'] = DataType.DT_UINT32 + */ + __Pyx_GetModuleGlobalName(__pyx_t_15, __pyx_n_s_DataType); if (unlikely(!__pyx_t_15)) __PYX_ERR(1, 72, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_15); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_15, __pyx_n_s_DT_UINT16); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 72, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + if (unlikely(__Pyx_globals == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(1, 72, __pyx_L1_error) + } + if (unlikely(PyDict_SetItem(__Pyx_globals, __pyx_n_s_DT_UINT16, __pyx_t_2) < 0)) __PYX_ERR(1, 72, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "EnumType":73 + * __Pyx_globals['DT_INT16'] = DataType.DT_INT16 + * __Pyx_globals['DT_UINT16'] = DataType.DT_UINT16 + * __Pyx_globals['DT_INT32'] = DataType.DT_INT32 # <<<<<<<<<<<<<< + * __Pyx_globals['DT_UINT32'] = DataType.DT_UINT32 + * __Pyx_globals['DT_INT64'] = DataType.DT_INT64 + */ + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_DataType); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 73, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_DT_INT32); if (unlikely(!__pyx_t_15)) __PYX_ERR(1, 73, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_15); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(__Pyx_globals == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(1, 73, __pyx_L1_error) + } + if (unlikely(PyDict_SetItem(__Pyx_globals, __pyx_n_s_DT_INT32, __pyx_t_15) < 0)) __PYX_ERR(1, 73, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + + /* "EnumType":74 + * __Pyx_globals['DT_UINT16'] = DataType.DT_UINT16 + * __Pyx_globals['DT_INT32'] = DataType.DT_INT32 + * __Pyx_globals['DT_UINT32'] = DataType.DT_UINT32 # <<<<<<<<<<<<<< + * __Pyx_globals['DT_INT64'] = DataType.DT_INT64 + * __Pyx_globals['DT_UINT64'] = DataType.DT_UINT64 + */ + __Pyx_GetModuleGlobalName(__pyx_t_15, __pyx_n_s_DataType); if (unlikely(!__pyx_t_15)) __PYX_ERR(1, 74, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_15); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_15, __pyx_n_s_DT_UINT32); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 74, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + if (unlikely(__Pyx_globals == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(1, 74, __pyx_L1_error) + } + if (unlikely(PyDict_SetItem(__Pyx_globals, __pyx_n_s_DT_UINT32, __pyx_t_2) < 0)) __PYX_ERR(1, 74, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "EnumType":75 + * __Pyx_globals['DT_INT32'] = DataType.DT_INT32 + * __Pyx_globals['DT_UINT32'] = DataType.DT_UINT32 + * __Pyx_globals['DT_INT64'] = DataType.DT_INT64 # <<<<<<<<<<<<<< + * __Pyx_globals['DT_UINT64'] = DataType.DT_UINT64 + * __Pyx_globals['DT_FLOAT32'] = DataType.DT_FLOAT32 */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_DracoPointCloud); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 34, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 34, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2); - __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_CalculateMetaclass(NULL, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 34, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_Py3MetaclassPrepare(__pyx_t_2, __pyx_t_1, __pyx_n_s_DracoMesh, __pyx_n_s_DracoMesh, (PyObject *) NULL, __pyx_n_s_DracoPy, (PyObject *) NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 34, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_DataType); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 75, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_DT_INT64); if (unlikely(!__pyx_t_15)) __PYX_ERR(1, 75, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_15); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(__Pyx_globals == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(1, 75, __pyx_L1_error) + } + if (unlikely(PyDict_SetItem(__Pyx_globals, __pyx_n_s_DT_INT64, __pyx_t_15) < 0)) __PYX_ERR(1, 75, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + + /* "EnumType":76 + * __Pyx_globals['DT_UINT32'] = DataType.DT_UINT32 + * __Pyx_globals['DT_INT64'] = DataType.DT_INT64 + * __Pyx_globals['DT_UINT64'] = DataType.DT_UINT64 # <<<<<<<<<<<<<< + * __Pyx_globals['DT_FLOAT32'] = DataType.DT_FLOAT32 + * __Pyx_globals['DT_FLOAT64'] = DataType.DT_FLOAT64 + */ + __Pyx_GetModuleGlobalName(__pyx_t_15, __pyx_n_s_DataType); if (unlikely(!__pyx_t_15)) __PYX_ERR(1, 76, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_15); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_15, __pyx_n_s_DT_UINT64); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 76, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + if (unlikely(__Pyx_globals == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(1, 76, __pyx_L1_error) + } + if (unlikely(PyDict_SetItem(__Pyx_globals, __pyx_n_s_DT_UINT64, __pyx_t_2) < 0)) __PYX_ERR(1, 76, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "DracoPy.pyx":36 - * class DracoMesh(DracoPointCloud): - * @property - * def faces(self): # <<<<<<<<<<<<<< - * return self.data_struct['faces'] - * + /* "EnumType":77 + * __Pyx_globals['DT_INT64'] = DataType.DT_INT64 + * __Pyx_globals['DT_UINT64'] = DataType.DT_UINT64 + * __Pyx_globals['DT_FLOAT32'] = DataType.DT_FLOAT32 # <<<<<<<<<<<<<< + * __Pyx_globals['DT_FLOAT64'] = DataType.DT_FLOAT64 + * __Pyx_globals['DT_BOOL'] = DataType.DT_BOOL */ - __pyx_t_4 = __Pyx_CyFunction_New(&__pyx_mdef_7DracoPy_9DracoMesh_1faces, 0, __pyx_n_s_DracoMesh_faces, NULL, __pyx_n_s_DracoPy, __pyx_d, ((PyObject *)__pyx_codeobj__17)); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 36, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_DataType); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 77, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_DT_FLOAT32); if (unlikely(!__pyx_t_15)) __PYX_ERR(1, 77, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_15); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(__Pyx_globals == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(1, 77, __pyx_L1_error) + } + if (unlikely(PyDict_SetItem(__Pyx_globals, __pyx_n_s_DT_FLOAT32, __pyx_t_15) < 0)) __PYX_ERR(1, 77, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + + /* "EnumType":78 + * __Pyx_globals['DT_UINT64'] = DataType.DT_UINT64 + * __Pyx_globals['DT_FLOAT32'] = DataType.DT_FLOAT32 + * __Pyx_globals['DT_FLOAT64'] = DataType.DT_FLOAT64 # <<<<<<<<<<<<<< + * __Pyx_globals['DT_BOOL'] = DataType.DT_BOOL + * __Pyx_globals['DT_TYPES_COUNT'] = DataType.DT_TYPES_COUNT + */ + __Pyx_GetModuleGlobalName(__pyx_t_15, __pyx_n_s_DataType); if (unlikely(!__pyx_t_15)) __PYX_ERR(1, 78, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_15); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_15, __pyx_n_s_DT_FLOAT64); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 78, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + if (unlikely(__Pyx_globals == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(1, 78, __pyx_L1_error) + } + if (unlikely(PyDict_SetItem(__Pyx_globals, __pyx_n_s_DT_FLOAT64, __pyx_t_2) < 0)) __PYX_ERR(1, 78, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "DracoPy.pyx":35 - * - * class DracoMesh(DracoPointCloud): - * @property # <<<<<<<<<<<<<< - * def faces(self): - * return self.data_struct['faces'] + /* "EnumType":79 + * __Pyx_globals['DT_FLOAT32'] = DataType.DT_FLOAT32 + * __Pyx_globals['DT_FLOAT64'] = DataType.DT_FLOAT64 + * __Pyx_globals['DT_BOOL'] = DataType.DT_BOOL # <<<<<<<<<<<<<< + * __Pyx_globals['DT_TYPES_COUNT'] = DataType.DT_TYPES_COUNT + * else: */ - __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_builtin_property, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 35, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_faces, __pyx_t_5) < 0) __PYX_ERR(0, 36, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_DataType); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 79, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_DT_BOOL); if (unlikely(!__pyx_t_15)) __PYX_ERR(1, 79, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_15); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(__Pyx_globals == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(1, 79, __pyx_L1_error) + } + if (unlikely(PyDict_SetItem(__Pyx_globals, __pyx_n_s_DT_BOOL, __pyx_t_15) < 0)) __PYX_ERR(1, 79, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + + /* "EnumType":80 + * __Pyx_globals['DT_FLOAT64'] = DataType.DT_FLOAT64 + * __Pyx_globals['DT_BOOL'] = DataType.DT_BOOL + * __Pyx_globals['DT_TYPES_COUNT'] = DataType.DT_TYPES_COUNT # <<<<<<<<<<<<<< + * else: + * class DataType(__Pyx_EnumBase): + */ + __Pyx_GetModuleGlobalName(__pyx_t_15, __pyx_n_s_DataType); if (unlikely(!__pyx_t_15)) __PYX_ERR(1, 80, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_15); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_15, __pyx_n_s_DT_TYPES_COUNT); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 80, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + if (unlikely(__Pyx_globals == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(1, 80, __pyx_L1_error) + } + if (unlikely(PyDict_SetItem(__Pyx_globals, __pyx_n_s_DT_TYPES_COUNT, __pyx_t_2) < 0)) __PYX_ERR(1, 80, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "DracoPy.pyx":40 + /* "EnumType":51 * - * @property - * def normals(self): # <<<<<<<<<<<<<< - * return self.data_struct['normals'] + * cdef dict __Pyx_globals = globals() + * if PY_VERSION_HEX >= 0x03040000: # <<<<<<<<<<<<<< * + * DataType = __Pyx_EnumBase('DataType', __Pyx_OrderedDict([ */ - __pyx_t_5 = __Pyx_CyFunction_New(&__pyx_mdef_7DracoPy_9DracoMesh_3normals, 0, __pyx_n_s_DracoMesh_normals, NULL, __pyx_n_s_DracoPy, __pyx_d, ((PyObject *)__pyx_codeobj__19)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 40, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_5); + goto __pyx_L4; + } - /* "DracoPy.pyx":39 - * return self.data_struct['faces'] - * - * @property # <<<<<<<<<<<<<< - * def normals(self): - * return self.data_struct['normals'] + /* "EnumType":82 + * __Pyx_globals['DT_TYPES_COUNT'] = DataType.DT_TYPES_COUNT + * else: + * class DataType(__Pyx_EnumBase): # <<<<<<<<<<<<<< + * pass + * __Pyx_globals['DT_INVALID'] = DataType(DT_INVALID, 'DT_INVALID') */ - __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_property, __pyx_t_5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 39, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__Pyx_SetNameInClass(__pyx_t_3, __pyx_n_s_normals, __pyx_t_4) < 0) __PYX_ERR(0, 40, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + /*else*/ { + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 82, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF(__Pyx_EnumBase); + __Pyx_GIVEREF(__Pyx_EnumBase); + PyTuple_SET_ITEM(__pyx_t_2, 0, __Pyx_EnumBase); + __pyx_t_15 = __Pyx_CalculateMetaclass(NULL, __pyx_t_2); if (unlikely(!__pyx_t_15)) __PYX_ERR(1, 82, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_15); + __pyx_t_14 = __Pyx_Py3MetaclassPrepare(__pyx_t_15, __pyx_t_2, __pyx_n_s_DataType, __pyx_n_s_DataType, (PyObject *) NULL, __pyx_n_s_EnumType, (PyObject *) NULL); if (unlikely(!__pyx_t_14)) __PYX_ERR(1, 82, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_14); + __pyx_t_13 = __Pyx_Py3ClassCreate(__pyx_t_15, __pyx_n_s_DataType, __pyx_t_2, __pyx_t_14, NULL, 0, 1); if (unlikely(!__pyx_t_13)) __PYX_ERR(1, 82, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_13); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_DataType, __pyx_t_13) < 0) __PYX_ERR(1, 82, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "DracoPy.pyx":34 - * return self.data_struct['points'] - * - * class DracoMesh(DracoPointCloud): # <<<<<<<<<<<<<< - * @property - * def faces(self): + /* "EnumType":84 + * class DataType(__Pyx_EnumBase): + * pass + * __Pyx_globals['DT_INVALID'] = DataType(DT_INVALID, 'DT_INVALID') # <<<<<<<<<<<<<< + * __Pyx_globals['DT_INT8'] = DataType(DT_INT8, 'DT_INT8') + * __Pyx_globals['DT_UINT8'] = DataType(DT_UINT8, 'DT_UINT8') */ - __pyx_t_4 = __Pyx_Py3ClassCreate(__pyx_t_2, __pyx_n_s_DracoMesh, __pyx_t_1, __pyx_t_3, NULL, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 34, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_DracoMesh, __pyx_t_4) < 0) __PYX_ERR(0, 34, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "DracoPy.pyx":43 - * return self.data_struct['normals'] - * - * class EncodingOptions(object): # <<<<<<<<<<<<<< - * def __init__(self, quantization_bits, quantization_range, quantization_origin): - * self.quantization_bits = quantization_bits + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_DataType); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 84, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_15 = __Pyx_PyInt_From_enum__draco_3a__3a_DataType(draco::DataType::DT_INVALID); if (unlikely(!__pyx_t_15)) __PYX_ERR(1, 84, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_15); + __pyx_t_14 = PyTuple_New(2); if (unlikely(!__pyx_t_14)) __PYX_ERR(1, 84, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_14); + __Pyx_GIVEREF(__pyx_t_15); + PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_15); + __Pyx_INCREF(__pyx_n_s_DT_INVALID); + __Pyx_GIVEREF(__pyx_n_s_DT_INVALID); + PyTuple_SET_ITEM(__pyx_t_14, 1, __pyx_n_s_DT_INVALID); + __pyx_t_15 = 0; + __pyx_t_15 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_14, NULL); if (unlikely(!__pyx_t_15)) __PYX_ERR(1, 84, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_15); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + if (unlikely(__Pyx_globals == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(1, 84, __pyx_L1_error) + } + if (unlikely(PyDict_SetItem(__Pyx_globals, __pyx_n_s_DT_INVALID, __pyx_t_15) < 0)) __PYX_ERR(1, 84, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + + /* "EnumType":85 + * pass + * __Pyx_globals['DT_INVALID'] = DataType(DT_INVALID, 'DT_INVALID') + * __Pyx_globals['DT_INT8'] = DataType(DT_INT8, 'DT_INT8') # <<<<<<<<<<<<<< + * __Pyx_globals['DT_UINT8'] = DataType(DT_UINT8, 'DT_UINT8') + * __Pyx_globals['DT_INT16'] = DataType(DT_INT16, 'DT_INT16') */ - __pyx_t_1 = __Pyx_CalculateMetaclass(NULL, __pyx_tuple__20); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 43, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_Py3MetaclassPrepare(__pyx_t_1, __pyx_tuple__20, __pyx_n_s_EncodingOptions, __pyx_n_s_EncodingOptions, (PyObject *) NULL, __pyx_n_s_DracoPy, (PyObject *) NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 43, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - - /* "DracoPy.pyx":44 - * - * class EncodingOptions(object): - * def __init__(self, quantization_bits, quantization_range, quantization_origin): # <<<<<<<<<<<<<< - * self.quantization_bits = quantization_bits - * self.quantization_range = quantization_range + __Pyx_GetModuleGlobalName(__pyx_t_15, __pyx_n_s_DataType); if (unlikely(!__pyx_t_15)) __PYX_ERR(1, 85, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_15); + __pyx_t_14 = __Pyx_PyInt_From_enum__draco_3a__3a_DataType(draco::DataType::DT_INT8); if (unlikely(!__pyx_t_14)) __PYX_ERR(1, 85, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_14); + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 85, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GIVEREF(__pyx_t_14); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_14); + __Pyx_INCREF(__pyx_n_s_DT_INT8); + __Pyx_GIVEREF(__pyx_n_s_DT_INT8); + PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_n_s_DT_INT8); + __pyx_t_14 = 0; + __pyx_t_14 = __Pyx_PyObject_Call(__pyx_t_15, __pyx_t_2, NULL); if (unlikely(!__pyx_t_14)) __PYX_ERR(1, 85, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_14); + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(__Pyx_globals == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(1, 85, __pyx_L1_error) + } + if (unlikely(PyDict_SetItem(__Pyx_globals, __pyx_n_s_DT_INT8, __pyx_t_14) < 0)) __PYX_ERR(1, 85, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + + /* "EnumType":86 + * __Pyx_globals['DT_INVALID'] = DataType(DT_INVALID, 'DT_INVALID') + * __Pyx_globals['DT_INT8'] = DataType(DT_INT8, 'DT_INT8') + * __Pyx_globals['DT_UINT8'] = DataType(DT_UINT8, 'DT_UINT8') # <<<<<<<<<<<<<< + * __Pyx_globals['DT_INT16'] = DataType(DT_INT16, 'DT_INT16') + * __Pyx_globals['DT_UINT16'] = DataType(DT_UINT16, 'DT_UINT16') */ - __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_7DracoPy_15EncodingOptions_1__init__, 0, __pyx_n_s_EncodingOptions___init, NULL, __pyx_n_s_DracoPy, __pyx_d, ((PyObject *)__pyx_codeobj__22)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 44, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_init, __pyx_t_3) < 0) __PYX_ERR(0, 44, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_GetModuleGlobalName(__pyx_t_14, __pyx_n_s_DataType); if (unlikely(!__pyx_t_14)) __PYX_ERR(1, 86, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_14); + __pyx_t_2 = __Pyx_PyInt_From_enum__draco_3a__3a_DataType(draco::DataType::DT_UINT8); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 86, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_15 = PyTuple_New(2); if (unlikely(!__pyx_t_15)) __PYX_ERR(1, 86, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_15); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_2); + __Pyx_INCREF(__pyx_n_s_DT_UINT8); + __Pyx_GIVEREF(__pyx_n_s_DT_UINT8); + PyTuple_SET_ITEM(__pyx_t_15, 1, __pyx_n_s_DT_UINT8); + __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_14, __pyx_t_15, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 86, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + if (unlikely(__Pyx_globals == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(1, 86, __pyx_L1_error) + } + if (unlikely(PyDict_SetItem(__Pyx_globals, __pyx_n_s_DT_UINT8, __pyx_t_2) < 0)) __PYX_ERR(1, 86, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "DracoPy.pyx":50 - * self.inverse_alpha = quantization_range / ((2 ** quantization_bits) - 1) - * - * def get_encoded_coordinate(self, value, axis): # <<<<<<<<<<<<<< - * if value < self.quantization_origin[axis] or value > (self.quantization_origin[axis] + self.quantization_range): - * raise ValueError('Specified value out of encoded range') + /* "EnumType":87 + * __Pyx_globals['DT_INT8'] = DataType(DT_INT8, 'DT_INT8') + * __Pyx_globals['DT_UINT8'] = DataType(DT_UINT8, 'DT_UINT8') + * __Pyx_globals['DT_INT16'] = DataType(DT_INT16, 'DT_INT16') # <<<<<<<<<<<<<< + * __Pyx_globals['DT_UINT16'] = DataType(DT_UINT16, 'DT_UINT16') + * __Pyx_globals['DT_INT32'] = DataType(DT_INT32, 'DT_INT32') */ - __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_7DracoPy_15EncodingOptions_3get_encoded_coordinate, 0, __pyx_n_s_EncodingOptions_get_encoded_coor, NULL, __pyx_n_s_DracoPy, __pyx_d, ((PyObject *)__pyx_codeobj__24)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 50, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_get_encoded_coordinate, __pyx_t_3) < 0) __PYX_ERR(0, 50, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - - /* "DracoPy.pyx":57 - * return self.quantization_origin[axis] + (quantized_index * self.inverse_alpha) - * - * def get_encoded_point(self, point): # <<<<<<<<<<<<<< - * encoded_point = [] - * for axis in range(self.num_axes): + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_DataType); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 87, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_15 = __Pyx_PyInt_From_enum__draco_3a__3a_DataType(draco::DataType::DT_INT16); if (unlikely(!__pyx_t_15)) __PYX_ERR(1, 87, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_15); + __pyx_t_14 = PyTuple_New(2); if (unlikely(!__pyx_t_14)) __PYX_ERR(1, 87, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_14); + __Pyx_GIVEREF(__pyx_t_15); + PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_15); + __Pyx_INCREF(__pyx_n_s_DT_INT16); + __Pyx_GIVEREF(__pyx_n_s_DT_INT16); + PyTuple_SET_ITEM(__pyx_t_14, 1, __pyx_n_s_DT_INT16); + __pyx_t_15 = 0; + __pyx_t_15 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_14, NULL); if (unlikely(!__pyx_t_15)) __PYX_ERR(1, 87, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_15); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + if (unlikely(__Pyx_globals == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(1, 87, __pyx_L1_error) + } + if (unlikely(PyDict_SetItem(__Pyx_globals, __pyx_n_s_DT_INT16, __pyx_t_15) < 0)) __PYX_ERR(1, 87, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + + /* "EnumType":88 + * __Pyx_globals['DT_UINT8'] = DataType(DT_UINT8, 'DT_UINT8') + * __Pyx_globals['DT_INT16'] = DataType(DT_INT16, 'DT_INT16') + * __Pyx_globals['DT_UINT16'] = DataType(DT_UINT16, 'DT_UINT16') # <<<<<<<<<<<<<< + * __Pyx_globals['DT_INT32'] = DataType(DT_INT32, 'DT_INT32') + * __Pyx_globals['DT_UINT32'] = DataType(DT_UINT32, 'DT_UINT32') */ - __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_7DracoPy_15EncodingOptions_5get_encoded_point, 0, __pyx_n_s_EncodingOptions_get_encoded_poin, NULL, __pyx_n_s_DracoPy, __pyx_d, ((PyObject *)__pyx_codeobj__26)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 57, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_get_encoded_point, __pyx_t_3) < 0) __PYX_ERR(0, 57, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_GetModuleGlobalName(__pyx_t_15, __pyx_n_s_DataType); if (unlikely(!__pyx_t_15)) __PYX_ERR(1, 88, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_15); + __pyx_t_14 = __Pyx_PyInt_From_enum__draco_3a__3a_DataType(draco::DataType::DT_UINT16); if (unlikely(!__pyx_t_14)) __PYX_ERR(1, 88, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_14); + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 88, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GIVEREF(__pyx_t_14); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_14); + __Pyx_INCREF(__pyx_n_s_DT_UINT16); + __Pyx_GIVEREF(__pyx_n_s_DT_UINT16); + PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_n_s_DT_UINT16); + __pyx_t_14 = 0; + __pyx_t_14 = __Pyx_PyObject_Call(__pyx_t_15, __pyx_t_2, NULL); if (unlikely(!__pyx_t_14)) __PYX_ERR(1, 88, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_14); + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(__Pyx_globals == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(1, 88, __pyx_L1_error) + } + if (unlikely(PyDict_SetItem(__Pyx_globals, __pyx_n_s_DT_UINT16, __pyx_t_14) < 0)) __PYX_ERR(1, 88, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + + /* "EnumType":89 + * __Pyx_globals['DT_INT16'] = DataType(DT_INT16, 'DT_INT16') + * __Pyx_globals['DT_UINT16'] = DataType(DT_UINT16, 'DT_UINT16') + * __Pyx_globals['DT_INT32'] = DataType(DT_INT32, 'DT_INT32') # <<<<<<<<<<<<<< + * __Pyx_globals['DT_UINT32'] = DataType(DT_UINT32, 'DT_UINT32') + * __Pyx_globals['DT_INT64'] = DataType(DT_INT64, 'DT_INT64') + */ + __Pyx_GetModuleGlobalName(__pyx_t_14, __pyx_n_s_DataType); if (unlikely(!__pyx_t_14)) __PYX_ERR(1, 89, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_14); + __pyx_t_2 = __Pyx_PyInt_From_enum__draco_3a__3a_DataType(draco::DataType::DT_INT32); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 89, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_15 = PyTuple_New(2); if (unlikely(!__pyx_t_15)) __PYX_ERR(1, 89, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_15); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_2); + __Pyx_INCREF(__pyx_n_s_DT_INT32); + __Pyx_GIVEREF(__pyx_n_s_DT_INT32); + PyTuple_SET_ITEM(__pyx_t_15, 1, __pyx_n_s_DT_INT32); + __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_14, __pyx_t_15, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 89, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + if (unlikely(__Pyx_globals == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(1, 89, __pyx_L1_error) + } + if (unlikely(PyDict_SetItem(__Pyx_globals, __pyx_n_s_DT_INT32, __pyx_t_2) < 0)) __PYX_ERR(1, 89, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "DracoPy.pyx":64 - * - * @property - * def num_axes(self): # <<<<<<<<<<<<<< - * return 3 - * + /* "EnumType":90 + * __Pyx_globals['DT_UINT16'] = DataType(DT_UINT16, 'DT_UINT16') + * __Pyx_globals['DT_INT32'] = DataType(DT_INT32, 'DT_INT32') + * __Pyx_globals['DT_UINT32'] = DataType(DT_UINT32, 'DT_UINT32') # <<<<<<<<<<<<<< + * __Pyx_globals['DT_INT64'] = DataType(DT_INT64, 'DT_INT64') + * __Pyx_globals['DT_UINT64'] = DataType(DT_UINT64, 'DT_UINT64') */ - __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_7DracoPy_15EncodingOptions_7num_axes, 0, __pyx_n_s_EncodingOptions_num_axes, NULL, __pyx_n_s_DracoPy, __pyx_d, ((PyObject *)__pyx_codeobj__28)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 64, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_DataType); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 90, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_15 = __Pyx_PyInt_From_enum__draco_3a__3a_DataType(draco::DataType::DT_UINT32); if (unlikely(!__pyx_t_15)) __PYX_ERR(1, 90, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_15); + __pyx_t_14 = PyTuple_New(2); if (unlikely(!__pyx_t_14)) __PYX_ERR(1, 90, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_14); + __Pyx_GIVEREF(__pyx_t_15); + PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_15); + __Pyx_INCREF(__pyx_n_s_DT_UINT32); + __Pyx_GIVEREF(__pyx_n_s_DT_UINT32); + PyTuple_SET_ITEM(__pyx_t_14, 1, __pyx_n_s_DT_UINT32); + __pyx_t_15 = 0; + __pyx_t_15 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_14, NULL); if (unlikely(!__pyx_t_15)) __PYX_ERR(1, 90, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_15); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + if (unlikely(__Pyx_globals == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(1, 90, __pyx_L1_error) + } + if (unlikely(PyDict_SetItem(__Pyx_globals, __pyx_n_s_DT_UINT32, __pyx_t_15) < 0)) __PYX_ERR(1, 90, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + + /* "EnumType":91 + * __Pyx_globals['DT_INT32'] = DataType(DT_INT32, 'DT_INT32') + * __Pyx_globals['DT_UINT32'] = DataType(DT_UINT32, 'DT_UINT32') + * __Pyx_globals['DT_INT64'] = DataType(DT_INT64, 'DT_INT64') # <<<<<<<<<<<<<< + * __Pyx_globals['DT_UINT64'] = DataType(DT_UINT64, 'DT_UINT64') + * __Pyx_globals['DT_FLOAT32'] = DataType(DT_FLOAT32, 'DT_FLOAT32') + */ + __Pyx_GetModuleGlobalName(__pyx_t_15, __pyx_n_s_DataType); if (unlikely(!__pyx_t_15)) __PYX_ERR(1, 91, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_15); + __pyx_t_14 = __Pyx_PyInt_From_enum__draco_3a__3a_DataType(draco::DataType::DT_INT64); if (unlikely(!__pyx_t_14)) __PYX_ERR(1, 91, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_14); + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 91, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GIVEREF(__pyx_t_14); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_14); + __Pyx_INCREF(__pyx_n_s_DT_INT64); + __Pyx_GIVEREF(__pyx_n_s_DT_INT64); + PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_n_s_DT_INT64); + __pyx_t_14 = 0; + __pyx_t_14 = __Pyx_PyObject_Call(__pyx_t_15, __pyx_t_2, NULL); if (unlikely(!__pyx_t_14)) __PYX_ERR(1, 91, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_14); + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(__Pyx_globals == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(1, 91, __pyx_L1_error) + } + if (unlikely(PyDict_SetItem(__Pyx_globals, __pyx_n_s_DT_INT64, __pyx_t_14) < 0)) __PYX_ERR(1, 91, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + + /* "EnumType":92 + * __Pyx_globals['DT_UINT32'] = DataType(DT_UINT32, 'DT_UINT32') + * __Pyx_globals['DT_INT64'] = DataType(DT_INT64, 'DT_INT64') + * __Pyx_globals['DT_UINT64'] = DataType(DT_UINT64, 'DT_UINT64') # <<<<<<<<<<<<<< + * __Pyx_globals['DT_FLOAT32'] = DataType(DT_FLOAT32, 'DT_FLOAT32') + * __Pyx_globals['DT_FLOAT64'] = DataType(DT_FLOAT64, 'DT_FLOAT64') + */ + __Pyx_GetModuleGlobalName(__pyx_t_14, __pyx_n_s_DataType); if (unlikely(!__pyx_t_14)) __PYX_ERR(1, 92, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_14); + __pyx_t_2 = __Pyx_PyInt_From_enum__draco_3a__3a_DataType(draco::DataType::DT_UINT64); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 92, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_15 = PyTuple_New(2); if (unlikely(!__pyx_t_15)) __PYX_ERR(1, 92, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_15); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_2); + __Pyx_INCREF(__pyx_n_s_DT_UINT64); + __Pyx_GIVEREF(__pyx_n_s_DT_UINT64); + PyTuple_SET_ITEM(__pyx_t_15, 1, __pyx_n_s_DT_UINT64); + __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_14, __pyx_t_15, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 92, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + if (unlikely(__Pyx_globals == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(1, 92, __pyx_L1_error) + } + if (unlikely(PyDict_SetItem(__Pyx_globals, __pyx_n_s_DT_UINT64, __pyx_t_2) < 0)) __PYX_ERR(1, 92, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "DracoPy.pyx":63 - * return encoded_point + /* "EnumType":93 + * __Pyx_globals['DT_INT64'] = DataType(DT_INT64, 'DT_INT64') + * __Pyx_globals['DT_UINT64'] = DataType(DT_UINT64, 'DT_UINT64') + * __Pyx_globals['DT_FLOAT32'] = DataType(DT_FLOAT32, 'DT_FLOAT32') # <<<<<<<<<<<<<< + * __Pyx_globals['DT_FLOAT64'] = DataType(DT_FLOAT64, 'DT_FLOAT64') + * __Pyx_globals['DT_BOOL'] = DataType(DT_BOOL, 'DT_BOOL') + */ + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_DataType); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 93, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_15 = __Pyx_PyInt_From_enum__draco_3a__3a_DataType(draco::DataType::DT_FLOAT32); if (unlikely(!__pyx_t_15)) __PYX_ERR(1, 93, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_15); + __pyx_t_14 = PyTuple_New(2); if (unlikely(!__pyx_t_14)) __PYX_ERR(1, 93, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_14); + __Pyx_GIVEREF(__pyx_t_15); + PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_15); + __Pyx_INCREF(__pyx_n_s_DT_FLOAT32); + __Pyx_GIVEREF(__pyx_n_s_DT_FLOAT32); + PyTuple_SET_ITEM(__pyx_t_14, 1, __pyx_n_s_DT_FLOAT32); + __pyx_t_15 = 0; + __pyx_t_15 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_14, NULL); if (unlikely(!__pyx_t_15)) __PYX_ERR(1, 93, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_15); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + if (unlikely(__Pyx_globals == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(1, 93, __pyx_L1_error) + } + if (unlikely(PyDict_SetItem(__Pyx_globals, __pyx_n_s_DT_FLOAT32, __pyx_t_15) < 0)) __PYX_ERR(1, 93, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + + /* "EnumType":94 + * __Pyx_globals['DT_UINT64'] = DataType(DT_UINT64, 'DT_UINT64') + * __Pyx_globals['DT_FLOAT32'] = DataType(DT_FLOAT32, 'DT_FLOAT32') + * __Pyx_globals['DT_FLOAT64'] = DataType(DT_FLOAT64, 'DT_FLOAT64') # <<<<<<<<<<<<<< + * __Pyx_globals['DT_BOOL'] = DataType(DT_BOOL, 'DT_BOOL') + * __Pyx_globals['DT_TYPES_COUNT'] = DataType(DT_TYPES_COUNT, 'DT_TYPES_COUNT') + */ + __Pyx_GetModuleGlobalName(__pyx_t_15, __pyx_n_s_DataType); if (unlikely(!__pyx_t_15)) __PYX_ERR(1, 94, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_15); + __pyx_t_14 = __Pyx_PyInt_From_enum__draco_3a__3a_DataType(draco::DataType::DT_FLOAT64); if (unlikely(!__pyx_t_14)) __PYX_ERR(1, 94, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_14); + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 94, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GIVEREF(__pyx_t_14); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_14); + __Pyx_INCREF(__pyx_n_s_DT_FLOAT64); + __Pyx_GIVEREF(__pyx_n_s_DT_FLOAT64); + PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_n_s_DT_FLOAT64); + __pyx_t_14 = 0; + __pyx_t_14 = __Pyx_PyObject_Call(__pyx_t_15, __pyx_t_2, NULL); if (unlikely(!__pyx_t_14)) __PYX_ERR(1, 94, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_14); + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(__Pyx_globals == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(1, 94, __pyx_L1_error) + } + if (unlikely(PyDict_SetItem(__Pyx_globals, __pyx_n_s_DT_FLOAT64, __pyx_t_14) < 0)) __PYX_ERR(1, 94, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + + /* "EnumType":95 + * __Pyx_globals['DT_FLOAT32'] = DataType(DT_FLOAT32, 'DT_FLOAT32') + * __Pyx_globals['DT_FLOAT64'] = DataType(DT_FLOAT64, 'DT_FLOAT64') + * __Pyx_globals['DT_BOOL'] = DataType(DT_BOOL, 'DT_BOOL') # <<<<<<<<<<<<<< + * __Pyx_globals['DT_TYPES_COUNT'] = DataType(DT_TYPES_COUNT, 'DT_TYPES_COUNT') * - * @property # <<<<<<<<<<<<<< - * def num_axes(self): - * return 3 */ - __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_builtin_property, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 63, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__Pyx_SetNameInClass(__pyx_t_2, __pyx_n_s_num_axes, __pyx_t_4) < 0) __PYX_ERR(0, 64, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_GetModuleGlobalName(__pyx_t_14, __pyx_n_s_DataType); if (unlikely(!__pyx_t_14)) __PYX_ERR(1, 95, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_14); + __pyx_t_2 = __Pyx_PyInt_From_enum__draco_3a__3a_DataType(draco::DataType::DT_BOOL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 95, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_15 = PyTuple_New(2); if (unlikely(!__pyx_t_15)) __PYX_ERR(1, 95, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_15); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_2); + __Pyx_INCREF(__pyx_n_s_DT_BOOL); + __Pyx_GIVEREF(__pyx_n_s_DT_BOOL); + PyTuple_SET_ITEM(__pyx_t_15, 1, __pyx_n_s_DT_BOOL); + __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_14, __pyx_t_15, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 95, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + if (unlikely(__Pyx_globals == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(1, 95, __pyx_L1_error) + } + if (unlikely(PyDict_SetItem(__Pyx_globals, __pyx_n_s_DT_BOOL, __pyx_t_2) < 0)) __PYX_ERR(1, 95, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "DracoPy.pyx":43 - * return self.data_struct['normals'] + /* "EnumType":96 + * __Pyx_globals['DT_FLOAT64'] = DataType(DT_FLOAT64, 'DT_FLOAT64') + * __Pyx_globals['DT_BOOL'] = DataType(DT_BOOL, 'DT_BOOL') + * __Pyx_globals['DT_TYPES_COUNT'] = DataType(DT_TYPES_COUNT, 'DT_TYPES_COUNT') # <<<<<<<<<<<<<< * - * class EncodingOptions(object): # <<<<<<<<<<<<<< - * def __init__(self, quantization_bits, quantization_range, quantization_origin): - * self.quantization_bits = quantization_bits */ - __pyx_t_4 = __Pyx_Py3ClassCreate(__pyx_t_1, __pyx_n_s_EncodingOptions, __pyx_tuple__20, __pyx_t_2, NULL, 0, 0); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 43, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_EncodingOptions, __pyx_t_4) < 0) __PYX_ERR(0, 43, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_DataType); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 96, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_15 = __Pyx_PyInt_From_enum__draco_3a__3a_DataType(draco::DataType::DT_TYPES_COUNT); if (unlikely(!__pyx_t_15)) __PYX_ERR(1, 96, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_15); + __pyx_t_14 = PyTuple_New(2); if (unlikely(!__pyx_t_14)) __PYX_ERR(1, 96, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_14); + __Pyx_GIVEREF(__pyx_t_15); + PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_15); + __Pyx_INCREF(__pyx_n_s_DT_TYPES_COUNT); + __Pyx_GIVEREF(__pyx_n_s_DT_TYPES_COUNT); + PyTuple_SET_ITEM(__pyx_t_14, 1, __pyx_n_s_DT_TYPES_COUNT); + __pyx_t_15 = 0; + __pyx_t_15 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_14, NULL); if (unlikely(!__pyx_t_15)) __PYX_ERR(1, 96, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_15); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + if (unlikely(__Pyx_globals == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(1, 96, __pyx_L1_error) + } + if (unlikely(PyDict_SetItem(__Pyx_globals, __pyx_n_s_DT_TYPES_COUNT, __pyx_t_15) < 0)) __PYX_ERR(1, 96, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + } + __pyx_L4:; - /* "DracoPy.pyx":67 - * return 3 + /* "EnumType":50 * - * class FileTypeException(Exception): # <<<<<<<<<<<<<< - * pass + * + * cdef dict __Pyx_globals = globals() # <<<<<<<<<<<<<< + * if PY_VERSION_HEX >= 0x03040000: * */ - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 67, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); - __Pyx_GIVEREF(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); - PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); - __pyx_t_2 = __Pyx_CalculateMetaclass(NULL, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 67, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = __Pyx_Py3MetaclassPrepare(__pyx_t_2, __pyx_t_1, __pyx_n_s_FileTypeException, __pyx_n_s_FileTypeException, (PyObject *) NULL, __pyx_n_s_DracoPy, (PyObject *) NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 67, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = __Pyx_Py3ClassCreate(__pyx_t_2, __pyx_n_s_FileTypeException, __pyx_t_1, __pyx_t_4, NULL, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 67, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_FileTypeException, __pyx_t_3) < 0) __PYX_ERR(0, 67, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "DracoPy.pyx":70 - * pass + __pyx_t_15 = __Pyx_Globals(); if (unlikely(!__pyx_t_15)) __PYX_ERR(1, 50, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_15); + if (!(likely(PyDict_CheckExact(__pyx_t_15))||((__pyx_t_15) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "dict", Py_TYPE(__pyx_t_15)->tp_name), 0))) __PYX_ERR(1, 50, __pyx_L1_error) + __Pyx_XGOTREF(__Pyx_globals); + __Pyx_DECREF_SET(__Pyx_globals, ((PyObject*)__pyx_t_15)); + __Pyx_GIVEREF(__pyx_t_15); + __pyx_t_15 = 0; + + /* "EnumType":51 * - * class EncodingFailedException(Exception): # <<<<<<<<<<<<<< - * pass + * cdef dict __Pyx_globals = globals() + * if PY_VERSION_HEX >= 0x03040000: # <<<<<<<<<<<<<< * + * GeometryAttributeType = __Pyx_EnumBase('GeometryAttributeType', __Pyx_OrderedDict([ */ - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 70, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); - __Pyx_GIVEREF(((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); - PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)(&((PyTypeObject*)PyExc_Exception)[0]))); - __pyx_t_2 = __Pyx_CalculateMetaclass(NULL, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 70, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = __Pyx_Py3MetaclassPrepare(__pyx_t_2, __pyx_t_1, __pyx_n_s_EncodingFailedException, __pyx_n_s_EncodingFailedException, (PyObject *) NULL, __pyx_n_s_DracoPy, (PyObject *) NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 70, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = __Pyx_Py3ClassCreate(__pyx_t_2, __pyx_n_s_EncodingFailedException, __pyx_t_1, __pyx_t_4, NULL, 0, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 70, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_EncodingFailedException, __pyx_t_3) < 0) __PYX_ERR(0, 70, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_7 = ((PY_VERSION_HEX >= 0x03040000) != 0); + if (__pyx_t_7) { - /* "DracoPy.pyx":73 - * pass + /* "EnumType":54 * - * def encode_mesh_to_buffer(points, faces, quantization_bits=14, compression_level=1, quantization_range=-1, quantization_origin=None, create_metadata=False): # <<<<<<<<<<<<<< - * """ - * Encode a list or numpy array of points/vertices (float) and faces (unsigned int) to a draco buffer. + * GeometryAttributeType = __Pyx_EnumBase('GeometryAttributeType', __Pyx_OrderedDict([ + * ('INVALID', INVALID), # <<<<<<<<<<<<<< + * ('POSITION', POSITION), + * ('NORMAL', NORMAL), */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_7DracoPy_1encode_mesh_to_buffer, NULL, __pyx_n_s_DracoPy); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 73, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_encode_mesh_to_buffer, __pyx_t_1) < 0) __PYX_ERR(0, 73, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "DracoPy.pyx":104 - * raise ValueError("Input invalid") + __pyx_t_15 = __Pyx_PyInt_From_enum__draco_3a__3a_GeometryAttribute_3a__3a_Type(draco::GeometryAttribute::INVALID); if (unlikely(!__pyx_t_15)) __PYX_ERR(1, 54, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_15); + __pyx_t_14 = PyTuple_New(2); if (unlikely(!__pyx_t_14)) __PYX_ERR(1, 54, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_14); + __Pyx_INCREF(__pyx_n_s_INVALID); + __Pyx_GIVEREF(__pyx_n_s_INVALID); + PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_n_s_INVALID); + __Pyx_GIVEREF(__pyx_t_15); + PyTuple_SET_ITEM(__pyx_t_14, 1, __pyx_t_15); + __pyx_t_15 = 0; + + /* "EnumType":55 + * GeometryAttributeType = __Pyx_EnumBase('GeometryAttributeType', __Pyx_OrderedDict([ + * ('INVALID', INVALID), + * ('POSITION', POSITION), # <<<<<<<<<<<<<< + * ('NORMAL', NORMAL), + * ('COLOR', COLOR), + */ + __pyx_t_15 = __Pyx_PyInt_From_enum__draco_3a__3a_GeometryAttribute_3a__3a_Type(draco::GeometryAttribute::POSITION); if (unlikely(!__pyx_t_15)) __PYX_ERR(1, 55, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_15); + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 55, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF(__pyx_n_s_POSITION); + __Pyx_GIVEREF(__pyx_n_s_POSITION); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_POSITION); + __Pyx_GIVEREF(__pyx_t_15); + PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_15); + __pyx_t_15 = 0; + + /* "EnumType":56 + * ('INVALID', INVALID), + * ('POSITION', POSITION), + * ('NORMAL', NORMAL), # <<<<<<<<<<<<<< + * ('COLOR', COLOR), + * ('TEX_COORD', TEX_COORD), + */ + __pyx_t_15 = __Pyx_PyInt_From_enum__draco_3a__3a_GeometryAttribute_3a__3a_Type(draco::GeometryAttribute::NORMAL); if (unlikely(!__pyx_t_15)) __PYX_ERR(1, 56, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_15); + __pyx_t_13 = PyTuple_New(2); if (unlikely(!__pyx_t_13)) __PYX_ERR(1, 56, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_13); + __Pyx_INCREF(__pyx_n_s_NORMAL); + __Pyx_GIVEREF(__pyx_n_s_NORMAL); + PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_n_s_NORMAL); + __Pyx_GIVEREF(__pyx_t_15); + PyTuple_SET_ITEM(__pyx_t_13, 1, __pyx_t_15); + __pyx_t_15 = 0; + + /* "EnumType":57 + * ('POSITION', POSITION), + * ('NORMAL', NORMAL), + * ('COLOR', COLOR), # <<<<<<<<<<<<<< + * ('TEX_COORD', TEX_COORD), + * ('GENERIC', GENERIC), + */ + __pyx_t_15 = __Pyx_PyInt_From_enum__draco_3a__3a_GeometryAttribute_3a__3a_Type(draco::GeometryAttribute::COLOR); if (unlikely(!__pyx_t_15)) __PYX_ERR(1, 57, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_15); + __pyx_t_12 = PyTuple_New(2); if (unlikely(!__pyx_t_12)) __PYX_ERR(1, 57, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_12); + __Pyx_INCREF(__pyx_n_s_COLOR); + __Pyx_GIVEREF(__pyx_n_s_COLOR); + PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_n_s_COLOR); + __Pyx_GIVEREF(__pyx_t_15); + PyTuple_SET_ITEM(__pyx_t_12, 1, __pyx_t_15); + __pyx_t_15 = 0; + + /* "EnumType":58 + * ('NORMAL', NORMAL), + * ('COLOR', COLOR), + * ('TEX_COORD', TEX_COORD), # <<<<<<<<<<<<<< + * ('GENERIC', GENERIC), + * ('NAMED_ATTRIBUTES_COUNT', NAMED_ATTRIBUTES_COUNT), + */ + __pyx_t_15 = __Pyx_PyInt_From_enum__draco_3a__3a_GeometryAttribute_3a__3a_Type(draco::GeometryAttribute::TEX_COORD); if (unlikely(!__pyx_t_15)) __PYX_ERR(1, 58, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_15); + __pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 58, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + __Pyx_INCREF(__pyx_n_s_TEX_COORD); + __Pyx_GIVEREF(__pyx_n_s_TEX_COORD); + PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_n_s_TEX_COORD); + __Pyx_GIVEREF(__pyx_t_15); + PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_15); + __pyx_t_15 = 0; + + /* "EnumType":59 + * ('COLOR', COLOR), + * ('TEX_COORD', TEX_COORD), + * ('GENERIC', GENERIC), # <<<<<<<<<<<<<< + * ('NAMED_ATTRIBUTES_COUNT', NAMED_ATTRIBUTES_COUNT), + * ])) + */ + __pyx_t_15 = __Pyx_PyInt_From_enum__draco_3a__3a_GeometryAttribute_3a__3a_Type(draco::GeometryAttribute::GENERIC); if (unlikely(!__pyx_t_15)) __PYX_ERR(1, 59, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_15); + __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 59, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __Pyx_INCREF(__pyx_n_s_GENERIC); + __Pyx_GIVEREF(__pyx_n_s_GENERIC); + PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_n_s_GENERIC); + __Pyx_GIVEREF(__pyx_t_15); + PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_15); + __pyx_t_15 = 0; + + /* "EnumType":60 + * ('TEX_COORD', TEX_COORD), + * ('GENERIC', GENERIC), + * ('NAMED_ATTRIBUTES_COUNT', NAMED_ATTRIBUTES_COUNT), # <<<<<<<<<<<<<< + * ])) + * __Pyx_globals['INVALID'] = GeometryAttributeType.INVALID + */ + __pyx_t_15 = __Pyx_PyInt_From_enum__draco_3a__3a_GeometryAttribute_3a__3a_Type(draco::GeometryAttribute::NAMED_ATTRIBUTES_COUNT); if (unlikely(!__pyx_t_15)) __PYX_ERR(1, 60, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_15); + __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 60, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_INCREF(__pyx_n_s_NAMED_ATTRIBUTES_COUNT); + __Pyx_GIVEREF(__pyx_n_s_NAMED_ATTRIBUTES_COUNT); + PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_n_s_NAMED_ATTRIBUTES_COUNT); + __Pyx_GIVEREF(__pyx_t_15); + PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_15); + __pyx_t_15 = 0; + + /* "EnumType":53 + * if PY_VERSION_HEX >= 0x03040000: * - * def encode_point_cloud_to_buffer(points, quantization_bits=14, compression_level=1, quantization_range=-1, quantization_origin=None, create_metadata=False): # <<<<<<<<<<<<<< - * """ - * Encode a list or numpy array of points/vertices (float) to a draco buffer. + * GeometryAttributeType = __Pyx_EnumBase('GeometryAttributeType', __Pyx_OrderedDict([ # <<<<<<<<<<<<<< + * ('INVALID', INVALID), + * ('POSITION', POSITION), */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_7DracoPy_3encode_point_cloud_to_buffer, NULL, __pyx_n_s_DracoPy); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 104, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_encode_point_cloud_to_buffer, __pyx_t_1) < 0) __PYX_ERR(0, 104, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_15 = PyList_New(7); if (unlikely(!__pyx_t_15)) __PYX_ERR(1, 53, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_15); + __Pyx_GIVEREF(__pyx_t_14); + PyList_SET_ITEM(__pyx_t_15, 0, __pyx_t_14); + __Pyx_GIVEREF(__pyx_t_2); + PyList_SET_ITEM(__pyx_t_15, 1, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_13); + PyList_SET_ITEM(__pyx_t_15, 2, __pyx_t_13); + __Pyx_GIVEREF(__pyx_t_12); + PyList_SET_ITEM(__pyx_t_15, 3, __pyx_t_12); + __Pyx_GIVEREF(__pyx_t_11); + PyList_SET_ITEM(__pyx_t_15, 4, __pyx_t_11); + __Pyx_GIVEREF(__pyx_t_10); + PyList_SET_ITEM(__pyx_t_15, 5, __pyx_t_10); + __Pyx_GIVEREF(__pyx_t_9); + PyList_SET_ITEM(__pyx_t_15, 6, __pyx_t_9); + __pyx_t_14 = 0; + __pyx_t_2 = 0; + __pyx_t_13 = 0; + __pyx_t_12 = 0; + __pyx_t_11 = 0; + __pyx_t_10 = 0; + __pyx_t_9 = 0; + __pyx_t_9 = __Pyx_PyObject_CallOneArg(__Pyx_OrderedDict, __pyx_t_15); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 53, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + __pyx_t_15 = PyTuple_New(2); if (unlikely(!__pyx_t_15)) __PYX_ERR(1, 53, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_15); + __Pyx_INCREF(__pyx_n_s_GeometryAttributeType); + __Pyx_GIVEREF(__pyx_n_s_GeometryAttributeType); + PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_n_s_GeometryAttributeType); + __Pyx_GIVEREF(__pyx_t_9); + PyTuple_SET_ITEM(__pyx_t_15, 1, __pyx_t_9); + __pyx_t_9 = 0; + __pyx_t_9 = __Pyx_PyObject_Call(__Pyx_EnumBase, __pyx_t_15, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 53, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + if (PyDict_SetItem(__pyx_d, __pyx_n_s_GeometryAttributeType, __pyx_t_9) < 0) __PYX_ERR(1, 53, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + + /* "EnumType":62 + * ('NAMED_ATTRIBUTES_COUNT', NAMED_ATTRIBUTES_COUNT), + * ])) + * __Pyx_globals['INVALID'] = GeometryAttributeType.INVALID # <<<<<<<<<<<<<< + * __Pyx_globals['POSITION'] = GeometryAttributeType.POSITION + * __Pyx_globals['NORMAL'] = GeometryAttributeType.NORMAL + */ + __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_GeometryAttributeType); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 62, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_INVALID); if (unlikely(!__pyx_t_15)) __PYX_ERR(1, 62, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_15); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + if (unlikely(__Pyx_globals == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(1, 62, __pyx_L1_error) + } + if (unlikely(PyDict_SetItem(__Pyx_globals, __pyx_n_s_INVALID, __pyx_t_15) < 0)) __PYX_ERR(1, 62, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + + /* "EnumType":63 + * ])) + * __Pyx_globals['INVALID'] = GeometryAttributeType.INVALID + * __Pyx_globals['POSITION'] = GeometryAttributeType.POSITION # <<<<<<<<<<<<<< + * __Pyx_globals['NORMAL'] = GeometryAttributeType.NORMAL + * __Pyx_globals['COLOR'] = GeometryAttributeType.COLOR + */ + __Pyx_GetModuleGlobalName(__pyx_t_15, __pyx_n_s_GeometryAttributeType); if (unlikely(!__pyx_t_15)) __PYX_ERR(1, 63, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_15); + __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_15, __pyx_n_s_POSITION); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 63, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + if (unlikely(__Pyx_globals == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(1, 63, __pyx_L1_error) + } + if (unlikely(PyDict_SetItem(__Pyx_globals, __pyx_n_s_POSITION, __pyx_t_9) < 0)) __PYX_ERR(1, 63, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + + /* "EnumType":64 + * __Pyx_globals['INVALID'] = GeometryAttributeType.INVALID + * __Pyx_globals['POSITION'] = GeometryAttributeType.POSITION + * __Pyx_globals['NORMAL'] = GeometryAttributeType.NORMAL # <<<<<<<<<<<<<< + * __Pyx_globals['COLOR'] = GeometryAttributeType.COLOR + * __Pyx_globals['TEX_COORD'] = GeometryAttributeType.TEX_COORD + */ + __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_GeometryAttributeType); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 64, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_NORMAL); if (unlikely(!__pyx_t_15)) __PYX_ERR(1, 64, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_15); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + if (unlikely(__Pyx_globals == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(1, 64, __pyx_L1_error) + } + if (unlikely(PyDict_SetItem(__Pyx_globals, __pyx_n_s_NORMAL, __pyx_t_15) < 0)) __PYX_ERR(1, 64, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + + /* "EnumType":65 + * __Pyx_globals['POSITION'] = GeometryAttributeType.POSITION + * __Pyx_globals['NORMAL'] = GeometryAttributeType.NORMAL + * __Pyx_globals['COLOR'] = GeometryAttributeType.COLOR # <<<<<<<<<<<<<< + * __Pyx_globals['TEX_COORD'] = GeometryAttributeType.TEX_COORD + * __Pyx_globals['GENERIC'] = GeometryAttributeType.GENERIC + */ + __Pyx_GetModuleGlobalName(__pyx_t_15, __pyx_n_s_GeometryAttributeType); if (unlikely(!__pyx_t_15)) __PYX_ERR(1, 65, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_15); + __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_15, __pyx_n_s_COLOR); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 65, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + if (unlikely(__Pyx_globals == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(1, 65, __pyx_L1_error) + } + if (unlikely(PyDict_SetItem(__Pyx_globals, __pyx_n_s_COLOR, __pyx_t_9) < 0)) __PYX_ERR(1, 65, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + + /* "EnumType":66 + * __Pyx_globals['NORMAL'] = GeometryAttributeType.NORMAL + * __Pyx_globals['COLOR'] = GeometryAttributeType.COLOR + * __Pyx_globals['TEX_COORD'] = GeometryAttributeType.TEX_COORD # <<<<<<<<<<<<<< + * __Pyx_globals['GENERIC'] = GeometryAttributeType.GENERIC + * __Pyx_globals['NAMED_ATTRIBUTES_COUNT'] = GeometryAttributeType.NAMED_ATTRIBUTES_COUNT + */ + __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_GeometryAttributeType); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 66, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_TEX_COORD); if (unlikely(!__pyx_t_15)) __PYX_ERR(1, 66, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_15); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + if (unlikely(__Pyx_globals == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(1, 66, __pyx_L1_error) + } + if (unlikely(PyDict_SetItem(__Pyx_globals, __pyx_n_s_TEX_COORD, __pyx_t_15) < 0)) __PYX_ERR(1, 66, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + + /* "EnumType":67 + * __Pyx_globals['COLOR'] = GeometryAttributeType.COLOR + * __Pyx_globals['TEX_COORD'] = GeometryAttributeType.TEX_COORD + * __Pyx_globals['GENERIC'] = GeometryAttributeType.GENERIC # <<<<<<<<<<<<<< + * __Pyx_globals['NAMED_ATTRIBUTES_COUNT'] = GeometryAttributeType.NAMED_ATTRIBUTES_COUNT + * else: + */ + __Pyx_GetModuleGlobalName(__pyx_t_15, __pyx_n_s_GeometryAttributeType); if (unlikely(!__pyx_t_15)) __PYX_ERR(1, 67, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_15); + __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_15, __pyx_n_s_GENERIC); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 67, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + if (unlikely(__Pyx_globals == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(1, 67, __pyx_L1_error) + } + if (unlikely(PyDict_SetItem(__Pyx_globals, __pyx_n_s_GENERIC, __pyx_t_9) < 0)) __PYX_ERR(1, 67, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + + /* "EnumType":68 + * __Pyx_globals['TEX_COORD'] = GeometryAttributeType.TEX_COORD + * __Pyx_globals['GENERIC'] = GeometryAttributeType.GENERIC + * __Pyx_globals['NAMED_ATTRIBUTES_COUNT'] = GeometryAttributeType.NAMED_ATTRIBUTES_COUNT # <<<<<<<<<<<<<< + * else: + * class GeometryAttributeType(__Pyx_EnumBase): + */ + __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_GeometryAttributeType); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 68, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_NAMED_ATTRIBUTES_COUNT); if (unlikely(!__pyx_t_15)) __PYX_ERR(1, 68, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_15); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + if (unlikely(__Pyx_globals == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(1, 68, __pyx_L1_error) + } + if (unlikely(PyDict_SetItem(__Pyx_globals, __pyx_n_s_NAMED_ATTRIBUTES_COUNT, __pyx_t_15) < 0)) __PYX_ERR(1, 68, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; - /* "DracoPy.pyx":135 - * raise ValueError("Input invalid") + /* "EnumType":51 * - * def raise_decoding_error(decoding_status): # <<<<<<<<<<<<<< - * if decoding_status == DracoPy.decoding_status.not_draco_encoded: - * raise FileTypeException('Input mesh is not draco encoded') + * cdef dict __Pyx_globals = globals() + * if PY_VERSION_HEX >= 0x03040000: # <<<<<<<<<<<<<< + * + * GeometryAttributeType = __Pyx_EnumBase('GeometryAttributeType', __Pyx_OrderedDict([ */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_7DracoPy_5raise_decoding_error, NULL, __pyx_n_s_DracoPy); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 135, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_raise_decoding_error, __pyx_t_1) < 0) __PYX_ERR(0, 135, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L5; + } - /* "DracoPy.pyx":143 - * raise ValueError('DracoPy only supports meshes with position attributes') - * - * def decode_buffer_to_mesh(buffer): # <<<<<<<<<<<<<< - * mesh_struct = DracoPy.decode_buffer(buffer, len(buffer)) - * if mesh_struct.decode_status == DracoPy.decoding_status.successful: + /* "EnumType":70 + * __Pyx_globals['NAMED_ATTRIBUTES_COUNT'] = GeometryAttributeType.NAMED_ATTRIBUTES_COUNT + * else: + * class GeometryAttributeType(__Pyx_EnumBase): # <<<<<<<<<<<<<< + * pass + * __Pyx_globals['INVALID'] = GeometryAttributeType(INVALID, 'INVALID') + */ + /*else*/ { + __pyx_t_15 = PyTuple_New(1); if (unlikely(!__pyx_t_15)) __PYX_ERR(1, 70, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_15); + __Pyx_INCREF(__Pyx_EnumBase); + __Pyx_GIVEREF(__Pyx_EnumBase); + PyTuple_SET_ITEM(__pyx_t_15, 0, __Pyx_EnumBase); + __pyx_t_9 = __Pyx_CalculateMetaclass(NULL, __pyx_t_15); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 70, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_10 = __Pyx_Py3MetaclassPrepare(__pyx_t_9, __pyx_t_15, __pyx_n_s_GeometryAttributeType, __pyx_n_s_GeometryAttributeType, (PyObject *) NULL, __pyx_n_s_EnumType, (PyObject *) NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 70, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_11 = __Pyx_Py3ClassCreate(__pyx_t_9, __pyx_n_s_GeometryAttributeType, __pyx_t_15, __pyx_t_10, NULL, 0, 1); if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 70, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_11); + if (PyDict_SetItem(__pyx_d, __pyx_n_s_GeometryAttributeType, __pyx_t_11) < 0) __PYX_ERR(1, 70, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + + /* "EnumType":72 + * class GeometryAttributeType(__Pyx_EnumBase): + * pass + * __Pyx_globals['INVALID'] = GeometryAttributeType(INVALID, 'INVALID') # <<<<<<<<<<<<<< + * __Pyx_globals['POSITION'] = GeometryAttributeType(POSITION, 'POSITION') + * __Pyx_globals['NORMAL'] = GeometryAttributeType(NORMAL, 'NORMAL') + */ + __Pyx_GetModuleGlobalName(__pyx_t_15, __pyx_n_s_GeometryAttributeType); if (unlikely(!__pyx_t_15)) __PYX_ERR(1, 72, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_15); + __pyx_t_9 = __Pyx_PyInt_From_enum__draco_3a__3a_GeometryAttribute_3a__3a_Type(draco::GeometryAttribute::INVALID); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 72, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 72, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __Pyx_GIVEREF(__pyx_t_9); + PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_9); + __Pyx_INCREF(__pyx_n_s_INVALID); + __Pyx_GIVEREF(__pyx_n_s_INVALID); + PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_n_s_INVALID); + __pyx_t_9 = 0; + __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_15, __pyx_t_10, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 72, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + if (unlikely(__Pyx_globals == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(1, 72, __pyx_L1_error) + } + if (unlikely(PyDict_SetItem(__Pyx_globals, __pyx_n_s_INVALID, __pyx_t_9) < 0)) __PYX_ERR(1, 72, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + + /* "EnumType":73 + * pass + * __Pyx_globals['INVALID'] = GeometryAttributeType(INVALID, 'INVALID') + * __Pyx_globals['POSITION'] = GeometryAttributeType(POSITION, 'POSITION') # <<<<<<<<<<<<<< + * __Pyx_globals['NORMAL'] = GeometryAttributeType(NORMAL, 'NORMAL') + * __Pyx_globals['COLOR'] = GeometryAttributeType(COLOR, 'COLOR') + */ + __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_GeometryAttributeType); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 73, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_10 = __Pyx_PyInt_From_enum__draco_3a__3a_GeometryAttribute_3a__3a_Type(draco::GeometryAttribute::POSITION); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 73, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_15 = PyTuple_New(2); if (unlikely(!__pyx_t_15)) __PYX_ERR(1, 73, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_15); + __Pyx_GIVEREF(__pyx_t_10); + PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_10); + __Pyx_INCREF(__pyx_n_s_POSITION); + __Pyx_GIVEREF(__pyx_n_s_POSITION); + PyTuple_SET_ITEM(__pyx_t_15, 1, __pyx_n_s_POSITION); + __pyx_t_10 = 0; + __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_15, NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 73, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + if (unlikely(__Pyx_globals == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(1, 73, __pyx_L1_error) + } + if (unlikely(PyDict_SetItem(__Pyx_globals, __pyx_n_s_POSITION, __pyx_t_10) < 0)) __PYX_ERR(1, 73, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + + /* "EnumType":74 + * __Pyx_globals['INVALID'] = GeometryAttributeType(INVALID, 'INVALID') + * __Pyx_globals['POSITION'] = GeometryAttributeType(POSITION, 'POSITION') + * __Pyx_globals['NORMAL'] = GeometryAttributeType(NORMAL, 'NORMAL') # <<<<<<<<<<<<<< + * __Pyx_globals['COLOR'] = GeometryAttributeType(COLOR, 'COLOR') + * __Pyx_globals['TEX_COORD'] = GeometryAttributeType(TEX_COORD, 'TEX_COORD') + */ + __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_GeometryAttributeType); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 74, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_15 = __Pyx_PyInt_From_enum__draco_3a__3a_GeometryAttribute_3a__3a_Type(draco::GeometryAttribute::NORMAL); if (unlikely(!__pyx_t_15)) __PYX_ERR(1, 74, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_15); + __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 74, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_GIVEREF(__pyx_t_15); + PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_15); + __Pyx_INCREF(__pyx_n_s_NORMAL); + __Pyx_GIVEREF(__pyx_n_s_NORMAL); + PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_n_s_NORMAL); + __pyx_t_15 = 0; + __pyx_t_15 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_9, NULL); if (unlikely(!__pyx_t_15)) __PYX_ERR(1, 74, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_15); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + if (unlikely(__Pyx_globals == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(1, 74, __pyx_L1_error) + } + if (unlikely(PyDict_SetItem(__Pyx_globals, __pyx_n_s_NORMAL, __pyx_t_15) < 0)) __PYX_ERR(1, 74, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + + /* "EnumType":75 + * __Pyx_globals['POSITION'] = GeometryAttributeType(POSITION, 'POSITION') + * __Pyx_globals['NORMAL'] = GeometryAttributeType(NORMAL, 'NORMAL') + * __Pyx_globals['COLOR'] = GeometryAttributeType(COLOR, 'COLOR') # <<<<<<<<<<<<<< + * __Pyx_globals['TEX_COORD'] = GeometryAttributeType(TEX_COORD, 'TEX_COORD') + * __Pyx_globals['GENERIC'] = GeometryAttributeType(GENERIC, 'GENERIC') */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_7DracoPy_7decode_buffer_to_mesh, NULL, __pyx_n_s_DracoPy); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 143, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_decode_buffer_to_mesh, __pyx_t_1) < 0) __PYX_ERR(0, 143, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "DracoPy.pyx":150 - * raise_decoding_error(mesh_struct.decode_status) - * - * def decode_point_cloud_buffer(buffer): # <<<<<<<<<<<<<< - * point_cloud_struct = DracoPy.decode_buffer_to_point_cloud(buffer, len(buffer)) - * if point_cloud_struct.decode_status == DracoPy.decoding_status.successful: + __Pyx_GetModuleGlobalName(__pyx_t_15, __pyx_n_s_GeometryAttributeType); if (unlikely(!__pyx_t_15)) __PYX_ERR(1, 75, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_15); + __pyx_t_9 = __Pyx_PyInt_From_enum__draco_3a__3a_GeometryAttribute_3a__3a_Type(draco::GeometryAttribute::COLOR); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 75, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 75, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __Pyx_GIVEREF(__pyx_t_9); + PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_9); + __Pyx_INCREF(__pyx_n_s_COLOR); + __Pyx_GIVEREF(__pyx_n_s_COLOR); + PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_n_s_COLOR); + __pyx_t_9 = 0; + __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_15, __pyx_t_10, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 75, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + if (unlikely(__Pyx_globals == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(1, 75, __pyx_L1_error) + } + if (unlikely(PyDict_SetItem(__Pyx_globals, __pyx_n_s_COLOR, __pyx_t_9) < 0)) __PYX_ERR(1, 75, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + + /* "EnumType":76 + * __Pyx_globals['NORMAL'] = GeometryAttributeType(NORMAL, 'NORMAL') + * __Pyx_globals['COLOR'] = GeometryAttributeType(COLOR, 'COLOR') + * __Pyx_globals['TEX_COORD'] = GeometryAttributeType(TEX_COORD, 'TEX_COORD') # <<<<<<<<<<<<<< + * __Pyx_globals['GENERIC'] = GeometryAttributeType(GENERIC, 'GENERIC') + * __Pyx_globals['NAMED_ATTRIBUTES_COUNT'] = GeometryAttributeType(NAMED_ATTRIBUTES_COUNT, 'NAMED_ATTRIBUTES_COUNT') */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_7DracoPy_9decode_point_cloud_buffer, NULL, __pyx_n_s_DracoPy); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 150, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_decode_point_cloud_buffer, __pyx_t_1) < 0) __PYX_ERR(0, 150, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - - /* "DracoPy.pyx":1 - * # distutils: language = c++ # <<<<<<<<<<<<<< + __Pyx_GetModuleGlobalName(__pyx_t_9, __pyx_n_s_GeometryAttributeType); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 76, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_10 = __Pyx_PyInt_From_enum__draco_3a__3a_GeometryAttribute_3a__3a_Type(draco::GeometryAttribute::TEX_COORD); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 76, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_15 = PyTuple_New(2); if (unlikely(!__pyx_t_15)) __PYX_ERR(1, 76, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_15); + __Pyx_GIVEREF(__pyx_t_10); + PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_10); + __Pyx_INCREF(__pyx_n_s_TEX_COORD); + __Pyx_GIVEREF(__pyx_n_s_TEX_COORD); + PyTuple_SET_ITEM(__pyx_t_15, 1, __pyx_n_s_TEX_COORD); + __pyx_t_10 = 0; + __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_15, NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 76, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + if (unlikely(__Pyx_globals == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(1, 76, __pyx_L1_error) + } + if (unlikely(PyDict_SetItem(__Pyx_globals, __pyx_n_s_TEX_COORD, __pyx_t_10) < 0)) __PYX_ERR(1, 76, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + + /* "EnumType":77 + * __Pyx_globals['COLOR'] = GeometryAttributeType(COLOR, 'COLOR') + * __Pyx_globals['TEX_COORD'] = GeometryAttributeType(TEX_COORD, 'TEX_COORD') + * __Pyx_globals['GENERIC'] = GeometryAttributeType(GENERIC, 'GENERIC') # <<<<<<<<<<<<<< + * __Pyx_globals['NAMED_ATTRIBUTES_COUNT'] = GeometryAttributeType(NAMED_ATTRIBUTES_COUNT, 'NAMED_ATTRIBUTES_COUNT') * - * from cpython.mem cimport PyMem_Malloc, PyMem_Free */ - __pyx_t_1 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_test, __pyx_t_1) < 0) __PYX_ERR(0, 1, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_GetModuleGlobalName(__pyx_t_10, __pyx_n_s_GeometryAttributeType); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 77, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_15 = __Pyx_PyInt_From_enum__draco_3a__3a_GeometryAttribute_3a__3a_Type(draco::GeometryAttribute::GENERIC); if (unlikely(!__pyx_t_15)) __PYX_ERR(1, 77, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_15); + __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 77, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_GIVEREF(__pyx_t_15); + PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_15); + __Pyx_INCREF(__pyx_n_s_GENERIC); + __Pyx_GIVEREF(__pyx_n_s_GENERIC); + PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_n_s_GENERIC); + __pyx_t_15 = 0; + __pyx_t_15 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_9, NULL); if (unlikely(!__pyx_t_15)) __PYX_ERR(1, 77, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_15); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + if (unlikely(__Pyx_globals == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(1, 77, __pyx_L1_error) + } + if (unlikely(PyDict_SetItem(__Pyx_globals, __pyx_n_s_GENERIC, __pyx_t_15) < 0)) __PYX_ERR(1, 77, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; - /* "vector.to_py":60 - * - * @cname("__pyx_convert_vector_to_py_double") - * cdef object __pyx_convert_vector_to_py_double(vector[X]& v): # <<<<<<<<<<<<<< - * return [v[i] for i in range(v.size())] + /* "EnumType":78 + * __Pyx_globals['TEX_COORD'] = GeometryAttributeType(TEX_COORD, 'TEX_COORD') + * __Pyx_globals['GENERIC'] = GeometryAttributeType(GENERIC, 'GENERIC') + * __Pyx_globals['NAMED_ATTRIBUTES_COUNT'] = GeometryAttributeType(NAMED_ATTRIBUTES_COUNT, 'NAMED_ATTRIBUTES_COUNT') # <<<<<<<<<<<<<< * */ + __Pyx_GetModuleGlobalName(__pyx_t_15, __pyx_n_s_GeometryAttributeType); if (unlikely(!__pyx_t_15)) __PYX_ERR(1, 78, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_15); + __pyx_t_9 = __Pyx_PyInt_From_enum__draco_3a__3a_GeometryAttribute_3a__3a_Type(draco::GeometryAttribute::NAMED_ATTRIBUTES_COUNT); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 78, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 78, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_10); + __Pyx_GIVEREF(__pyx_t_9); + PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_9); + __Pyx_INCREF(__pyx_n_s_NAMED_ATTRIBUTES_COUNT); + __Pyx_GIVEREF(__pyx_n_s_NAMED_ATTRIBUTES_COUNT); + PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_n_s_NAMED_ATTRIBUTES_COUNT); + __pyx_t_9 = 0; + __pyx_t_9 = __Pyx_PyObject_Call(__pyx_t_15, __pyx_t_10, NULL); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 78, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + if (unlikely(__Pyx_globals == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(1, 78, __pyx_L1_error) + } + if (unlikely(PyDict_SetItem(__Pyx_globals, __pyx_n_s_NAMED_ATTRIBUTES_COUNT, __pyx_t_9) < 0)) __PYX_ERR(1, 78, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + } + __pyx_L5:; /*--- Wrapped vars code ---*/ @@ -6644,6 +15969,15 @@ if (!__Pyx_RefNanny) { __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_XDECREF(__pyx_t_10); + __Pyx_XDECREF(__pyx_t_11); + __Pyx_XDECREF(__pyx_t_12); + __Pyx_XDECREF(__pyx_t_13); + __Pyx_XDECREF(__pyx_t_14); + __Pyx_XDECREF(__pyx_t_15); if (__pyx_m) { if (__pyx_d) { __Pyx_AddTraceback("init DracoPy", __pyx_clineno, __pyx_lineno, __pyx_filename); @@ -6735,6 +16069,46 @@ static void __Pyx_RaiseArgtupleInvalid( (num_expected == 1) ? "" : "s", num_found); } +/* KeywordStringCheck */ +static int __Pyx_CheckKeywordStrings( + PyObject *kwdict, + const char* function_name, + int kw_allowed) +{ + PyObject* key = 0; + Py_ssize_t pos = 0; +#if CYTHON_COMPILING_IN_PYPY + if (!kw_allowed && PyDict_Next(kwdict, &pos, &key, 0)) + goto invalid_keyword; + return 1; +#else + while (PyDict_Next(kwdict, &pos, &key, 0)) { + #if PY_MAJOR_VERSION < 3 + if (unlikely(!PyString_Check(key))) + #endif + if (unlikely(!PyUnicode_Check(key))) + goto invalid_keyword_type; + } + if ((!kw_allowed) && unlikely(key)) + goto invalid_keyword; + return 1; +invalid_keyword_type: + PyErr_Format(PyExc_TypeError, + "%.200s() keywords must be strings", function_name); + return 0; +#endif +invalid_keyword: + PyErr_Format(PyExc_TypeError, + #if PY_MAJOR_VERSION < 3 + "%.200s() got an unexpected keyword argument '%.200s'", + function_name, PyString_AsString(key)); + #else + "%s() got an unexpected keyword argument '%U'", + function_name, key); + #endif + return 0; +} + /* RaiseDoubleKeywords */ static void __Pyx_RaiseDoubleKeywordsError( const char* func_name, @@ -6830,26 +16204,229 @@ static int __Pyx_ParseOptionalKeywords( goto invalid_keyword; } } - return 0; -arg_passed_twice: - __Pyx_RaiseDoubleKeywordsError(function_name, key); - goto bad; -invalid_keyword_type: - PyErr_Format(PyExc_TypeError, - "%.200s() keywords must be strings", function_name); - goto bad; -invalid_keyword: - PyErr_Format(PyExc_TypeError, - #if PY_MAJOR_VERSION < 3 - "%.200s() got an unexpected keyword argument '%.200s'", - function_name, PyString_AsString(key)); - #else - "%s() got an unexpected keyword argument '%U'", - function_name, key); - #endif + return 0; +arg_passed_twice: + __Pyx_RaiseDoubleKeywordsError(function_name, key); + goto bad; +invalid_keyword_type: + PyErr_Format(PyExc_TypeError, + "%.200s() keywords must be strings", function_name); + goto bad; +invalid_keyword: + PyErr_Format(PyExc_TypeError, + #if PY_MAJOR_VERSION < 3 + "%.200s() got an unexpected keyword argument '%.200s'", + function_name, PyString_AsString(key)); + #else + "%s() got an unexpected keyword argument '%U'", + function_name, key); + #endif +bad: + return -1; +} + +/* PyObjectCall */ +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) { + PyObject *result; + ternaryfunc call = Py_TYPE(func)->tp_call; + if (unlikely(!call)) + return PyObject_Call(func, arg, kw); + if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) + return NULL; + result = (*call)(func, arg, kw); + Py_LeaveRecursiveCall(); + if (unlikely(!result) && unlikely(!PyErr_Occurred())) { + PyErr_SetString( + PyExc_SystemError, + "NULL result without error in PyObject_Call"); + } + return result; +} +#endif + +/* PyErrFetchRestore */ +#if CYTHON_FAST_THREAD_STATE +static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) { + PyObject *tmp_type, *tmp_value, *tmp_tb; + tmp_type = tstate->curexc_type; + tmp_value = tstate->curexc_value; + tmp_tb = tstate->curexc_traceback; + tstate->curexc_type = type; + tstate->curexc_value = value; + tstate->curexc_traceback = tb; + Py_XDECREF(tmp_type); + Py_XDECREF(tmp_value); + Py_XDECREF(tmp_tb); +} +static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { + *type = tstate->curexc_type; + *value = tstate->curexc_value; + *tb = tstate->curexc_traceback; + tstate->curexc_type = 0; + tstate->curexc_value = 0; + tstate->curexc_traceback = 0; +} +#endif + +/* RaiseException */ +#if PY_MAJOR_VERSION < 3 +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, + CYTHON_UNUSED PyObject *cause) { + __Pyx_PyThreadState_declare + Py_XINCREF(type); + if (!value || value == Py_None) + value = NULL; + else + Py_INCREF(value); + if (!tb || tb == Py_None) + tb = NULL; + else { + Py_INCREF(tb); + if (!PyTraceBack_Check(tb)) { + PyErr_SetString(PyExc_TypeError, + "raise: arg 3 must be a traceback or None"); + goto raise_error; + } + } + if (PyType_Check(type)) { +#if CYTHON_COMPILING_IN_PYPY + if (!value) { + Py_INCREF(Py_None); + value = Py_None; + } +#endif + PyErr_NormalizeException(&type, &value, &tb); + } else { + if (value) { + PyErr_SetString(PyExc_TypeError, + "instance exception may not have a separate value"); + goto raise_error; + } + value = type; + type = (PyObject*) Py_TYPE(type); + Py_INCREF(type); + if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) { + PyErr_SetString(PyExc_TypeError, + "raise: exception class must be a subclass of BaseException"); + goto raise_error; + } + } + __Pyx_PyThreadState_assign + __Pyx_ErrRestore(type, value, tb); + return; +raise_error: + Py_XDECREF(value); + Py_XDECREF(type); + Py_XDECREF(tb); + return; +} +#else +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { + PyObject* owned_instance = NULL; + if (tb == Py_None) { + tb = 0; + } else if (tb && !PyTraceBack_Check(tb)) { + PyErr_SetString(PyExc_TypeError, + "raise: arg 3 must be a traceback or None"); + goto bad; + } + if (value == Py_None) + value = 0; + if (PyExceptionInstance_Check(type)) { + if (value) { + PyErr_SetString(PyExc_TypeError, + "instance exception may not have a separate value"); + goto bad; + } + value = type; + type = (PyObject*) Py_TYPE(value); + } else if (PyExceptionClass_Check(type)) { + PyObject *instance_class = NULL; + if (value && PyExceptionInstance_Check(value)) { + instance_class = (PyObject*) Py_TYPE(value); + if (instance_class != type) { + int is_subclass = PyObject_IsSubclass(instance_class, type); + if (!is_subclass) { + instance_class = NULL; + } else if (unlikely(is_subclass == -1)) { + goto bad; + } else { + type = instance_class; + } + } + } + if (!instance_class) { + PyObject *args; + if (!value) + args = PyTuple_New(0); + else if (PyTuple_Check(value)) { + Py_INCREF(value); + args = value; + } else + args = PyTuple_Pack(1, value); + if (!args) + goto bad; + owned_instance = PyObject_Call(type, args, NULL); + Py_DECREF(args); + if (!owned_instance) + goto bad; + value = owned_instance; + if (!PyExceptionInstance_Check(value)) { + PyErr_Format(PyExc_TypeError, + "calling %R should have returned an instance of " + "BaseException, not %R", + type, Py_TYPE(value)); + goto bad; + } + } + } else { + PyErr_SetString(PyExc_TypeError, + "raise: exception class must be a subclass of BaseException"); + goto bad; + } + if (cause) { + PyObject *fixed_cause; + if (cause == Py_None) { + fixed_cause = NULL; + } else if (PyExceptionClass_Check(cause)) { + fixed_cause = PyObject_CallObject(cause, NULL); + if (fixed_cause == NULL) + goto bad; + } else if (PyExceptionInstance_Check(cause)) { + fixed_cause = cause; + Py_INCREF(fixed_cause); + } else { + PyErr_SetString(PyExc_TypeError, + "exception causes must derive from " + "BaseException"); + goto bad; + } + PyException_SetCause(value, fixed_cause); + } + PyErr_SetObject(type, value); + if (tb) { +#if CYTHON_COMPILING_IN_PYPY + PyObject *tmp_type, *tmp_value, *tmp_tb; + PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb); + Py_INCREF(tb); + PyErr_Restore(tmp_type, tmp_value, tb); + Py_XDECREF(tmp_tb); +#else + PyThreadState *tstate = __Pyx_PyThreadState_Current; + PyObject* tmp_tb = tstate->curexc_traceback; + if (tb != tmp_tb) { + Py_INCREF(tb); + tstate->curexc_traceback = tb; + Py_XDECREF(tmp_tb); + } +#endif + } bad: - return -1; + Py_XDECREF(owned_instance); + return; } +#endif /* PyObjectSetAttrStr */ #if CYTHON_USE_TYPE_SLOTS @@ -7092,26 +16669,6 @@ static CYTHON_INLINE PyObject * __Pyx_PyCFunction_FastCall(PyObject *func_obj, P } #endif -/* PyObjectCall */ -#if CYTHON_COMPILING_IN_CPYTHON -static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) { - PyObject *result; - ternaryfunc call = func->ob_type->tp_call; - if (unlikely(!call)) - return PyObject_Call(func, arg, kw); - if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) - return NULL; - result = (*call)(func, arg, kw); - Py_LeaveRecursiveCall(); - if (unlikely(!result) && unlikely(!PyErr_Occurred())) { - PyErr_SetString( - PyExc_SystemError, - "NULL result without error in PyObject_Call"); - } - return result; -} -#endif - /* PyObjectCall2Args */ static CYTHON_UNUSED PyObject* __Pyx_PyObject_Call2Args(PyObject* function, PyObject* arg1, PyObject* arg2) { PyObject *args, *result = NULL; @@ -7492,189 +17049,6 @@ static PyObject *__Pyx_PyObject_GetItem(PyObject *obj, PyObject* key) { } #endif -/* PyErrFetchRestore */ -#if CYTHON_FAST_THREAD_STATE -static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb) { - PyObject *tmp_type, *tmp_value, *tmp_tb; - tmp_type = tstate->curexc_type; - tmp_value = tstate->curexc_value; - tmp_tb = tstate->curexc_traceback; - tstate->curexc_type = type; - tstate->curexc_value = value; - tstate->curexc_traceback = tb; - Py_XDECREF(tmp_type); - Py_XDECREF(tmp_value); - Py_XDECREF(tmp_tb); -} -static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb) { - *type = tstate->curexc_type; - *value = tstate->curexc_value; - *tb = tstate->curexc_traceback; - tstate->curexc_type = 0; - tstate->curexc_value = 0; - tstate->curexc_traceback = 0; -} -#endif - -/* RaiseException */ -#if PY_MAJOR_VERSION < 3 -static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, - CYTHON_UNUSED PyObject *cause) { - __Pyx_PyThreadState_declare - Py_XINCREF(type); - if (!value || value == Py_None) - value = NULL; - else - Py_INCREF(value); - if (!tb || tb == Py_None) - tb = NULL; - else { - Py_INCREF(tb); - if (!PyTraceBack_Check(tb)) { - PyErr_SetString(PyExc_TypeError, - "raise: arg 3 must be a traceback or None"); - goto raise_error; - } - } - if (PyType_Check(type)) { -#if CYTHON_COMPILING_IN_PYPY - if (!value) { - Py_INCREF(Py_None); - value = Py_None; - } -#endif - PyErr_NormalizeException(&type, &value, &tb); - } else { - if (value) { - PyErr_SetString(PyExc_TypeError, - "instance exception may not have a separate value"); - goto raise_error; - } - value = type; - type = (PyObject*) Py_TYPE(type); - Py_INCREF(type); - if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) { - PyErr_SetString(PyExc_TypeError, - "raise: exception class must be a subclass of BaseException"); - goto raise_error; - } - } - __Pyx_PyThreadState_assign - __Pyx_ErrRestore(type, value, tb); - return; -raise_error: - Py_XDECREF(value); - Py_XDECREF(type); - Py_XDECREF(tb); - return; -} -#else -static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { - PyObject* owned_instance = NULL; - if (tb == Py_None) { - tb = 0; - } else if (tb && !PyTraceBack_Check(tb)) { - PyErr_SetString(PyExc_TypeError, - "raise: arg 3 must be a traceback or None"); - goto bad; - } - if (value == Py_None) - value = 0; - if (PyExceptionInstance_Check(type)) { - if (value) { - PyErr_SetString(PyExc_TypeError, - "instance exception may not have a separate value"); - goto bad; - } - value = type; - type = (PyObject*) Py_TYPE(value); - } else if (PyExceptionClass_Check(type)) { - PyObject *instance_class = NULL; - if (value && PyExceptionInstance_Check(value)) { - instance_class = (PyObject*) Py_TYPE(value); - if (instance_class != type) { - int is_subclass = PyObject_IsSubclass(instance_class, type); - if (!is_subclass) { - instance_class = NULL; - } else if (unlikely(is_subclass == -1)) { - goto bad; - } else { - type = instance_class; - } - } - } - if (!instance_class) { - PyObject *args; - if (!value) - args = PyTuple_New(0); - else if (PyTuple_Check(value)) { - Py_INCREF(value); - args = value; - } else - args = PyTuple_Pack(1, value); - if (!args) - goto bad; - owned_instance = PyObject_Call(type, args, NULL); - Py_DECREF(args); - if (!owned_instance) - goto bad; - value = owned_instance; - if (!PyExceptionInstance_Check(value)) { - PyErr_Format(PyExc_TypeError, - "calling %R should have returned an instance of " - "BaseException, not %R", - type, Py_TYPE(value)); - goto bad; - } - } - } else { - PyErr_SetString(PyExc_TypeError, - "raise: exception class must be a subclass of BaseException"); - goto bad; - } - if (cause) { - PyObject *fixed_cause; - if (cause == Py_None) { - fixed_cause = NULL; - } else if (PyExceptionClass_Check(cause)) { - fixed_cause = PyObject_CallObject(cause, NULL); - if (fixed_cause == NULL) - goto bad; - } else if (PyExceptionInstance_Check(cause)) { - fixed_cause = cause; - Py_INCREF(fixed_cause); - } else { - PyErr_SetString(PyExc_TypeError, - "exception causes must derive from " - "BaseException"); - goto bad; - } - PyException_SetCause(value, fixed_cause); - } - PyErr_SetObject(type, value); - if (tb) { -#if CYTHON_COMPILING_IN_PYPY - PyObject *tmp_type, *tmp_value, *tmp_tb; - PyErr_Fetch(&tmp_type, &tmp_value, &tmp_tb); - Py_INCREF(tb); - PyErr_Restore(tmp_type, tmp_value, tb); - Py_XDECREF(tmp_tb); -#else - PyThreadState *tstate = __Pyx_PyThreadState_Current; - PyObject* tmp_tb = tstate->curexc_traceback; - if (tb != tmp_tb) { - Py_INCREF(tb); - tstate->curexc_traceback = tb; - Py_XDECREF(tmp_tb); - } -#endif - } -bad: - Py_XDECREF(owned_instance); - return; -} -#endif - /* PyFloatBinop */ #if !CYTHON_COMPILING_IN_PYPY static PyObject* __Pyx_PyFloat_AddObjC(PyObject *op1, PyObject *op2, double floatval, int inplace, int zerodivision_check) { @@ -7750,7 +17124,50 @@ static PyObject* __Pyx_PyFloat_AddObjC(PyObject *op1, PyObject *op2, double floa PyFPE_END_PROTECT(result) return PyFloat_FromDouble(result); } -#endif +#endif + +/* PyObjectCallNoArg */ + #if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func) { +#if CYTHON_FAST_PYCALL + if (PyFunction_Check(func)) { + return __Pyx_PyFunction_FastCall(func, NULL, 0); + } +#endif +#ifdef __Pyx_CyFunction_USED + if (likely(PyCFunction_Check(func) || __Pyx_CyFunction_Check(func))) +#else + if (likely(PyCFunction_Check(func))) +#endif + { + if (likely(PyCFunction_GET_FLAGS(func) & METH_NOARGS)) { + return __Pyx_PyObject_CallMethO(func, NULL); + } + } + return __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL); +} +#endif + +/* ArgTypeTest */ + static int __Pyx__ArgTypeTest(PyObject *obj, PyTypeObject *type, const char *name, int exact) +{ + if (unlikely(!type)) { + PyErr_SetString(PyExc_SystemError, "Missing type object"); + return 0; + } + else if (exact) { + #if PY_MAJOR_VERSION == 2 + if ((type == &PyBaseString_Type) && likely(__Pyx_PyBaseString_CheckExact(obj))) return 1; + #endif + } + else { + if (likely(__Pyx_TypeCheck(obj, type))) return 1; + } + PyErr_Format(PyExc_TypeError, + "Argument '%.200s' has incorrect type (expected %.200s, got %.200s)", + name, type->tp_name, Py_TYPE(obj)->tp_name); + return 0; +} /* GetTopmostException */ #if CYTHON_USE_EXC_INFO_STACK @@ -7982,6 +17399,412 @@ static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) return -1; } +/* IterFinish */ + static CYTHON_INLINE int __Pyx_IterFinish(void) { +#if CYTHON_FAST_THREAD_STATE + PyThreadState *tstate = __Pyx_PyThreadState_Current; + PyObject* exc_type = tstate->curexc_type; + if (unlikely(exc_type)) { + if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) { + PyObject *exc_value, *exc_tb; + exc_value = tstate->curexc_value; + exc_tb = tstate->curexc_traceback; + tstate->curexc_type = 0; + tstate->curexc_value = 0; + tstate->curexc_traceback = 0; + Py_DECREF(exc_type); + Py_XDECREF(exc_value); + Py_XDECREF(exc_tb); + return 0; + } else { + return -1; + } + } + return 0; +#else + if (unlikely(PyErr_Occurred())) { + if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) { + PyErr_Clear(); + return 0; + } else { + return -1; + } + } + return 0; +#endif +} + +/* PyObjectGetMethod */ + static int __Pyx_PyObject_GetMethod(PyObject *obj, PyObject *name, PyObject **method) { + PyObject *attr; +#if CYTHON_UNPACK_METHODS && CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_PYTYPE_LOOKUP + PyTypeObject *tp = Py_TYPE(obj); + PyObject *descr; + descrgetfunc f = NULL; + PyObject **dictptr, *dict; + int meth_found = 0; + assert (*method == NULL); + if (unlikely(tp->tp_getattro != PyObject_GenericGetAttr)) { + attr = __Pyx_PyObject_GetAttrStr(obj, name); + goto try_unpack; + } + if (unlikely(tp->tp_dict == NULL) && unlikely(PyType_Ready(tp) < 0)) { + return 0; + } + descr = _PyType_Lookup(tp, name); + if (likely(descr != NULL)) { + Py_INCREF(descr); +#if PY_MAJOR_VERSION >= 3 + #ifdef __Pyx_CyFunction_USED + if (likely(PyFunction_Check(descr) || (Py_TYPE(descr) == &PyMethodDescr_Type) || __Pyx_CyFunction_Check(descr))) + #else + if (likely(PyFunction_Check(descr) || (Py_TYPE(descr) == &PyMethodDescr_Type))) + #endif +#else + #ifdef __Pyx_CyFunction_USED + if (likely(PyFunction_Check(descr) || __Pyx_CyFunction_Check(descr))) + #else + if (likely(PyFunction_Check(descr))) + #endif +#endif + { + meth_found = 1; + } else { + f = Py_TYPE(descr)->tp_descr_get; + if (f != NULL && PyDescr_IsData(descr)) { + attr = f(descr, obj, (PyObject *)Py_TYPE(obj)); + Py_DECREF(descr); + goto try_unpack; + } + } + } + dictptr = _PyObject_GetDictPtr(obj); + if (dictptr != NULL && (dict = *dictptr) != NULL) { + Py_INCREF(dict); + attr = __Pyx_PyDict_GetItemStr(dict, name); + if (attr != NULL) { + Py_INCREF(attr); + Py_DECREF(dict); + Py_XDECREF(descr); + goto try_unpack; + } + Py_DECREF(dict); + } + if (meth_found) { + *method = descr; + return 1; + } + if (f != NULL) { + attr = f(descr, obj, (PyObject *)Py_TYPE(obj)); + Py_DECREF(descr); + goto try_unpack; + } + if (descr != NULL) { + *method = descr; + return 0; + } + PyErr_Format(PyExc_AttributeError, +#if PY_MAJOR_VERSION >= 3 + "'%.50s' object has no attribute '%U'", + tp->tp_name, name); +#else + "'%.50s' object has no attribute '%.400s'", + tp->tp_name, PyString_AS_STRING(name)); +#endif + return 0; +#else + attr = __Pyx_PyObject_GetAttrStr(obj, name); + goto try_unpack; +#endif +try_unpack: +#if CYTHON_UNPACK_METHODS + if (likely(attr) && PyMethod_Check(attr) && likely(PyMethod_GET_SELF(attr) == obj)) { + PyObject *function = PyMethod_GET_FUNCTION(attr); + Py_INCREF(function); + Py_DECREF(attr); + *method = function; + return 1; + } +#endif + *method = attr; + return 0; +} + +/* PyObjectCallMethod0 */ + static PyObject* __Pyx_PyObject_CallMethod0(PyObject* obj, PyObject* method_name) { + PyObject *method = NULL, *result = NULL; + int is_method = __Pyx_PyObject_GetMethod(obj, method_name, &method); + if (likely(is_method)) { + result = __Pyx_PyObject_CallOneArg(method, obj); + Py_DECREF(method); + return result; + } + if (unlikely(!method)) goto bad; + result = __Pyx_PyObject_CallNoArg(method); + Py_DECREF(method); +bad: + return result; +} + +/* RaiseNeedMoreValuesToUnpack */ + static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { + PyErr_Format(PyExc_ValueError, + "need more than %" CYTHON_FORMAT_SSIZE_T "d value%.1s to unpack", + index, (index == 1) ? "" : "s"); +} + +/* RaiseTooManyValuesToUnpack */ + static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) { + PyErr_Format(PyExc_ValueError, + "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected); +} + +/* UnpackItemEndCheck */ + static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) { + if (unlikely(retval)) { + Py_DECREF(retval); + __Pyx_RaiseTooManyValuesError(expected); + return -1; + } else { + return __Pyx_IterFinish(); + } + return 0; +} + +/* RaiseNoneIterError */ + static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); +} + +/* UnpackTupleError */ + static void __Pyx_UnpackTupleError(PyObject *t, Py_ssize_t index) { + if (t == Py_None) { + __Pyx_RaiseNoneNotIterableError(); + } else if (PyTuple_GET_SIZE(t) < index) { + __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(t)); + } else { + __Pyx_RaiseTooManyValuesError(index); + } +} + +/* UnpackTuple2 */ + static CYTHON_INLINE int __Pyx_unpack_tuple2_exact( + PyObject* tuple, PyObject** pvalue1, PyObject** pvalue2, int decref_tuple) { + PyObject *value1 = NULL, *value2 = NULL; +#if CYTHON_COMPILING_IN_PYPY + value1 = PySequence_ITEM(tuple, 0); if (unlikely(!value1)) goto bad; + value2 = PySequence_ITEM(tuple, 1); if (unlikely(!value2)) goto bad; +#else + value1 = PyTuple_GET_ITEM(tuple, 0); Py_INCREF(value1); + value2 = PyTuple_GET_ITEM(tuple, 1); Py_INCREF(value2); +#endif + if (decref_tuple) { + Py_DECREF(tuple); + } + *pvalue1 = value1; + *pvalue2 = value2; + return 0; +#if CYTHON_COMPILING_IN_PYPY +bad: + Py_XDECREF(value1); + Py_XDECREF(value2); + if (decref_tuple) { Py_XDECREF(tuple); } + return -1; +#endif +} +static int __Pyx_unpack_tuple2_generic(PyObject* tuple, PyObject** pvalue1, PyObject** pvalue2, + int has_known_size, int decref_tuple) { + Py_ssize_t index; + PyObject *value1 = NULL, *value2 = NULL, *iter = NULL; + iternextfunc iternext; + iter = PyObject_GetIter(tuple); + if (unlikely(!iter)) goto bad; + if (decref_tuple) { Py_DECREF(tuple); tuple = NULL; } + iternext = Py_TYPE(iter)->tp_iternext; + value1 = iternext(iter); if (unlikely(!value1)) { index = 0; goto unpacking_failed; } + value2 = iternext(iter); if (unlikely(!value2)) { index = 1; goto unpacking_failed; } + if (!has_known_size && unlikely(__Pyx_IternextUnpackEndCheck(iternext(iter), 2))) goto bad; + Py_DECREF(iter); + *pvalue1 = value1; + *pvalue2 = value2; + return 0; +unpacking_failed: + if (!has_known_size && __Pyx_IterFinish() == 0) + __Pyx_RaiseNeedMoreValuesError(index); +bad: + Py_XDECREF(iter); + Py_XDECREF(value1); + Py_XDECREF(value2); + if (decref_tuple) { Py_XDECREF(tuple); } + return -1; +} + +/* dict_iter */ + static CYTHON_INLINE PyObject* __Pyx_dict_iterator(PyObject* iterable, int is_dict, PyObject* method_name, + Py_ssize_t* p_orig_length, int* p_source_is_dict) { + is_dict = is_dict || likely(PyDict_CheckExact(iterable)); + *p_source_is_dict = is_dict; + if (is_dict) { +#if !CYTHON_COMPILING_IN_PYPY + *p_orig_length = PyDict_Size(iterable); + Py_INCREF(iterable); + return iterable; +#elif PY_MAJOR_VERSION >= 3 + static PyObject *py_items = NULL, *py_keys = NULL, *py_values = NULL; + PyObject **pp = NULL; + if (method_name) { + const char *name = PyUnicode_AsUTF8(method_name); + if (strcmp(name, "iteritems") == 0) pp = &py_items; + else if (strcmp(name, "iterkeys") == 0) pp = &py_keys; + else if (strcmp(name, "itervalues") == 0) pp = &py_values; + if (pp) { + if (!*pp) { + *pp = PyUnicode_FromString(name + 4); + if (!*pp) + return NULL; + } + method_name = *pp; + } + } +#endif + } + *p_orig_length = 0; + if (method_name) { + PyObject* iter; + iterable = __Pyx_PyObject_CallMethod0(iterable, method_name); + if (!iterable) + return NULL; +#if !CYTHON_COMPILING_IN_PYPY + if (PyTuple_CheckExact(iterable) || PyList_CheckExact(iterable)) + return iterable; +#endif + iter = PyObject_GetIter(iterable); + Py_DECREF(iterable); + return iter; + } + return PyObject_GetIter(iterable); +} +static CYTHON_INLINE int __Pyx_dict_iter_next( + PyObject* iter_obj, CYTHON_NCP_UNUSED Py_ssize_t orig_length, CYTHON_NCP_UNUSED Py_ssize_t* ppos, + PyObject** pkey, PyObject** pvalue, PyObject** pitem, int source_is_dict) { + PyObject* next_item; +#if !CYTHON_COMPILING_IN_PYPY + if (source_is_dict) { + PyObject *key, *value; + if (unlikely(orig_length != PyDict_Size(iter_obj))) { + PyErr_SetString(PyExc_RuntimeError, "dictionary changed size during iteration"); + return -1; + } + if (unlikely(!PyDict_Next(iter_obj, ppos, &key, &value))) { + return 0; + } + if (pitem) { + PyObject* tuple = PyTuple_New(2); + if (unlikely(!tuple)) { + return -1; + } + Py_INCREF(key); + Py_INCREF(value); + PyTuple_SET_ITEM(tuple, 0, key); + PyTuple_SET_ITEM(tuple, 1, value); + *pitem = tuple; + } else { + if (pkey) { + Py_INCREF(key); + *pkey = key; + } + if (pvalue) { + Py_INCREF(value); + *pvalue = value; + } + } + return 1; + } else if (PyTuple_CheckExact(iter_obj)) { + Py_ssize_t pos = *ppos; + if (unlikely(pos >= PyTuple_GET_SIZE(iter_obj))) return 0; + *ppos = pos + 1; + next_item = PyTuple_GET_ITEM(iter_obj, pos); + Py_INCREF(next_item); + } else if (PyList_CheckExact(iter_obj)) { + Py_ssize_t pos = *ppos; + if (unlikely(pos >= PyList_GET_SIZE(iter_obj))) return 0; + *ppos = pos + 1; + next_item = PyList_GET_ITEM(iter_obj, pos); + Py_INCREF(next_item); + } else +#endif + { + next_item = PyIter_Next(iter_obj); + if (unlikely(!next_item)) { + return __Pyx_IterFinish(); + } + } + if (pitem) { + *pitem = next_item; + } else if (pkey && pvalue) { + if (__Pyx_unpack_tuple2(next_item, pkey, pvalue, source_is_dict, source_is_dict, 1)) + return -1; + } else if (pkey) { + *pkey = next_item; + } else { + *pvalue = next_item; + } + return 1; +} + +/* PyErrExceptionMatches */ + #if CYTHON_FAST_THREAD_STATE +static int __Pyx_PyErr_ExceptionMatchesTuple(PyObject *exc_type, PyObject *tuple) { + Py_ssize_t i, n; + n = PyTuple_GET_SIZE(tuple); +#if PY_MAJOR_VERSION >= 3 + for (i=0; icurexc_type; + if (exc_type == err) return 1; + if (unlikely(!exc_type)) return 0; + if (unlikely(PyTuple_Check(err))) + return __Pyx_PyErr_ExceptionMatchesTuple(exc_type, err); + return __Pyx_PyErr_GivenExceptionMatches(exc_type, err); +} +#endif + +/* GetAttr */ + static CYTHON_INLINE PyObject *__Pyx_GetAttr(PyObject *o, PyObject *n) { +#if CYTHON_USE_TYPE_SLOTS +#if PY_MAJOR_VERSION >= 3 + if (likely(PyUnicode_Check(n))) +#else + if (likely(PyString_Check(n))) +#endif + return __Pyx_PyObject_GetAttrStr(o, n); +#endif + return PyObject_GetAttr(o, n); +} + +/* GetAttr3 */ + static PyObject *__Pyx_GetAttr3Default(PyObject *d) { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + if (unlikely(!__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError))) + return NULL; + __Pyx_PyErr_Clear(); + Py_INCREF(d); + return d; +} +static CYTHON_INLINE PyObject *__Pyx_GetAttr3(PyObject *o, PyObject *n, PyObject *d) { + PyObject *r = __Pyx_GetAttr(o, n); + return (likely(r)) ? r : __Pyx_GetAttr3Default(d); +} + /* Import */ static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) { PyObject *empty_list = 0; @@ -8061,6 +17884,180 @@ static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) return value; } +/* HasAttr */ + static CYTHON_INLINE int __Pyx_HasAttr(PyObject *o, PyObject *n) { + PyObject *r; + if (unlikely(!__Pyx_PyBaseString_Check(n))) { + PyErr_SetString(PyExc_TypeError, + "hasattr(): attribute name must be string"); + return -1; + } + r = __Pyx_GetAttr(o, n); + if (unlikely(!r)) { + PyErr_Clear(); + return 0; + } else { + Py_DECREF(r); + return 1; + } +} + +/* PyObject_GenericGetAttrNoDict */ + #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000 +static PyObject *__Pyx_RaiseGenericGetAttributeError(PyTypeObject *tp, PyObject *attr_name) { + PyErr_Format(PyExc_AttributeError, +#if PY_MAJOR_VERSION >= 3 + "'%.50s' object has no attribute '%U'", + tp->tp_name, attr_name); +#else + "'%.50s' object has no attribute '%.400s'", + tp->tp_name, PyString_AS_STRING(attr_name)); +#endif + return NULL; +} +static CYTHON_INLINE PyObject* __Pyx_PyObject_GenericGetAttrNoDict(PyObject* obj, PyObject* attr_name) { + PyObject *descr; + PyTypeObject *tp = Py_TYPE(obj); + if (unlikely(!PyString_Check(attr_name))) { + return PyObject_GenericGetAttr(obj, attr_name); + } + assert(!tp->tp_dictoffset); + descr = _PyType_Lookup(tp, attr_name); + if (unlikely(!descr)) { + return __Pyx_RaiseGenericGetAttributeError(tp, attr_name); + } + Py_INCREF(descr); + #if PY_MAJOR_VERSION < 3 + if (likely(PyType_HasFeature(Py_TYPE(descr), Py_TPFLAGS_HAVE_CLASS))) + #endif + { + descrgetfunc f = Py_TYPE(descr)->tp_descr_get; + if (unlikely(f)) { + PyObject *res = f(descr, obj, (PyObject *)tp); + Py_DECREF(descr); + return res; + } + } + return descr; +} +#endif + +/* PyObject_GenericGetAttr */ + #if CYTHON_USE_TYPE_SLOTS && CYTHON_USE_PYTYPE_LOOKUP && PY_VERSION_HEX < 0x03070000 +static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_name) { + if (unlikely(Py_TYPE(obj)->tp_dictoffset)) { + return PyObject_GenericGetAttr(obj, attr_name); + } + return __Pyx_PyObject_GenericGetAttrNoDict(obj, attr_name); +} +#endif + +/* PyObjectGetAttrStrNoError */ + static void __Pyx_PyObject_GetAttrStr_ClearAttributeError(void) { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + if (likely(__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError))) + __Pyx_PyErr_Clear(); +} +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name) { + PyObject *result; +#if CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_TYPE_SLOTS && PY_VERSION_HEX >= 0x030700B1 + PyTypeObject* tp = Py_TYPE(obj); + if (likely(tp->tp_getattro == PyObject_GenericGetAttr)) { + return _PyObject_GenericGetAttrWithDict(obj, attr_name, NULL, 1); + } +#endif + result = __Pyx_PyObject_GetAttrStr(obj, attr_name); + if (unlikely(!result)) { + __Pyx_PyObject_GetAttrStr_ClearAttributeError(); + } + return result; +} + +/* SetupReduce */ + static int __Pyx_setup_reduce_is_named(PyObject* meth, PyObject* name) { + int ret; + PyObject *name_attr; + name_attr = __Pyx_PyObject_GetAttrStr(meth, __pyx_n_s_name_2); + if (likely(name_attr)) { + ret = PyObject_RichCompareBool(name_attr, name, Py_EQ); + } else { + ret = -1; + } + if (unlikely(ret < 0)) { + PyErr_Clear(); + ret = 0; + } + Py_XDECREF(name_attr); + return ret; +} +static int __Pyx_setup_reduce(PyObject* type_obj) { + int ret = 0; + PyObject *object_reduce = NULL; + PyObject *object_reduce_ex = NULL; + PyObject *reduce = NULL; + PyObject *reduce_ex = NULL; + PyObject *reduce_cython = NULL; + PyObject *setstate = NULL; + PyObject *setstate_cython = NULL; +#if CYTHON_USE_PYTYPE_LOOKUP + if (_PyType_Lookup((PyTypeObject*)type_obj, __pyx_n_s_getstate)) goto __PYX_GOOD; +#else + if (PyObject_HasAttr(type_obj, __pyx_n_s_getstate)) goto __PYX_GOOD; +#endif +#if CYTHON_USE_PYTYPE_LOOKUP + object_reduce_ex = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto __PYX_BAD; +#else + object_reduce_ex = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto __PYX_BAD; +#endif + reduce_ex = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce_ex); if (unlikely(!reduce_ex)) goto __PYX_BAD; + if (reduce_ex == object_reduce_ex) { +#if CYTHON_USE_PYTYPE_LOOKUP + object_reduce = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto __PYX_BAD; +#else + object_reduce = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto __PYX_BAD; +#endif + reduce = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce); if (unlikely(!reduce)) goto __PYX_BAD; + if (reduce == object_reduce || __Pyx_setup_reduce_is_named(reduce, __pyx_n_s_reduce_cython)) { + reduce_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_reduce_cython); + if (likely(reduce_cython)) { + ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce, reduce_cython); if (unlikely(ret < 0)) goto __PYX_BAD; + ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce_cython); if (unlikely(ret < 0)) goto __PYX_BAD; + } else if (reduce == object_reduce || PyErr_Occurred()) { + goto __PYX_BAD; + } + setstate = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_setstate); + if (!setstate) PyErr_Clear(); + if (!setstate || __Pyx_setup_reduce_is_named(setstate, __pyx_n_s_setstate_cython)) { + setstate_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_setstate_cython); + if (likely(setstate_cython)) { + ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate, setstate_cython); if (unlikely(ret < 0)) goto __PYX_BAD; + ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate_cython); if (unlikely(ret < 0)) goto __PYX_BAD; + } else if (!setstate || PyErr_Occurred()) { + goto __PYX_BAD; + } + } + PyType_Modified((PyTypeObject*)type_obj); + } + } + goto __PYX_GOOD; +__PYX_BAD: + if (!PyErr_Occurred()) + PyErr_Format(PyExc_RuntimeError, "Unable to initialize pickling for %s", ((PyTypeObject*)type_obj)->tp_name); + ret = -1; +__PYX_GOOD: +#if !CYTHON_USE_PYTYPE_LOOKUP + Py_XDECREF(object_reduce); + Py_XDECREF(object_reduce_ex); +#endif + Py_XDECREF(reduce); + Py_XDECREF(reduce_ex); + Py_XDECREF(reduce_cython); + Py_XDECREF(setstate); + Py_XDECREF(setstate_cython); + return ret; +} + /* CalculateMetaclass */ static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bases) { Py_ssize_t i, nbases = PyTuple_GET_SIZE(bases); @@ -8432,7 +18429,8 @@ static PyObject * __Pyx_CyFunction_reduce(__pyx_CyFunctionObject *m, CYTHON_UNUSED PyObject *args) { #if PY_MAJOR_VERSION >= 3 - return PyUnicode_FromString(m->func.m_ml->ml_name); + Py_INCREF(m->func_qualname); + return m->func_qualname; #else return PyString_FromString(m->func.m_ml->ml_name); #endif @@ -8709,6 +18707,9 @@ static PyTypeObject __pyx_CyFunctionType_type = { #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000 0, #endif +#if PY_VERSION_HEX >= 0x030B00A2 + 0, +#endif }; static int __pyx_CyFunction_init(void) { __pyx_CyFunctionType = __Pyx_FetchCommonType(&__pyx_CyFunctionType_type); @@ -8823,6 +18824,51 @@ static PyObject *__Pyx_Py3ClassCreate(PyObject *metaclass, PyObject *name, PyObj return result; } +/* Globals */ + static PyObject* __Pyx_Globals(void) { + Py_ssize_t i; + PyObject *names; + PyObject *globals = __pyx_d; + Py_INCREF(globals); + names = PyObject_Dir(__pyx_m); + if (!names) + goto bad; + for (i = PyList_GET_SIZE(names)-1; i >= 0; i--) { +#if CYTHON_COMPILING_IN_PYPY + PyObject* name = PySequence_ITEM(names, i); + if (!name) + goto bad; +#else + PyObject* name = PyList_GET_ITEM(names, i); +#endif + if (!PyDict_Contains(globals, name)) { + PyObject* value = __Pyx_GetAttr(__pyx_m, name); + if (!value) { +#if CYTHON_COMPILING_IN_PYPY + Py_DECREF(name); +#endif + goto bad; + } + if (PyDict_SetItem(globals, name, value) < 0) { +#if CYTHON_COMPILING_IN_PYPY + Py_DECREF(name); +#endif + Py_DECREF(value); + goto bad; + } + } +#if CYTHON_COMPILING_IN_PYPY + Py_DECREF(name); +#endif + } + Py_DECREF(names); + return globals; +bad: + Py_XDECREF(names); + Py_XDECREF(globals); + return NULL; +} + /* CLineInTraceback */ #ifndef CYTHON_CLINE_IN_TRACEBACK static int __Pyx_CLineForTraceback(CYTHON_NCP_UNUSED PyThreadState *tstate, int c_line) { @@ -8855,7 +18901,7 @@ static int __Pyx_CLineForTraceback(CYTHON_NCP_UNUSED PyThreadState *tstate, int } if (!use_cline) { c_line = 0; - PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False); + (void) PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False); } else if (use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) { c_line = 0; @@ -8952,30 +18998,31 @@ static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) { static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( const char *funcname, int c_line, int py_line, const char *filename) { - PyCodeObject *py_code = 0; - PyObject *py_srcfile = 0; - PyObject *py_funcname = 0; + PyCodeObject *py_code = NULL; + PyObject *py_funcname = NULL; #if PY_MAJOR_VERSION < 3 + PyObject *py_srcfile = NULL; py_srcfile = PyString_FromString(filename); - #else - py_srcfile = PyUnicode_FromString(filename); - #endif if (!py_srcfile) goto bad; + #endif if (c_line) { #if PY_MAJOR_VERSION < 3 py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); + if (!py_funcname) goto bad; #else py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); + if (!py_funcname) goto bad; + funcname = PyUnicode_AsUTF8(py_funcname); + if (!funcname) goto bad; #endif } else { #if PY_MAJOR_VERSION < 3 py_funcname = PyString_FromString(funcname); - #else - py_funcname = PyUnicode_FromString(funcname); + if (!py_funcname) goto bad; #endif } - if (!py_funcname) goto bad; + #if PY_MAJOR_VERSION < 3 py_code = __Pyx_PyCode_New( 0, 0, @@ -8994,11 +19041,16 @@ static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( __pyx_empty_bytes /*PyObject *lnotab*/ ); Py_DECREF(py_srcfile); - Py_DECREF(py_funcname); + #else + py_code = PyCode_NewEmpty(filename, funcname, py_line); + #endif + Py_XDECREF(py_funcname); // XDECREF since it's only set on Py3 if cline return py_code; bad: - Py_XDECREF(py_srcfile); Py_XDECREF(py_funcname); + #if PY_MAJOR_VERSION < 3 + Py_XDECREF(py_srcfile); + #endif return NULL; } static void __Pyx_AddTraceback(const char *funcname, int c_line, @@ -9052,10 +19104,64 @@ static void __Pyx_AddTraceback(const char *funcname, int c_line, return (target_type) value;\ } -static PyObject* __pyx_convert__to_py_struct__DracoFunctions_3a__3a_MeshObject(struct DracoFunctions::MeshObject s) { +static PyObject* __pyx_convert__to_py_struct__DracoFunctions_3a__3a_MetadataObject(struct DracoFunctions::MetadataObject s) { + PyObject* res; + PyObject* member; + res = __Pyx_PyDict_NewPresized(2); if (unlikely(!res)) return NULL; + member = __pyx_convert_unordered_map_to_py_std_3a__3a_string____std_3a__3a_string(s.entries); if (unlikely(!member)) goto bad; + if (unlikely(PyDict_SetItem(res, __pyx_n_s_entries, member) < 0)) goto bad; + Py_DECREF(member); + member = __pyx_convert_unordered_map_to_py_std_3a__3a_string____uint32_t(s.sub_metadata_ids); if (unlikely(!member)) goto bad; + if (unlikely(PyDict_SetItem(res, __pyx_n_s_sub_metadata_ids, member) < 0)) goto bad; + Py_DECREF(member); + return res; + bad: + Py_XDECREF(member); + Py_DECREF(res); + return NULL; + } + static PyObject* __pyx_convert__to_py_struct__DracoFunctions_3a__3a_PointAttributeObject(struct DracoFunctions::PointAttributeObject s) { PyObject* res; PyObject* member; - res = __Pyx_PyDict_NewPresized(8); if (unlikely(!res)) return NULL; + res = __Pyx_PyDict_NewPresized(4); if (unlikely(!res)) return NULL; + member = __pyx_convert_unordered_map_to_py_uint32_t____std_3a__3a_string(s.data); if (unlikely(!member)) goto bad; + if (unlikely(PyDict_SetItem(res, __pyx_n_s_data, member) < 0)) goto bad; + Py_DECREF(member); + member = __Pyx_PyInt_From_enum__draco_3a__3a_DataType(s.datatype); if (unlikely(!member)) goto bad; + if (unlikely(PyDict_SetItem(res, __pyx_n_s_datatype, member) < 0)) goto bad; + Py_DECREF(member); + member = __Pyx_PyInt_From_uint32_t(s.dimension); if (unlikely(!member)) goto bad; + if (unlikely(PyDict_SetItem(res, __pyx_n_s_dimension, member) < 0)) goto bad; + Py_DECREF(member); + member = __Pyx_PyInt_From_uint32_t(s.metadata_id); if (unlikely(!member)) goto bad; + if (unlikely(PyDict_SetItem(res, __pyx_n_s_metadata_id, member) < 0)) goto bad; + Py_DECREF(member); + return res; + bad: + Py_XDECREF(member); + Py_DECREF(res); + return NULL; + } + static PyObject* __pyx_convert__to_py_struct__DracoFunctions_3a__3a_GeometryMetadataObject(struct DracoFunctions::GeometryMetadataObject s) { + PyObject* res; + PyObject* member; + res = __Pyx_PyDict_NewPresized(2); if (unlikely(!res)) return NULL; + member = __Pyx_PyInt_From_uint32_t(s.metadata_id); if (unlikely(!member)) goto bad; + if (unlikely(PyDict_SetItem(res, __pyx_n_s_metadata_id, member) < 0)) goto bad; + Py_DECREF(member); + member = __pyx_convert_vector_to_py_struct__DracoFunctions_3a__3a_PointAttributeObject(s.generic_attributes); if (unlikely(!member)) goto bad; + if (unlikely(PyDict_SetItem(res, __pyx_n_s_generic_attributes, member) < 0)) goto bad; + Py_DECREF(member); + return res; + bad: + Py_XDECREF(member); + Py_DECREF(res); + return NULL; + } + static PyObject* __pyx_convert__to_py_struct__DracoFunctions_3a__3a_MeshObject(struct DracoFunctions::MeshObject s) { + PyObject* res; + PyObject* member; + res = __Pyx_PyDict_NewPresized(10); if (unlikely(!res)) return NULL; member = __pyx_convert_vector_to_py_float(s.points); if (unlikely(!member)) goto bad; if (unlikely(PyDict_SetItem(res, __pyx_n_s_points, member) < 0)) goto bad; Py_DECREF(member); @@ -9080,6 +19186,12 @@ static PyObject* __pyx_convert__to_py_struct__DracoFunctions_3a__3a_MeshObject(s member = __Pyx_PyInt_From_enum__DracoFunctions_3a__3a_decoding_status(s.decode_status); if (unlikely(!member)) goto bad; if (unlikely(PyDict_SetItem(res, __pyx_n_s_decode_status, member) < 0)) goto bad; Py_DECREF(member); + member = __pyx_convert__to_py_struct__DracoFunctions_3a__3a_GeometryMetadataObject(s.geometry_metadata); if (unlikely(!member)) goto bad; + if (unlikely(PyDict_SetItem(res, __pyx_n_s_geometry_metadata, member) < 0)) goto bad; + Py_DECREF(member); + member = __pyx_convert_vector_to_py_struct__DracoFunctions_3a__3a_MetadataObject(s.metadatas); if (unlikely(!member)) goto bad; + if (unlikely(PyDict_SetItem(res, __pyx_n_s_metadatas, member) < 0)) goto bad; + Py_DECREF(member); return res; bad: Py_XDECREF(member); @@ -9089,7 +19201,7 @@ static PyObject* __pyx_convert__to_py_struct__DracoFunctions_3a__3a_MeshObject(s static PyObject* __pyx_convert__to_py_struct__DracoFunctions_3a__3a_PointCloudObject(struct DracoFunctions::PointCloudObject s) { PyObject* res; PyObject* member; - res = __Pyx_PyDict_NewPresized(6); if (unlikely(!res)) return NULL; + res = __Pyx_PyDict_NewPresized(8); if (unlikely(!res)) return NULL; member = __pyx_convert_vector_to_py_float(s.points); if (unlikely(!member)) goto bad; if (unlikely(PyDict_SetItem(res, __pyx_n_s_points, member) < 0)) goto bad; Py_DECREF(member); @@ -9108,6 +19220,12 @@ static PyObject* __pyx_convert__to_py_struct__DracoFunctions_3a__3a_MeshObject(s member = __Pyx_PyInt_From_enum__DracoFunctions_3a__3a_decoding_status(s.decode_status); if (unlikely(!member)) goto bad; if (unlikely(PyDict_SetItem(res, __pyx_n_s_decode_status, member) < 0)) goto bad; Py_DECREF(member); + member = __pyx_convert__to_py_struct__DracoFunctions_3a__3a_GeometryMetadataObject(s.geometry_metadata); if (unlikely(!member)) goto bad; + if (unlikely(PyDict_SetItem(res, __pyx_n_s_geometry_metadata, member) < 0)) goto bad; + Py_DECREF(member); + member = __pyx_convert_vector_to_py_struct__DracoFunctions_3a__3a_MetadataObject(s.metadatas); if (unlikely(!member)) goto bad; + if (unlikely(PyDict_SetItem(res, __pyx_n_s_metadatas, member) < 0)) goto bad; + Py_DECREF(member); return res; bad: Py_XDECREF(member); @@ -9115,26 +19233,26 @@ static PyObject* __pyx_convert__to_py_struct__DracoFunctions_3a__3a_MeshObject(s return NULL; } /* CIntFromPy */ - static CYTHON_INLINE size_t __Pyx_PyInt_As_size_t(PyObject *x) { + static CYTHON_INLINE enum draco::GeometryAttribute::Type __Pyx_PyInt_As_enum__draco_3a__3a_GeometryAttribute_3a__3a_Type(PyObject *x) { #ifdef __Pyx_HAS_GCC_DIAGNOSTIC #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wconversion" #endif - const size_t neg_one = (size_t) -1, const_zero = (size_t) 0; + const enum draco::GeometryAttribute::Type neg_one = (enum draco::GeometryAttribute::Type) -1, const_zero = (enum draco::GeometryAttribute::Type) 0; #ifdef __Pyx_HAS_GCC_DIAGNOSTIC #pragma GCC diagnostic pop #endif const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { - if (sizeof(size_t) < sizeof(long)) { - __PYX_VERIFY_RETURN_INT(size_t, long, PyInt_AS_LONG(x)) + if (sizeof(enum draco::GeometryAttribute::Type) < sizeof(long)) { + __PYX_VERIFY_RETURN_INT(enum draco::GeometryAttribute::Type, long, PyInt_AS_LONG(x)) } else { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { goto raise_neg_overflow; } - return (size_t) val; + return (enum draco::GeometryAttribute::Type) val; } } else #endif @@ -9143,32 +19261,32 @@ static PyObject* __pyx_convert__to_py_struct__DracoFunctions_3a__3a_MeshObject(s #if CYTHON_USE_PYLONG_INTERNALS const digit* digits = ((PyLongObject*)x)->ob_digit; switch (Py_SIZE(x)) { - case 0: return (size_t) 0; - case 1: __PYX_VERIFY_RETURN_INT(size_t, digit, digits[0]) + case 0: return (enum draco::GeometryAttribute::Type) 0; + case 1: __PYX_VERIFY_RETURN_INT(enum draco::GeometryAttribute::Type, digit, digits[0]) case 2: - if (8 * sizeof(size_t) > 1 * PyLong_SHIFT) { + if (8 * sizeof(enum draco::GeometryAttribute::Type) > 1 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(size_t) >= 2 * PyLong_SHIFT) { - return (size_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); + __PYX_VERIFY_RETURN_INT(enum draco::GeometryAttribute::Type, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(enum draco::GeometryAttribute::Type) >= 2 * PyLong_SHIFT) { + return (enum draco::GeometryAttribute::Type) (((((enum draco::GeometryAttribute::Type)digits[1]) << PyLong_SHIFT) | (enum draco::GeometryAttribute::Type)digits[0])); } } break; case 3: - if (8 * sizeof(size_t) > 2 * PyLong_SHIFT) { + if (8 * sizeof(enum draco::GeometryAttribute::Type) > 2 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(size_t) >= 3 * PyLong_SHIFT) { - return (size_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); + __PYX_VERIFY_RETURN_INT(enum draco::GeometryAttribute::Type, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(enum draco::GeometryAttribute::Type) >= 3 * PyLong_SHIFT) { + return (enum draco::GeometryAttribute::Type) (((((((enum draco::GeometryAttribute::Type)digits[2]) << PyLong_SHIFT) | (enum draco::GeometryAttribute::Type)digits[1]) << PyLong_SHIFT) | (enum draco::GeometryAttribute::Type)digits[0])); } } break; case 4: - if (8 * sizeof(size_t) > 3 * PyLong_SHIFT) { + if (8 * sizeof(enum draco::GeometryAttribute::Type) > 3 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __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]))) - } else if (8 * sizeof(size_t) >= 4 * PyLong_SHIFT) { - 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])); + __PYX_VERIFY_RETURN_INT(enum draco::GeometryAttribute::Type, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(enum draco::GeometryAttribute::Type) >= 4 * PyLong_SHIFT) { + return (enum draco::GeometryAttribute::Type) (((((((((enum draco::GeometryAttribute::Type)digits[3]) << PyLong_SHIFT) | (enum draco::GeometryAttribute::Type)digits[2]) << PyLong_SHIFT) | (enum draco::GeometryAttribute::Type)digits[1]) << PyLong_SHIFT) | (enum draco::GeometryAttribute::Type)digits[0])); } } break; @@ -9182,86 +19300,282 @@ static PyObject* __pyx_convert__to_py_struct__DracoFunctions_3a__3a_MeshObject(s { int result = PyObject_RichCompareBool(x, Py_False, Py_LT); if (unlikely(result < 0)) - return (size_t) -1; + return (enum draco::GeometryAttribute::Type) -1; if (unlikely(result == 1)) goto raise_neg_overflow; } #endif - if (sizeof(size_t) <= sizeof(unsigned long)) { - __PYX_VERIFY_RETURN_INT_EXC(size_t, unsigned long, PyLong_AsUnsignedLong(x)) + if (sizeof(enum draco::GeometryAttribute::Type) <= sizeof(unsigned long)) { + __PYX_VERIFY_RETURN_INT_EXC(enum draco::GeometryAttribute::Type, unsigned long, PyLong_AsUnsignedLong(x)) #ifdef HAVE_LONG_LONG - } else if (sizeof(size_t) <= sizeof(unsigned PY_LONG_LONG)) { - __PYX_VERIFY_RETURN_INT_EXC(size_t, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) + } else if (sizeof(enum draco::GeometryAttribute::Type) <= sizeof(unsigned PY_LONG_LONG)) { + __PYX_VERIFY_RETURN_INT_EXC(enum draco::GeometryAttribute::Type, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) #endif } } else { #if CYTHON_USE_PYLONG_INTERNALS const digit* digits = ((PyLongObject*)x)->ob_digit; switch (Py_SIZE(x)) { - case 0: return (size_t) 0; - case -1: __PYX_VERIFY_RETURN_INT(size_t, sdigit, (sdigit) (-(sdigit)digits[0])) - case 1: __PYX_VERIFY_RETURN_INT(size_t, digit, +digits[0]) + case 0: return (enum draco::GeometryAttribute::Type) 0; + case -1: __PYX_VERIFY_RETURN_INT(enum draco::GeometryAttribute::Type, sdigit, (sdigit) (-(sdigit)digits[0])) + case 1: __PYX_VERIFY_RETURN_INT(enum draco::GeometryAttribute::Type, digit, +digits[0]) case -2: - if (8 * sizeof(size_t) - 1 > 1 * PyLong_SHIFT) { + if (8 * sizeof(enum draco::GeometryAttribute::Type) - 1 > 1 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(size_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT) { - return (size_t) (((size_t)-1)*(((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]))); + __PYX_VERIFY_RETURN_INT(enum draco::GeometryAttribute::Type, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(enum draco::GeometryAttribute::Type) - 1 > 2 * PyLong_SHIFT) { + return (enum draco::GeometryAttribute::Type) (((enum draco::GeometryAttribute::Type)-1)*(((((enum draco::GeometryAttribute::Type)digits[1]) << PyLong_SHIFT) | (enum draco::GeometryAttribute::Type)digits[0]))); } } break; case 2: - if (8 * sizeof(size_t) > 1 * PyLong_SHIFT) { + if (8 * sizeof(enum draco::GeometryAttribute::Type) > 1 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT) { - return (size_t) ((((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]))); + __PYX_VERIFY_RETURN_INT(enum draco::GeometryAttribute::Type, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(enum draco::GeometryAttribute::Type) - 1 > 2 * PyLong_SHIFT) { + return (enum draco::GeometryAttribute::Type) ((((((enum draco::GeometryAttribute::Type)digits[1]) << PyLong_SHIFT) | (enum draco::GeometryAttribute::Type)digits[0]))); } } break; case -3: - if (8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT) { + if (8 * sizeof(enum draco::GeometryAttribute::Type) - 1 > 2 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(size_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT) { - return (size_t) (((size_t)-1)*(((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]))); + __PYX_VERIFY_RETURN_INT(enum draco::GeometryAttribute::Type, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(enum draco::GeometryAttribute::Type) - 1 > 3 * PyLong_SHIFT) { + return (enum draco::GeometryAttribute::Type) (((enum draco::GeometryAttribute::Type)-1)*(((((((enum draco::GeometryAttribute::Type)digits[2]) << PyLong_SHIFT) | (enum draco::GeometryAttribute::Type)digits[1]) << PyLong_SHIFT) | (enum draco::GeometryAttribute::Type)digits[0]))); } } break; case 3: - if (8 * sizeof(size_t) > 2 * PyLong_SHIFT) { + if (8 * sizeof(enum draco::GeometryAttribute::Type) > 2 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT) { - return (size_t) ((((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]))); + __PYX_VERIFY_RETURN_INT(enum draco::GeometryAttribute::Type, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(enum draco::GeometryAttribute::Type) - 1 > 3 * PyLong_SHIFT) { + return (enum draco::GeometryAttribute::Type) ((((((((enum draco::GeometryAttribute::Type)digits[2]) << PyLong_SHIFT) | (enum draco::GeometryAttribute::Type)digits[1]) << PyLong_SHIFT) | (enum draco::GeometryAttribute::Type)digits[0]))); } } break; case -4: - if (8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT) { + if (8 * sizeof(enum draco::GeometryAttribute::Type) - 1 > 3 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __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]))) - } else if (8 * sizeof(size_t) - 1 > 4 * PyLong_SHIFT) { - 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]))); + __PYX_VERIFY_RETURN_INT(enum draco::GeometryAttribute::Type, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(enum draco::GeometryAttribute::Type) - 1 > 4 * PyLong_SHIFT) { + return (enum draco::GeometryAttribute::Type) (((enum draco::GeometryAttribute::Type)-1)*(((((((((enum draco::GeometryAttribute::Type)digits[3]) << PyLong_SHIFT) | (enum draco::GeometryAttribute::Type)digits[2]) << PyLong_SHIFT) | (enum draco::GeometryAttribute::Type)digits[1]) << PyLong_SHIFT) | (enum draco::GeometryAttribute::Type)digits[0]))); + } + } + break; + case 4: + if (8 * sizeof(enum draco::GeometryAttribute::Type) > 3 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(enum draco::GeometryAttribute::Type, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(enum draco::GeometryAttribute::Type) - 1 > 4 * PyLong_SHIFT) { + return (enum draco::GeometryAttribute::Type) ((((((((((enum draco::GeometryAttribute::Type)digits[3]) << PyLong_SHIFT) | (enum draco::GeometryAttribute::Type)digits[2]) << PyLong_SHIFT) | (enum draco::GeometryAttribute::Type)digits[1]) << PyLong_SHIFT) | (enum draco::GeometryAttribute::Type)digits[0]))); + } + } + break; + } +#endif + if (sizeof(enum draco::GeometryAttribute::Type) <= sizeof(long)) { + __PYX_VERIFY_RETURN_INT_EXC(enum draco::GeometryAttribute::Type, long, PyLong_AsLong(x)) +#ifdef HAVE_LONG_LONG + } else if (sizeof(enum draco::GeometryAttribute::Type) <= sizeof(PY_LONG_LONG)) { + __PYX_VERIFY_RETURN_INT_EXC(enum draco::GeometryAttribute::Type, PY_LONG_LONG, PyLong_AsLongLong(x)) +#endif + } + } + { +#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) + PyErr_SetString(PyExc_RuntimeError, + "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); +#else + enum draco::GeometryAttribute::Type val; + PyObject *v = __Pyx_PyNumber_IntOrLong(x); + #if PY_MAJOR_VERSION < 3 + if (likely(v) && !PyLong_Check(v)) { + PyObject *tmp = v; + v = PyNumber_Long(tmp); + Py_DECREF(tmp); + } + #endif + if (likely(v)) { + int one = 1; int is_little = (int)*(unsigned char *)&one; + unsigned char *bytes = (unsigned char *)&val; + int ret = _PyLong_AsByteArray((PyLongObject *)v, + bytes, sizeof(val), + is_little, !is_unsigned); + Py_DECREF(v); + if (likely(!ret)) + return val; + } +#endif + return (enum draco::GeometryAttribute::Type) -1; + } + } else { + enum draco::GeometryAttribute::Type val; + PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); + if (!tmp) return (enum draco::GeometryAttribute::Type) -1; + val = __Pyx_PyInt_As_enum__draco_3a__3a_GeometryAttribute_3a__3a_Type(tmp); + Py_DECREF(tmp); + return val; + } +raise_overflow: + PyErr_SetString(PyExc_OverflowError, + "value too large to convert to enum draco::GeometryAttribute::Type"); + return (enum draco::GeometryAttribute::Type) -1; +raise_neg_overflow: + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to enum draco::GeometryAttribute::Type"); + return (enum draco::GeometryAttribute::Type) -1; +} + +/* CIntFromPy */ + static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) { +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const int neg_one = (int) -1, const_zero = (int) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif + const int is_unsigned = neg_one > const_zero; +#if PY_MAJOR_VERSION < 3 + if (likely(PyInt_Check(x))) { + if (sizeof(int) < sizeof(long)) { + __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x)) + } else { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + goto raise_neg_overflow; + } + return (int) val; + } + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { +#if CYTHON_USE_PYLONG_INTERNALS + const digit* digits = ((PyLongObject*)x)->ob_digit; + switch (Py_SIZE(x)) { + case 0: return (int) 0; + case 1: __PYX_VERIFY_RETURN_INT(int, digit, digits[0]) + case 2: + if (8 * sizeof(int) > 1 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(int) >= 2 * PyLong_SHIFT) { + return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); + } + } + break; + case 3: + if (8 * sizeof(int) > 2 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(int) >= 3 * PyLong_SHIFT) { + return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); + } + } + break; + case 4: + if (8 * sizeof(int) > 3 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { + __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]))) + } else if (8 * sizeof(int) >= 4 * PyLong_SHIFT) { + return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); + } + } + break; + } +#endif +#if CYTHON_COMPILING_IN_CPYTHON + if (unlikely(Py_SIZE(x) < 0)) { + goto raise_neg_overflow; + } +#else + { + int result = PyObject_RichCompareBool(x, Py_False, Py_LT); + if (unlikely(result < 0)) + return (int) -1; + if (unlikely(result == 1)) + goto raise_neg_overflow; + } +#endif + if (sizeof(int) <= sizeof(unsigned long)) { + __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x)) +#ifdef HAVE_LONG_LONG + } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) { + __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) +#endif + } + } else { +#if CYTHON_USE_PYLONG_INTERNALS + const digit* digits = ((PyLongObject*)x)->ob_digit; + switch (Py_SIZE(x)) { + case 0: return (int) 0; + case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, (sdigit) (-(sdigit)digits[0])) + case 1: __PYX_VERIFY_RETURN_INT(int, digit, +digits[0]) + case -2: + if (8 * sizeof(int) - 1 > 1 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) { + return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } + } + break; + case 2: + if (8 * sizeof(int) > 1 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) { + return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } + } + break; + case -3: + if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) { + return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } + } + break; + case 3: + if (8 * sizeof(int) > 2 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) { + return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + } + } + break; + case -4: + if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { + __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]))) + } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) { + return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); } } break; case 4: - if (8 * sizeof(size_t) > 3 * PyLong_SHIFT) { + if (8 * sizeof(int) > 3 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __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]))) - } else if (8 * sizeof(size_t) - 1 > 4 * PyLong_SHIFT) { - 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]))); + __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]))) + } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) { + return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); } } break; } #endif - if (sizeof(size_t) <= sizeof(long)) { - __PYX_VERIFY_RETURN_INT_EXC(size_t, long, PyLong_AsLong(x)) + if (sizeof(int) <= sizeof(long)) { + __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x)) #ifdef HAVE_LONG_LONG - } else if (sizeof(size_t) <= sizeof(PY_LONG_LONG)) { - __PYX_VERIFY_RETURN_INT_EXC(size_t, PY_LONG_LONG, PyLong_AsLongLong(x)) + } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) { + __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x)) #endif } } @@ -9270,7 +19584,7 @@ static PyObject* __pyx_convert__to_py_struct__DracoFunctions_3a__3a_MeshObject(s PyErr_SetString(PyExc_RuntimeError, "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); #else - size_t val; + int val; PyObject *v = __Pyx_PyNumber_IntOrLong(x); #if PY_MAJOR_VERSION < 3 if (likely(v) && !PyLong_Check(v)) { @@ -9290,24 +19604,138 @@ static PyObject* __pyx_convert__to_py_struct__DracoFunctions_3a__3a_MeshObject(s return val; } #endif - return (size_t) -1; + return (int) -1; } } else { - size_t val; + int val; PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); - if (!tmp) return (size_t) -1; - val = __Pyx_PyInt_As_size_t(tmp); + if (!tmp) return (int) -1; + val = __Pyx_PyInt_As_int(tmp); Py_DECREF(tmp); return val; } raise_overflow: PyErr_SetString(PyExc_OverflowError, - "value too large to convert to size_t"); - return (size_t) -1; + "value too large to convert to int"); + return (int) -1; raise_neg_overflow: PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to size_t"); - return (size_t) -1; + "can't convert negative value to int"); + return (int) -1; +} + +/* CIntToPy */ + static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) { +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const long neg_one = (long) -1, const_zero = (long) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif + 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); + } +} + +/* CIntToPy */ + static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) { +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const int neg_one = (int) -1, const_zero = (int) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif + const int is_unsigned = neg_one > const_zero; + if (is_unsigned) { + if (sizeof(int) < sizeof(long)) { + return PyInt_FromLong((long) value); + } else if (sizeof(int) <= sizeof(unsigned long)) { + return PyLong_FromUnsignedLong((unsigned long) value); +#ifdef HAVE_LONG_LONG + } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) { + return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); +#endif + } + } else { + if (sizeof(int) <= sizeof(long)) { + return PyInt_FromLong((long) value); +#ifdef HAVE_LONG_LONG + } else if (sizeof(int) <= 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(int), + little, !is_unsigned); + } +} + +/* CIntToPy */ + static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum__draco_3a__3a_GeometryAttribute_3a__3a_Type(enum draco::GeometryAttribute::Type value) { +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const enum draco::GeometryAttribute::Type neg_one = (enum draco::GeometryAttribute::Type) -1, const_zero = (enum draco::GeometryAttribute::Type) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif + const int is_unsigned = neg_one > const_zero; + if (is_unsigned) { + if (sizeof(enum draco::GeometryAttribute::Type) < sizeof(long)) { + return PyInt_FromLong((long) value); + } else if (sizeof(enum draco::GeometryAttribute::Type) <= sizeof(unsigned long)) { + return PyLong_FromUnsignedLong((unsigned long) value); +#ifdef HAVE_LONG_LONG + } else if (sizeof(enum draco::GeometryAttribute::Type) <= sizeof(unsigned PY_LONG_LONG)) { + return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); +#endif + } + } else { + if (sizeof(enum draco::GeometryAttribute::Type) <= sizeof(long)) { + return PyInt_FromLong((long) value); +#ifdef HAVE_LONG_LONG + } else if (sizeof(enum draco::GeometryAttribute::Type) <= 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(enum draco::GeometryAttribute::Type), + little, !is_unsigned); + } } /* CIntFromPy */ @@ -9507,26 +19935,26 @@ static PyObject* __pyx_convert__to_py_struct__DracoFunctions_3a__3a_MeshObject(s } /* CIntFromPy */ - static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) { + static CYTHON_INLINE enum draco::DataType __Pyx_PyInt_As_enum__draco_3a__3a_DataType(PyObject *x) { #ifdef __Pyx_HAS_GCC_DIAGNOSTIC #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wconversion" #endif - const int neg_one = (int) -1, const_zero = (int) 0; + const enum draco::DataType neg_one = (enum draco::DataType) -1, const_zero = (enum draco::DataType) 0; #ifdef __Pyx_HAS_GCC_DIAGNOSTIC #pragma GCC diagnostic pop #endif const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { - if (sizeof(int) < sizeof(long)) { - __PYX_VERIFY_RETURN_INT(int, long, PyInt_AS_LONG(x)) + if (sizeof(enum draco::DataType) < sizeof(long)) { + __PYX_VERIFY_RETURN_INT(enum draco::DataType, long, PyInt_AS_LONG(x)) } else { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { goto raise_neg_overflow; } - return (int) val; + return (enum draco::DataType) val; } } else #endif @@ -9535,32 +19963,32 @@ static PyObject* __pyx_convert__to_py_struct__DracoFunctions_3a__3a_MeshObject(s #if CYTHON_USE_PYLONG_INTERNALS const digit* digits = ((PyLongObject*)x)->ob_digit; switch (Py_SIZE(x)) { - case 0: return (int) 0; - case 1: __PYX_VERIFY_RETURN_INT(int, digit, digits[0]) + case 0: return (enum draco::DataType) 0; + case 1: __PYX_VERIFY_RETURN_INT(enum draco::DataType, digit, digits[0]) case 2: - if (8 * sizeof(int) > 1 * PyLong_SHIFT) { + if (8 * sizeof(enum draco::DataType) > 1 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) >= 2 * PyLong_SHIFT) { - return (int) (((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); + __PYX_VERIFY_RETURN_INT(enum draco::DataType, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(enum draco::DataType) >= 2 * PyLong_SHIFT) { + return (enum draco::DataType) (((((enum draco::DataType)digits[1]) << PyLong_SHIFT) | (enum draco::DataType)digits[0])); } } break; case 3: - if (8 * sizeof(int) > 2 * PyLong_SHIFT) { + if (8 * sizeof(enum draco::DataType) > 2 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) >= 3 * PyLong_SHIFT) { - return (int) (((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); + __PYX_VERIFY_RETURN_INT(enum draco::DataType, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(enum draco::DataType) >= 3 * PyLong_SHIFT) { + return (enum draco::DataType) (((((((enum draco::DataType)digits[2]) << PyLong_SHIFT) | (enum draco::DataType)digits[1]) << PyLong_SHIFT) | (enum draco::DataType)digits[0])); } } break; case 4: - if (8 * sizeof(int) > 3 * PyLong_SHIFT) { + if (8 * sizeof(enum draco::DataType) > 3 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __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]))) - } else if (8 * sizeof(int) >= 4 * PyLong_SHIFT) { - return (int) (((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0])); + __PYX_VERIFY_RETURN_INT(enum draco::DataType, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(enum draco::DataType) >= 4 * PyLong_SHIFT) { + return (enum draco::DataType) (((((((((enum draco::DataType)digits[3]) << PyLong_SHIFT) | (enum draco::DataType)digits[2]) << PyLong_SHIFT) | (enum draco::DataType)digits[1]) << PyLong_SHIFT) | (enum draco::DataType)digits[0])); } } break; @@ -9574,86 +20002,86 @@ static PyObject* __pyx_convert__to_py_struct__DracoFunctions_3a__3a_MeshObject(s { int result = PyObject_RichCompareBool(x, Py_False, Py_LT); if (unlikely(result < 0)) - return (int) -1; + return (enum draco::DataType) -1; if (unlikely(result == 1)) goto raise_neg_overflow; } #endif - if (sizeof(int) <= sizeof(unsigned long)) { - __PYX_VERIFY_RETURN_INT_EXC(int, unsigned long, PyLong_AsUnsignedLong(x)) + if (sizeof(enum draco::DataType) <= sizeof(unsigned long)) { + __PYX_VERIFY_RETURN_INT_EXC(enum draco::DataType, unsigned long, PyLong_AsUnsignedLong(x)) #ifdef HAVE_LONG_LONG - } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) { - __PYX_VERIFY_RETURN_INT_EXC(int, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) + } else if (sizeof(enum draco::DataType) <= sizeof(unsigned PY_LONG_LONG)) { + __PYX_VERIFY_RETURN_INT_EXC(enum draco::DataType, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) #endif } } else { #if CYTHON_USE_PYLONG_INTERNALS const digit* digits = ((PyLongObject*)x)->ob_digit; switch (Py_SIZE(x)) { - case 0: return (int) 0; - case -1: __PYX_VERIFY_RETURN_INT(int, sdigit, (sdigit) (-(sdigit)digits[0])) - case 1: __PYX_VERIFY_RETURN_INT(int, digit, +digits[0]) + case 0: return (enum draco::DataType) 0; + case -1: __PYX_VERIFY_RETURN_INT(enum draco::DataType, sdigit, (sdigit) (-(sdigit)digits[0])) + case 1: __PYX_VERIFY_RETURN_INT(enum draco::DataType, digit, +digits[0]) case -2: - if (8 * sizeof(int) - 1 > 1 * PyLong_SHIFT) { + if (8 * sizeof(enum draco::DataType) - 1 > 1 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) { - return (int) (((int)-1)*(((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + __PYX_VERIFY_RETURN_INT(enum draco::DataType, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(enum draco::DataType) - 1 > 2 * PyLong_SHIFT) { + return (enum draco::DataType) (((enum draco::DataType)-1)*(((((enum draco::DataType)digits[1]) << PyLong_SHIFT) | (enum draco::DataType)digits[0]))); } } break; case 2: - if (8 * sizeof(int) > 1 * PyLong_SHIFT) { + if (8 * sizeof(enum draco::DataType) > 1 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) { - return (int) ((((((int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + __PYX_VERIFY_RETURN_INT(enum draco::DataType, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(enum draco::DataType) - 1 > 2 * PyLong_SHIFT) { + return (enum draco::DataType) ((((((enum draco::DataType)digits[1]) << PyLong_SHIFT) | (enum draco::DataType)digits[0]))); } } break; case -3: - if (8 * sizeof(int) - 1 > 2 * PyLong_SHIFT) { + if (8 * sizeof(enum draco::DataType) - 1 > 2 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) { - return (int) (((int)-1)*(((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + __PYX_VERIFY_RETURN_INT(enum draco::DataType, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(enum draco::DataType) - 1 > 3 * PyLong_SHIFT) { + return (enum draco::DataType) (((enum draco::DataType)-1)*(((((((enum draco::DataType)digits[2]) << PyLong_SHIFT) | (enum draco::DataType)digits[1]) << PyLong_SHIFT) | (enum draco::DataType)digits[0]))); } } break; case 3: - if (8 * sizeof(int) > 2 * PyLong_SHIFT) { + if (8 * sizeof(enum draco::DataType) > 2 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { - __PYX_VERIFY_RETURN_INT(int, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) - } else if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) { - return (int) ((((((((int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + __PYX_VERIFY_RETURN_INT(enum draco::DataType, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(enum draco::DataType) - 1 > 3 * PyLong_SHIFT) { + return (enum draco::DataType) ((((((((enum draco::DataType)digits[2]) << PyLong_SHIFT) | (enum draco::DataType)digits[1]) << PyLong_SHIFT) | (enum draco::DataType)digits[0]))); } } break; case -4: - if (8 * sizeof(int) - 1 > 3 * PyLong_SHIFT) { + if (8 * sizeof(enum draco::DataType) - 1 > 3 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __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]))) - } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) { - return (int) (((int)-1)*(((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + __PYX_VERIFY_RETURN_INT(enum draco::DataType, long, -(long) (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(enum draco::DataType) - 1 > 4 * PyLong_SHIFT) { + return (enum draco::DataType) (((enum draco::DataType)-1)*(((((((((enum draco::DataType)digits[3]) << PyLong_SHIFT) | (enum draco::DataType)digits[2]) << PyLong_SHIFT) | (enum draco::DataType)digits[1]) << PyLong_SHIFT) | (enum draco::DataType)digits[0]))); } } break; case 4: - if (8 * sizeof(int) > 3 * PyLong_SHIFT) { + if (8 * sizeof(enum draco::DataType) > 3 * PyLong_SHIFT) { if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { - __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]))) - } else if (8 * sizeof(int) - 1 > 4 * PyLong_SHIFT) { - return (int) ((((((((((int)digits[3]) << PyLong_SHIFT) | (int)digits[2]) << PyLong_SHIFT) | (int)digits[1]) << PyLong_SHIFT) | (int)digits[0]))); + __PYX_VERIFY_RETURN_INT(enum draco::DataType, unsigned long, (((((((((unsigned long)digits[3]) << PyLong_SHIFT) | (unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(enum draco::DataType) - 1 > 4 * PyLong_SHIFT) { + return (enum draco::DataType) ((((((((((enum draco::DataType)digits[3]) << PyLong_SHIFT) | (enum draco::DataType)digits[2]) << PyLong_SHIFT) | (enum draco::DataType)digits[1]) << PyLong_SHIFT) | (enum draco::DataType)digits[0]))); } } break; } #endif - if (sizeof(int) <= sizeof(long)) { - __PYX_VERIFY_RETURN_INT_EXC(int, long, PyLong_AsLong(x)) + if (sizeof(enum draco::DataType) <= sizeof(long)) { + __PYX_VERIFY_RETURN_INT_EXC(enum draco::DataType, long, PyLong_AsLong(x)) #ifdef HAVE_LONG_LONG - } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) { - __PYX_VERIFY_RETURN_INT_EXC(int, PY_LONG_LONG, PyLong_AsLongLong(x)) + } else if (sizeof(enum draco::DataType) <= sizeof(PY_LONG_LONG)) { + __PYX_VERIFY_RETURN_INT_EXC(enum draco::DataType, PY_LONG_LONG, PyLong_AsLongLong(x)) #endif } } @@ -9662,7 +20090,7 @@ static PyObject* __pyx_convert__to_py_struct__DracoFunctions_3a__3a_MeshObject(s PyErr_SetString(PyExc_RuntimeError, "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); #else - int val; + enum draco::DataType val; PyObject *v = __Pyx_PyNumber_IntOrLong(x); #if PY_MAJOR_VERSION < 3 if (likely(v) && !PyLong_Check(v)) { @@ -9682,24 +20110,100 @@ static PyObject* __pyx_convert__to_py_struct__DracoFunctions_3a__3a_MeshObject(s return val; } #endif - return (int) -1; + return (enum draco::DataType) -1; } } else { - int val; + enum draco::DataType val; PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); - if (!tmp) return (int) -1; - val = __Pyx_PyInt_As_int(tmp); + if (!tmp) return (enum draco::DataType) -1; + val = __Pyx_PyInt_As_enum__draco_3a__3a_DataType(tmp); Py_DECREF(tmp); return val; } -raise_overflow: - PyErr_SetString(PyExc_OverflowError, - "value too large to convert to int"); - return (int) -1; -raise_neg_overflow: - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to int"); - return (int) -1; +raise_overflow: + PyErr_SetString(PyExc_OverflowError, + "value too large to convert to enum draco::DataType"); + return (enum draco::DataType) -1; +raise_neg_overflow: + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to enum draco::DataType"); + return (enum draco::DataType) -1; +} + +/* CIntToPy */ + static CYTHON_INLINE PyObject* __Pyx_PyInt_From_uint32_t(uint32_t value) { +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const uint32_t neg_one = (uint32_t) -1, const_zero = (uint32_t) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif + const int is_unsigned = neg_one > const_zero; + if (is_unsigned) { + if (sizeof(uint32_t) < sizeof(long)) { + return PyInt_FromLong((long) value); + } else if (sizeof(uint32_t) <= sizeof(unsigned long)) { + return PyLong_FromUnsignedLong((unsigned long) value); +#ifdef HAVE_LONG_LONG + } else if (sizeof(uint32_t) <= sizeof(unsigned PY_LONG_LONG)) { + return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); +#endif + } + } else { + if (sizeof(uint32_t) <= sizeof(long)) { + return PyInt_FromLong((long) value); +#ifdef HAVE_LONG_LONG + } else if (sizeof(uint32_t) <= 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(uint32_t), + little, !is_unsigned); + } +} + +/* CIntToPy */ + static CYTHON_INLINE PyObject* __Pyx_PyInt_From_enum__draco_3a__3a_DataType(enum draco::DataType value) { +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const enum draco::DataType neg_one = (enum draco::DataType) -1, const_zero = (enum draco::DataType) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif + const int is_unsigned = neg_one > const_zero; + if (is_unsigned) { + if (sizeof(enum draco::DataType) < sizeof(long)) { + return PyInt_FromLong((long) value); + } else if (sizeof(enum draco::DataType) <= sizeof(unsigned long)) { + return PyLong_FromUnsignedLong((unsigned long) value); +#ifdef HAVE_LONG_LONG + } else if (sizeof(enum draco::DataType) <= sizeof(unsigned PY_LONG_LONG)) { + return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); +#endif + } + } else { + if (sizeof(enum draco::DataType) <= sizeof(long)) { + return PyInt_FromLong((long) value); +#ifdef HAVE_LONG_LONG + } else if (sizeof(enum draco::DataType) <= 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(enum draco::DataType), + little, !is_unsigned); + } } /* CIntToPy */ @@ -9816,80 +20320,200 @@ static PyObject* __pyx_convert__to_py_struct__DracoFunctions_3a__3a_MeshObject(s } } -/* CIntToPy */ - static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) { +/* CIntFromPy */ + static CYTHON_INLINE size_t __Pyx_PyInt_As_size_t(PyObject *x) { #ifdef __Pyx_HAS_GCC_DIAGNOSTIC #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wconversion" #endif - const int neg_one = (int) -1, const_zero = (int) 0; + const size_t neg_one = (size_t) -1, const_zero = (size_t) 0; #ifdef __Pyx_HAS_GCC_DIAGNOSTIC #pragma GCC diagnostic pop #endif const int is_unsigned = neg_one > const_zero; - if (is_unsigned) { - if (sizeof(int) < sizeof(long)) { - return PyInt_FromLong((long) value); - } else if (sizeof(int) <= sizeof(unsigned long)) { - return PyLong_FromUnsignedLong((unsigned long) value); -#ifdef HAVE_LONG_LONG - } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) { - return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); -#endif +#if PY_MAJOR_VERSION < 3 + if (likely(PyInt_Check(x))) { + if (sizeof(size_t) < sizeof(long)) { + __PYX_VERIFY_RETURN_INT(size_t, long, PyInt_AS_LONG(x)) + } else { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + goto raise_neg_overflow; + } + return (size_t) val; } - } else { - if (sizeof(int) <= sizeof(long)) { - return PyInt_FromLong((long) value); -#ifdef HAVE_LONG_LONG - } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) { - return PyLong_FromLongLong((PY_LONG_LONG) value); + } else #endif - } - } - { - int one = 1; int little = (int)*(unsigned char *)&one; - unsigned char *bytes = (unsigned char *)&value; - return _PyLong_FromByteArray(bytes, sizeof(int), - little, !is_unsigned); - } -} - -/* CIntToPy */ - static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) { -#ifdef __Pyx_HAS_GCC_DIAGNOSTIC -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wconversion" + if (likely(PyLong_Check(x))) { + if (is_unsigned) { +#if CYTHON_USE_PYLONG_INTERNALS + const digit* digits = ((PyLongObject*)x)->ob_digit; + switch (Py_SIZE(x)) { + case 0: return (size_t) 0; + case 1: __PYX_VERIFY_RETURN_INT(size_t, digit, digits[0]) + case 2: + if (8 * sizeof(size_t) > 1 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(size_t) >= 2 * PyLong_SHIFT) { + return (size_t) (((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); + } + } + break; + case 3: + if (8 * sizeof(size_t) > 2 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(size_t) >= 3 * PyLong_SHIFT) { + return (size_t) (((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0])); + } + } + break; + case 4: + if (8 * sizeof(size_t) > 3 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { + __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]))) + } else if (8 * sizeof(size_t) >= 4 * PyLong_SHIFT) { + 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])); + } + } + break; + } #endif - const long neg_one = (long) -1, const_zero = (long) 0; -#ifdef __Pyx_HAS_GCC_DIAGNOSTIC -#pragma GCC diagnostic pop +#if CYTHON_COMPILING_IN_CPYTHON + if (unlikely(Py_SIZE(x) < 0)) { + goto raise_neg_overflow; + } +#else + { + int result = PyObject_RichCompareBool(x, Py_False, Py_LT); + if (unlikely(result < 0)) + return (size_t) -1; + if (unlikely(result == 1)) + goto raise_neg_overflow; + } #endif - 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); + if (sizeof(size_t) <= sizeof(unsigned long)) { + __PYX_VERIFY_RETURN_INT_EXC(size_t, unsigned long, PyLong_AsUnsignedLong(x)) #ifdef HAVE_LONG_LONG - } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) { - return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); + } else if (sizeof(size_t) <= sizeof(unsigned PY_LONG_LONG)) { + __PYX_VERIFY_RETURN_INT_EXC(size_t, unsigned PY_LONG_LONG, PyLong_AsUnsignedLongLong(x)) #endif - } - } else { - if (sizeof(long) <= sizeof(long)) { - return PyInt_FromLong((long) value); + } + } else { +#if CYTHON_USE_PYLONG_INTERNALS + const digit* digits = ((PyLongObject*)x)->ob_digit; + switch (Py_SIZE(x)) { + case 0: return (size_t) 0; + case -1: __PYX_VERIFY_RETURN_INT(size_t, sdigit, (sdigit) (-(sdigit)digits[0])) + case 1: __PYX_VERIFY_RETURN_INT(size_t, digit, +digits[0]) + case -2: + if (8 * sizeof(size_t) - 1 > 1 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(size_t, long, -(long) (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT) { + return (size_t) (((size_t)-1)*(((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]))); + } + } + break; + case 2: + if (8 * sizeof(size_t) > 1 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 2 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT) { + return (size_t) ((((((size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]))); + } + } + break; + case -3: + if (8 * sizeof(size_t) - 1 > 2 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(size_t, long, -(long) (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT) { + return (size_t) (((size_t)-1)*(((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]))); + } + } + break; + case 3: + if (8 * sizeof(size_t) > 2 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 3 * PyLong_SHIFT) { + __PYX_VERIFY_RETURN_INT(size_t, unsigned long, (((((((unsigned long)digits[2]) << PyLong_SHIFT) | (unsigned long)digits[1]) << PyLong_SHIFT) | (unsigned long)digits[0]))) + } else if (8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT) { + return (size_t) ((((((((size_t)digits[2]) << PyLong_SHIFT) | (size_t)digits[1]) << PyLong_SHIFT) | (size_t)digits[0]))); + } + } + break; + case -4: + if (8 * sizeof(size_t) - 1 > 3 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { + __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]))) + } else if (8 * sizeof(size_t) - 1 > 4 * PyLong_SHIFT) { + 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]))); + } + } + break; + case 4: + if (8 * sizeof(size_t) > 3 * PyLong_SHIFT) { + if (8 * sizeof(unsigned long) > 4 * PyLong_SHIFT) { + __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]))) + } else if (8 * sizeof(size_t) - 1 > 4 * PyLong_SHIFT) { + 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]))); + } + } + break; + } +#endif + if (sizeof(size_t) <= sizeof(long)) { + __PYX_VERIFY_RETURN_INT_EXC(size_t, long, PyLong_AsLong(x)) #ifdef HAVE_LONG_LONG - } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) { - return PyLong_FromLongLong((PY_LONG_LONG) value); + } else if (sizeof(size_t) <= sizeof(PY_LONG_LONG)) { + __PYX_VERIFY_RETURN_INT_EXC(size_t, PY_LONG_LONG, PyLong_AsLongLong(x)) #endif + } } + { +#if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) + PyErr_SetString(PyExc_RuntimeError, + "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); +#else + size_t val; + PyObject *v = __Pyx_PyNumber_IntOrLong(x); + #if PY_MAJOR_VERSION < 3 + if (likely(v) && !PyLong_Check(v)) { + PyObject *tmp = v; + v = PyNumber_Long(tmp); + Py_DECREF(tmp); + } + #endif + if (likely(v)) { + int one = 1; int is_little = (int)*(unsigned char *)&one; + unsigned char *bytes = (unsigned char *)&val; + int ret = _PyLong_AsByteArray((PyLongObject *)v, + bytes, sizeof(val), + is_little, !is_unsigned); + Py_DECREF(v); + if (likely(!ret)) + return val; + } +#endif + return (size_t) -1; + } + } else { + size_t val; + PyObject *tmp = __Pyx_PyNumber_IntOrLong(x); + if (!tmp) return (size_t) -1; + val = __Pyx_PyInt_As_size_t(tmp); + Py_DECREF(tmp); + return val; } - { - int one = 1; int little = (int)*(unsigned char *)&one; - unsigned char *bytes = (unsigned char *)&value; - return _PyLong_FromByteArray(bytes, sizeof(long), - little, !is_unsigned); - } +raise_overflow: + PyErr_SetString(PyExc_OverflowError, + "value too large to convert to size_t"); + return (size_t) -1; +raise_neg_overflow: + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to size_t"); + return (size_t) -1; } /* CIntFromPy */ @@ -10352,6 +20976,23 @@ static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { Py_DECREF(x); return ival; } +static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject* o) { + if (sizeof(Py_hash_t) == sizeof(Py_ssize_t)) { + return (Py_hash_t) __Pyx_PyIndex_AsSsize_t(o); +#if PY_MAJOR_VERSION < 3 + } else if (likely(PyInt_CheckExact(o))) { + return PyInt_AS_LONG(o); +#endif + } else { + Py_ssize_t ival; + PyObject *x; + x = PyNumber_Index(o); + if (!x) return -1; + ival = PyInt_AsLong(x); + Py_DECREF(x); + return ival; + } +} static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) { return b ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False); } diff --git a/src/DracoPy.h b/src/DracoPy.h index 39211a8..e17a4b3 100644 --- a/src/DracoPy.h +++ b/src/DracoPy.h @@ -1,5 +1,8 @@ -#include -#include +#include +#include +#include +#include + #include "draco/compression/decode.h" #include "draco/compression/encode.h" #include "draco/core/encoder_buffer.h" @@ -12,6 +15,31 @@ namespace DracoFunctions { enum decoding_status { successful, not_draco_encoded, no_position_attribute, failed_during_decoding }; enum encoding_status { successful_encoding, failed_during_encoding }; + struct MetadataObject { + std::unordered_map entries; + std::unordered_map sub_metadata_ids; + + // MetadataObject() = default; + // MetadataObject(const MetadataObject&) = delete; + }; + + // struct AttributeMetadataObject { + // uint32_t metadata_id; // reference to metadata object + // uint32_t unique_id; + // }; + + struct PointAttributeObject { + std::unordered_map data; + draco::DataType datatype; + uint32_t dimension; + uint32_t metadata_id; + }; + + struct GeometryMetadataObject { + uint32_t metadata_id; // reference to metadata object + std::vector generic_attributes; + }; + struct PointCloudObject { std::vector points; @@ -22,6 +50,11 @@ namespace DracoFunctions { std::vector quantization_origin; decoding_status decode_status; + + // geometry metadata + attributes + GeometryMetadataObject geometry_metadata; + // contains all metadata here + std::vector metadatas; }; struct MeshObject : PointCloudObject { @@ -34,7 +67,183 @@ namespace DracoFunctions { encoding_status encode_status; }; - MeshObject decode_buffer(const char *buffer, std::size_t buffer_len) { + namespace { + //////////////////////////////////////////////////// + ////// helpful decoding functions ////////////////// + //////////////////////////////////////////////////// + + uint32_t add_metadata_object(std::vector& metadata_objects) { + metadata_objects.push_back({}); + const auto metadata_id = static_cast(metadata_objects.size() - 1); + return metadata_id; + } + + uint32_t decode_metadata(const draco::Metadata& in_metadata, std::vector& all_metadata_objects) { + // main metadata object is a have just created object + uint32_t metadata_id = add_metadata_object(all_metadata_objects); + using MetadataPair = std::pair; + for (std::vector to_parse_metadata = { {&in_metadata, metadata_id} }, + to_parse_metadatas_next; + !to_parse_metadata.empty(); + to_parse_metadata = std::move(to_parse_metadatas_next)) { + for (auto& meta_pair: to_parse_metadata) { + const draco::Metadata* metadata = meta_pair.first; + const uint32_t metadata_object_idx = meta_pair.second; + // consider entries + for (const auto& entry_pair: metadata->entries()) { + const std::string& name = entry_pair.first; + const draco::EntryValue& vec_value = entry_pair.second; + auto raw_value = reinterpret_cast(vec_value.data().data()); + auto value_size = vec_value.data().size(); + std::string str_value(raw_value, raw_value + value_size); + all_metadata_objects[metadata_object_idx].entries[name] = std::move(str_value); + } + // consider sub metadatas + for (const auto& sub_meta_pair: metadata->sub_metadatas()) { + const std::string& name = sub_meta_pair.first; + const std::unique_ptr& sub_metadata = sub_meta_pair.second; + const uint32_t sub_metadata_id = add_metadata_object(all_metadata_objects); + all_metadata_objects[metadata_object_idx].sub_metadata_ids[name] = sub_metadata_id; + to_parse_metadatas_next.push_back({sub_metadata.get(), sub_metadata_id}); + } + } + + } + return metadata_id; + } + + std::vector decode_generic_attributes(const draco::PointCloud& pc, + std::vector& all_metadata_objects) { + std::vector attribute_objects; + for (int i = 0; i < pc.num_attributes(); ++i) + if (const auto* attribute = pc.attribute(i)) + if (attribute->attribute_type() == draco::GeometryAttribute::GENERIC) { + const uint32_t attribute_id = pc.GetAttributeIdByUniqueId(attribute->unique_id()); + const auto* attribute_metadata = pc.GetAttributeMetadataByAttributeId(attribute_id); + attribute_metadata = pc.GetAttributeMetadataByAttributeId(attribute->unique_id()); + // decode fields + PointAttributeObject pao; + pao.dimension = static_cast(attribute->num_components()); + pao.datatype = attribute->data_type(); + if (attribute_metadata) + pao.metadata_id = decode_metadata(*attribute_metadata, all_metadata_objects); + else + pao.metadata_id = -1; + // decode geometry data + const auto value_size = attribute->num_components() * attribute->byte_stride(); + for (draco::PointIndex v(0); v < attribute->indices_map_size(); ++v) { + auto& value = pao.data[v.value()]; + value.resize(value_size); + attribute->GetMappedValue(v, &value[0]); + } + attribute_objects.push_back(std::move(pao)); + } + return attribute_objects; + } + + void decode_geometry_metadata(draco::PointCloud& pc, + const draco::GeometryMetadata& geometry_metadata, + PointCloudObject& pco) { + pco.geometry_metadata.metadata_id = decode_metadata(geometry_metadata, pco.metadatas); + pco.geometry_metadata.generic_attributes = decode_generic_attributes(pc, pco.metadatas); + } + + //////////////////////////////////////////////////// + ////// helpful encoding functions ////////////////// + //////////////////////////////////////////////////// + + int32_t encode_generic_attribute( + const PointAttributeObject& pao, + draco::PointCloud& pc + ) { + draco::GeometryAttribute base_attribute; + base_attribute.Init(draco::GeometryAttribute::GENERIC, nullptr, + pao.dimension, pao.datatype, false, + draco::DataTypeLength(pao.datatype) * pao.dimension, 0); + int32_t attribute_id = pc.AddAttribute(base_attribute, false, pao.data.size()); + if (attribute_id < 0) + return attribute_id; + draco::PointAttribute* attribute = pc.attribute(attribute_id); + for (draco::PointIndex v(0); v < pao.data.size(); ++v) { + draco::AttributeValueIndex value_index(v.value()); + attribute->SetPointMapEntry(v, value_index); + try { + const auto& point_value = pao.data.at(v.value()); + attribute->SetAttributeValue(value_index, point_value.data()); + } catch (std::out_of_range& e ) { + std::cout << e.what() << std::endl; + } + } + return attribute_id; + } + + void encode_metadata(const std::vector& metadatas, + const MetadataObject& main_metadata_object, + draco::Metadata& out_metadata) { + // it should not encode metadata if it doesn't exist + if (metadatas.empty()) + return; + using MetadataPair = std::pair; + for (std::vector to_parse_metadata = { {&out_metadata, &main_metadata_object} }, + to_parse_metadatas_next; + !to_parse_metadata.empty(); + to_parse_metadata = std::move(to_parse_metadatas_next)) { + for (auto& meta_pair: to_parse_metadata) { + draco::Metadata* metadata = meta_pair.first; + const MetadataObject* metadata_object = meta_pair.second; + // consider entries + for (const auto& meta_pair: metadata_object->entries) { + const std::string& name = meta_pair.first; + const std::string str_value = meta_pair.second; + std::vector vec_value(str_value.size()); + memcpy(vec_value.data(), str_value.data(), str_value.size()); + metadata->AddEntryBinary(name, vec_value); + } + // consider sub metadatas + for (const auto& sub_meta_pair: metadata_object->sub_metadata_ids) { + const std::string& name = sub_meta_pair.first; + const uint32_t& metadata_id = sub_meta_pair.second; + std::unique_ptr sub_metadata(new draco::Metadata); + to_parse_metadatas_next.push_back({sub_metadata.get(), &metadatas[metadata_id]}); + metadata->AddSubMetadata(name, std::move(sub_metadata)); + } + } + + } + } + + draco::GeometryMetadata& encode_geometry_metadata( + draco::PointCloud& pc, + const std::vector& metadatas, + const GeometryMetadataObject& geometry_metadata_object) { + const auto& gmo = geometry_metadata_object; + std::unique_ptr geometry_metadata_ptr(new draco::GeometryMetadata); + auto& geometry_metadata = *geometry_metadata_ptr; + pc.AddMetadata(std::move(geometry_metadata_ptr)); + // it should encode empty geometry metadata if actually no metadata was passed + if (metadatas.empty()) + return geometry_metadata; + encode_metadata(metadatas, metadatas[gmo.metadata_id], geometry_metadata); + for (const auto& attribute_object: gmo.generic_attributes) { + int32_t attribute_id = encode_generic_attribute(attribute_object, pc); + if (attribute_id < 0) + continue; + std::unique_ptr attribute_metadata(new draco::AttributeMetadata); + encode_metadata(metadatas, metadatas[attribute_object.metadata_id], *attribute_metadata); + + auto& attribute_metadata_ref = *attribute_metadata; + pc.AddAttributeMetadata(attribute_id, std::move(attribute_metadata)); + } + return geometry_metadata; + } + } + + //////////////////////////////////////////////////// + ///////// Decode/Encode functions ////////////////// + //////////////////////////////////////////////////// + + MeshObject decode_buffer(const char *buffer, std::size_t buffer_len, bool + deduplicate) { MeshObject meshObject; draco::DecoderBuffer decoderBuffer; decoderBuffer.Init(buffer, buffer_len); @@ -52,6 +261,10 @@ namespace DracoFunctions { } std::unique_ptr in_mesh = std::move(statusor).value(); draco::Mesh *mesh = in_mesh.get(); + if (deduplicate) { + mesh->DeduplicateAttributeValues(); + mesh->DeduplicatePointIds(); + } const int pos_att_id = mesh->GetNamedAttributeId(draco::GeometryAttribute::POSITION); if (pos_att_id < 0) { meshObject.decode_status = no_position_attribute; @@ -84,12 +297,14 @@ namespace DracoFunctions { metadata->GetEntryDoubleArray("quantization_origin", &(meshObject.quantization_origin))) { meshObject.encoding_options_set = true; } + decode_geometry_metadata(*mesh, *metadata, meshObject); } meshObject.decode_status = successful; return meshObject; } - PointCloudObject decode_buffer_to_point_cloud(const char *buffer, std::size_t buffer_len) { + PointCloudObject decode_buffer_to_point_cloud(const char *buffer, std::size_t + buffer_len, bool deduplicate) { PointCloudObject pointCloudObject; draco::DecoderBuffer decoderBuffer; decoderBuffer.Init(buffer, buffer_len); @@ -107,6 +322,10 @@ namespace DracoFunctions { } std::unique_ptr in_point_cloud = std::move(statusor).value(); draco::PointCloud *point_cloud = in_point_cloud.get(); + if (deduplicate) { + point_cloud->DeduplicateAttributeValues(); + point_cloud->DeduplicatePointIds(); + } const int pos_att_id = point_cloud->GetNamedAttributeId(draco::GeometryAttribute::POSITION); if (pos_att_id < 0) { pointCloudObject.decode_status = no_position_attribute; @@ -132,53 +351,35 @@ namespace DracoFunctions { metadata->GetEntryDoubleArray("quantization_origin", &(pointCloudObject.quantization_origin))) { pointCloudObject.encoding_options_set = true; } + decode_geometry_metadata(*point_cloud, *metadata, pointCloudObject); } pointCloudObject.decode_status = successful; return pointCloudObject; } - void setup_encoder_and_metadata(draco::PointCloud *point_cloud_or_mesh, draco::Encoder &encoder, int compression_level, int quantization_bits, float quantization_range, const float *quantization_origin, bool create_metadata) { - int speed = 10 - compression_level; - encoder.SetSpeedOptions(speed, speed); - std::unique_ptr metadata = std::unique_ptr(new draco::GeometryMetadata()); - if (quantization_origin == NULL || quantization_range == -1) { - encoder.SetAttributeQuantization(draco::GeometryAttribute::POSITION, quantization_bits); - } - else { - encoder.SetAttributeExplicitQuantization(draco::GeometryAttribute::POSITION, quantization_bits, 3, quantization_origin, quantization_range); - if (create_metadata) { - metadata->AddEntryDouble("quantization_range", quantization_range); - std::vector quantization_origin_vec; - for (int i = 0; i < 3; i++) { - quantization_origin_vec.push_back(quantization_origin[i]); - } - metadata->AddEntryDoubleArray("quantization_origin", quantization_origin_vec); - } - } - if (create_metadata) { - metadata->AddEntryInt("quantization_bits", quantization_bits); - point_cloud_or_mesh->AddMetadata(std::move(metadata)); - } - } - - EncodedObject encode_mesh(const std::vector &points, const std::vector &faces, - int quantization_bits, int compression_level, float quantization_range, const float *quantization_origin, bool create_metadata) { + EncodedObject encode_mesh(const std::vector &points, + const std::vector &faces, + draco::Encoder& encoder, + const std::vector& metadatas, + const GeometryMetadataObject& geometry_metadata_object) { draco::TriangleSoupMeshBuilder mb; mb.Start(faces.size()); const int pos_att_id = - mb.AddAttribute(draco::GeometryAttribute::POSITION, 3, draco::DataType::DT_FLOAT32); - + mb.AddAttribute(draco::GeometryAttribute::POSITION, 3, draco::DataType::DT_FLOAT32); for (std::size_t i = 0; i <= faces.size() - 3; i += 3) { auto point1Index = faces[i]*3; auto point2Index = faces[i+1]*3; auto point3Index = faces[i+2]*3; - mb.SetAttributeValuesForFace(pos_att_id, draco::FaceIndex(i), draco::Vector3f(points[point1Index], points[point1Index+1], points[point1Index+2]).data(), draco::Vector3f(points[point2Index], points[point2Index+1], points[point2Index+2]).data(), draco::Vector3f(points[point3Index], points[point3Index+1], points[point3Index+2]).data()); + mb.SetAttributeValuesForFace(pos_att_id, draco::FaceIndex(i), + draco::Vector3f(points[point1Index], points[point1Index+1], points[point1Index+2]).data(), + draco::Vector3f(points[point2Index], points[point2Index+1], points[point2Index+2]).data(), + draco::Vector3f(points[point3Index], points[point3Index+1], points[point3Index+2]).data()); } std::unique_ptr ptr_mesh = mb.Finalize(); draco::Mesh *mesh = ptr_mesh.get(); - draco::Encoder encoder; - setup_encoder_and_metadata(mesh, encoder, compression_level, quantization_bits, quantization_range, quantization_origin, create_metadata); + if (!metadatas.empty()) + encode_geometry_metadata(*mesh, metadatas, geometry_metadata_object); draco::EncoderBuffer buffer; const draco::Status status = encoder.EncodeMeshToBuffer(*mesh, &buffer); EncodedObject encodedMeshObject; @@ -192,8 +393,10 @@ namespace DracoFunctions { return encodedMeshObject; } - EncodedObject encode_point_cloud(const std::vector &points, int quantization_bits, - int compression_level, float quantization_range, const float *quantization_origin, bool create_metadata) { + EncodedObject encode_point_cloud(const std::vector &points, + draco::Encoder& encoder, + const std::vector& metadatas, + const GeometryMetadataObject& geometry_metadata_object) { int num_points = points.size() / 3; draco::PointCloudBuilder pcb; pcb.Start(num_points); @@ -206,8 +409,8 @@ namespace DracoFunctions { std::unique_ptr ptr_point_cloud = pcb.Finalize(true); draco::PointCloud *point_cloud = ptr_point_cloud.get(); - draco::Encoder encoder; - setup_encoder_and_metadata(point_cloud, encoder, compression_level, quantization_bits, quantization_range, quantization_origin, create_metadata); + if (!metadatas.empty()) + encode_geometry_metadata(*point_cloud, metadatas, geometry_metadata_object); draco::EncoderBuffer buffer; const draco::Status status = encoder.EncodePointCloudToBuffer(*point_cloud, &buffer); EncodedObject encodedPointCloudObject; @@ -220,5 +423,4 @@ namespace DracoFunctions { } return encodedPointCloudObject; } - } diff --git a/src/DracoPy.pxd b/src/DracoPy.pxd index 511522e..7fa5def 100644 --- a/src/DracoPy.pxd +++ b/src/DracoPy.pxd @@ -1,7 +1,46 @@ from libcpp.vector cimport vector -from libc.stdint cimport uint32_t +from libcpp.string cimport string +from libcpp.unordered_map cimport unordered_map +from libc.stdint cimport uint32_t, uint8_t from libcpp cimport bool + +cdef extern from "DracoPy.h" namespace "draco::GeometryAttribute": + cpdef enum GeometryAttributeType "draco::GeometryAttribute::Type": + INVALID = -1 + POSITION = 0 + NORMAL + COLOR + TEX_COORD + GENERIC + NAMED_ATTRIBUTES_COUNT + + +cdef extern from "DracoPy.h" namespace "draco": + cpdef enum DataType: + DT_INVALID "draco::DataType::DT_INVALID", + DT_INT8 "draco::DataType::DT_INT8", + DT_UINT8 "draco::DataType::DT_UINT8", + DT_INT16 "draco::DataType::DT_INT16", + DT_UINT16 "draco::DataType::DT_UINT16", + DT_INT32 "draco::DataType::DT_INT32", + DT_UINT32 "draco::DataType::DT_UINT32", + DT_INT64 "draco::DataType::DT_INT64", + DT_UINT64 "draco::DataType::DT_UINT64", + DT_FLOAT32 "draco::DataType::DT_FLOAT32", + DT_FLOAT64 "draco::DataType::DT_FLOAT64", + DT_BOOL "draco::DataType::DT_BOOL", + DT_TYPES_COUNT "draco::DataType::DT_TYPES_COUNT" + + cpdef cppclass CppEncoder "draco::Encoder": + CppEncoder() except + + void SetSpeedOptions(int encoding_speed, int decoding_speed) except + + void SetAttributeQuantization(GeometryAttributeType type, int quantization_bits) except + + void SetAttributeExplicitQuantization(GeometryAttributeType type, int quantization_bits, + int num_dims, const float *origin, + float range) except + + + cdef extern from "DracoPy.h" namespace "DracoFunctions": cdef enum decoding_status: @@ -10,6 +49,20 @@ cdef extern from "DracoPy.h" namespace "DracoFunctions": cdef enum encoding_status: successful_encoding, failed_during_encoding + + cdef struct MetadataObject: + unordered_map[string, string] entries + unordered_map[string, uint32_t] sub_metadata_ids + + cdef struct PointAttributeObject: + unordered_map[uint32_t, string] data + DataType datatype + uint32_t dimension + uint32_t metadata_id + + cdef struct GeometryMetadataObject: + uint32_t metadata_id # reference to metadata object + vector[PointAttributeObject] generic_attributes cdef struct PointCloudObject: vector[float] points @@ -23,6 +76,9 @@ cdef extern from "DracoPy.h" namespace "DracoFunctions": # Represents the decoding success or error message decoding_status decode_status + GeometryMetadataObject geometry_metadata + vector[MetadataObject] metadatas + cdef struct MeshObject: vector[float] points vector[unsigned int] faces @@ -39,16 +95,28 @@ cdef extern from "DracoPy.h" namespace "DracoFunctions": # Represents the decoding success or error message decoding_status decode_status + GeometryMetadataObject geometry_metadata + vector[MetadataObject] metadatas + cdef struct EncodedObject: vector[unsigned char] buffer encoding_status encode_status - MeshObject decode_buffer(const char *buffer, size_t buffer_len) except + + MeshObject decode_buffer(const char *buffer, size_t buffer_len, bool deduplicate) except + - PointCloudObject decode_buffer_to_point_cloud(const char *buffer, size_t buffer_len) except + + PointCloudObject decode_buffer_to_point_cloud(const char *buffer, size_t buffer_len, bool deduplicate) except + - EncodedObject encode_mesh(vector[float] points, vector[uint32_t] faces, int quantization_bits, - int compression_level, float quantization_range, const float *quantization_origin, bool create_metadata) except + + EncodedObject encode_mesh( + vector[float] points, + vector[uint32_t] faces, + CppEncoder encoder, + vector[MetadataObject] metadatas, + GeometryMetadataObject geometry_metadata + ) except + - EncodedObject encode_point_cloud(vector[float] points, int quantization_bits, - int compression_level, float quantization_range, const float *quantization_origin, bool create_metadata) except + + EncodedObject encode_point_cloud( + vector[float] points, + CppEncoder encoder, + vector[MetadataObject] metadatas, + GeometryMetadataObject geometry_metadata_object + ) except + diff --git a/src/DracoPy.pyx b/src/DracoPy.pyx index 68e66a4..a922424 100644 --- a/src/DracoPy.pyx +++ b/src/DracoPy.pyx @@ -1,10 +1,40 @@ # distutils: language = c++ - +import struct +from typing import Dict, List, Optional +from libcpp.vector cimport vector from cpython.mem cimport PyMem_Malloc, PyMem_Free cimport DracoPy -import struct from math import floor -from libc.string cimport memcmp + + +cdef class Encoder: + """ + Python wrapper for draco::Encoder + Allow set up encoding options + """ + + cdef DracoPy.CppEncoder this_encoder + + def __cinit__(self): + self.this_encoder = CppEncoder() + + def SetSpeedOptions(self, encoding_speed: int, decoding_speed: int): + self.this_encoder.SetSpeedOptions(encoding_speed, decoding_speed) + + def SetAttributeQuantization(self, + attr_type: GeometryAttributeType, + quantization_bits: int): + self.this_encoder.SetAttributeQuantization(attr_type, quantization_bits) + + def SetAttributeExplicitQuantization(self, + attr_type: GeometryAttributeType, + quantization_bits: int, + quantization_range: float, + quantization_origin: vector[float]): + self.this_encoder.SetAttributeExplicitQuantization( + attr_type, quantization_bits, quantization_origin.size(), + &quantization_origin[0], quantization_range) + class DracoPointCloud(object): def __init__(self, data_struct): @@ -14,7 +44,7 @@ class DracoPointCloud(object): data_struct['quantization_range'], data_struct['quantization_origin']) else: self.encoding_options = None - + def get_encoded_coordinate(self, value, axis): if self.encoding_options is not None: return self.encoding_options.get_encoded_coordinate(value, axis) @@ -28,25 +58,35 @@ class DracoPointCloud(object): return 3 @property - def points(self): + def points(self) -> List[float]: return self.data_struct['points'] + @property + def geometry_metadata(self) -> Optional[Dict]: + return self.data_struct['geometry_metadata'] if self.metadatas else None + + @property + def metadatas(self) -> List[Dict]: + return self.data_struct['metadatas'] + + class DracoMesh(DracoPointCloud): @property - def faces(self): + def faces(self) -> List[int]: return self.data_struct['faces'] @property def normals(self): return self.data_struct['normals'] + class EncodingOptions(object): def __init__(self, quantization_bits, quantization_range, quantization_origin): self.quantization_bits = quantization_bits self.quantization_range = quantization_range self.quantization_origin = quantization_origin self.inverse_alpha = quantization_range / ((2 ** quantization_bits) - 1) - + def get_encoded_coordinate(self, value, axis): if value < self.quantization_origin[axis] or value > (self.quantization_origin[axis] + self.quantization_range): raise ValueError('Specified value out of encoded range') @@ -59,74 +99,210 @@ class EncodingOptions(object): for axis in range(self.num_axes): encoded_point.append(self.get_encoded_coordinate(point[axis], axis)) return encoded_point - + @property def num_axes(self): return 3 + class FileTypeException(Exception): pass + class EncodingFailedException(Exception): pass -def encode_mesh_to_buffer(points, faces, quantization_bits=14, compression_level=1, quantization_range=-1, quantization_origin=None, create_metadata=False): + +def _create_empty_geometry_metadata() -> GeometryMetadataObject: + return { + "metadata_id": 0, + "generic_attributes": [], + } + + +def _create_empty_metadata() -> MetadataObject: + return { + "entries": {}, + "sub_metadata_ids": {} + } + + +cdef Encoder _generate_encoder_and_update_metadata( + int quantization_bits, + int compression_level, + double quantization_range, + vector[double] quantization_origin, + vector[MetadataObject]& metadatas, + GeometryMetadataObject& geometry_metadata): + encoder = Encoder() + speed = 10 - compression_level + encoder.SetSpeedOptions(speed, speed) + to_create_quantization_metadata = not metadatas.empty() + cdef MetadataObject *metadata = NULL; + if to_create_quantization_metadata: + metadata = &metadatas[geometry_metadata.metadata_id] + metadata.entries[b"quantization_bits"] = struct.pack( + "=i", quantization_bits) + if quantization_origin.empty() or quantization_range == -1: + encoder.SetAttributeQuantization( + GeometryAttributeType.POSITION, quantization_bits) + else: + encoder.SetAttributeExplicitQuantization( + GeometryAttributeType.POSITION, quantization_bits, + quantization_range, quantization_origin) + if to_create_quantization_metadata: + metadata.entries[b"quantization_range"] = struct.pack( + "=d", quantization_range) + metadata.entries[b"quantization_origin"] = struct.pack( + "=ddd", + quantization_origin[0], + quantization_origin[1], + quantization_origin[2]) + return encoder + +def encode_mesh_to_buffer(points, faces, + quantization_bits=14, + compression_level=1, + quantization_range=-1, + quantization_origin=None, + create_metadata=False, + ): """ - Encode a list or numpy array of points/vertices (float) and faces (unsigned int) to a draco buffer. - Quantization bits should be an integer between 0 and 31 - Compression level should be an integer between 0 and 10 - Quantization_range is a float representing the size of the bounding cube for the mesh. - By default it is the range of the dimension of the input vertices with greatest range. - Quantization_origin is the point in space where the bounding box begins. By default it is - a point where each coordinate is the minimum of that coordinate among the input vertices. + Legacy version of 'encode_to_buffer' function + It allows: + * set up encoder + * save encoder settings into metadata + * serialize to buffer as mesh + + :param List[float] points: vector of points coordination + :param Optional[List[int]] faces: vector of points indexes + (each triple means one face). + :param int quantization_bits: integer between 0 and 31 + :param int compression_level: integer between 0 and 10 + :param float quantization_range: float representing the size + of the bounding cube for the mesh. By default it is the range of + the dimension of the input vertices with greatest range. + :param quantization_origin: point in space where the bounding box begins. + By default it is a point where each coordinate is the minimum + of that coordinate among the input vertices. + :param bool create_metadata: if True then it creates GeometryMetadata + :return bytes: encoded mesh """ - cdef float* quant_origin = NULL - try: - num_dims = 3 - if quantization_origin is not None: - quant_origin = PyMem_Malloc(sizeof(float) * num_dims) - for dim in range(num_dims): - quant_origin[dim] = quantization_origin[dim] - encoded_mesh = DracoPy.encode_mesh(points, faces, quantization_bits, compression_level, quantization_range, quant_origin, create_metadata) - if quant_origin != NULL: - PyMem_Free(quant_origin) - if encoded_mesh.encode_status == DracoPy.encoding_status.successful_encoding: - return bytes(encoded_mesh.buffer) - elif encoded_mesh.encode_status == DracoPy.encoding_status.failed_during_encoding: - raise EncodingFailedException('Invalid mesh') - except EncodingFailedException: - raise EncodingFailedException('Invalid mesh') - except: - if quant_origin != NULL: - PyMem_Free(quant_origin) - raise ValueError("Input invalid") + cdef GeometryMetadataObject geometry_metadata = _create_empty_geometry_metadata() + cdef vector[MetadataObject] metadatas + if create_metadata: + metadatas.push_back(_create_empty_metadata()) + encoder = _generate_encoder_and_update_metadata( + quantization_bits, + compression_level, + quantization_range, + [] if quantization_origin is None else quantization_origin, + metadatas, + geometry_metadata, + ) + return encode_to_buffer(points, faces, encoder, metadatas, geometry_metadata) -def encode_point_cloud_to_buffer(points, quantization_bits=14, compression_level=1, quantization_range=-1, quantization_origin=None, create_metadata=False): + +def encode_point_cloud_to_buffer(points, + quantization_bits=14, + compression_level=1, + quantization_range=-1, + quantization_origin=None, + create_metadata=False + ): + """ + Legacy version of 'encode_to_buffer' function + It allows: + * set up encoder + * save encoder settings into metadata + * serialize to buffer as point cloud + + :param List[float] points: vector of points coordination + :param int quantization_bits: integer between 0 and 31 + :param int compression_level: integer between 0 and 10 + :param float quantization_range: float representing the size + of the bounding cube for the mesh. By default it is the range of + the dimension of the input vertices with greatest range. + :param quantization_origin: point in space where the bounding box begins. + By default it is a point where each coordinate is the minimum + of that coordinate among the input vertices. + :param bool create_metadata: if True then it creates GeometryMetadata + :return bytes: encoded point cloud + """ + cdef GeometryMetadataObject geometry_metadata = _create_empty_geometry_metadata() + cdef vector[MetadataObject] metadatas + if create_metadata: + metadatas.push_back(_create_empty_metadata()) + encoder = _generate_encoder_and_update_metadata( + quantization_bits, + compression_level, + quantization_range, + [] if quantization_origin is None else quantization_origin, + metadatas, + geometry_metadata, + ) + return encode_to_buffer(points, None, encoder, metadatas, geometry_metadata) + + +def encode_to_buffer(points: List[float], + faces: List[int] = None, + encoder: Encoder = Encoder(), + metadatas = None, + geometry_metadata = None, + ): """ Encode a list or numpy array of points/vertices (float) to a draco buffer. - Quantization bits should be an integer between 0 and 31 - Compression level should be an integer between 0 and 10 - Quantization_range is a float representing the size of the bounding cube for the mesh. - By default it is the range of the dimension of the input vertices with greatest range. - Quantization_origin is the point in space where the bounding box begins. By default it is - a point where each coordinate is the minimum of that coordinate among the input vertices. + :param List[float] points: vector of points coordination + :param Optional[List[int]] faces: vector of points indexes + (each triple means one face). If faces is None then point cloud + will be encoded, otherwise mesh will be encoded + :param List[dict] metadatas: list of metadatas each of them containing + "entries" - dictionary with strings (entry name) and binary data + related to that entry + "sub_metadata_ids" - dictionary with strings (submetadata name) and + related submetadata index in the list 'metadatas' + :param dict geometry_metadata: dict containing the following items: + "metadata_id" - index in the list 'metadatas' related to that metadata + "generic_attributes" - list of geometry attributes (dict) each of them contain: + "data" - dictionary with point index (not pure points index) + from points list + "datatype" - type of the data item (see DataType enum) + "dimension" - integer that defines number of data items with type 'datatype' + are placed per point + "metadata_id" - metadata index in 'metadatas' + NOTE: all 'metadata_id' indexes have to exist in 'metadatas' + :return bytes: encoded mesh """ + is_mesh = faces is not None + if not is_mesh and isinstance(geometry_metadata, dict) and \ + len(geometry_metadata["generic_attributes"]) > 0: + raise RuntimeError("generic attributes encoding/decoding " + "is not supported for point cloud") + if metadatas is None: + metadatas = [] + if geometry_metadata is None: + geometry_metadata = _create_empty_geometry_metadata() cdef float* quant_origin = NULL try: - num_dims = 3 - if quantization_origin is not None: - quant_origin = PyMem_Malloc(sizeof(float) * num_dims) - for dim in range(num_dims): - quant_origin[dim] = quantization_origin[dim] - encoded_point_cloud = DracoPy.encode_point_cloud(points, quantization_bits, compression_level, quantization_range, quant_origin, create_metadata) + if is_mesh: + draco_encoded = DracoPy.encode_mesh(points, + faces, + encoder.this_encoder, + metadatas, + geometry_metadata) + else: + draco_encoded = DracoPy.encode_point_cloud(points, + encoder.this_encoder, + metadatas, + geometry_metadata) if quant_origin != NULL: PyMem_Free(quant_origin) - if encoded_point_cloud.encode_status == DracoPy.encoding_status.successful_encoding: - return bytes(encoded_point_cloud.buffer) - elif encoded_point_cloud.encode_status == DracoPy.encoding_status.failed_during_encoding: - raise EncodingFailedException('Invalid point cloud') + if draco_encoded.encode_status == DracoPy.encoding_status.successful_encoding: + return bytes(draco_encoded.buffer) + elif draco_encoded.encode_status == DracoPy.encoding_status.failed_during_encoding: + raise EncodingFailedException('Invalid draco structure') except EncodingFailedException: - raise EncodingFailedException('Invalid point cloud') + raise EncodingFailedException('Invalid draco structure') except: if quant_origin != NULL: PyMem_Free(quant_origin) @@ -140,15 +316,27 @@ def raise_decoding_error(decoding_status): elif decoding_status == DracoPy.decoding_status.no_position_attribute: raise ValueError('DracoPy only supports meshes with position attributes') -def decode_buffer_to_mesh(buffer): - mesh_struct = DracoPy.decode_buffer(buffer, len(buffer)) +def decode_buffer_to_mesh(buffer, deduplicate=False): + """ + Decode buffer to mesh + :param bytes buffer: encoded mesh + :param bool deduplicate: run Draco deduplcation functions + :return: mesh object + """ + mesh_struct = DracoPy.decode_buffer(buffer, len(buffer), deduplicate) if mesh_struct.decode_status == DracoPy.decoding_status.successful: return DracoMesh(mesh_struct) else: raise_decoding_error(mesh_struct.decode_status) -def decode_point_cloud_buffer(buffer): - point_cloud_struct = DracoPy.decode_buffer_to_point_cloud(buffer, len(buffer)) +def decode_point_cloud_buffer(buffer, deduplicate=False): + """ + Decode buffer to point cloud + :param bytes buffer: encoded point cloud + :param bool deduplicate: run Draco deduplcation functions + :return: point cloud object + """ + point_cloud_struct = DracoPy.decode_buffer_to_point_cloud(buffer, len(buffer), deduplicate) if point_cloud_struct.decode_status == DracoPy.decoding_status.successful: return DracoPointCloud(point_cloud_struct) else: diff --git a/tests.py b/tests.py index 1e7d5c7..e12d254 100644 --- a/tests.py +++ b/tests.py @@ -1,10 +1,88 @@ import os +import sys +from typing import Tuple, List, Dict + import DracoPy import pytest testdata_directory = "testdata_files" +############################################### +############## Utils For Tests ################ +############################################### + +def create_tetrahedron() -> Tuple[List[float], List[int]]: + """ + Tetrahedron + (3) + | + | + | + | + (0)--------(1) + / + / + / + (2) + """ + points = [ + # X, Y, Z + 0., 0., 0., # 0 + 1., 0., 0., # 1 + 0., 1., 0., # 2 + 1., 1., 1., # 3 + ] + faces = [ + 0, 1, 2, + 0, 1, 3, + 1, 2, 3, + 2, 0, 3, + ] + return points, faces + + +def create_points_map(in_points: List[float], + out_points: List[int]) -> Dict[int, int]: + # mapping from out_vertex to in_vertex + points_map = { + i: tuple(out_points[i * 3:(i + 1) * 3]) + for i in range(len(out_points) // 3) + } + for i in range(len(in_points) // 3): + in_vertex = tuple(in_points[i * 3:(i + 1) * 3]) + for j, value in list(points_map.items()): + if value == in_vertex: + points_map[j] = i + for in_index in points_map.values(): + assert isinstance(in_index, int), f"input point {in_index} is not in output" + return points_map + + +def create_faces_map(in_faces: List[int], + out_faces: List[int], + points_map: Dict[int, int]) -> Dict[int, int]: + faces_map = {} + out_faces_map = { + i: tuple(out_faces[i * 3:(i + 1) * 3]) + for i in range(len(out_faces) // 3) + } + for i in range(len(in_faces) // 3): + value = in_faces[i * 3:(i + 1) * 3] + for j, (out_v1, out_v2, out_v3) in list(out_faces_map.items()): + in_face = points_map[out_v1], points_map[out_v2], points_map[out_v3] + if set(value) == set(in_face): + out_faces_map.pop(j) + faces_map[j] = i + for out_value in out_faces_map.values(): + assert False, f"input face {out_value} is not in output" + return faces_map + + +############################################### +################ Tests itselves ############### +############################################### + def test_decoding_and_encoding_mesh_file(): expected_points = 104502 expected_faces = 208353 @@ -84,3 +162,235 @@ def test_decoding_and_encoding_point_cloud_file(): point_cloud_object = DracoPy.decode_point_cloud_buffer(file_content) assert (point_cloud_object.encoding_options) is None assert len(point_cloud_object.points) == expected_points + + +def test_encode_decode_tetrahedron_mesh(): + points, faces = create_tetrahedron() + buffer = DracoPy.encode_to_buffer(points, faces) + mesh = DracoPy.decode_buffer_to_mesh(buffer, deduplicate=False) + points_map = create_points_map(points, mesh.points) + faces_map = create_faces_map(faces, mesh.faces, points_map) + assert len(points) <= len(mesh.points) # consider duplicated points + assert len(faces) <= len(mesh.faces) # consider duplicated faces + for j in range(len(mesh.points) // 3): + i = points_map[j] + assert mesh.points[j * 3:(j + 1) * 3] == points[i * 3:(i + 1) * 3] + for j in range(len(mesh.faces) // 3): + i = faces_map[j] + out_face_with_input_point_indexes = set( + points_map[out_point_idx] + for out_point_idx in mesh.faces[j * 3:(j + 1) * 3] + ) + assert out_face_with_input_point_indexes == set(faces[i * 3:(i + 1) * 3]) + + +def test_encode_decode_tetrahedron_point_cloud(): + points, _ = create_tetrahedron() + buffer = DracoPy.encode_to_buffer(points) + point_cloud = DracoPy.decode_point_cloud_buffer(buffer, deduplicate=False) + points_map = create_points_map(points, point_cloud.points) + assert len(points) >= len(point_cloud.points) + for j in range(len(point_cloud.points) // 3): + i = points_map[j] + assert point_cloud.points[j * 3:(j + 1) * 3] == points[i * 3:(i + 1) * 3] + + +def test_encode_decode_tetrahedron_with_deduplication_mesh(): + points, faces = create_tetrahedron() + buffer = DracoPy.encode_to_buffer(points, faces) + mesh = DracoPy.decode_buffer_to_mesh(buffer, deduplicate=True) + points_map = create_points_map(points, mesh.points) + faces_map = create_faces_map(faces, mesh.faces, points_map) + assert len(points) == len(mesh.points) + assert len(faces) == len(mesh.faces) + for j in range(len(mesh.points) // 3): + i = points_map[j] + assert mesh.points[j * 3:(j + 1) * 3] == points[i * 3:(i + 1) * 3] + for j in range(len(mesh.faces) // 3): + i = faces_map[j] + out_face_with_input_point_indexes = set( + points_map[out_point_idx] + for out_point_idx in mesh.faces[j * 3:(j + 1) * 3] + ) + assert out_face_with_input_point_indexes == set(faces[i * 3:(i + 1) * 3]) + + +def test_encode_decode_tetrahedron_with_deduplication_point_cloud(): + points, _ = create_tetrahedron() + buffer = DracoPy.encode_to_buffer(points) + point_cloud = DracoPy.decode_point_cloud_buffer(buffer, deduplicate=True) + points_map = create_points_map(points, point_cloud.points) + assert len(points) == len(point_cloud.points) # consider duplicated points + for j in range(len(point_cloud.points) // 3): + i = points_map[j] + assert point_cloud.points[j * 3:(j + 1) * 3] == points[i * 3:(i + 1) * 3] + + +def test_encode_decode_geometry_attributes_mesh(): + # prepare input data + points, faces = create_tetrahedron() + metadatas = [ + { + "entries": {}, + "sub_metadata_ids": {}, + } + for _ in range(2) + ] + attribute = { + "data": { + i: int.to_bytes(4 - i, 4, sys.byteorder, signed=False) + for i in range(4) + }, + "datatype": DracoPy.DataType.DT_INT32, + "dimension": 1, + "metadata_id": 1, + } + geometry_metadata = { + "metadata_id": 0, + "generic_attributes": [attribute], + } + # encode - decode + buffer = DracoPy.encode_to_buffer( + points, faces, + metadatas=metadatas, + geometry_metadata=geometry_metadata, + ) + mesh = DracoPy.decode_buffer_to_mesh(buffer, True) + points_map = create_points_map(points, mesh.points) + # validate results + out_generic_attributes = mesh.geometry_metadata["generic_attributes"] + assert len(out_generic_attributes) == 1 + out_attribute = out_generic_attributes[0] + assert out_attribute["datatype"] == attribute["datatype"] + assert out_attribute["dimension"] == attribute["dimension"] + assert out_attribute["metadata_id"] == attribute["metadata_id"] + assert len(out_attribute["data"]) == len(attribute["data"]) + for out_index, point_value in out_attribute["data"].items(): + in_index = points_map[out_index] + assert point_value == attribute["data"][in_index] + + +# data encoding-decoding still does not work for point cloud +def test_encode_decode_geometry_attributes_point_cloud(): + # prepare input data + points, _ = create_tetrahedron() + metadatas = [ + { + "entries": {}, + "sub_metadata_ids": {}, + } + for _ in range(2) + ] + attribute = { + "data": { + i: int.to_bytes(4 - i, 4, sys.byteorder, signed=False) + for i in range(4) + }, + "datatype": DracoPy.DataType.DT_UINT32, + "dimension": 1, + "metadata_id": 1, + } + geometry_metadata = { + "metadata_id": 0, + "generic_attributes": [attribute], + } + # encode - decode + with pytest.raises(RuntimeError): + DracoPy.encode_to_buffer( + points, + metadatas=metadatas, + geometry_metadata=geometry_metadata) + + +def test_encode_decode_submetadata_entries_mesh(): + # prepare input data + points, faces = create_tetrahedron() + geometry_metadata = { + "entries": {b"name": b"global_geometry_metadata_name"}, + "sub_metadata_ids": {b"custom_metadata_name": 1}, + } + custom_submetadata = { + "entries": {b"name": b"custom_attribute_name"}, + "sub_metadata_ids": {}, + } + metadatas = [ + geometry_metadata, + custom_submetadata, + ] + geometry_metadata_specific = { + "metadata_id": 0, + "generic_attributes": [], + } + # encode - decode + buffer = DracoPy.encode_to_buffer( + points, faces, + metadatas=metadatas, + geometry_metadata=geometry_metadata_specific) + mesh = DracoPy.decode_buffer_to_mesh(buffer) + # validate results + out_metadatas = mesh.metadatas + assert len(out_metadatas) == len(metadatas) + out_geometry_metadata = out_metadatas[ + mesh.geometry_metadata["metadata_id"]] + assert out_geometry_metadata["entries"] == geometry_metadata["entries"] + assert list(out_geometry_metadata["sub_metadata_ids"]) == \ + list(geometry_metadata["sub_metadata_ids"]) + custom_metadata_id = out_geometry_metadata["sub_metadata_ids"][ + b"custom_metadata_name"] + custom_metadata = out_metadatas[custom_metadata_id] + assert custom_metadata == metadatas[1] + + +def test_encode_decode_submetadata_entries_point_cloud(): + # prepare input data + points, _ = create_tetrahedron() + geometry_metadata = { + "entries": {b"name": b"global_geometry_metadata_name"}, + "sub_metadata_ids": {b"custom_metadata_name": 1}, + } + custom_submetadata = { + "entries": {b"name": b"custom_attribute_name"}, + "sub_metadata_ids": {}, + } + metadatas = [ + geometry_metadata, + custom_submetadata, + ] + geometry_metadata_specific = { + "metadata_id": 0, + "generic_attributes": [], + } + # encode - decode + buffer = DracoPy.encode_to_buffer( + points, + metadatas=metadatas, + geometry_metadata=geometry_metadata_specific) + point_cloud = DracoPy.decode_point_cloud_buffer(buffer) + # validate results + out_metadatas = point_cloud.metadatas + assert len(out_metadatas) == len(metadatas) + out_geometry_metadata = out_metadatas[ + point_cloud.geometry_metadata["metadata_id"]] + assert out_geometry_metadata["entries"] == geometry_metadata["entries"] + assert list(out_geometry_metadata["sub_metadata_ids"]) == \ + list(geometry_metadata["sub_metadata_ids"]) + custom_metadata_id = out_geometry_metadata["sub_metadata_ids"][ + b"custom_metadata_name"] + custom_metadata = out_metadatas[custom_metadata_id] + assert custom_metadata == metadatas[1] + + +def test_data_type_enum(): + assert int(DracoPy.DataType.DT_INVALID) == 0 + assert int(DracoPy.DataType.DT_TYPES_COUNT) == len(DracoPy.DataType) - 1 + usual_values = list(range(0, len(DracoPy.DataType) - 1)) + assert int(DracoPy.DataType.DT_INT8) in usual_values + assert int(DracoPy.DataType.DT_INT16) in usual_values + assert int(DracoPy.DataType.DT_UINT16) in usual_values + assert int(DracoPy.DataType.DT_INT32) in usual_values + assert int(DracoPy.DataType.DT_UINT32) in usual_values + assert int(DracoPy.DataType.DT_INT64) in usual_values + assert int(DracoPy.DataType.DT_UINT64) in usual_values + assert int(DracoPy.DataType.DT_FLOAT32) in usual_values + assert int(DracoPy.DataType.DT_FLOAT64) in usual_values + assert int(DracoPy.DataType.DT_BOOL) in usual_values